Imagedata row order

J. Landman Gay jacque at hyperactivesw.com
Sun Jul 23 13:15:05 EDT 2006


Rob Cozens wrote:
 > Jacque,
 >
 >> Do you use imageData a lot? I know the crashes I had were because the
 >> imageData was wrong, but in your experience is this generally a stable
 >> technique for repeated use?
 >
 > The image's TEXT property contains the binary data that comprises the
 > image.
 >
 > The image's imageData property contains a binary representation of the
 > image AS IT IS CURRENTLY DISPLAYED.

Right, though in this case I think they are the same, since I'm creating 
the images from from scratch.

 >
 > I see next to no reason to ever reference the imageData property of an
 > image, and as noted in my last post, setting the TEXT property causes
 > the imageData, dimensions, and related properties to adjust 
automatically.


I use the text method when I need to dynamically resize images, but in 
this particular case the dimensions and properties will never change. 
Since I also need to set the maskdata, and sometimes the alphadata, I 
just used the imagedata too. Basically I'm creating small icons on the 
fly as determined by user input. I only need to create 64 pixels at a time.

In this particular case, the loss of detail you mention in your other 
note doesn't matter much, because 64 pixels doesn't offer a whole lot of 
detail anyway. ;) But it's a good tip for other uses.

I think the main thing I learned was that you really do need to match up 
the length of the imagedata and the size of the image. Otherwise you're 
in trouble. Now that I've fixed my repeat loop to calculate the area 
correctly, it seems to be working fine. No crashes since then.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list