RGB colours

Mark Smith mark at maseurope.net
Wed Dec 19 10:44:37 EST 2007


It seems like the templateButton/field etc doesn't have a usable  
backPixel property...

This seems to work, though I don't think it's any better than  
Sarah's. It doesn't need to create any objects, but then the Sarah's  
could be modified to work the same way.

function getRGB cName
     lock screen
     put the backcolor of this cd into oldColor
     set the backcolor of this cd to cName
     put the effective backpixel of this cd into tRGB
     put binaryencode("M", tRGB) into tBin

     repeat for each char i in tBin
         put chartonum(i) & comma after rgbList
     end repeat
     set the backcolor of this cd to oldColor
     return item 2 to 4 of rgbList
end getRGB

Interestingly, 'the effective backPixel' in this case returns a  
decimal representation of the 4 byte pixel as a 4 byte integer.

Best,

Mark

On 19 Dec 2007, at 15:00, Richard Gaskin wrote:

> Sarah Reichelt wrote:
> > Here is a function I gleaned from the list a long time ago.
> >
> > function translateColorName pColorName
> >    lock screen
> >    lock messages
> >    create btn "ColorTest"
> >    put it into tButtonID
> >    set the backcolor of tButtonID to pColorName
> >    get the effective backpixel of tButtonID
> >    set the backcolor of tButtonID to empty
> >    set the backpixel of tButtonID to it
> >    put the backcolor of tButtonID into tRGB
> >    delete tButtonID
> >    return tRGB
> > end translateColorName
>
> Do you know of a way in which that might be modified to use the  
> templateButton rather than a physical button?
>
> -- 
>  Richard Gaskin
>  Managing Editor, revJournal
>  _______________________________________________________
>  Rev tips, tutorials and more: http://www.revJournal.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the Use-livecode mailing list