Re: Common standard for defining a color?

From: Date: Tue, 03 Feb 2004 18:00:35 +0000
Subject: Re: Common standard for defining a color?
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-25447@lists.php.net to get a copy of this message
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) ); stephan

« previous php.pear.dev (#25447) next »