Open nikochiko opened 4 months ago
We can also do a LazyContext
that only stores the list of shapes that are show
-n.
At the end, depending on the function that the user calls (writePNG
or writeSVG
or whatever), and from introspecting the environment, we can smartly guess the context and give the user what they probably want.
We should be able to support multiple types of context.
So far, the API is restricted to the Cairo backend and assumes that it will be the only one.
I suggest that we:
show
add to global context - whose actual behaviour will be different depending on the actual backende.g. the context type that is as of now a record that immediately stores the cairo context and surface, will change to a sum type:
The global context will be of
context
type, then we change the rendering logic to do a match-case on the context before we pass it to the actual backend.The interface for each backend should be something like: