API Reference¶
Comprehensive lookup reference for PyFreeform's public API. Organized to follow the natural flow -- from creating a canvas to building complex generative art.
How to use this reference
This section is designed as a lookup reference. For learning-oriented walkthroughs with visual examples, see the Guide. For copy-paste starting points, see Recipes.
| Page | Covers |
|---|---|
| Scene | Creating your canvas -- constructors, properties, rendering, saving |
| Grid & Cells | Dividing the canvas -- grid structure, cell access, image data, neighbors |
| Drawing | Putting things on the canvas -- the 12 builder methods, positioning, along/t/align |
| Entities | What you draw -- Dot, Line, Curve, Ellipse, Polygon, Rect, Text, Path, EntityGroup, Point |
| Connections & Paths | Linking things together -- Connection class, Pathable protocol, built-in path shapes |
| Transforms | Rotating, scaling, fitting -- rotate(), scale(), fit_to_surface(), fit_within() |
| Styling & Caps | Making it beautiful -- colors, opacity, style classes, palettes, cap system |
| Types & Utilities | Building blocks -- Coord, RelCoord, AnchorSpec, Image, utility functions |
Relationship Map¶
Key Design Principles¶
- Surface protocol: Cell, Scene, CellGroup all share identical
add_*methods - Pathable protocol: Position anything along anything with
along/t fill=vscolor=: Shapes usefill, everything else usescolor- Immutable styles: Style classes with
.with_*()builder methods - z_index layering: Higher values render on top, same values preserve add-order
- Everything returns self: Transform methods chain:
entity.rotate(45).scale(0.5)