Tbitmap image access issues and canvas.client rect problems.
Original Reporter info from Mantis: jamie @jamie
-
Reporter name: jamie philbrook
Original Reporter info from Mantis: jamie @jamie
- Reporter name: jamie philbrook
Description:
Two items here.
Bitmap.Canvas.ClientRect should always be set to the size of the bitmap when it
is created or loaded from a stream, currently it's always 2000x2000.
Now the big problem.
Doing direct image access.
It took me a while to figure this out, however, to access the
image data you need to use "BeginUpdate(false)" in this case I need to
not have a canvas, otherwise, I can not change the bit values. That part
works fine.
However, If you do this
Bitmap.BeginUpdate(false);
// do no image accessing at all.
Bitmap.EndUpdate;
At this point, there is no longer a canvas connecting to the
image. Using canvas functions to draw the image somewhere results
in a black image. Image is still there but Device context is not connected.
However, if you do this
BeginUpdate(false);
SomePointer := Scanline[?] or use GetLineStart(?);
//
EndUpdate;
The fact that I did a request to inquire a pointer to the
image, fixes the problem. There is a canvas that is connected to
the image when "EndUpdate" is execute.
It appears the canavs is not getting reinstated when no getlinestart
or scanline is done.
Thanks.
Steps to reproduce:
Explained in Description.
Simply do not acquire any line starting pointers between
BeginUpdate(false) and EndUpdate; will detach the canvas.
Additional information:
Mantis conversion info:
- Mantis ID: 27175
- OS: Windows
- OS Build: W2k,7,8 etc.
- Build: 46529
- Platform: win32
- Version: 1.2.5 (SVN)