Hi all -- not sure who to direct this at -- I've got a question
regarding the method below that Cairo adds to the Pixmap class : cairoSurface ^CairoGraphics.Surface concreteDisplayClass pixmap: self Does this mean that I can draw a pixmap with whatever I want and then call the above method and somehow tell Cairo to generate a PDF from the pixmap contents? Just thought I'd ask.. Thx! _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
On May 29, 2009, at 11:45 PM, Rick Flower wrote:
> Hi all -- not sure who to direct this at -- I've got a question > regarding the method below that Cairo adds to the Pixmap class : I might be able to help you. :) > cairoSurface > ^CairoGraphics.Surface concreteDisplayClass pixmap: self > > Does this mean that I can draw a pixmap with whatever I want and then > call the above method and somehow tell > Cairo to generate a PDF from the pixmap contents? Just thought I'd > ask.. Thx! Not exactly, at least as far as I understand your question. PDFSurface and a HostSurface (QuartSurface, XLibSurface, Win32Surface) are two distinct kinds of surfaces that Cairo can render to. There is no "take any surface and make a PDF file out of it." I've not had luck drawing to a Pixmap surface, and then using that as a source for a PDFSurface. But I have been able to do it with an ImageSurface: surface := ImageSurface format: CairoFormat argb32 extent: 100@100. surface newCairoContextWhile: [:cr | cr source: ColorValue red; paint]. pdf := PDFSurface path: '/Users/travis/Desktop/torick.pdf' pointExtent: 72 @ 72. pdf newCairoContextWhile: [:cr | cr source: surface; paint; showPage]. pdf finish I haven't had the time to figure out why a Pixmap derived surface is not happy there. I don't know if it's OSX specific problem, or cross platform. To get around the Pixmap problem, I might do something like this (which I tested): p := Pixmap extent: 100 @ 100. (p graphicsContext) paint: ColorValue blue; displayRectangle: (20 @ 20 corner: 80 @ 80). image := p asImage. image becomeCairoCompatible. pdf := PDFSurface path: '/Users/travis/Desktop/torick.pdf' pointExtent: 72 @ 72. pdf newCairoContextWhile: [:cr | image newCairoSurfaceWhile: [:surface | cr source: surface; paint; showPage]]. pdf finish -- Travis Griggs Objologist My Other Machine runs OSX. But then... so does this one. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Travis Griggs wrote:
> On May 29, 2009, at 11:45 PM, Rick Flower wrote: > > >> Hi all -- not sure who to direct this at -- I've got a question >> regarding the method below that Cairo adds to the Pixmap class : >> > > I might be able to help you. :) > > >> cairoSurface >> ^CairoGraphics.Surface concreteDisplayClass pixmap: self >> >> Does this mean that I can draw a pixmap with whatever I want and then >> call the above method and somehow tell >> Cairo to generate a PDF from the pixmap contents? Just thought I'd >> ask.. Thx! >> > > Not exactly, at least as far as I understand your question. > > PDFSurface and a HostSurface (QuartSurface, XLibSurface, Win32Surface) > are two distinct kinds of surfaces that Cairo can render to. There is > no "take any surface and make a PDF file out of it." I've not had luck > drawing to a Pixmap surface, and then using that as a source for a > PDFSurface. But I have been able to do it with an ImageSurface: > > surface := ImageSurface format: CairoFormat argb32 extent: 100@100. > surface newCairoContextWhile: [:cr | > cr > source: ColorValue red; > paint]. > pdf := PDFSurface path: '/Users/travis/Desktop/torick.pdf' > pointExtent: 72 @ 72. > pdf newCairoContextWhile: [:cr | > cr > source: surface; > paint; > showPage]. > pdf finish > > I haven't had the time to figure out why a Pixmap derived surface is > not happy there. I don't know if it's OSX specific problem, or cross > platform. To get around the Pixmap problem, I might do something like > this (which I tested): > > point out is that IF I were to use a pixmap and happened to render some text to it and later generate a PDF, I'd not want to have the text be a bitmap... I think I'll need to look at some of the other surfaces... I'm trying to make this play with Simberon and have been in contact w/ Chris Lopeman on that end -- I'm just trying to still put some of the puzzle pieces together still.. Thanks! _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |