Software Archive
Read-only legacy content
17061 Discussions

QuikWin and Bit-Block Transfers - Possible

isn-removed200637
360 Views
(There should be a ? after 'possible' in the subject box).

Is it possible to add code to a QuickWin application (that animates by repeatedly redrawing an object using MOVETO and LINETO commands into a QuickWin window) to draw instead to a bitmap and then transfer the bitmap to the Window to speed up animation?


I know that QuickWin uses the MDI and that the QuickWin window that is drawn to is a child window of the client area.


I know that if I can get the handle to the Device context (DC) for the QuickWIn window I can then use CreateCompatibleDC and CreateCompatibleBitmap and SelectObject to create a bitmap in memory I can then draw to and then use BitBlt to copy the drawn bitmap into the window's DC.


Can it be done using sub-classing?


TIA

0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
360 Views
Yes and no. The problem is that QuickWin already does its own double buffering.
(Think about it -- SetWindowConfig must actually call CreateCompatibleDC/ CreateCompatibleBitmap.) So, if you subclass a QuickWin window you lose all QW's drawing capabilities and you'll have to do your own drawing by yourself using Win32. If the sole task of the window is to display the animation, you can subclass it, process WM_PAINT and do your own BitBlt-ing, thus completely removing any drawing by QuickWin, but you (in my experience) can't have them mixed.

Actually, you don't have to subclass a QuickWin window -- you can create your own using CreateWindow (but you should register its class prior to that) and have it behaving like any Win32-handled window. I did that before, so I can send you some code snippets if you wish (there are few gotchas, mostly related to QuickWin's two-threaded structure).

HTH
Jugoslav
0 Kudos
Jugoslav_Dujic
Valued Contributor II
360 Views
...oh, I forgot another possibility: create an invisible (is it possible? -- I forgot) "buffer" QuickWin window, draw to it and do a GetImage/SetImage to the visible one. In this way, you won't have any Win32 involved; note, however, that it's slow.
0 Kudos
Reply