WideImage

# Class: WideImage_TrueColorImage

Source Location: /TrueColorImage.php

### Class Overview

    WideImage_Image
       |
       --WideImage_TrueColorImage

A class for truecolor image objects

### Methods

- __construct
- allocateColorAlpha
- alphaBlending
- asPalette
- asTrueColor
- copyNoAlpha
- create
- doCreate
- getChannels
- getClosestColorAlpha
- getExactColorAlpha
- isTrueColor
- saveAlpha

### Inherited Variables

#### Class: WideImage_Image

WideImage_Image::$canvas
WideImage_Image::$handle
WideImage_Image::$handleReleased
WideImage_Image::$sdata

### Inherited Methods

#### Class: WideImage_Image

WideImage_Image::__construct()
  The base class constructor
WideImage_Image::addNoise()
  Adds noise to the image
WideImage_Image::allocateColor()
  Allocate a color by RGB values.
WideImage_Image::applyConvolution()
  Applies convolution matrix with imageconvolution()
WideImage_Image::applyFilter()
  Applies a filter
WideImage_Image::applyMask()
  Returns an image with applied mask
WideImage_Image::asGrayscale()
  Returns a grayscale copy of the image
WideImage_Image::asNegative()
  Returns a negative of the image
WideImage_Image::asPalette()
  Returns a palette copy (8bit) of the image
WideImage_Image::asString()
  Returns binary string with image data in format specified by $format
WideImage_Image::asTrueColor()
  Returns a true-color copy of the image
WideImage_Image::autoCrop()
  Performs an auto-crop on the image
WideImage_Image::copy()
  Returns a copy of the image object
WideImage_Image::copyNoAlpha()
  Returns an image without an alpha channel
WideImage_Image::copyTo()
  Copies this image onto another image
WideImage_Image::copyTransparencyFrom()
  Copies transparency information from $sourceImage. Optionally fills the image with the transparent color at (0, 0).
WideImage_Image::correctGamma()
  Corrects gamma on the image
WideImage_Image::crop()
  Returns a cropped rectangular portion of the image
WideImage_Image::destroy()
  This method destroy the image handle, and releases the image resource.
WideImage_Image::fill()
  Fill the image at ($x, $y) with color index $color
WideImage_Image::flip()
  Returns a flipped (mirrored over horizontal line) copy of the image
WideImage_Image::getCanvas()
  Returns the canvas object
WideImage_Image::getChannels()
  Retrieve an image with selected channels
WideImage_Image::getClosestColor()
  Returns closest color index that matches the given RGB value. Uses PHP's imagecolorclosest()
WideImage_Image::getColorAt()
  Returns an index of the color at $x, $y
WideImage_Image::getColorRGB()
  Returns a color's RGB
WideImage_Image::getExactColor()
  Returns the color index that exactly matches the given RGB value. Uses PHP's imagecolorexact()
WideImage_Image::getHandle()
  Returns the GD image resource
WideImage_Image::getHeight()
WideImage_Image::getMask()
  Returns the image's mask
WideImage_Image::getOperation()
  Used internally to create Operation objects
WideImage_Image::getRGBAt()
  Returns a RGBA array for pixel at $x, $y
WideImage_Image::getTransparentColor()
WideImage_Image::getTransparentColorRGB()
  Returns a RGB array of the transparent color or null if none.
WideImage_Image::getWidth()
WideImage_Image::isTransparent()
WideImage_Image::isTrueColor()
  Returns true if the image is true-color, false otherwise
WideImage_Image::isValid()
WideImage_Image::merge()
  This method lays the overlay (watermark) on the image.
WideImage_Image::mirror()
  Returns a mirrored copy of the image
WideImage_Image::output()
  Outputs the image to browser
WideImage_Image::releaseHandle()
  Releases the handle
WideImage_Image::resize()
  Resize the image to given dimensions.
WideImage_Image::resizeCanvas()
  Resizes the canvas of the image, but doesn't scale the content of the image
WideImage_Image::resizeDown()
  Same as WideImage_Image::resize(), but the image is only applied if it is larger then the given dimensions.
WideImage_Image::resizeUp()
  Same as WideImage_Image::resize(), but the image is only applied if it is smaller then the given dimensions.
WideImage_Image::rotate()
  Rotate the image for angle $angle clockwise.
WideImage_Image::roundCorners()
  Returns an image with round corners
WideImage_Image::saveToFile()
  Saves an image to a file
WideImage_Image::setColorAt()
  Set the color index $color to a pixel at $x, $y
WideImage_Image::setRGBAt()
  Writes a pixel at the designated coordinates
WideImage_Image::setTransparentColor()
  Sets the current transparent color index. Only makes sense for palette images (8-bit).
WideImage_Image::unsharp()
  Applies the unsharp filter
WideImage_Image::writeHeader()
  Output a header to browser.
WideImage_Image::__call()
  Used internally to execute operations
WideImage_Image::__destruct()
  Cleanup
WideImage_Image::__sleep()
  Returns an array of serializable protected variables. Called automatically upon serialize().
WideImage_Image::__toString()
  Returns an image in GIF or PNG format
WideImage_Image::__wakeup()
  Restores an image from serialization. Called automatically upon unserialize().

### Class Details

[line 28]
A class for truecolor image objects
[ Top ]

### Class Methods

### static method create [line 49]

`static WideImage_TrueColorImage create( int $width, int $height)`

Factory method that creates a true-color image object

#### Parameters:

int | $width |
int | $height |

[ Top ]

### constructor __construct [line 35]

`WideImage_TrueColorImage __construct( resource $handle)`

Creates the object
Overrides WideImage_Image::__construct() (The base class constructor)

#### Parameters:

resource | $handle |

[ Top ]

### method allocateColorAlpha [line 102]

`int allocateColorAlpha( mixed $R, [int $G = null], [int $B = null], [int $A = null])`

Allocates a color and returns its index

This method accepts either each component as an integer value, or an associative array that holds the color's components in keys 'red', 'green', 'blue', 'alpha'.

#### Parameters:

mixed | $R |
int | $G |
int | $B |
int | $A |

[ Top ]

### method alphaBlending [line 73]

`bool alphaBlending( bool $mode)`

Sets alpha blending mode via imagealphablending()

#### Parameters:

bool | $mode |

[ Top ]

### method asPalette [line 113]

`void asPalette( [ $nColors = 255], [ $dither = null], [ $matchPalette = true])`

#### Tags:

see: | asPalette($nColors, $dither, $matchPalette)

Overrides WideImage_Image::asPalette() (Returns a palette copy (8bit) of the image)

#### Parameters:

| $nColors |
| $dither |
| $matchPalette |

[ Top ]

### method asTrueColor [line 214]

`void asTrueColor( )`

(non-PHPdoc)

#### Tags:

see: | asTrueColor()

Overrides WideImage_Image::asTrueColor() (Returns a true-color copy of the image)
[ Top ]

### method copyNoAlpha [line 201]

`void copyNoAlpha( )`

(non-PHPdoc)

#### Tags:

see: | copyNoAlpha()

Overrides WideImage_Image::copyNoAlpha() (Returns an image without an alpha channel)
[ Top ]

### method doCreate [line 57]

`void doCreate( $width, $height)`

#### Parameters:

| $width |
| $height |

[ Top ]

### method getChannels [line 189]

`void getChannels( )`

#### Tags:

see: | getChannels()

Overrides WideImage_Image::getChannels() (Retrieve an image with selected channels)
[ Top ]

### method getClosestColorAlpha [line 157]

`int getClosestColorAlpha( mixed $R, [int $G = null], [int $B = null], [int $A = null])`

Returns the index of the color that best match the given color components

This method accepts either each component as an integer value, or an associative array that holds the color's components in keys 'red', 'green', 'blue', 'alpha'.

#### Tags:

return: | The color index

#### Parameters:

mixed | $R | Red component value or an associative array
int | $G | Green component
int | $B | Blue component
int | $A | Alpha component

[ Top ]

### method getExactColorAlpha [line 178]

`int getExactColorAlpha( mixed $R, [int $G = null], [int $B = null], [int $A = null])`

Returns the index of the color that exactly match the given color components

This method accepts either each component as an integer value, or an associative array that holds the color's components in keys 'red', 'green', 'blue', 'alpha'.

#### Tags:

return: | The color index

#### Parameters:

mixed | $R | Red component value or an associative array
int | $G | Green component
int | $B | Blue component
int | $A | Alpha component

[ Top ]

### method isTrueColor [line 62]

`void isTrueColor( )`

Overrides WideImage_Image::isTrueColor() (Returns true if the image is true-color, false otherwise)
[ Top ]

### method saveAlpha [line 84]

`bool saveAlpha( bool $on)`

Toggle if alpha channel should be saved with the image via imagesavealpha()

#### Parameters:

bool | $on |

[ Top ]

Documentation generated on Sat, 19 Feb 2011 12:55:43 +0100 by phpDocumentor 1.4.3