[cairo] plots of contiguous rectangles

Bill Baxter wbaxter at gmail.com
Wed Aug 8 11:09:27 PDT 2007


So Cairo doesn't have any way to render water-tight meshes?
Do GDI+ and Quartz punt on that too?

--bb

On 8/9/07, Carl Worth <cworth at cworth.org> wrote:
> On Wed, 8 Aug 2007 18:50:16 +0200, Tamas K Papp wrote:
> >
> > How could I get rid of both?
>
> Snapping to device-space integers is what I would recommend.
>
> Something like:
>
>         void
>         snap_point (cairo_t *cr, double *x, double *y)
>         {
>             cairo_user_to_device (cr, x, y);
>             *x = round (*x);
>             *y = round (*y);
>             cairo_device_to_user (cr, x, y);
>         }
>
>         snap_point (cr, &x1, &y1);
>         snap_point (cr, &x2, &y2);
>
>         cairo_rectangle (cr, x1, y2, x2 - x1, y2 - y2);
>
> >                              Snapping to integer grids is something I
> > want to avoid: I am drawing on vector and bitmap surfaces, and I would
> > have to keep tack of which is which.  But if there is not other
> > solution, I can try to manage that, I just need to know.
>
>
> Even if you didn't distinguish between vector and bitmap surfaces,
> (which I can understand your reluctance to do), the device-space grid
> for a vector surface such as PostScript or PDF will be 1 device-space
> unit == 1 point (1/72 inch). Would a maximum error of half of 1/144
> inch be a noticeable problem?
>
> -Carl
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
>


More information about the cairo mailing list