Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 1963

Where's My Canvas?

$
0
0

I broke some working code, but can't figure out how I could have caused this particular problem.

I have a TImage in a scrollbox.  If I build a bitmap from an array of data and Image1.picture.bitmap.assign(the_constructed_image), everything works as it has for quite a while.  But either AFTER I have successfully done that or on a FIRST CALL to the image/scrollbox-containing window, 

   Image1.picture.bitmap.assign(a_different_bitmap_image);  {a_different_bitmap_image is a tbitmap}

   Image1.width := image1.picture.bitmap.width; {debugger confirms the value is as expected}

   Image1.height := image1.picture.bitmap.height;  {debugger confirms value}

   Image1.picture.bitmap.pixelformat := pf32bit;  {same as the image that was just assigned}

  {use debugger and evaluate assigned(image1.canvas).  Result : true}

the very next instruction has an access violation ($C0000005).  And the command?

  Image1.canvas.pixels[0,0] := clblack;

How can an image and picture exist without a canvas?  Before doing the assignment, I used scanline to go through a_different_bitmap_image (a tbitmap) that was about to be copied to ensure that it was there and the size I expected -- it is.  Ever seen something like this?


Viewing all articles
Browse latest Browse all 1963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>