Types
Common Lens types
Color
type Color = readonly [number, number, number, number];
Color type.
Array of 4 elements representing color channel values: [red, green, blue, alpha]
Each channel value must be in range [0; QuantumRange], where QuantumRange
is maximal channel value, which depends on color depth and generally equals 255
for 8 bits per channel color depth, unless underlying image interface supports bigger values. Alpha channel equals 0 for completely transparent color and QuantumRange
(255 for 8 bits per channel) for fully opaque color.
Point
type Point = [number, number];
Tuple of X and Y coordinates.
ViewportLiteral
type ViewportLiteral =
| { x1: number; y1: number; x2: number; y2: number }
| { width: number; height: number; x?: number; y?: number };
Describes image virtual viewport. Used only for creating Viewport
class instance.
Can be defined in two forms:
{x1, y1, x2, y2}
, wherex1
,x2
are coordinates of top-left apex image pixel, andx2
,y2
are coordinates of bottom-right apex image pixel.{width, height, x?, y?}
, wherewidth
,height
are image viewport width and height, andx
,y
are optional origin offset coordinates.
INFO
Virtual viewport coordinates and image pixel coordinates are not the same. Image pixel coordinates always are:
See Virtual Viewport