Can Colors & Patterns be used with pngs?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
steve10
Posts: 85
Joined: Fri May 13, 2011 9:38 am

Can Colors & Patterns be used with pngs?

Post by steve10 » Mon Jun 27, 2011 4:24 pm

I'm continuing a thread from the Summer Academy sub-forum, which is now locked. RIP. :(
Here's the postings so far.
steve10 wrote:Can Colors & Patterns from the Inspector be used with pngs? What about the associated code?

The other effects in the Inspector seem to work with pngs, but I can't get Colors & Patterns to work. Could someone please confirm?

Steve
hanson wrote:Hi Steve,

please have a look at the dictionary page "color" for more information on where the 8 colors are used. I think this will answer the question for you.


Thanks,

Hanson
Now I'm only more confused! Here's some text extracted from the dictionary about colors:
colors
Type: property
Syntax:
set the colors of object to colorsList
Objects (or Types): card,stack,group,field,button,graphic,scrollbar,player,image

The colors of an image contains as many lines as there are colors used in the image. The colors of all other objects contains eight lines, some of which may be empty.

Comments:
For objects other than images, you can set all these colors individually; the colors property simply provides a shorter method of dealing with all of them at once. Each line of the colors corresponds to one of the following color properties:

Line 1: the foregroundColor
Line 2: the backgroundColor
Line 3: the hiliteColor
Line 4: the borderColor
Line 5: the topColor
Line 6: the bottomColor
Line 7: the shadowColor
Line 8: the focusColor


This text from the dictionary is typical of the different types of color properties:

foregroundColor
Type: property
Syntax:
set the backgroundColor of object to {empty | colorName | RGBColor}
set the backgroundColor of [chunk of] field to {empty|colorName|RGBColor}
Objects (or Types): card,stack,group,field,button,graphic,scrollbar,player,image


From this it seems that the color properties should work similarly on images and objects, the only difference being that images have unlimited colors and graphics have 8 defined color types. It works as expected for graphics, but seems to do nothing to images. This is my code:

Code: Select all

on mouseenter
   set the foregroundcolor of me to "60,130,200"
   set the shadowcolor of me to "200,130,100"
end mouseenter
The image color and the shadows previously created through the Inspector did not change. What am I not understanding?

Steve

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Can Colors & Patterns be used with pngs?

Post by Klaus » Mon Jun 27, 2011 5:36 pm

Hi Steve,

if you exspect to really "colorize" an image by setting its "forecolor", this is not the case"
For me "colors" do not have any meaning with images except maybe "shadowcolor".

Example: to set the bordercolor of an image you need to set the bordercolor of the STACK
so it is inherited, but you cannot set it directly :?

This is so un-intuitive, so I would not waste my time with "colors" of images.


Best

Klaus

steve10
Posts: 85
Joined: Fri May 13, 2011 9:38 am

Re: Can Colors & Patterns be used with pngs?

Post by steve10 » Mon Jun 27, 2011 6:19 pm

Hi Klaus,

I pretty much have come to the same conclusion, but wanted to try to fully understand this. I'm using overlays and transparencies to control colors. My real goal is to be able to use shadows on the images. Do you think that I should also give up on that? Any alternate suggestions would be appreciated.

Thanks,
Steve

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Can Colors & Patterns be used with pngs?

Post by Klaus » Mon Jun 27, 2011 6:38 pm

Hi Steve,

the "graphic effects" are different from "the colors" so they are indeed usable 8)
and work fine with (semi-) transparent PNG images!


Best

Klaus

steve10
Posts: 85
Joined: Fri May 13, 2011 9:38 am

Re: Can Colors & Patterns be used with pngs?

Post by steve10 » Mon Jun 27, 2011 7:09 pm

Thanks again Klaus. Okay, so now I have to fully understand how graphic effects are used with images. I did a double take when I re-read this:
Klaus wrote:
Example: to set the bordercolor of an image you need to set the bordercolor of the STACK
so it is inherited, but you cannot set it directly :?

This is so un-intuitive...
"Un-intuitive" doesn't even begin to describe it. I'm hoping it's a two step process, first change the graphic effect for the stack and then for the image. Otherwise I would assume that changing it for the stack would change it for all images at once. I was hoping to use shadowcolors, perhaps along with some effects, for a status indicator. The status of different images will vary, so I may have to go back to the drawing board on how to do it.

Regards,
Steve

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Can Colors & Patterns be used with pngs?

Post by Klaus » Mon Jun 27, 2011 7:29 pm

Hi Steve,

you cannot set a "graphic effect" for a stack or card, so this is obviously a per-object setting!
Check the dictionary for "dropshadow" and the "See also..." on that card on how to set graphic effects by script.


Best

Klaus

steve10
Posts: 85
Joined: Fri May 13, 2011 9:38 am

Re: Can Colors & Patterns be used with pngs?

Post by steve10 » Mon Jun 27, 2011 8:32 pm

Hi Klaus,

I now understand one of the sources of my confusion. The list of 8 color types includes bordercolor and shadowcolor, and since shadow is also a graphic effect, I made a bad assumption. I should sleep more to get my head working straight. :? In any case, it makes sense now.

Thanks,
Steve

Post Reply