Complete usage guide, keyboard shortcuts, changelog and FAQ for the Brushes canvas editor
Generated from uploaded source (editor implementation & UI)
References: code snippets used from uploaded `type2(1).html`.

Overview

What this documentation covers

This document explains how to use the Brushes editor: tools, layers, objects (images & text), file workflow, keyboard shortcuts, history/undo, and advanced behaviors (WASM acceleration, object transforms, image insertion/resizing). It also contains a searchable FAQ and changelog.

Implementation notes: the editor uses an HTML canvas as the final output and manages layers as separate off-screen canvases. Image insertion automatically scales images when inserted (see Objects & Images). Features like history/undo store canvas image data and object lists (see history/undo description below). For low-level details, see the source code snippets in the uploaded file. :contentReference[oaicite:3]{index=3}

Quick start

  1. Open the app page that contains the editor (the one with the big canvas).
  2. To create a new document: top toolbar → New or N (Ctrl/Cmd+N also supported). The app creates an initial white background layer automatically. :contentReference[oaicite:4]{index=4}
  3. Use the left toolbox to select a tool (Brush, Pencil, Eraser, Text, Transform, etc.).
  4. Insert an image: toolbar → Insert Image or menu Insert → Image. The editor scales inserted images to fit (scaled to at most 60% of canvas width by default). :contentReference[oaicite:5]{index=5}
  5. Save: toolbar → Save or Ctrl/Cmd+S to export the current canvas as PNG. :contentReference[oaicite:6]{index=6}

Tip: When you insert text you enter an inline text editor that commits on blur or Enter (without shift). :contentReference[oaicite:7]{index=7}

Tools & What they do

Tool list (left toolbox)

  • Brush — pressure-like brush with size/hardness/opacity/flow sliders. Use mouse or stylus to paint. (Brush uses radial gradients to simulate hardness when hardness < 100%.) :contentReference[oaicite:8]{index=8}
  • Pencil — hard-edged stroke (similar control to brush but optimized for pixel-like strokes).
  • Eraser — draws with destination-out to erase pixels or uses WASM eraser if WASM engine is present. :contentReference[oaicite:9]{index=9}
  • Select — rectangular selection; selection bounds are shown and can be committed.
  • Eyedropper — pick a pixel color from the canvas and set it as foreground. :contentReference[oaicite:10]{index=10}
  • Transform — move, rotate, resize objects (images & text). Supports handles, rotation, and snapping to grid.
  • Crop — crop canvas area.
  • Clone — clone stamp (set source point then paint).
  • Healing — sample a source and apply blended heal to target area; supports Alt to re-pick source. :contentReference[oaicite:11]{index=11}
  • Blur / Sharpen / Dodge / Burn — localized filters applied either via JS or through WASM acceleration if enabled. :contentReference[oaicite:12]{index=12}
  • Text — creates text objects editable with an inline textarea; font family, font size, weight, color and alignment controls available. :contentReference[oaicite:13]{index=13}

File operations

New / Open / Save

  • New — resets layers, history and creates the initial white background layer.
  • Open — loads an image file; the canvas is resized to the image size and the image becomes the single loaded layer. When an image is opened the WASM engine (if enabled) is resized to match the new canvas size. :contentReference[oaicite:14]{index=14}
  • Save — exports the composited canvas as PNG (`canvas.toDataURL('image/png')`) and triggers a download. :contentReference[oaicite:15]{index=15}

Layers & History

Layer model

  • Each layer is an off-screen canvas (separate canvas element). Layers have properties: id, name, visible, opacity, blendMode, and locked. The UI lists layers and allows toggling visibility and selecting the current layer. :contentReference[oaicite:16]{index=16}
  • Layer operations: Add, Duplicate, Move Up/Down, Lock, Delete. The app prevents deleting the last (background) layer. :contentReference[oaicite:17]{index=17}

History / Undo / Redo

History entries store imageData for the affected layer and serialized objects list. Clicking history items restores the canvas imageData and object state. Undo/redo adjust history index and reapply stored imageData. :contentReference[oaicite:18]{index=18}

Objects (images & text)

Overview

The editor supports placing objects on top of the layer stack: images and text objects with position, rotation, scale, flip, visible, and other properties. Objects are drawn on the canvas during redraw and are separate from pixels stored in layer canvases. This allows moving/resizing without re-painting pixels. :contentReference[oaicite:19]{index=19}

Insert Image — scaling behavior

When you insert an image (Insert → Image), the editor:

  • Loads the image with FileReader, creates an <img> then measures it.
  • Computes a maximum width as min(canvas.width * 0.6, img.width) and scales image proportionally so it fits comfortably in the canvas. The created object is centered on the canvas and becomes the active object. This is the implemented "image resizing" behavior. :contentReference[oaicite:20]{index=20}

Text objects

Text objects are created by selecting the Text tool and clicking. An inline textarea appears for editing; commit on blur or Enter. Font family/size/weight and color controls are available; the editor loads fonts via document.fonts.load when necessary. :contentReference[oaicite:21]{index=21}

Keyboard shortcuts

Ctrl/Cmd + N — New document
Ctrl/Cmd + O — Open
Ctrl/Cmd + S — Save (export PNG). :contentReference[oaicite:22]{index=22}
Ctrl/Cmd + Z — Undo (Shift to redo). :contentReference[oaicite:23]{index=23}
B — Brush
E — Eraser
I — Eyedropper
V — Transform
M — Select
T — Text
Space — Hold to pan (press/hold to grab canvas)
Arrow keys — Nudge selected object (Shift for larger step)

Changelog

  • [Latest] Added image resizing on insert — inserted images now scale to at most 60% of canvas width and are centered automatically. (This is the "added image resizing" entry you asked for.) :contentReference[oaicite:24]{index=24}
  • Feature: WASM engine support detected at startup — when available, brush/eraser/filters can call into the WasmEngine for faster operations. :contentReference[oaicite:25]{index=25}
  • UX: inline text editor for editing text objects with font loading support.
  • Fix: save/export uses canvas.toDataURL('image/png') and triggers download reliably. :contentReference[oaicite:26]{index=26}

Frequently Asked Questions (FAQ)

Q: How do I export a PNG of my work?
A: Use the Save button in the toolbar or press Ctrl/Cmd + S. The editor uses the main canvas' data URL and triggers a file download. :contentReference[oaicite:27]{index=27}
Q: How does image insertion size get computed?
A: Inserted images are scaled proportionally so their width is at most 60% of the canvas width (or less if the image is smaller), and they are centered. This prevents huge imported images from overflowing the view. :contentReference[oaicite:28]{index=28}
Q: Can I undo multiple steps?
A: Yes — every significant change saves a history entry with imageData and objects. Use Undo/Redo from the Edit menu or keyboard shortcuts. Clicking a history item will restore that state. :contentReference[oaicite:29]{index=29}
Q: Does the editor support pressure/stylus?
A: The core brush uses size/hardness/opacity controls. If you have a pointer/stylus device the browser may supply pressure data — the current engine does not explicitly show pressure mapping code in the uploaded file; it would be straightforward to map pointer.pressure to brush size/alpha in the input handlers.
Q: What happens if the WASM engine is not available?
A: The editor falls back to pure JavaScript implementations for brush strokes, filters and healing — the fallback code is included and works without WASM. If WasmEngine is available it attempts initialization at startup and uses it for expensive ops. :contentReference[oaicite:30]{index=30}
Q: Can I copy/paste objects?
A: Yes — objects can be serialized into a clipboard and pasted back — images keep a source if present, text becomes text objects. There's a copy/paste object clipboard in the runtime. :contentReference[oaicite:31]{index=31}
Q: My inserted image is too big/small — can I resize it?
A: Yes. After insertion the image becomes an object. Use the Transform tool to drag handles and resize; hold Snap toggle for snapping to grid. Rotations and flips are supported. Resizing modifies object properties not pixels, so you can resize without losing quality. :contentReference[oaicite:32]{index=32}
Q: How can I use custom fonts with text objects?
A: Choose font family and weight from the text controls. The editor calls document.fonts.load() to ensure the font is available prior to measuring/drawing text. If a font isn't loaded, the editor falls back to system fonts. :contentReference[oaicite:33]{index=33}
Q: Where are the brush settings located?
A: Brush settings (Size, Hardness, Opacity, Flow) live in the properties panel on the left. Adjust them while painting to change stroke characteristics. :contentReference[oaicite:34]{index=34}
If your question isn't in this FAQ, use the search box above to find relevant documentation and examples.