[cairo] dimensionally accurate drawings on screen ?

Jason Dorje Short jdorje at users.sf.net
Fri Jan 20 12:30:54 PST 2006


John Ellson wrote:
> This isn't a cairo problem, I'm sure, but I'm hoping that someone here will
> know how to solve it.
> 
> I'm trying to create dimensionally accurate drawings using cairo on a 
> GdkDrawable using
> 
>     GdkDrawable *drawable;
>     cairo_t *cr;
>     drawable = gtk_drawing_area_new();
>        cr = gdk_cairo_create  (drawable);
> 
> 
> I can generate the drawings ok.  Its the dimensionally accurate part I'm 
> having difficultly with.
> 
> I'd like to scale according to accurate xy resolution values.  With Xlib 
> I know I can obtain the
> resolution with:
>     resolution.x = DisplayWidth(dpy, scr) / DisplayWidthMM(dpy, scr);
>     resolution.y = DisplayHeight(dpy, scr) / DisplayHeightMM(dpy, scr);
> 
> 
> but how can I get from "GdkDrawable *display"  to the "Display* dpy" and 
> the "int scr" ?
> 
> 
> Thanks in advance for any hints.

gdk isn't just a wrapper for xlib.  You need to use an appropriate gdk 
function instead.  Try looking at the GdkScreen API.

-jason


More information about the cairo mailing list