Sledgehammer Framework

Canvas extends Graphics
in package

Drawing lines, rectangles, etc.

Table of Contents

$aspectRatio  : float
$height  : int
$width  : int
$gd  : resource
$color  : int
__call()  : mixed
Report that the $method doesn't exist.
__callStatic()  : mixed
Report that the $method doesn't exist.
__construct()  : mixed
__destruct()  : mixed
__get()  : mixed
Report that $property doesn't exist.
__set()  : mixed
Report that $property doesn't exist and set the property to the given $value.
__toString()  : string
The object is used as an string.
cropped()  : Graphics
Return a new Graphics object with the cropped contents.
dot()  : mixed
fill()  : mixed
Vul de gehele gd met de meegegeven kleur.
fillRectangle()  : mixed
flipped()  : Graphics
Return a new Graphics object with the contents flipped.
getHeaders()  : mixed
isDocument()  : true
This Component can not be nested inside another Component.
line()  : mixed
rectangle()  : mixed
render()  : mixed
resized()  : Image
Returns a new Graphics object in the given size.
rotated()  : Graphics
Return a new Graphics object in te given rotation.
saveAs()  : mixed
Save the graphic as an image.
saveThumbnail()  : mixed
Create a thumbnail.
setColor()  : mixed
Set the Brush color to the given $color.
setThickness()  : mixed
Set the thickness for line drawing.
colorIndex()  : int
Resolve/Allocate palete index for the given $color.
createCanvas()  : resource
Create a transparent gd resource with full (white) alphachannel.
getAspectRatio()  : float
getHeight()  : int
getWidth()  : int
rasterize()  : resource
Rasterize the layer to an GD resource.
rasterizeTo()  : mixed
Render the graphics to the given $gd resource.
rasterizeTruecolor()  : resource
Rasterize the layer to a truecolor(32bit) GD resource.
color()  : int
Return a color palette index.

Properties

$aspectRatio read-only

public float $aspectRatio

$color

private int $color

The index for the current color, (default: black)

Methods

__call()

Report that the $method doesn't exist.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__callStatic()

Report that the $method doesn't exist.

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__construct()

public __construct(mixed $width, mixed $height[, mixed $bgcolor = 'rgba(255,255,255,0)' ]) : mixed
Parameters
$width : mixed
$height : mixed
$bgcolor : mixed = 'rgba(255,255,255,0)'
Return values
mixed

__destruct()

public __destruct() : mixed
Return values
mixed

__get()

Report that $property doesn't exist.

public __get(string $property) : mixed
Parameters
$property : string
Return values
mixed

__set()

Report that $property doesn't exist and set the property to the given $value.

public __set(string $property, mixed $value) : mixed
Parameters
$property : string
$value : mixed
Return values
mixed

__toString()

The object is used as an string.

public __toString() : string
Return values
string

cropped()

Return a new Graphics object with the cropped contents.

public cropped(int $width, int $height[, int $offsetLeft = null ][, int $offsetTop = null ]) : Graphics

Resizes the canvas, but not the contents.

Parameters
$width : int

The new width

$height : int

The new height

$offsetLeft : int = null

Offset left (null: centered)

$offsetTop : int = null

Offset top (null: centered)

Return values
Graphics

dot()

public dot(mixed $x, mixed $y[, mixed $color = null ]) : mixed
Parameters
$x : mixed
$y : mixed
$color : mixed = null
Return values
mixed

fill()

Vul de gehele gd met de meegegeven kleur.

public fill([string $color = null ]) : mixed
Parameters
$color : string = null

Bv: 'ddeeff'

Return values
mixed

fillRectangle()

public fillRectangle(mixed $x, mixed $y, mixed $width, mixed $height[, mixed $color = null ]) : mixed
Parameters
$x : mixed
$y : mixed
$width : mixed
$height : mixed
$color : mixed = null
Return values
mixed

flipped()

Return a new Graphics object with the contents flipped.

public flipped([enum $mode = 'both' ]) : Graphics
Parameters
$mode : enum = 'both'

"horizontal" left <-> right, "vertical": up ^v down, "both": rotates 180deg

Return values
Graphics

getHeaders()

public getHeaders() : mixed
Return values
mixed

isDocument()

This Component can not be nested inside another Component.

public isDocument() : true
Return values
true

line()

public line(mixed $x1, mixed $y1, mixed $x2, mixed $y2[, mixed $color = null ]) : mixed
Parameters
$x1 : mixed
$y1 : mixed
$x2 : mixed
$y2 : mixed
$color : mixed = null
Return values
mixed

rectangle()

public rectangle(mixed $x, mixed $y, mixed $width, mixed $height[, mixed $color = null ]) : mixed
Parameters
$x : mixed
$y : mixed
$width : mixed
$height : mixed
$color : mixed = null
Return values
mixed

render()

public render() : mixed
Return values
mixed

resized()

Returns a new Graphics object in the given size.

public resized(int $width, int $height) : Image
Parameters
$width : int
$height : int
Return values
Image

rotated()

Return a new Graphics object in te given rotation.

public rotated(float $angle[, string $bgcolor = 'rgba(255,255,255,0)' ]) : Graphics
Parameters
$angle : float
$bgcolor : string = 'rgba(255,255,255,0)'
Return values
Graphics

saveAs()

Save the graphic as an image.

public saveAs(string $filename[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$filename : string
$options : array<string|int, mixed> = []
Return values
mixed

saveThumbnail()

Create a thumbnail.

public saveThumbnail(string $filename, int $width, int $height) : mixed
Parameters
$filename : string
$width : int
$height : int
Return values
mixed

setColor()

Set the Brush color to the given $color.

public setColor(string $color) : mixed
Parameters
$color : string

Allowed syntax: 'red' '#f00' '#ff0000' 'rgb(255, 0, 0)' 'rgba(255, 0, 0, 0.5)'

Return values
mixed

setThickness()

Set the thickness for line drawing.

public setThickness(int $px) : mixed
Parameters
$px : int
Return values
mixed

colorIndex()

Resolve/Allocate palete index for the given $color.

protected colorIndex(string $color[,  $gd = null ]) : int
Parameters
$color : string

Allowed syntax: 'red' '#f00' '#ff0000' 'rgb(255, 0, 0)' 'rgba(255, 0, 0, 0.5)'

$gd : = null

(optional) GD resource

Return values
int

createCanvas()

Create a transparent gd resource with full (white) alphachannel.

protected createCanvas(int $width, int $height[, mixed $bgcolor = 'rgba(255,255,255,0)' ]) : resource
Parameters
$width : int
$height : int
$bgcolor : mixed = 'rgba(255,255,255,0)'
Return values
resource

gd

getAspectRatio()

protected getAspectRatio() : float
Return values
float

Aspect ratio

getHeight()

protected getHeight() : int
Return values
int

Height

getWidth()

protected getWidth() : int
Return values
int

Width

rasterize()

Rasterize the layer to an GD resource.

protected rasterize() : resource

Updates and returns the internal gd resource.

Return values
resource

gd

rasterizeTo()

Render the graphics to the given $gd resource.

protected rasterizeTo(resource $gd, mixed $x, mixed $y) : mixed
Parameters
$gd : resource
$x : mixed
$y : mixed
Return values
mixed

rasterizeTruecolor()

Rasterize the layer to a truecolor(32bit) GD resource.

protected rasterizeTruecolor() : resource

Updates and returns the internal gd resource.

Return values
resource

gd

color()

Return a color palette index.

private color([null|string $color = null ]) : int
Parameters
$color : null|string = null

null: Current color, string: html-color-code

Return values
int

Search results