phpDocumentor Gd
Classes
[ class tree: Gd ] [ index: Gd ] [ all elements ]

Class: GdToolkit

Source Location: /modules/gd/classes/GdToolkit.class

Class GdToolkit

Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From GalleryToolkit

GalleryToolkit::applyTransform()
Apply the transform operation to the set of target operations. The transform operation
GalleryToolkit::estimateDimensions()
Estimate the dimensions of a GalleryDerivativeImage from its operations and its source.
GalleryToolkit::getProperty()
Get a certain property of a file
GalleryToolkit::mergeOperations()
Merge two operations together in an intelligent way. The end result of
GalleryToolkit::performOperation()
Perform a certain operation

[ Top ]
Property Summary
$_gdFunctionality   $_gdFunctionality   Our private GdFunctionality instance
mixed   $_hasImageCreateTrueColor   Does our GD library has a working imageCreateTrueColor?
mixed   $_transparencyReplacementColor   The color used to replace transparent areas is the output format doesn't support transparency. An RGB triple.

[ Top ]
Method Summary
void   getProperty()  
void   performOperation()  
nothing   setGdFunctionality()   Set a different GdFunctionality object to be used by this Toolkit.
bool   _canHaveAlphaChannel()   Checks whether files of the given mime-type can have a whole alpha channel.
bool   _canHaveTransparency()   Checks whether files of the given mime-type can have transparencies.
GalleryStatus   _flattenAlphaChannel()   Handle the resouce according to the capabilities of the output format.
void   _free()  
object implementation   &_getGdFunctionality()   Return the current set gdFunctionality.
void   _getImageDimensions()  
array   _getImageDimensionsForResource()   Get the image dimentions for an already opened GD resource.
array   _getImageResource()   Return a GD image resource for the given filename so we can perform other operations on it.
array   _getTrueColorImageRes()   Create a truecolor GD resource with the specified sizes.
array   _hasImageCreateTrueColor()   Do we have a working version of imageCreateTrueColor()?
GalleryStatus   _imageCopyResampled()   Copy and resize part of an image with resampling or resizing.
GalleryStatus   _prepareResourceForAlphaChannel()   Prepares a resource to handle alpha inherited from a source resource.
array   _resizeImageResource()   Resizes an open GD-resource to the specified size.
GalleryStatus   _saveImageResourceToFile()   Save a GD resource to a file with a certain mime-type

[ Top ]
Properties
$_gdFunctionality   $_gdFunctionality [line 43]

Our private GdFunctionality instance

API Tags:
Access:  private


[ Top ]
mixed   $_hasImageCreateTrueColor [line 49]

Does our GD library has a working imageCreateTrueColor?

API Tags:
Access:  private


[ Top ]
mixed   $_transparencyReplacementColor = array(255, 255, 255) [line 57]

The color used to replace transparent areas is the output format doesn't support transparency. An RGB triple.

API Tags:
Access:  private


[ Top ]
Methods
getProperty  [line 109]

  void getProperty( $mimeType, $propertyName, $sourceFilename  )

Parameters:
   $mimeType: 
   $propertyName: 
   $sourceFilename: 

API Tags:
See:  GalleryToolkit::getProperty


Redefinition of:
GalleryToolkit::getProperty()
Get a certain property of a file

[ Top ]
performOperation  [line 129]

  void performOperation( $mimeType, $operationName, $sourceFilename, $destFilename, $parameters, [ $context = array()]  )

Parameters:
   $mimeType: 
   $operationName: 
   $sourceFilename: 
   $destFilename: 
   $parameters: 
   $context: 

API Tags:
See:  GalleryToolkit::performOperation


Redefinition of:
GalleryToolkit::performOperation()
Perform a certain operation

[ Top ]
setGdFunctionality  [line 81]

  nothing setGdFunctionality( &$obj  )

Set a different GdFunctionality object to be used by this Toolkit.

This is useful on our phpunit tests, which will make this Toolkit use a pseudo-gd-implementation that simulates different PHP versions.

Parameters:
   &$obj: 


[ Top ]
_canHaveAlphaChannel  [line 934]

  bool _canHaveAlphaChannel( string $mimeType  )

Checks whether files of the given mime-type can have a whole alpha channel.

Parameters:
string   $mimeType: 


[ Top ]
_canHaveTransparency  [line 916]

  bool _canHaveTransparency( string $mimeType, [resource $res = null]  )

Checks whether files of the given mime-type can have transparencies.

Parameters:
string   $mimeType: 
resource   $res:  (optional) If specified, additional checks are executed


[ Top ]
_flattenAlphaChannel  [line 792]

  GalleryStatus _flattenAlphaChannel( resource $res, string $outputMimeType  )

Handle the resouce according to the capabilities of the output format.

  • For formats that support an alpha channel, don't do anything.
  • For formats that support a single transparent color, interpret everything that is more than 50% opaque as transparent.
  • For formats that don't support any form of transparency, fill the transparent area with a predefined background color.
The code is based on phpthumb by James Heinrich <info@silisoftware.com>.

Parameters:
resource   $res: 
string   $outputMimeType: 


[ Top ]
_free  [line 903]

  void _free( $resource  )

Parameters:
   $resource: 

API Tags:
See:  GdFunctionality::imagedestroy


[ Top ]
_getGdFunctionality  [line 66]

  object implementation &_getGdFunctionality( )

Return the current set gdFunctionality.

Default is GdFunctionality.class if no other is set.


API Tags:
Return:  of GdFunctionality
Access:  private


[ Top ]
_getImageDimensions  [line 654]

  void _getImageDimensions( $mimeType, $filename  )

Parameters:
   $mimeType: 
   $filename: 

API Tags:
Access:  private
See:  GalleryGraphics::getImageDimensions


[ Top ]
_getImageDimensionsForResource  [line 689]

  array _getImageDimensionsForResource( $res  )

Get the image dimentions for an already opened GD resource.

Parameters:
   $res: 

API Tags:
Return:  GalleryStatus int width int height
Access:  private


[ Top ]
_getImageResource  [line 464]

  array _getImageResource( string $mimeType, string $filename  )

Return a GD image resource for the given filename so we can perform other operations on it.

Parameters:
string   $mimeType:  the mime-type of the image
string   $filename:  the path to the file to read

API Tags:
Return:  GalleryStatus a status code resource the GD resource
Access:  private


[ Top ]
_getTrueColorImageRes  [line 511]

  array _getTrueColorImageRes( int $width, int $height, [bool $prepareAlpha = false]  )

Create a truecolor GD resource with the specified sizes.

On GD >= 2.0.1 there is a function to do this directly. On earlier versions, we need to create a temporary JPEG image and create the image from that.

Parameters:
int   $width: 
int   $height: 
bool   $prepareAlpha:  (optional) whether the resource should be prepared to host any transparencies

API Tags:
Return:  GalleryStatus resource the GD resource
Access:  private


[ Top ]
_hasImageCreateTrueColor  [line 93]

  array _hasImageCreateTrueColor( )

Do we have a working version of imageCreateTrueColor()?


API Tags:
Return:  GalleryStatus boolean true if this function should work
Access:  private


[ Top ]
_imageCopyResampled  [line 714]

  GalleryStatus _imageCopyResampled( $dstRes, $srcRes, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH  )

Copy and resize part of an image with resampling or resizing.

We will use GD's "resample" functionality and fallback to "resize" if "resample" is not available.

Parameters:
   $dstRes: 
   $srcRes: 
   $dstX: 
   $dstY: 
   $srcX: 
   $srcY: 
   $dstW: 
   $dstH: 
   $srcW: 
   $srcH: 

API Tags:
Access:  private


[ Top ]
_prepareResourceForAlphaChannel  [line 744]

  GalleryStatus _prepareResourceForAlphaChannel( &$res, resource $res, int $width, int $height  )

Prepares a resource to handle alpha inherited from a source resource.

Images that have transparency must have the background filled with the indexed color for transparency, otherwise the transparent color will appear as black.

The code is based on phpthumb by James Heinrich <info@silisoftware.com>. This version only works for PHP >= 4.3.2

Parameters:
resource   $res: 
int   $width: 
int   $height: 
   &$res: 


[ Top ]
_resizeImageResource  [line 622]

  array _resizeImageResource( resource $sourceRes, int $destWidth, int $destHeight, [bool $hasAlpha = false]  )

Resizes an open GD-resource to the specified size.

Parameters:
resource   $sourceRes:  the source GD-resource
int   $destWidth:  the destination width
int   $destHeight:  the destination height
bool   $hasAlpha:  (optional) whether the source image has any transparency

API Tags:
Return:  GalleryStatus resource the destination GD-resource
Access:  private


[ Top ]
_saveImageResourceToFile  [line 566]

  GalleryStatus _saveImageResourceToFile( resource $res, string $filename, string $mimeType, [bool $hasTransparency = true], [string $jpegQuality = null]  )

Save a GD resource to a file with a certain mime-type

Parameters:
resource   $res: 
string   $filename:  the path to the file to read
string   $mimeType:  the mime-type of the image
bool   $hasTransparency:  (optional) set to false to prevent dithering
string   $jpegQuality:  (optional)

API Tags:
Return:  a status code
Access:  private


[ Top ]

Documentation generated on Fri, 03 Oct 2008 05:15:49 -0700 by phpDocumentor 1.3.0RC6