Skip to content

Canvas & Context

Taco de Wolff edited this page Apr 7, 2021 · 6 revisions

The library specifies two main structures for handling drawing. One is Canvas and the other is Context. We can think of the first as the drawing target and the second as the drawer. That is, Context will keep a context of drawing parameters and a set of functions to perform drawing operations and keep a state (such as color, position, ...). It will draw to a Renderer interface, which is implemented by Canvas but also by the individual renderers (rasterizer, PDF, EPS, ...). That means we can draw directly to any given renderer, including Canvas which is really just an array of records of previous drawing commands. From Canvas we can draw to any other renderer any number of times by reproducing the drawing commands.

Canvas and Renderers

Clone this wiki locally