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

Brent Yorgey byorgey at seas.upenn.edu
Tue Aug 24 06:27:15 EDT 2010


It seems for some reason I failed to ever respond to this email.
(Well, I guess it was probably because I was right in the process of
moving to England, but anyway...)  Sorry about that.

On Fri, Jun 04, 2010 at 08:54:29PM -0400, sam griffin wrote:
> Excellent!
> 
> 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)]

Off the top of my head, I am not sure why that would be.  I'll have to
play around with it a bit.

> 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.

Agreed.  We should probably add something to the Backend class for
rendering multiple diagrams at once.

-Brent



More information about the diagrams mailing list