Image_Color2
[ class tree: Image_Color2 ] [ index: Image_Color2 ] [ all elements ]

Class: Image_Color2_Model_Hex

Source Location: /Image_Color2-0.1.5/Image/Color2/Model/Hex.php

Class Overview


Hex color model defines RGB colors using hexadecimal values for each component.


Author(s):

Copyright:

  • 2005

Variables

Methods


Child classes:

Image_Color2_Model_WebsafeHex
Hex color model that is limited to websafe colors.

Inherited Variables

Inherited Methods


Class Details

[line 42]
Hex color model defines RGB colors using hexadecimal values for each component.

Typically, these values are concatenated into a string and prefixed by the # character:

#339900
 #390



[ Top ]


Class Variables

$_b =  0

[line 57]

Blue component
  • Var: 0-255
  • Access: protected

Type:   integer


[ Top ]

$_g =  0

[line 52]

Green component
  • Var: 0-255
  • Access: protected

Type:   integer


[ Top ]

$_r =  0

[line 47]

Red component
  • Var: 0-255
  • Access: protected

Type:   integer


[ Top ]



Method Detail

__construct (Constructor)   [line 66]

Image_Color2_Model_Hex __construct( integer $r, integer $g, integer $b)

Construct the hex color from RGB components.
  • Access: protected

Overridden in child classes as:

Image_Color2_Model_WebsafeHex::__construct()
Construct the websafe hex color from RGB components. All values will be rounded to the closest websafe value.

Parameters:

integer   $r   —  0-255
integer   $g   —  0-255
integer   $b   —  0-255

[ Top ]

fromArray   [line 98]

Image_Color2_Model_Hex fromArray( $array, array $rgb)

Construct a new Image_Color2_Model from the components in an array. The array format happens to be the PEAR style RGB array so we just hand it off to fromRgb.

Overridden in child classes as:

Image_Color2_Model_WebsafeHex::fromArray()

Parameters:

array   $rgb   —  A PEAR style RGB array containing three integers from 0 to 255 for the Red, Green, and Blue color components followed by a 'type' => 'rgb' element.
   $array   — 

[ Top ]

fromRgb   [line 81]

Image_Color2_Model_Hex fromRgb( array $rgb)

Pass the RGB components to the constructor and return a new instance of Image_Color2_Model.

Overridden in child classes as:

Image_Color2_Model_WebsafeHex::fromRgb()

Parameters:

array   $rgb   —  A PEAR style RGB array containing three integers from 0 to 255 for the Red, Green, and Blue color components followed by a 'type' => 'rgb' element.

[ Top ]

fromString   [line 109]

Image_Color2_Model_Hex fromString( string $str)

Convert the hex string into RGB components and return a new instance of Image_Color2_Model. Allow both #abc and #aabbcc forms.
  • Access: public

Overridden in child classes as:

Image_Color2_Model_WebsafeHex::fromString()

Parameters:

string   $str   —  in the format 'AABBCC', 'ABC', '#ABCDEF', or '#ABC'

[ Top ]

getArray   [line 147]

array getArray( )

  • Return: A PEAR style RGB array containing three integers from 0 to 255 for the Red, Green, and Blue color components followed by a 'type'=>'rgb' element.
  • Access: public
  • Uses: Image_Color2_Model_Hex::getRgb() - because both functions share the same return format.

[ Top ]

getRgb   [line 135]

array getRgb( )

  • Return: A PEAR style RGB array containing three integers from 0 to 255 for the Red, Green, and Blue color components followed by a 'type' => 'rgb' element.
  • Access: public
  • Usedby: Image_Color2_Model_Hex::getArray() - because both functions share the same return format.

[ Top ]

getString   [line 157]

string getString( )

  • Return: A string in the format '#RRGGBB' where each channel is a hex byte.
  • Access: public
  • Usedby: Image_Color2::getHex()

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.