More discussion about recommendatiosn ("color representation")

From: Date: Tue, 16 Mar 2004 12:36:14 +0000
Subject: More discussion about recommendatiosn ("color representation")
Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-942@lists.php.net to get a copy of this message
Hi, following up a recent discussion with Pierre on IRC I'd like to draw your attention to the "color representation"-recommendation again. http://pear.php.net/manual/en/developers.faq.colorrepresentation.php It's been discussed before, I've written drafts and so on, but it seems it was not read over by many people in-deep - or it is still not clear what this recommendation is for. The aim is to have an internal, interop-format. One (!) base-format for each color type (to avoid precision-loss because of color- conversions). For Image_Color I already have some extensions for alpha-channels and e.g. flexible color handling. This makes it possible to convert various formats like ("red") or ("100%, 0%, 0%") or (255, 0, 0) to the internal format. Pierre said that he dislikes the demand for a special internal format, because it might mean a big performance loss. It's not the intention to use this format to represent colors for each pixel of e.g. a 6 Megapixel-Image. That's overkill, I know. But it's meant for the various ocasions where you simply need a few colors, e.g. a text- color, or a gradient from one color to another or so (the two edge- colors). The intention is that you can use a tool (e.g. Image_Color) to convert the color into the interop-format and then feed that one into various classes which can well work with all the same color representation. The demand raised e.g. between Image_Graph and Image_Text where a certain color was already present in Image_Graph and needed to be transfered to Image_Text. In Image_Graph a array($r, $g, $b)-format is used. However Image_Text prefers array(r' => $r, 'g' => $g, 'b' => $b). That's why we discussed to have one common representation - and it would be a good thing [tm]. Now, to come to the point: Please review the recommendation in-depth once again. Pierre already asked me to move from the 0..255-range (only used for RGB) to a float-format (0..1), since it is much more flexible. This would allow for other formats which might usually be expressed as percent (e.g. CYMK) to also use 0..1, having a common value range and not loosing any precision. Please comment on this, since if we do this big step to the recommendation we should change all other things that might need a change also in one go! What do you think? *Please* comment on this email. Stefan

« previous php.pear.qa (#942) next »