Quantcast
Channel: LiveCode Forums
Viewing all articles
Browse latest Browse all 757

Getting Started with LiveCode - Experienced Developers • backgroundcolor for transparent images

$
0
0
If I put an image with has a transparent background on a field, then the backgroundcolor of the field shows through properly. And if I change the backgroundcolor of the field, then the new backgroundcolor shows through. This also works correctly if I use the "set imagesource" command to replace a character with an image. The field's backgroundcolor shows through the transparent background of the image which has been inserted for a specific character using the "set imagesource" command.

But if I change the backgroundcolor of the character which has been replaced by the transparent image, the new backgroundcolor does not come through the transparent areas of the image; it remains the color of the field's backgroundcolor rather than the character's backgroundcolor.

CODE:

put "12345" into fld "Field"set the backgroundcolor of fld "FIeld" to "yellow"
So now I have the text "12345" with a yellow background

CODE:

set the imagesource of char 3 of fld "Field" to 1111
Now I see the text "12" followed by image 1111 followed by the text "45" in the field. The yellow field backgroundcolor comes through the transparent areas of image 1111.

CODE:

set the backgroundcolor of char 1 to -1 of fld "Field" to "red"
Now the background of the text "12" and "45" is red, but the background of image 1111 is still yellow, the field's backgroundcolor, rather than the character's backgroundcolor.

This also happens if you set the backgroundcolor at the character level first and then set the imagesource. The color which shows through the image's transparent areas is the field's backgroundcolor, not the character's.

Livecode correctly sees the character's backgroundcolor is "red".

CODE:

put the backgroundcolor of char 3 of fld "field"
returns "255,0,0" (red). But that's not what you see through the transparent areas of the image in that character's place. You see yellow.

Any ideas how to get a transparent image to show the character's backgroundcolor if it is set rather than the field's backgroundcolor?

Statistics: Posted by bamakojeff — Fri Feb 21, 2025 8:34 pm



Viewing all articles
Browse latest Browse all 757

Trending Articles