beta3designs Posted July 14, 2009 Share Posted July 14, 2009 First... hello everyone! I'm new to these forums, not to PHP (anyway I consider myself a beginner so don't be too harsh with me please ) and I hope to get some help and to help as much as I can Well, let's get down to business I'm making a Color class with conversions between different colorspaces, colors, etc. so it can be helpful later to use with image libraries, like GD or ImageMagick... So I've come to a point where I don't know what to do. A lot of ways of implementing this class come to my head and I don't know which one would be the best to keep working on (I mean, it isn't finished and I don't want to write both, I'd like to choose one). So that's basically what I want you to help me with... to choose one of these two. The one you think would be better in every aspect especially when processing images. Also if you find any errors, or have any ideas, anything... please let me know i will really appreciate it Attached are the two implementations. Below I post some basic examples of how to use each one but I think it's easy enough. color.class.php: <?php require_once("color.class.php"); print Color::rgb2hex(array(255,0,255),0,1); print "<br/>"; $col = new Color; $col->set_from_hex("#FF0000"); $col2 = new Color; $col2->set_from_cmy(0, 1, 1); print $col2->get_hex(1, 1); print "<br/>"; ?> color.class2.php: <?php require_once("color.class2.php"); $rgb1 = new rgbColor(255,0,0,255); $rgb2 = new rgbColor(255,0,0,255); $cmy = new cmyColor(0,1,1,1); $cmyk = new cmykColor(0,1,1,0,1); print $rgb1->equals($rgb2); print "<br/>"; print $cmyk; print "<br/>"; print ColorConverter::toCmyk($rgb1); print "<br/>"; print $rgb1->getAlpha(); ?> Thanks in advance! P.S: In case you aren't familiar with colorspaces... RGB components are in the range 0..255, CMY and CMYK in the range 0..1, and notice the second implementation has also alpha channel while the first one doesn't (just cause when I wrote it I didn't think about it... ) [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
beta3designs Posted July 20, 2009 Author Share Posted July 20, 2009 hello again! sorry for double posting but... it's been a week since i posted this, and i really need some advise, i know you just can take all the time to answer everyone in this forum but i really need some advise so i can continue with my project is all i ask for... Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.