Jaguar - PHP Graphic Library
  • Namespace
  • Class
  • Tree

Namespaces

  • Jaguar
    • Action
      • Blur
      • Color
      • Pixelate
      • Preset
    • Color
    • Drawable
      • Border
      • Style
      • Text
    • Exception
    • Factory
    • Format
    • Gradient

Classes

  • AbstractCanvas
  • Box
  • Canvas
  • CompressableCanvas
  • Coordinate
  • Dimension
  • Font
  • ImageFile
  • Transformation
  • Util

Interfaces

  • CanvasFactory
  • CanvasInterface
  • EqualsInterface

Class AbstractCanvas

Jaguar\AbstractCanvas implements Jaguar\CanvasInterface

Direct known subclasses

Jaguar\Canvas, Jaguar\CompressableCanvas, Jaguar\Format\Gd, Jaguar\Format\Gif

Indirect known subclasses

Jaguar\Format\Jpeg, Jaguar\Format\Png

Abstract
Namespace: Jaguar
Located at Jaguar/AbstractCanvas.php

Methods summary

public
# __construct( Jaguar\Dimension|Jaguar\CanvasInterface|file|string $source = null )

construct new canvas

construct new canvas

Parameters

$source
Jaguar\Dimension|Jaguar\CanvasInterface|file|string
$source the source could be a dimension object to create a new canvas , another canvas instance to create from , file path to load canvas from or null to take no action

Throws

Jaguar\Exception\InvalidDimensionException
Jaguar\Exception\CanvasCreationException
public boolean
# isGdResource( mixed $resource )

Check if the given resource is gd resource

Check if the given resource is gd resource

Returns

boolean
public boolean
# isHandlerSet( )

Check if the handler is empty

Check if the handler is empty

Returns

boolean

Implementation of

Jaguar\CanvasInterface::isHandlerSet()
public resource
# getHandler( )

Get canvas handler

Get canvas handler

Returns

resource
gd resource

Implementation of

Jaguar\CanvasInterface::getHandler()
public Jaguar\CanvasInterface
# setHandler( resource $handler )

Set canvas handler

Set canvas handler

Parameters

$handler
resource
$handler gd resource

Returns

Jaguar\CanvasInterface

Throws

InvalidArgumentException

Implementation of

Jaguar\CanvasInterface::setHandler()
public integer
# getWidth( )

Get canvas width

Get canvas width

Returns

integer

Implementation of

Jaguar\CanvasInterface::getWidth()
public integer
# getHeight( )

Get height

Get height

Returns

integer

Implementation of

Jaguar\CanvasInterface::getHeight()
public Jaguar\Dimension
# getDimension( )

Get canvas dimension

Get canvas dimension

Returns

Jaguar\Dimension

Implementation of

Jaguar\CanvasInterface::getDimension()
public boolean
# isTrueColor( )

Check if the canvas represents a truecolor canvas

Check if the canvas represents a truecolor canvas

Returns

boolean
true if true color false otherwise

Throws

Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::isTrueColor()
public Jaguar\CanvasInterface
# alphaBlending( boolean $bool )

Set alpha blending

Set alpha blending

Parameters

$bool
boolean
$bool default true

Returns

Jaguar\CanvasInterface

Throws

Jaguar\Exception\CanvasException
Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::alphaBlending()
public Jaguar\CanvasInterface
# create( Jaguar\Dimension $dimension )

Create canvas (true colors only)

Create canvas (true colors only)

Parameters

$dimension
Jaguar\Dimension
$dimension

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\InvalidDimensionException
Jaguar\Exception\CanvasCreationException

Implementation of

Jaguar\CanvasInterface::create()
public Jaguar\CanvasInterface
# fromString( string $string )

Create new canvas representing the canvas obtained from the given string

Create new canvas representing the canvas obtained from the given string

Parameters

$string
string
$string canvas as string

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasCreationException

Implementation of

Jaguar\CanvasInterface::fromString()
public Jaguar\CanvasInterface
# fromFile( string $file )

Create new canvas from file

Create new canvas from file

Parameters

$file
string
$image

Returns

Jaguar\CanvasInterface
self

Throws

InvalidArgumentException
Jaguar\Exception\CanvasCreationException

Implementation of

Jaguar\CanvasInterface::fromFile()
public Jaguar\CanvasInterface
# fromCanvas( Jaguar\CanvasInterface $canvas )

Replace this canvas handler with a new one loaded from another canvas

Replace this canvas handler with a new one loaded from another canvas

Parameters

$canvas
Jaguar\CanvasInterface
$canvas

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasEmptyException
Jaguar\Exception\CanvasException;

Implementation of

Jaguar\CanvasInterface::fromCanvas()
public integer
# getColorAt( Jaguar\Coordinate $coordinate )

Get color at specific coordinate

Get color at specific coordinate

Parameters

$coordinate
Jaguar\Coordinatee
$coordinate

Returns

integer

Throws

Jaguar\Exception\InvalidCoordinateException
Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::getColorAt()
public Jaguar\Drawable\Pixel
# getPixel( Jaguar\Coordinate $coordinate )

Get Pixel at specific coordinate

Get Pixel at specific coordinate

Parameters

$coordinate
Jaguar\Coordinatee
$coordinate

Returns

Jaguar\Drawable\Pixel

Throws

Jaguar\Exception\InvalidCoordinateException
Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::getPixel()
public Jaguar\CanvasInterface
# draw( Jaguar\Drawable\DrawableInterface $drawable, mixed $style = null )

Draw drawable object on the current canvas

Draw drawable object on the current canvas

Parameters

$drawable
Jaguar\Drawable\DrawableInterface
$drawable
$style
mixed
$style

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::draw()
public Jaguar\CanvasInterface
# paste( Jaguar\CanvasInterface $src, Jaguar\Box $srcBox = null, Jaguar\Box $destBox = null )

Merge two canvas together

Merge two canvas together

Parameters

$src
Jaguar\CanvasInterface
$src the canvas that should be merged into current one
$srcBox
Jaguar\Box
$srcBox Box from src canvas
$destBox
Jaguar\Box
$destBox Box for the current canvas

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasException
Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::paste()
public Jaguar\CanvasInterface
# fill( Jaguar\Color\ColorInterface $color, Jaguar\Coordinate $coordinate = null )

Fill canvas with color

Fill canvas with color

Parameters

$color
Jaguar\Color\ColorInterface
$color
$coordinate
Jaguar\Coordinate
$coordinate start point

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasEmptyException

Implementation of

Jaguar\CanvasInterface::fill()
public Jaguar\CanvasInterface
# save( string $path = null )

Save canvas

Save canvas

Parameters

$path
string
$path The path to save the canvas to. If not set or NULL, the raw canvas stream will be outputted directly.

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasEmptyException
Jaguar\Exception\CanvasOutputException

Implementation of

Jaguar\CanvasInterface::save()
public Jaguar\CanvasInterface
# getCopy( )

Get Copy of the current canvas

Get Copy of the current canvas

Returns

Jaguar\CanvasInterface
return a canvas with a completey different gd resource

Throws

Jaguar\Exception\CanvasEmptyException
Jaguar\Exception\CanvasException

Implementation of

Jaguar\CanvasInterface::getCopy()
public
# __clone( )

Clone canvas

Clone canvas

public Jaguar\CanvasInterface
# destroy( )

Destroy the canvas

Destroy the canvas

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasDestroyingException

Implementation of

Jaguar\CanvasInterface::destroy()
public string
# __toString( )

Get a string representation of the current canvas object

Get a string representation of the current canvas object

Returns

string

Implementation of

Jaguar\CanvasInterface::__toString()

Magic methods summary

Jaguar - PHP Graphic Library API documentation generated by ApiGen 2.8.0