Drawing Tools & Brush Styles
PinePaper’s drawing system provides 15 tools across natural media, craft shapes, precision utilities, and spatial human-AI co-creation.
Activating Drawing Mode
app.setBackgroundMode('drawing');
Drawing Tools (DrawingToolManager)
| Tool | Description | Category |
|---|---|---|
pen |
Smooth freehand vector strokes with optional pressure width profile | Natural media |
pencil |
Graphite pencil with pressure + stylus tilt (altitudeAngle) shading |
Natural media |
ink |
Variable-width calligraphic ink ribbon | Natural media |
marker |
Semi-transparent flat highlighter with multiply blend |
Natural media |
charcoal |
Grainy paper-tooth ribbon with dry edge flecks | Natural media |
spray |
Diffused dot spray controlled by radius and density | Natural media |
watercolor |
Seeded capillary wash with granulation and wet-edge pooling | Natural media |
oil |
Opaque directional bristle impasto with tonal range and relief | Natural media |
gouache |
High-coverage matte pigment body with dry-brush split tail | Natural media |
cutout |
Freehand closed Matisse-style cut-paper shape with optional drop shadow | Craft |
stitch |
Freehand embroidery along spine (running, stem, satin, cross presets) |
Craft |
eraser |
Curve-aware partial vector spine-splitting (mode: 'partial' | 'whole') |
Utility |
fill |
3-stage flood fill with morphological barrier gapClose |
Utility |
eyedropper |
Samples canvas fill/stroke color and returns to prior brush | Utility |
ai_guide |
Non-printing dashed pp:GuideRegion / curve with inline AI prompt |
Co-creation |
Configuration
setDrawColor(color)
Set the current drawing color.
Parameters:
color(string): CSS color value (hex, rgb, named)
app.setDrawColor('#ef4444');
getDrawColor()
Get the current drawing color.
Returns: string
const color = app.getDrawColor();
setDrawWidth(width)
Set the current brush width.
Parameters:
width(number): Stroke width in pixels
app.setDrawWidth(5);
getDrawWidth()
Get the current brush width.
Returns: number
const width = app.getDrawWidth();
Background Mode
getBackgroundMode()
Get the current background mode.
Returns: string - 'drawing', 'generator', or 'none'
const mode = app.getBackgroundMode();
setBackgroundMode(mode)
Switch between background modes.
Parameters:
mode(string):'drawing','generator', or'none'
app.setBackgroundMode('drawing');
Freehand Drawing
startFreehand(point)
Begin a freehand stroke at the given point. Used internally by the drawing tool handlers.
Parameters:
point(paper.Point): Starting point
app.startFreehand(new paper.Point(100, 100));
endFreehand()
Complete the current freehand stroke.
app.endFreehand();
Cleanup
clearDrawings()
Remove all freehand drawings from the canvas.
app.clearDrawings();
Fill Tool
The fill tool uses 3-stage detection:
- Stroke detection — If the click point hits an existing stroke, fill that stroke with the current color
- Path containment — If the click point is inside a closed path, fill that path
- Canvas background — If no stroke or path is hit, fill the entire canvas background
// Fill tool is activated via the drawing toolbar
// Detection happens automatically on click
Programmatic & Co-Creation APIs
app.paintStroke(spec)
Paint an artistic brush stroke programmatically (also exposed to agents via pinepaper_paint_stroke).
app.paintStroke({
medium: 'watercolor', // pen | pencil | ink | marker | charcoal | watercolor | oil | gouache | cutout | stitch
points: [{ x: 140, y: 220, pressure: 0.5 }, { x: 240, y: 195, pressure: 0.8 }, { x: 340, y: 230, pressure: 0.4 }],
color: '#3b82f6',
width: 24,
opacity: 0.6,
preset: 'satin', // stitch preset: running | stem | satin | cross
guideId: 'item_12', // optional pp:GuideRegion id being fulfilled
resolveGuide: true, // remove the fulfilled guide region in the same undo step
});
app.createGuideRegion(points, opts) & app.resolveGuideRegion(guideId)
Create or resolve non-printing pp:GuideRegion areas or curves (data.isGuide = true), excluded from all image/vector/video exports.
const guide = app.createGuideRegion(
[{ x: 120, y: 120 }, { x: 260, y: 120 }, { x: 260, y: 220 }, { x: 122, y: 122 }],
{ prompt: 'Add shading along the ridge' }
);
// Once painted:
app.resolveGuideRegion(guide);
app.toggleUnderdrawing(targets)
Toggle non-printing 25% cornflower-blue pp:Underdrawing construction state on target items or the current selection (data.isUnderdrawing = true).
app.toggleUnderdrawing();
Stylus Stabilization & Symmetry Parameters
Configure input pipeline and mirror symmetry via app.drawingToolManager:
app.drawingToolManager.setAssistConfig({
streamline: 0.35, // 0..1 pulled-string tether strength
quickShape: true, // hold-to-snap line/arc/circle/ellipse/triangle/rectangle
symmetry: 'radial6', // 'off' | 'vertical' | 'horizontal' | 'quad' | 'radial6' | 'radial8'
pencilOnly: 'auto', // 'auto' | 'on' | 'off' palm rejection mode
});
Stroke Properties Reference
| Property | Values | Description |
|---|---|---|
strokeCap |
'round', 'square', 'butt' |
Line end style |
strokeJoin |
'round', 'miter', 'bevel' |
Corner style |
dashArray |
[dash, gap] |
Dashed line pattern |
Custom Brush Examples
Calligraphy Brush
const path = new paper.Path();
path.strokeColor = 'black';
path.strokeWidth = 3;
path.strokeCap = 'butt';
Highlighter
const path = new paper.Path();
path.strokeColor = new paper.Color(1, 1, 0, 0.5);
path.strokeWidth = 20;
path.strokeCap = 'round';
path.blendMode = 'multiply';
Dotted/Stipple
const path = new paper.Path();
path.strokeColor = 'blue';
path.dashArray = [2, 8];