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

Class: Image_Color2_Model_WebsafeHex

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

Class Overview

Image_Color2_Model_Hex
   |
   --Image_Color2_Model_WebsafeHex

Hex color model that is limited to websafe colors.


Author(s):

Copyright:

  • 2005

Methods


Inherited Variables

Inherited Methods

Class: Image_Color2_Model_Hex

Image_Color2_Model_Hex::__construct()
Construct the hex color from RGB components.
Image_Color2_Model_Hex::fromArray()
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.
Image_Color2_Model_Hex::fromRgb()
Pass the RGB components to the constructor and return a new instance of Image_Color2_Model.
Image_Color2_Model_Hex::fromString()
Convert the hex string into RGB components and return a new instance of Image_Color2_Model. Allow both #abc and #aabbcc forms.
Image_Color2_Model_Hex::getArray()
Image_Color2_Model_Hex::getRgb()
Image_Color2_Model_Hex::getString()

Class Details

[line 31]
Hex color model that is limited to websafe colors.


[ Top ]


Method Detail

__construct (Constructor)   [line 41]

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

Construct the websafe hex color from RGB components. All values will be rounded to the closest websafe value.

Overrides Image_Color2_Model_Hex::__construct() (Construct the hex color from RGB components.)

Parameters:

integer   $r   —  Red 0-255
integer   $g   —  Green 0-255
integer   $b   —  Blue 0-255

[ Top ]

fromArray   [line 92]

Image_Color2_Model_WebsafeHex fromArray( array $array)

  • Access: public

Overrides Image_Color2_Model_Hex::fromArray() (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.)

Parameters:

array   $array   — 

[ Top ]

fromRgb   [line 82]

Image_Color2_Model_WebsafeHex fromRgb( array $rgb)

  • Access: public

Overrides Image_Color2_Model_Hex::fromRgb() (Pass the RGB components to the constructor and return a new instance of Image_Color2_Model.)

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 104]

Image_Color2_Model_WebsafeHex fromString( string $str)

  • Access: public

Overrides Image_Color2_Model_Hex::fromString() (Convert the hex string into RGB components and return a new instance of Image_Color2_Model. Allow both #abc and #aabbcc forms.)

Parameters:

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

[ Top ]

round   [line 58]

integer round( integer $int)

Round a RGB element to the closest websafe value.

Invalid values--those less than 0 or greater than 255--are forced to the minimum or maximum values respectively.


Parameters:

integer   $int   —  An RGB color component.

[ Top ]


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