I've been working a lot with TCanvas & TBitmaps to get my WIN32 project running, and I discovered interesting stuff that could help with the debugging of Lazarus :
Let's say we work with a TImage object named theImage.
WHAT WE ALREADY KNOW
- Bug #514 : When drawing on theImage.canvas, no handle is created for theImage.picture.bitmap
- Bug #464 : When dynamically drawn , theImage clears itself whenever theImage.refresh is called (manually or by dragging another graphical object over it)
WHAT I HAVE FOUND
- By default, theImage.picture.bitmap has its width and height set to 0. When setting them to the right size manually, the whole surface goes black (the pixel data inside theImage.picture.bitmap is set to 0).
-> These default values must be set correctly when creating the TImage
- After doing this (i.e. correcting the inner TBitmap's default values), when drawing on theImage.picture.bitmap.canvas, the stuff I've drawn stays on screen (yay !) and I can get what I've just drawn into my DLL, using theImage.picture.bitmap.handle. (having used the TBitmap's canvas, a handle has been automatically created for it).
-> The operations made on a TImage.canvas must be somehow echoed to its TPicture.bitmap.canvas.