Setting Pixels - Any geeks out there?
Robert J Warren (Howsoft.com)
warren at howsoft.com
Fri Jan 31 06:14:01 EST 2003
For those of you who are interested in graphics, I DO suggest you try
Monte's custom paint tool for simply drawing squiggly lines with the mouse.
In terms of coding, and since Monte has proved to us all that he is quite
good at this kind of thing, I think that this routine is probably about as
efficient as it can be. Yet on my Pentium II (Windows ME), the result is not
very good, certainly not as good as it would be in VB. The mouse draws a
broken rather than continuous line, even when you move it slowly.
So contradict me if I am wrong:
The development of a procedure for direct access to the image's pixel data
(rather than having instructions like 'put the imageData of image "bmw.bmp"
into iData, set the imageData of image "bmw.bmp" to iData', etc.) would
probably help a lot.
But as I said, it would take a real bright spark (someone with internal
knowledge of the Transcript engine) to come up with such a solution.
However, they did it in VB...
ARE THERE ANY GEEKS OUT THERE?
When the RunRev team get their heads above water, I would also like to know
what they think about this issue.
Here's Monte's routine again:
-Button script
on mouseUp
InitialiseImageData
InitialisePaintColor
end mouseUp
-Card script
local lImageData,lPaintColor,lMouseDown
on InitialiseImageData
put the imageData of image 1 into lImageData
end InitialiseImageData
on InitialisePaintColor
put binaryEncode("CCCC",0,0,255,0) into lPaintColor
end InitialisePaintColor
on mouseMove x,y
if lMouseDown then
if word 1 of the target is "image" then
set the lockCursor to true
set the cursor to cross
put (x-the left of image 1)*4+(y- the top of image 1)*(the width of
image 1*4) into x
put lPaintColor into char x-3 to x of lImageData
set the imageData of image 1 to lImageData
end if
else
pass mouseMove
end if
end mouseMove
on mouseDown
put true into lMouseDown
end mouseDown
on mouseUp
put false into lMouseDown
end mouseUp
on mouseRelease
put false into lMouseDown
end mouseRelease
More information about the use-livecode
mailing list