Second set of eyes needed.
Michael Doub
mike at doub.com
Mon Jan 9 16:33:01 EST 2012
I have been trying to figure out why I have not been able to retrieve valid RGB values from an image.
I decided to generate my own image so I would be able to track down my issue. I thought that would
be straight forward, Several hrs later and i am still at an impasse. I am trying to understand why I
the pixel data, that was just written seems to be corrupted. This occurs on the first pixel of the second row
of pixels.
Could someone take a look and point out where I am going wrong? Interestingly enough, if you comment
out the check with the breakpoint you will get to see the image that seems to look just fine.
Thanks
Mike
local tData
on mouseUp
BuildImage
end mouseUp
On BuildImage
put empty into tData
put 320 into W
put 426 into L
create image
put it into tID
set the width of tID to W
set the height of tID to L
put 1 into R
put 1 into G
put 0 into B
repeat with y = 1 to L
repeat with x =1 to W
put binaryEncode("CCCC",0,R,G,B) into Pixel
put Pixel after tData
get getitback (L, x, y)
if it <> Pixel then
breakpoint
end if
add 1 to R
if R = 256 then put 1 into R
end repeat
Add 1 to G
put 1 into R
if G = 256 then put 1 into G
end repeat
set the imageData of tID to tData
end BuildImage
function getitback W, xx, yy
put ((yy - 1) * W ) + ((xx - 1) * 4) into myindex
put charToNum(char myindex + 2 of tData) into RR
put charToNum(char myindex + 3 of tData) into GG
put charToNum(char myindex + 4 of tData) into BB
put binaryEncode("CCCC",0,RR,GG,BB) into it
return it
end getitback
More information about the use-livecode
mailing list