Image fill question

Scott Rossi scott at tactilemedia.com
Tue Nov 4 14:53:49 EST 2014


Here is a technique I use to fill an image with a solid color.

on mouseUp
   put long id of img 1 into pImage --- THE TARGET IMAGE
   put "255,0,0" into pColor --- THE RGB COLOR
   fillImageWithColor pImage, pColor
end mouseUp

command fillImageWithColor pImage, pColor
   put binaryEncode("CCCC",0,item 1 of pColor,item 2 of pColor,item 3 of
pColor) into theData
   repeat (width of pImage * height of pImage)
      put theData after theColorData
   end repeat
   set imageData of pImage to theColorData
end fillImageWithColor


Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design


> On 11/4/2014, 12:20 PM, FlexibleLearning.com wrote:
>>  I have a 10px x 10px image. There is a 1px black border with a colour fill.
>> 
>>  How do I set the colour fill of the image using an arbitrary RGB value?
>> 
>>  It needs to be a mathematical approach setting the pixel data directly
>>  (taking and applying a screen shot of a graphic is going to be too slow).
>> 
>>  I've tried all sorts and failed miserably... Can anyone help with this
>>  challenge?
> 





More information about the use-livecode mailing list