The HSV Class and the accompanying functions allow you to convert between HSV and RGB.
RGB is what the computer understands. HSV is what people can use to easily work with colors. This code gives you the tools to convert between the two models.
PHP Version 4
LICENSE: This class is subject to the freebsd license found at http://freebsd.org/copyright/license.html.
| Class | Description |
|---|---|
| HSVClass | The HSV Class and the accompanying functions allow you to convert between HSV and RGB. |
Converts HSV to RGB
RGB is made up of three components, each having a possible value of 0 to 255. HSV is made up of three components, with H, the Hue, having the possible values of 0 to 360, while the other two having possible values 0 to 1.
By passing in HSV in array format, you will recieve back RGB in array format.
The RGB array is in the following format: array("r"=>?, "g"=>?, "b"=>?)
The HSV should be in the following format array("h"=>?, "s"=>?, "v"=>?);
Convert HSV to RGB String
Converts an HSV value into an RGB string for use in HTML
Converts RGB to HSV
RGB is made up of three components, each having a possible value of 0 to 255. HSV is made up of three components, with H, the Hue, having the possible values of 0 to 360, while the other two having possible values 0 to 1.
By passing in RGB in array format, you will recieve back HSV in array format.
The RGB array should be in the following format: array("r"=>?, "g"=>?, "b"=>?)
The returned hsv is in the following format array("h"=>?, "s"=>?, "v"=>?);
Documentation generated on Tue, 06 Sep 2005 00:57:19 -0400 by phpDocumentor 1.3.0RC3