Mark
in package
A mark drawn on a page as a vector path: a tick, a cross, a dot, a line, a rectangle or an ellipse. For ticking a box, striking something out or drawing a box around it on a form.
$signer->mark(new Mark(Mark::TICK), page: 1, x: 72, y: 300, width: 14, height: 14);
It fills a rectangle on the page the way a signature does; a line runs corner to corner, so a flat rectangle makes a straight line.
Table of Contents
Constants
- CROSS : mixed = 'cross'
- DOT : mixed = 'dot'
- ELLIPSE : mixed = 'ellipse'
- LINE_DOWN : mixed = 'line-down'
- A line from the top-left corner to the bottom-right.
- LINE_UP : mixed = 'line-up'
- A line from the bottom-left corner to the top-right.
- RECTANGLE : mixed = 'rectangle'
- TICK : mixed = 'tick'
- KAPPA : mixed = 0.5522847498307936
- How far a Bézier handle reaches for a quarter of a circle of radius 1.
Properties
Methods
- __construct() : mixed
- operators() : string
- The content-stream operators that draw the mark where a `cm` matrix would draw an image.
- rgb() : array{float, float, float}
- A colour written as six hexadecimal digits, like `b3141c` or `#b3141c`, as red, green and blue from 0 to 1.
- strokeWidth() : float
- How thick a mark's lines are, in points: 1.5, except that a tick or cross grows bolder with its size, at an eighth of its smaller side.
-
shape()
: array{paint: string, join: int, path: list
}>}|null - A shape as a path in the unit square, y upward from its bottom-left corner, which is how a placement matrix maps an image; `paint` is S to stroke it or f to fill it, and `join` the line join, round unless the corners should be sharp.
Constants
CROSS
public
mixed
CROSS
= 'cross'
DOT
public
mixed
DOT
= 'dot'
ELLIPSE
public
mixed
ELLIPSE
= 'ellipse'
LINE_DOWN
A line from the top-left corner to the bottom-right.
public
mixed
LINE_DOWN
= 'line-down'
LINE_UP
A line from the bottom-left corner to the top-right.
public
mixed
LINE_UP
= 'line-up'
RECTANGLE
public
mixed
RECTANGLE
= 'rectangle'
TICK
public
mixed
TICK
= 'tick'
KAPPA
How far a Bézier handle reaches for a quarter of a circle of radius 1.
private
mixed
KAPPA
= 0.5522847498307936
Properties
$color read-only
public
array<string|int, mixed>
$color
= [0, 0, 0]
$shape read-only
public
string
$shape
Methods
__construct()
public
__construct(string $shape[, array{float, float, float} $color = [0, 0, 0] ]) : mixed
Parameters
- $shape : string
-
One of the shape constants.
- $color : array{float, float, float} = [0, 0, 0]
-
Red, green and blue, each from 0 to 1.
Tags
operators()
The content-stream operators that draw the mark where a `cm` matrix would draw an image.
public
operators(array{float, float, float, float, float, float} $matrix) : string
The path is worked out in the page's own space rather than drawn under the matrix, so a line keeps its thickness however the mark is stretched, even flat.
Parameters
- $matrix : array{float, float, float, float, float, float}
-
The
cmoperator's a b c d e f.
Return values
stringrgb()
A colour written as six hexadecimal digits, like `b3141c` or `#b3141c`, as red, green and blue from 0 to 1.
public
static rgb(string $hex) : array{float, float, float}
Parameters
- $hex : string
-
The colour.
Tags
Return values
array{float, float, float}strokeWidth()
How thick a mark's lines are, in points: 1.5, except that a tick or cross grows bolder with its size, at an eighth of its smaller side.
public
static strokeWidth(string $shape, float $width, float $height) : float
Parameters
- $shape : string
-
One of the shape constants.
- $width : float
-
The mark's width, in points.
- $height : float
-
Its height.
Return values
floatshape()
A shape as a path in the unit square, y upward from its bottom-left corner, which is how a placement matrix maps an image; `paint` is S to stroke it or f to fill it, and `join` the line join, round unless the corners should be sharp.
private
static shape(string $shape) : array{paint: string, join: int, path: list}>}|null
Parameters
- $shape : string