[diagrams] path bounds and rendering multiple diagrams to a single document

sam griffin sam.griffin at gmail.com
Fri Jun 4 20:54:29 EDT 2010


Two questions I've been saving (Brent gets these twice, because I'm foolish):

First, the bounding box built for paths seems twice as big as it
should be (that is, the Bounds vector is twice as big). I had assumed
that the following code for a square would be a drop-in replacement
for box, but it is not.

polygon :: (BSpace b ~ P2, Renderable (Path P2) b) => [P2] -> Diagram b
polygon vlist = stroke . close $ pathFromVertices vlist

square :: (BSpace b ~ P2, Renderable (Path P2) b) => Diagram b
square = polygon [(-1,-1), (1,-1), (1,1), (-1,1)]

Second, if we want the Cairo Backend to render multiple diagrams into
a document, that will go beyond the bounds of what is defined for the
Backend class... should that be amended? Ideally, we could get around
that opening the desired document, rendering a single diagram to the
middle of it in whatever desired page, then saving it. Unfortunately,
the libraries we depend on probably don't support this.

More information about the diagrams mailing list