Re: Dimensions of a "surface_t"
Andrea Canciani <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAN_5=BDGFiuVpahnHOnRkKiRu7B=6Xgeq+3UacqPp2aF+N415w@mail.gmail.com> |
On Wed, Nov 9, 2011 at 12:32 AM, Charles Doutriaux <[email protected]> wrote: > Hi, > > I'm receiving a cairo_t, I can get the surface via cairo_get_target > > Now I would like to know what the dimensions of the "surface" is, if it is > an image i can use: > > w=cairo_image_surface_get_width(surface); > h=cairo_image_surface_get_height(surface); > > But I also get surface that ar PS, PDF or SVG > > All of these are created with dims: > e.g.: > surface = cairo_ps_surface_create_for_stream(stream_cairo_write, > ws->mf.any->fp, > XW,YW); > > Is it possible to retrieve what the original dims/size were? Something like: cairo_save (cr); cairo_reset_clip (cr); cairo_clip_extents (cr, &x1, &y1, &x2, &y2); cairo_restore (cr); should give you the size of the surface. Remember that this will give you the size of the group target, not of the "original" target. I believe that to get the size of the original target, you have to wrap it in a new cairo_t and ask for its clip extents. Andrea > > Thanks, > > C. > > -- > cairo mailing list > [email protected] > http://lists.cairographics.org/mailman/listinfo/cairo > -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo