Image Brushes
Fuderu can use a transparent image or canvas as the brush stamp. Pixels with content become the brush shape, and Fuderu recolors the stamp using the active brush color.
Image brush demo
Load a stamp image and paint with image-based brush shapes directly in the docs.
Loading demo…
No image loaded
await painter.loadImage("/brushes/star.png");
painter.loadConfig({
color: "#f97316",
size: 36,
});
With a standalone brush:
await brush.loadImageAsync("/brushes/leaf.png");
Supported Sources
Brush.loadImage accepts:
HTMLImageElementHTMLCanvasElement- image URL string
Canvas.loadImage returns a promise and delegates to the underlying brush.
Rotation
Image brushes are most expressive when paired with rotation:
painter.loadConfig({
rotation: {
mode: "flow",
smoothing: 0.15,
offset: 0,
},
});
Available rotation modes:
fixed: userotation.offsetas the stamp angle. Omitrotationto use the brush'sanglefield instead.flow: rotate stamps along the stroke direction.random: choose randomized stamp rotation.
Removing The Image
painter.brush.removeImage();
After removing the image, the brush returns to the default ellipse stamp.