How rough-stuff/rough works
Main Components
a) Core Engine Layer:
• Core.ts, math.ts, and geometry.ts as fundamental components
• These handle the basic calculations and geometric operations
b) Rendering Layer:
• Split into two parallel branches:
• Canvas Renderer (canvas.ts)
• SVG Renderer (svg.ts)
• Both to the core engine
c) Filler System:
• Inheritance hierarchy from filler-interface.ts
• Filler types:
• Hachure
• Dots
• ZigZag
• etc.
d) Generator Layer:
• Generator.ts as an intermediary between core and renderers
• How it processes drawing operations
Component Relationships
User Input -> Generator -> Core Engine -> Fillers -> Renderers -> Output (Canvas/SVG)
Specific Implementation Details
• Drawing Types |
• Lines |
• Curves |
• Rectangles |
• Circles |
• Paths |
• Polygons |
Architecture Patterns
Highlight:
• Strategy Pattern (for different fillers)
• Factory Pattern (for renderer creation)
• Bridge Pattern (between core and renderers)
• Input | | Core Engine | | Renderers |
• (API Calls) | --> | (Geometry/Math)| --> | (Canvas/SVG)|
• Fillers |
• (Fill Styles) |
Additional Elements
Include:
• Version information
• External dependencies
• Build/Bundle information
• Performance considerations