Zeh and Ian, Thank you very much for your help, It seems to be more
complicated than I thought :|
I will give it a go with you info, but obviously if you want ti give me some
further info, I would absolutely appreciate it :)
Thank you again,
Claudia
From: "Zeh Fernando" <[EMAIL PROTECTED]>
Reply-To: Flashcoders mailing list <[email protected]>
To: "Flashcoders mailing list" <[email protected]>
Subject: Re: [Flashcoders] Drawing gradients
Date: Fri, 18 Nov 2005 12:38:19 -0200
http://www.fnordware.com/superpng/samples.html
Im not really sure what the name of these type of gradients are, but they
are usually found in color selectors in graphics tools i.e. Photoshop. And
have four colors equally bended from each corner.
Could you give me a hint on how I could achieve this kind of help?
They're just that, gradients. However, they don't use four colors (one on
each corner), but rather three (one on each axis).
However, there's a problem: you can't have a proper gradient selection for
three colors on a box, since you only have two dimensions. Photoshop itself
(for example) only uses two colors
on each box (and one additional slider for the third value). You can have
some advanced selection using more than two values if you use a circle or a
triangle, but you'd still lose a bit of sampled colors; also be aware that
the example you linked to is not recommended: while it's still kind of a
sample of the 16m colors available, the color distribution is biased and
there are values missing (ie, there's no real purple - R 255 B 255 -
because the R is using the inverse value of B).
Anyways, to create one like Photoshop do, you just have to loop through two
values, plotting them on a movieclip (using F8's new bitmap class,
duplicating movieclips, whatever). Something like this (uses R and G):
for (var l:Number = 0; l <= 255; l++) {
for (var c:Number = 0; c <= 255; c++) {
var myColor:Number = (l << 16) + (c << 8);
// plot at line l, column c, the color "myColor"...
// ...using whatever method you want to use to plot them
}
}
If you're trying to use other kind of composition (ie, circular or
triangular), you'll have to come up with the equations you want to use. For
example, in the link you cited, the expression used seems to be:
var myColor:Number = ((255-c) << 16) + ((255-l) << 8) + c;
But I wouldn't recomment it. If you want to do it with one bidimensional
image alone (and no additional sliders), I'd recommend using a circle (a
color wheel) using HSB calculations, but you'd still lose the saturation
value.
- zeh
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!
http://www.msn.co.uk/newsletters
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders