Background image problems
WSUMNER at dom.wustl.edu
Thu Jun 4 21:11:49 CDT 2009
Can anyone shed some light on using paint tools and imagedata on images in a bg group?
Here's my situation: I have either 1 or 3 pictures to generate, each held by a separate image object. The user adjusts a bunch of settings and then presses a button to generate new pictures. To let the user see what is happening, the first is always visible, and is supposed to update frequently.
Because the new picture might look a lot like the old picture, the script selects some gray color and uses the pencil to draw horizontal lines over the first picture. This is fairly quick and gives a clear impression that the picture is being rebuilt. This works fine if the image is not part of a group. It works if the image is not the only image in a group. It seems not to work if the image is the only image in a group (Rev takes enough time to draw gray over the image, but no partially or fully gray image ever appears).
Next step is to generate new images. I take the imagedata for the all gray image, which is automatically the right size, make copies as needed for additional images, and then run through the pixels of each imagedata copy, inserting RGB values calculated on the fly. This is 300x faster than using paint tools. After every 1024 pixels, the script sends the imageData on the screen, so it looks like the image is redrawing a line or a few lines at a time. This works fine if the image is not part of a group and the script includes "unlock screen" commands. It seems not to work if the image is in a group.
Finally, the imagedata of the first image is set to the 1st imagedata, the imagedata of the second image is set to the 2nd imagedata, and same for the third. If all three images are in a group with bg behavior, the second and third look right and the first never updates - it's just gray. This problem persists with a 1-card stack. If all three images are not in a group, they all work fine.
This application lends itself to making many cards bearing different pictures, so I was hoping to put images in a group with bg behavior. However this seems not to work. I expect that I can remove the images from the group and make new image objects as needed, but what a kluge. Any thoughts on what is going wrong?
Rev Ent 3.5.0 dp7 build 820, Intel Macbook Pro OSX, 10.5.5
More information about the use-livecode