\SS_Color
DBField for Color manipulation and DB storage.
Color are stored in the DB as RRGGBBAAA:
Hex RGB value + 3 digit Alpha
AAA = [0,100] : 100 = 1 alpha / 001 = 0.01 alpha
- Author: Thierry Francois @colymba
Synopsis
class SS_Color
extends DBField
{
- // methods
- public void __construct()
- public void requireField()
- public void scaffoldFormField()
- public null nullValue()
- protected string formatValue()
- public void setValue()
- protected void syncValue()
- protected string extractHex()
- protected string extractAlpha()
- public void setHex()
- public string Hex()
- public void setAlpha()
- public float Alpha()
- public array RGB()
- public integer R()
- public integer G()
- public integer B()
- public static string format_hex()
- public static array hex_to_rgb()
- public static string rgb_to_hex()
Hierarchy
Extends
- DBField
Members
protected
- $alpha
—
float
Decimal 0-1 Alpah value - $hex
—
string
Color Hexadecimal value
Methods
protected
- extractAlpha() — Extrac the Alpah value from a RRGGBBAAA string
- extractHex() — Extrac the RGB Hex value from a RRGGBBAAA string
- formatValue() — Make sure the field's actual value is in an acceptable format or convert's it.
- syncValue() — Updates the fiels's value from the Hex and Alpha properties
public
- __construct() — DBField contrustor
- Alpha() — Return the Alpha value or the color
- B() — Return the decimal Blue component of the color
- G() — Return the decimal Green component of the color
- Hex() — Return the Hex representation of the color
- R() — Return the decimal Red component of the color
- RGB() — Return an RGB array representation of this color
- format_hex() — Return a correctly formatted Hex value RRGGBB
- hex_to_rgb() — Convert and Hex color into RGB decimal components
- nullValue() — Returns the value to be set in the database to blank this field.
- requireField() — (non-PHPdoc)
- rgb_to_hex() — Convert RGB color component int an Hex color string
- scaffoldFormField() — (non-PHPdoc)
- setAlpha() — Sets the field's Alpah value
- setHex() — Sets the field's RGB value in Hex format
- setValue() — Sets the field's value and sync Hex and Alpah properties.