Re: Common standard for defining a color?
| From: | Stefan Neufeind | Date: | Tue, 03 Feb 2004 18:32:38 +0000 |
| Subject: | Re: Common standard for defining a color? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25454@lists.php.net to get a copy of this message | ||
On 3 Feb 2004 at 19:00, Stephan Wentz wrote:
> Stefan Neufeind wrote:
>
> > On 3 Feb 2004 at 18:44, Norbert Mocsnik wrote:
> >
> >
> >>I don't know if any standard exists on Earth regarding color
> >>information storage in arrays.. What about mixing the two ways you
> >>wrote about? array("rgb" => array("r" => $red, "g"
> >>=> $green, "b" =>
> >>$blue),
> >> "a" => $alpha);
> >>or
> >>array("cmyk" => array("c" => $c, "m" => $m,
> >>"y" => $y, "k" => $k));
> >>So it can store any combination of color information.. - it's easy
> >>to construct this kind of arrays - it's easily readable
> >
> >
> > Well, the additional "array inside an array" makes it unnecessarily
> > complex in my eyes. You can have a function that checks if "c"
> > and/or "m" or something is set and assume that it's cmyk - you don't
> > need another level of complexity. So if you vote that we should move
> > from the array with indexes 0 to 2 of of Image_Color currently to
> > "r","g" and "b" (as Toby introducted in Image_Text) I'd
> > prefer that
> > solution.
> >
> > What about others?
>
> maybe use norbert's double-array, but a little less complex? when the
> key is cmyk we know that the 4 values are c, m, y, k...
>
> array(
> "cmyk" => array(1,2,3,4),
> "rgb" => array(3,5,4),
> "alpha" => array(1)
> );
But we want to represent only one color - not a set of colors. imho
there will be functions that e.g. could be implemented in Image_Color
(I already have some at hand) to convert from rgb to cymk etc. But
you would normally not need to have both rgb and cymk at a time ...
I'm not too much in favor of having an extra array-layer above the
actual color array. And if we agree that we don't need cymk and rgb
at once we could also move alpha into the array you proposed, right?
Stefan