Recent

Author Topic: Of TBitmaps and TCanvas :)  (Read 9385 times)

Zeugma

  • New Member
  • *
  • Posts: 10
Of TBitmaps and TCanvas :)
« on: December 25, 2004, 07:46:59 pm »
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.

Anonymous

  • Guest
Of TBitmaps and TCanvas :)
« Reply #1 on: December 28, 2004, 12:49:24 pm »
Quote from: "Zeugma"
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.
I have also been having trouble getting TBitmap to work under Windows (its working fine on Linux).

I've just raised bug 516. In summary, I am trying to access a previously created TBitmap from a DLL, but I get an access violation. It looks as though the Bitmap object has disappeared or been corrupted. I'm not sure whether or not the fact that I'm using a DLL has anything to do with the problem.

I've reproduced the problem in some simple example code, and have included this with the bug report.

Chris Gordon-Smith
http://graffiti.virgin.net/c.gordon-smith/index.html

 

TinyPortal © 2005-2018