PHP Classes

File: rgb_eng.class.txt

Recommend this page to a friend!
  Classes of Luis Quijada Serrano   RGB / CSS Color Process   rgb_eng.class.txt   Download  
File: rgb_eng.class.txt
Role: Documentation
Content type: text/plain
Description: Documentation & Examples for rgb_eng.class.php
Class: RGB / CSS Color Process
Performs RGB / CSS Color converting and processing
Author: By
Last change: Luminize? method name => lightup; darkenize? => darken
Date: 21 years ago
Size: 3,819 bytes
 

Contents

Class file image Download
AUTOR / AUTHOR : LUIS QUIJADA SERRANO FECHA / DATE : 7/03/2002. VERSION : 1.0 THIS FILE : COMMENTS AND EXPAMPLES FOR rgb_eng.clas.php LIST AND DESCRIPTION OF ENGLISH METHODS ******************************* Extracts the component given by $component from the given color. /* Return value: string */ function rgb_extract_component($rgb, $component, $cseparator="") /* Return value: string */ function css_extract_component($csscolor, $component) Replace the component given by $component with $new at the given color. /* Return value: [array|list] */ function rgb_replace_component($rgb, $new, $component, $cseparator="") /* Return value: string */ function css_replace_component($csscolor, $new, $component) Increments the component given by $component by $howmany. /* Return value: string */ function rgb_inc_component($howmany, $rgb, $component, $cseparator="") /* Return value: string */ function css_inc_component($howmany, $csscolor, $component) Decrements the component given by $component by $howmany. /* Return value: [array|list] */ function rgb_dec_component($howmany, $rgb, $component, $cseparator="") /* Return value: string */ function css_dec_component($howmany, $csscolor, $component) Increments the specified component ([RGB_R|RGB_G|RGB_B], if not specified the component to be incremented/saturated is the higher) decrementing the rest of the componentes in the same way. /* Returned value : [array|list] */ function rgb_saturate($howmany, $rgb, $component="", $cseparator="") /* Returned value : string */ function css_saturate($howmany, $csscolor, $component="") Increments all RGB's components. Light up your color. /* Returned value : [array|list] */ function rgb_lightup($howmany, $rgb, $cseparator="") /* Returned value : string */ function css_lightup($howmany, $csscolor) Decrements all RGB's components. Darken your color /* Returned value : [array|list] */ function rgb_darken($howmany, $rgb, $cseparator="") /* Returned value : string */ function css_darken($howmany, $csscolor) Converts an RGB triplet to a valid CSS color /* Returned value: [array]|[list] */ function rgb2css($rgb, $cseparator="") Converts a valid css color to an RGB triplet. /* Returned value: [array]|[list] */ function css2rgb($csscolor, $cseparator="") /* SOME EXAMPLES */ /* Creation (use the RGB_EN define to use the english like class) $objRGB = new RGB(RGB_EN); /* extracting values print($objRGB->rgb_extract_component("21,12,10", RGB_R, ",")); // OUT: 21 print($objRGB->rgb_extract_component(array(21,12,10), RGB_B)); // OUT: 10 print($objRGB->css_extract_component("#FFEEAA", RGB_R)); // OUT: FF /* replacing values print($objRGB->css_replace_component("#FFEEAA", "AA", RGB_G)); // OUT: #FFAAAA /* incrementing decrementing and some especial operations in values print($objRGB->rgb_inc_component(30, "40,50,20", RGB_B, ",")); // OUT: 40,50,50 print($objRGB->css_inc_component(9, "#A0BBCC", RGB_R)); // OUT: #A9BBCC print($objRGB->css_dec_component(9, "#A9BBCC", RGB_R)); // OUT: #A0BBCC print($objRGB->rgb_saturate(20, "20,20,25", "", ",")); // OUT: 0,0,54 print($objRGB->css_saturate(20, "#202025", "", ",")); // OUT: #0C0C39 print($objRGB->rgb_lightup(20, "20,20,25", ",")); // OUT: 40,40,45 print($objRGB->css_lightup(20, "#202020", ",")); // OUT: #343434 print($objRGB->rgb_darken(20, "20,20,25", ",")); // OUT: 0,0,5 print($objRGB->css_darken(20, "#202020", ",")); // OUT: #0C0C0C /* converting values print($objRGB->rgb2css("20,20,25", ",")); // OUT: #141419 print($objRGB->css2rgb("#452020","@")); // // OUT: 69@32@32