Setting Pixels - Clarification

Robert J Warren (Howsoft.com) warren at howsoft.com
Tue Jan 28 16:31:19 EST 2003


Many thanks to Scott Rossi for the tip, which as a Rev beginner I am
grateful for. However, I overdid it a little in trying to state my objective
simply. So I'll repeat the relevant part of my problem and try to explain my
aim more carefully.

As I gather from Ken Ray's very useful article "Understanding ImageData,
MaskData and AlphaData", "...you don't set SPECIFIC PARTS of imageData...,
you set  these properties as a whole."

>From the examples, this seems to mean in practice that if I want to change a
single pixel in an image I need to read the whole image bitmap into a
variable, change the pixel in the variable, and then copy the whole variable
contents back into the image.

Surely not! This is an incredibly slow process. Can anyone tell me of a
workaround? Or if there is no solution in RunRev #1, will this be fixed in
#2?

What eventually I would like to do is something like this (but this is only
any example). Suppose I am moving the mouse pointer in the form of an eraser
(i.e. a square of certain dimensions) over a photo. Wherever the eraser
passes, the colours change to a given different hue. So what I need is to be
able to extract the pixels under the eraser, convert them to HSL, adjust the
hue, convert them back to RGB, and then replace the pixels in the photo in
the required position under the eraser.

Using a bitmap pointer technique I manage to achieve this at appropriate
speed in VB by accessing the image bitmap directly, without having to copy
the whole image into a variable which would slow down the process too much.




More information about the use-livecode mailing list