\BaconQrCode\Renderer\ImageImageBackEndInterface

Interface for back ends able to to produce path based images.

Summary

Methods
Constants
new()
scale()
translate()
rotate()
push()
pop()
drawPathWithColor()
drawPathWithGradient()
done()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

new()

new(int  $size, \BaconQrCode\Renderer\Color\ColorInterface  $backgroundColor) : void

Starts a new image.

If a previous image was already started, previous data get erased.

Parameters

int $size
\BaconQrCode\Renderer\Color\ColorInterface $backgroundColor

scale()

scale(float  $size) : void

Transforms all following drawing operation coordinates by scaling them by a given factor.

Parameters

float $size

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

translate()

translate(float  $x, float  $y) : void

Transforms all following drawing operation coordinates by translating them by a given amount.

Parameters

float $x
float $y

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

rotate()

rotate(int  $degrees) : void

Transforms all following drawing operation coordinates by rotating them by a given amount.

Parameters

int $degrees

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

push()

push() : void

Pushes the current coordinate transformation onto a stack.

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

pop()

pop() : void

Pops the last coordinate transformation from a stack.

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

drawPathWithColor()

drawPathWithColor(\BaconQrCode\Renderer\Path\Path  $path, \BaconQrCode\Renderer\Color\ColorInterface  $color) : void

Draws a path with a given color.

Parameters

\BaconQrCode\Renderer\Path\Path $path
\BaconQrCode\Renderer\Color\ColorInterface $color

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

drawPathWithGradient()

drawPathWithGradient(\BaconQrCode\Renderer\Path\Path  $path, \BaconQrCode\Renderer\RendererStyle\Gradient  $gradient, float  $x, float  $y, float  $width, float  $height) : void

Draws a path with a given gradient which spans the box described by the position and size.

Parameters

\BaconQrCode\Renderer\Path\Path $path
\BaconQrCode\Renderer\RendererStyle\Gradient $gradient
float $x
float $y
float $width
float $height

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

done()

done() : string

Ends the image drawing operation and returns the resulting blob.

This should reset the state of the back end and thus this method should only be callable once per image.

Throws

\BaconQrCode\Exception\RuntimeException

if no image was started yet.

Returns

string —