Skip to main content

Interface: BrushConfig

Defined in: src/lib/brushes/types/index.ts:124

A brush's settings: what a brush preset holds (its content), and what the brush engine draws with

Properties​

alpha?​

optional alpha?: number

Defined in: src/lib/brushes/types/index.ts:181

Initial alpha value (0–1)

Default​

1

alphaConfig?​

optional alphaConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:183

How alpha varies per stamp (scale; see BrushParamConfig)


blue?​

optional blue?: string | number

Defined in: src/lib/brushes/types/index.ts:174

Initial colour blue value (0–255)

Default​

0

blueConfig?​

optional blueConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:176

How blue varies per stamp (scale; see BrushParamConfig)


colourMode?​

optional colourMode?: ColourMode

Defined in: src/lib/brushes/types/index.ts:134

Brush colour mode affects how colour settings are applied.

Default​

ColourMode.HSL

constrainProportions?​

optional constrainProportions?: boolean

Defined in: src/lib/brushes/types/index.ts:199

Keep the width-to-height ratio when the size changes


green?​

optional green?: string | number

Defined in: src/lib/brushes/types/index.ts:167

Initial colour green value (0–255)

Default​

0

greenConfig?​

optional greenConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:169

How green varies per stamp (scale; see BrushParamConfig)


height?​

optional height?: number

Defined in: src/lib/brushes/types/index.ts:195

Default height in pixels (the user can change it from 1 to 256)

Default​

1

heightConfig?​

optional heightConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:197

How height varies per stamp (scale; see BrushParamConfig)


hue?​

optional hue?: string | number

Defined in: src/lib/brushes/types/index.ts:139

Initial colour hue value (0–359)

Default​

0

hueConfig?​

optional hueConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:141

How hue varies per stamp (angle: adds up to 360°; see BrushParamConfig)


image?​

optional image?: string | Uint8Array<ArrayBufferLike>

Defined in: src/lib/brushes/types/index.ts:129

Brush shape: an image whose alpha values define the shape (its colours are ignored). A data URL string, or raw image file bytes. Defaults to a hard round shape.


lightness?​

optional lightness?: string | number

Defined in: src/lib/brushes/types/index.ts:153

Initial colour lightness value (0–100)

Default​

50

lightnessConfig?​

optional lightnessConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:155

How lightness varies per stamp (scale; see BrushParamConfig)


offsetX?​

optional offsetX?: number

Defined in: src/lib/brushes/types/index.ts:216

Horizontal offset of each stamp from the pointer, in pixels

Default​

0

offsetXConfig?​

optional offsetXConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:218

How offsetX varies per stamp (offset: scatters up to the factor × brush width either way; see BrushParamConfig)


offsetY?​

optional offsetY?: number

Defined in: src/lib/brushes/types/index.ts:223

Vertical offset of each stamp from the pointer, in pixels

Default​

0

offsetYConfig?​

optional offsetYConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:225

How offsetY varies per stamp (offset: scatters up to the factor × brush height either way; see BrushParamConfig)


red?​

optional red?: string | number

Defined in: src/lib/brushes/types/index.ts:160

Initial colour red value (0–255)

Default​

0

redConfig?​

optional redConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:162

How red varies per stamp (scale; see BrushParamConfig)


rotation?​

optional rotation?: number

Defined in: src/lib/brushes/types/index.ts:204

Rotation in degrees

Default​

0

rotationConfig?​

optional rotationConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:206

How rotation varies per stamp (angle; see BrushParamConfig)


rotationFollowsLean?​

optional rotationFollowsLean?: boolean

Defined in: src/lib/brushes/types/index.ts:211

Turn each stamp to the direction the pen leans (like a calligraphy nib), adding any variation from rotationConfig

Default​

false

sampleRate?​

optional sampleRate?: number

Defined in: src/lib/brushes/types/index.ts:231

How often (in milliseconds, 5–400) a new point is recorded while the pointer moves. Higher values record fewer points. No points are recorded while the pointer is still.

Default​

10

saturation?​

optional saturation?: string | number

Defined in: src/lib/brushes/types/index.ts:146

Initial colour saturation value (0–100)

Default​

100

saturationConfig?​

optional saturationConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:148

How saturation varies per stamp (scale; see BrushParamConfig)


smoothingType?​

optional smoothingType?: SmoothingType

Defined in: src/lib/brushes/types/index.ts:236

How the line between recorded points is drawn

Default​

SmoothingType.Linear

snapToPixelGrid?​

optional snapToPixelGrid?: boolean

Defined in: src/lib/brushes/types/index.ts:247

Draw each stamp on whole pixels: its size is rounded to whole pixels and its top-left corner is rounded down (Math.floor), so it never covers part of a pixel. Rotation other than a multiple of 90° still leaves the grid.

Default​

false

spacing?​

optional spacing?: number

Defined in: src/lib/brushes/types/index.ts:241

Distance in pixels (0–200) between stamps of the brush shape along the line. 0 stamps at every pixel.

Default​

5

width?​

optional width?: number

Defined in: src/lib/brushes/types/index.ts:188

Default width in pixels (the user can change it from 1 to 256)

Default​

1

widthConfig?​

optional widthConfig?: BrushParamConfig

Defined in: src/lib/brushes/types/index.ts:190

How width varies per stamp (scale; see BrushParamConfig)