Codeboard.

Brushes

A brush combines a tip, settings, and optional paper texture. A tip describes the stamped shape; settings control spacing, size, opacity, taper, and dynamics. The Codeboard brush engine paints those stamps along your path.

Customize a preset

import { brushes, customizeBrush, renderBrushSwatch } from 'codeboard-studio';
import { writeFile } from 'node:fs/promises';

const pencil = customizeBrush(brushes.roughPencil, {
  id: 'brush:soft-pencil', name: 'Soft pencil', size: 18,
  opacity: .65, spacing: .15,
  dynamics: { pressureSize: .8, pressureOpacity: .6 },
});
await writeFile('pencil-swatch.png', await renderBrushSwatch(pencil));

Built-in presets are roughPencil, cleanInk, shadeBrush, charcoal, and softEraser. Customize a copy rather than changing a shared definition.

SettingEffect
sizeTip width in canvas units
opacity, flowPaint transparency and accumulation
hardnessTip edge falloff
spacingDistance between stamps, relative to brush size
taperStart, taperEndNarrow the stroke near its ends
tip.rotationModeFixed, path-following, or stylus orientation
texture, textureStrengthProcedural graphite, charcoal, or dry-brush texture
paperTextureA repeating bitmap texture attached to the artwork
dynamicsResponses to pressure, speed, tilt, and rotation jitter

Use brushParameterSchema to inspect and validate the full preset structure. Set an explicit stroke seed when using randomized texture or rotation jitter.

Import a bitmap tip

import { importBrushResource, brushFromResource } from 'codeboard-studio';

const report = await importBrushResource('my-tip.png', {
  maskMode: 'alpha', maxTipSize: 256,
  origin: {
    source: 'My painted tip', author: 'Me',
    license: 'CC0-1.0', redistribution: 'allowed',
  },
});
console.log(report.missingDependencies, report.unsupported, report.warnings);
if (!report.resources.length) throw new Error('No usable tip in this resource');
const brush = brushFromResource(report.resources[0], {
  ...brushes.cleanInk, id: 'brush:painted-tip', name: 'Painted tip', size: 64,
});
await writeFile('tip-swatch.png', await renderBrushSwatch(brush));

Use alpha for transparent PNG tips, or luminance / inverse-luminance to derive a mask from brightness. A bitmap tip uses the stroke's chosen color; it does not paint the original RGB image as a color stamp. maxTipSize controls import resolution, with a maximum of 512 pixels; review any resize warning before using the brush.

External resource support

FormatWhat you can use
PNGBitmap alpha or brightness masks
GBRGIMP v1/v2 grayscale and RGBA tips
GIHIndividual GBR cells; choose the cell to use
ABRSampled 8-bit tips from v1/v2 and v6.1/v6.2
KPPPreset metadata, supported settings, and resolved embedded or linked tips
BUNDLESupported brushes, patterns, and presets inside a Krita resource bundle

Read the import report before painting. Foreign engine behavior is not reproduced automatically. GIH cell-selection behavior, computed ABR tips, and many Photoshop/Krita dynamics are unsupported. A KPP preview image is not used as a brush tip. Missing dependencies remain reported rather than being replaced with a round brush.

Record the actual source and license of resources you import. Only set redistribution: 'allowed' when you have permission to distribute the resource.

Save and reuse a brush

const brushId = project.production.createBrush(brush);
const savedBrush = project.production.brush(brushId);
panel.addRasterLayer('Paint').rasterStroke(points, savedBrush);
project.production.reviseBrush(brushId, { size: 90 });

Saving the project stores its brush definitions and tip data. Revising a library brush affects future strokes; existing strokes keep their recorded brush settings. Use an explicit stroke edit when you want older paint to use a different brush.

On this page