Types & Enums
Auto-generated from
bridge/src/js/prelude/src/on 2026-05-21. Runtask gen:api-referenceto refresh.
Numeric enums (BlendMode, Interp, BorderMode, AlphaMode, WarpBorder) and shared type aliases (Color, PadColor, Rect, ImageDims). The interfaces here describe handles owned by the Rust engine; the public API for them lives in the Image API page.
Classes
Blend
Constructors
Constructor
new Blend(): Blend;
Returns
Properties
| Property | Modifier | Type | Default value |
|---|---|---|---|
ColorBurn |
readonly |
7 |
BlendMode.ColorBurn |
ColorDodge |
readonly |
6 |
BlendMode.ColorDodge |
Difference |
readonly |
8 |
BlendMode.Difference |
Exclusion |
readonly |
9 |
BlendMode.Exclusion |
HardLight |
readonly |
5 |
BlendMode.HardLight |
Multiply |
readonly |
2 |
BlendMode.Multiply |
Normal |
readonly |
0 |
BlendMode.Normal |
Over |
readonly |
10 |
BlendMode.Over |
Overlay |
readonly |
3 |
BlendMode.Overlay |
Screen |
readonly |
1 |
BlendMode.Screen |
SoftLight |
readonly |
4 |
BlendMode.SoftLight |
Variables
AlphaMode
const AlphaMode: object;
Alpha adjustment mode for adjustAlpha().
Type Declaration
| Name | Type | Default value | Description |
|---|---|---|---|
Add |
2 |
2 |
Add value to alpha, clamped to [0..1]. |
Mul |
1 |
1 |
Multiply alpha by value (0 = transparent, 1 = unchanged). |
Set |
0 |
0 |
Set alpha directly to value. |
BlendMode
const BlendMode: object;
Blend mode for blend() and blendAt().
Type Declaration
| Name | Type | Default value | Description |
|---|---|---|---|
ColorBurn |
7 |
7 |
Color burn |
ColorDodge |
6 |
6 |
Color dodge |
Difference |
8 |
8 |
Difference |
Exclusion |
9 |
9 |
Exclusion |
HardLight |
5 |
5 |
Hard light |
Multiply |
2 |
2 |
Multiply blend: a * b |
Normal |
0 |
0 |
Weighted average: result = self * (1 - factor) + other * factor |
Over |
10 |
10 |
Porter-Duff "Over" — alpha-aware compositing (fg over bg). factor acts as overall opacity. |
Overlay |
3 |
3 |
Overlay blend: combines Multiply and Screen |
Screen |
1 |
1 |
Screen blend: 1 - (1-a)(1-b) |
SoftLight |
4 |
4 |
Soft light |
BorderMode
const BorderMode: object;
Pixel border mode for pad().
Type Declaration
| Name | Type | Default value | Description |
|---|---|---|---|
Constant |
0 |
0 |
Fill border with a constant color. |
Reflect |
1 |
1 |
Reflect pixels at the edge. |
Replicate |
3 |
3 |
Replicate edge pixels. |
Wrap |
2 |
2 |
Wrap pixels (tile). |
Interp
const Interp: object;
Interpolation method used in resize, rotate, and warp operations.
Type Declaration
| Name | Type | Default value | Description |
|---|---|---|---|
Bicubic |
2 |
2 |
Bicubic — highest quality, slower. |
Bilinear |
1 |
1 |
Bilinear — smooth, good general-purpose default. |
Nearest |
0 |
0 |
Nearest-neighbor — fastest, pixelated at large scales. |
WarpBorder
const WarpBorder: object;
Out-of-bounds fill mode for warpGrid().
Type Declaration
| Name | Type | Default value | Description |
|---|---|---|---|
Clamp |
0 |
0 |
Clamp UV to [0,1] — samples the nearest edge pixel. |
Transparent |
1 |
1 |
Return fully transparent (RGBA 0,0,0,0) for out-of-bounds UV. |
Type Aliases
AlphaMode
type AlphaMode = typeof AlphaMode[keyof typeof AlphaMode];
Alpha adjustment mode for adjustAlpha().
BlendMode
type BlendMode = typeof BlendMode[keyof typeof BlendMode];
Blend mode for blend() and blendAt().
BorderMode
type BorderMode = typeof BorderMode[keyof typeof BorderMode];
Pixel border mode for pad().
Color
type Color = Pixel | string;
A color value accepted by image and canvas operations.
Pixel— direct RGBA color with components ∈ [0..1]string— CSS hex string, e.g."#rrggbb"or"#rrggbbaa"
Interp
type Interp = typeof Interp[keyof typeof Interp];
Interpolation method used in resize, rotate, and warp operations.
PadColor
type PadColor = Color | BorderMode;
A pad/border color value accepted by pad(), padLeft(), etc.
Color(Pixel or hex string) — fill colorBorderMode(number) — Reflect / Wrap / Replicate (no fill color used)
Rect
type Rect = [number, number, number, number];
Normalized rectangle [x, y, w, h] with all values ∈ [0..1] relative to image dimensions.
Use ImageHandle.rectFromPixels(), rectFromCenter(), or rectFull() to construct one.
WarpBorder
type WarpBorder = typeof WarpBorder[keyof typeof WarpBorder];
Out-of-bounds fill mode for warpGrid().
Interfaces
DetectFacesOptions
Options for Engine.detectFaces() — forwarded to the underlying
facedetect-detect tool plugin. All optional; sensible defaults
keep the call site clean for the common case.
Properties
| Property | Type | Description |
|---|---|---|
minSize? |
number |
Minimum face size in pixels (square side). Default: 60. |
scoreThreshold? |
number |
Minimum Pico Q-score. Default: 30. Lower → more (noisier) hits. |
FaceDetection
One face detected by Engine.detectFaces(). Coordinates are in
pixels, the bounding box is square (Pico cascades only emit square
regions), and confidence is the Pico Q-score — values above ~30
are confident detections, below ~10 are likely noise.
Properties
| Property | Type | Description |
|---|---|---|
confidence |
number |
Pico Q-score: ~5 = noisy, ~30+ = confident. |
height |
number |
Side length in pixels (boxes are square). |
width |
number |
Side length in pixels (boxes are square). |
x |
number |
Top-left x in pixels. |
y |
number |
Top-left y in pixels. |
ImageDims
Image dimensions returned by Engine.handleDims().
Properties
| Property | Modifier | Type |
|---|---|---|
height |
readonly |
number |
width |
readonly |
number |
LmsStats
Per-channel mean and standard deviation in log-LMS colour space —
the form Reinhard color transfer reads. Returned by
Engine.colorStats(); consumed by img.colorTransfer().
Values are not particularly meaningful on their own; treat the struct as an opaque token you can cache and re-apply across many targets that all need to match the same reference look.
Properties
| Property | Type | Description |
|---|---|---|
mean |
[number, number, number] |
[L̄, M̄, S̄] in log-LMS. |
std |
[number, number, number] |
[σ_L, σ_M, σ_S] in log-LMS. |
SVGOptions
Options for ImageHandle.toSVG(). All fields are optional — omitted fields
use the defaults shown below.
Properties
| Property | Type | Description |
|---|---|---|
colorCount? |
number |
Max color clusters. Default: 16 |
colorMode? |
"color" | "binary" |
Color tracing mode. Default: "color" |
colorPrecision? |
number |
CIEDE2000 color clustering precision. Default: 6 |
cornerThreshold? |
number |
Corner detection angle in degrees. Default: 60 |
filterSpeckle? |
number |
Discard regions smaller than N pixels. Default: 4 |
gradientStep? |
number |
Gradient quantization step. Default: 16 |
hierarchical? |
"stacked" | "cutout" |
Layer composition mode. Default: "stacked" |
lengthThreshold? |
number |
Minimum segment length. Default: 4.0 |
maxIterations? |
number |
Path optimization iterations. Default: 10 |
pathPrecision? |
number |
SVG coordinate decimal precision. Default: 8 |
pathSimplify? |
"none" | "polygon" | "spline" |
Path smoothing mode. Default: "spline" |
spliceThreshold? |
number |
Splice angle threshold in degrees. Default: 45 |