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

Interface CanvasInterface

Direct known implementers

Jaguar\AbstractCanvas

Indirect known implementers

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

Namespace: Jaguar
Located at Jaguar/CanvasInterface.php

Methods summary

public Jaguar\CanvasInterface
# setHandler( resource $handler )

Set canvas handler

Set canvas handler

Parameters

$handler
resource
$handler gd resource

Returns

Jaguar\CanvasInterface

Throws

InvalidArgumentException
public resource
# getHandler( )

Get canvas handler

Get canvas handler

Returns

resource
gd resource
public boolean
# isHandlerSet( )

Check if the handler is empty

Check if the handler is empty

Returns

boolean
public integer
# getWidth( )

Get canvas width

Get canvas width

Returns

integer
public integer
# getHeight( )

Get height

Get height

Returns

integer
public Jaguar\Dimension
# getDimension( )

Get canvas dimension

Get canvas dimension

Returns

Jaguar\Dimension
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
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
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
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
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
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

Note : the current canvas handler will be destroy before creating the new one and you have no more access for it

Parameters

$string
string
$string canvas as string

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasCreationException
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

Note :

note that the current canvas handler will be destroyed before assigning the new one.

This behaviour will not allow to create canvas and depend on php garbage collection to clean it

Parameters

$canvas
Jaguar\CanvasInterface
$canvas

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasEmptyException
Jaguar\Exception\CanvasException;
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
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
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
public Jaguar\CanvasInterface
# paste( Jaguar\CanvasInterface $src, Jaguar\Box $srcBox = null, Jaguar\Box $destBox = null )

Merge two canvas together

Merge two canvas together

Note :

if $srcBox</t> or $destBox is null then a new box object will be created its dimension equlas the $src dimension and at (0,0) coordinate

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
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
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
public Jaguar\CanvasInterface
# destroy( )

Destroy the canvas

Destroy the canvas

destroy the canvas handler

Returns

Jaguar\CanvasInterface
self

Throws

Jaguar\Exception\CanvasDestroyingException
public string
# __toString( )

Get a string representation of the current canvas object

Get a string representation of the current canvas object

Returns

string

Magic methods summary

Jaguar - PHP Graphic Library API documentation generated by ApiGen 2.8.0