Problem
The current drawing engine uses a raster scanline approach:
- Template is a 150×N PNG
- Black pixels are drawn one-by-one in horizontal sweeps
- Every black pixel becomes an individual drag gesture
This works but has limitations:
- Lines are composed of tiny horizontal dashes (
--mode tiny) or jagged row swipes (--mode strokes)
- Curves and diagonals look pixelated — like a dot matrix printer
- No concept of "draw this line from A to B" — only "fill these grid cells"
- Complex designs create thousands of drags, making drawing slow
Proposed Solution
A vector tracing mode that accepts SVG (or similar vector format) and traces the actual paths:
python draw.py logo.svg --mode vector
How it would work
- Parse SVG paths → polylines (sequence of points)
- Map each point to screen coordinates via the calibrated boundary
- Trace each path with a single continuous CGEvent drag
- Hatch fill — for filled shapes, trace the outline then fill with diagonal hatch lines
Modes within vector mode
--mode vector-outline — trace only the outlines of shapes. Clean, sharp, fast.
--mode vector-fill — trace outlines + fill with evenly spaced hatch lines. Gives the filled look without thousands of individual drags.
--mode vector-hatch — fill shapes with parallel lines at configurable angle/spacing (--hatch-angle 45 --hatch-spacing 8)
Benefits
- Sharper — continuous drags along actual curves, not stair-stepped approximations
- Faster — a circle is 1 stroke instead of hundreds of pixel drags
- Smaller input — SVG files are tiny compared to 150×N PNGs
- Fill support — hatching gives the illusion of filled areas without needing every pixel
- Portable — same SVG works for both RevoDraw and CashDraw once implemented
Implementation Sketch
def extract_vector_paths(svg_path: str, boundary: dict, cols: int, rows: int):
"""Parse SVG, return list of screen-coordinate polylines."""
# Use svg.path or similar library
# Convert bezier curves to polyline approximations
# Map to screen coords
return paths # list of [(x1,y1), (x2,y2), ...]
def draw_vector_paths(paths, mode="outline", hatch_spacing=8, hatch_angle=45):
"""Trace each path with CGEvent drag."""
for path in paths:
for i in range(len(path) - 1):
cg_drag(path[i][0], path[i][1], path[i+1][0], path[i+1][1])
if mode == "fill":
# generate and trace hatch lines
...
Prior Art
- vpype — Python vector processing for plotters
- svg.path — SVG path parsing
- Plotter-like hatching algorithms (widely documented)
Dependencies to evaluate
svg.path or svgpathtools — path parsing
shapely — polygon operations for hatch fill
- Or keep it simple: require pre-processed polylines in a JSON format
Once proven on RevoDraw
Port the vector engine to cashapp-draw-ios.
Problem
The current drawing engine uses a raster scanline approach:
This works but has limitations:
--mode tiny) or jagged row swipes (--mode strokes)Proposed Solution
A vector tracing mode that accepts SVG (or similar vector format) and traces the actual paths:
How it would work
Modes within vector mode
--mode vector-outline— trace only the outlines of shapes. Clean, sharp, fast.--mode vector-fill— trace outlines + fill with evenly spaced hatch lines. Gives the filled look without thousands of individual drags.--mode vector-hatch— fill shapes with parallel lines at configurable angle/spacing (--hatch-angle 45 --hatch-spacing 8)Benefits
Implementation Sketch
Prior Art
Dependencies to evaluate
svg.pathorsvgpathtools— path parsingshapely— polygon operations for hatch fillOnce proven on RevoDraw
Port the vector engine to cashapp-draw-ios.