What replaces best DrawInto for a plain window: a screenshot or drawing the window to a graphics?

Hi,

In one app, I want to add a preview of a plain box window into another, smaller, window. The preview may be refreshed several times per second.
The plain box has 2 canvases and may also have a backdrop, a back colour or the default background.

I first tried DrawInto, but almost nothing draws there.
I’m considering either taking screenshots of the window or drawing everything in a temporary picture. Both methods have unwanted behaviours, though.

With taking screenshots, I’m concerned about the performance (time and RAM) it takes. And with drawing all myself (backdrop/back colour, then both canvases and possibly future controls), I’m concerned about the preview looking differently than the on-screen window (like, for example, gamma being applied differently in either context, or other OS tricks I may not be aware of when it renders a window).

Just wondering whether someone already encountered this question :thinking:.

Is not possible to render to a picture and use that same picture in both windows?

It’s pretty easy to grab the contents of the window (If you have the Ohanaware App Kit, look at the Preferences Window, how it animates). I personally have never tried to grab the contents and the frame.

I understand your concern about color profiles, as long as both windows are on the same screen, I don’t think you need to worry so much about it.

Actually, I’ve not thought of refactoring my UI. But you’re right, of course. It’s just I didn’t saw the obvious and tried to go on with the existing window and controls.

Sorry, I haven’t (too expensive for me currently, but have been considered it already).
Except DrawInto which didn’t work for me, I’m fine with the “how to do” part.

That’s the point, they are on different screens.
Anyway, I’ve since realised I’ll also try the screenshot way, as my goal is to be sure a remote screen shows the correct drawings. Only taking a screenshot will ensure all is fine (the window is still there, visible, and showing the correct things).

Thank you for your reply.

In my experience, unless both screens have been calibrated, then you can do your best and it still won’t match.

You can eyeball a calibration in System Preferences, and that can help get it close. Watch out for Apple’s TrueTone, make sure you disable that if your want any form of color accuracy.

i remember as i had created controls at runtime drawinto does nothing, but if me place one control
outside the visible area i can use drawinto.(happened at windows os in older xojo)
somehow drawinto just raise the paint event with any graphics context.