Second set of eyes needed.

Michael Doub mike at doub.com
Mon Jan 9 17:28:24 EST 2012


After taking a break for a while  and coming back I found it.

 put ((yy - 1) * W ) + ((xx - 1) * 4) into myindex needs to be

 put ((yy - 1) * W * 4 ) + ((xx - 1) * 4) into myindex



On 2012-01-09, at 4:54 PM, Michael Doub wrote:

> getitback needs to be passed W not L (width not the length) but the problem still exists.
> 
> On 2012-01-09, at 4:33 PM, Michael Doub wrote:
> 
>> 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
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list