![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Hello all, I am coding an animation package and can't find much
information regarding just how long a Memory DC and its bitmap
object can be kept. My question simplified is this: must a memory
DC and its bitmap be released immediately after each use?
I am "playing" about 15 bitmaps at over one hundred locations on
the screen at a frame rate of 20 frames/second. The overhead in
creating a memory DC and a *compatible* bitmap this often would be
very high.
I am very interested in everyone's option as I have not found any
code samples or discussions specific to animation of this type. Some
texts imply object must be released immediately after use but they
offer no details.
A simply example of what I am up to can be found at:
http://www.logix-controls.com/eng-room.html
If you breakdown the RENDER function in BMP.F you basically have
three parts 1) Create a memory DC holding a compatible bitmap, 2)
bitmap transfer to the display (BitBlt), and 3) Cleanup (release
the memory DC and related objects). In reviewing the latest MSDN, I
found:
MSDN: Private DC (Class CS_OWNDC)
"Private device contexts are not part of the system cache and
therefore need not be released after use." ... "The
application can continue using this handle (and the associated
DC) until it deletes the window created with this class."
MSDN: CreateCompatibleDC
"When you no longer need the memory DC, call the DeleteDC
function."
MSDN: SelectObject
"An application should always replace a new object with the
original, default object after it has finished drawing with
the new object."
In my development application, at startup, I am creating 15 memory
DCs each with a multi-framed animation bitmap. The application
continuously plays these frames at a rate of 20 frames per second.
When I terminate this application I release the memory DCs and
their related objects. This application, however, may execute
indefinitely.
I have also ran a SPY resource monitoring program and all resource
usage was modest and very stable (thanks SwiftForth!).
Best Regards, Mike Ghan mikeg_at_logix-controls.com
Logix Industrial Control Systems http://www.logix-controls.com
10518 NE 68th St
Kirkland, WA 98033 USA
(425)828-4149
(425)828-9682 Fax
.
Received on Wed May 10 2000 - 17:12:08 PDT
This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:28 PST