Graphics
extends Base
in package
The Graphics class, the baseclass for all Graphics classes.
Basic graphics operations: resizing, cropping, generating thumbnails, etc. Compatible with the View interface.
Table of Contents
- $aspectRatio : float
- $height : int
- $width : int
- $gd : resource
- __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.
- flipped() : Graphics
- Return a new Graphics object with the contents flipped.
- getHeaders() : mixed
- isDocument() : true
- This Component can not be nested inside another Component.
- 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.
- 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.
Properties
$aspectRatio read-only
public
float
$aspectRatio
$height
public
int
$height
in pixels.
$width
public
int
$width
in pixels.
$gd
protected
resource
$gd
GD
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(resource $gd) : mixed
Parameters
- $gd : resource
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —__get()
Report that $property doesn't exist.
public
__get(mixed $property) : mixed
Parameters
- $property : mixed
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 —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 —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 —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