Cairo: A Vector Graphics Library | ||||
---|---|---|---|---|
cairo_surface_t* cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int width, int height); cairo_surface_t* cairo_xlib_surface_create_for_bitmap (Display *dpy, Pixmap bitmap, Screen *screen, int width, int height); void cairo_xlib_surface_set_size (cairo_surface_t *surface, int width, int height); void cairo_xlib_surface_set_drawable (cairo_surface_t *surface, Drawable drawable, int width, int height);
cairo_surface_t* cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int width, int height);
Creates an Xlib surface that draws to the given drawable. The way that colors are represented in the drawable is specified by the provided visual.
NOTE: If drawable
is a Window, then the function
cairo_xlib_surface_set_size must be called whenever the size of the
window changes.
|
an X Display |
|
an X Drawable, (a Pixmap or a Window) |
|
the visual to use for drawing to drawable . The depth
of the visual must match the depth of the drawable.
Currently, only TrueColor visuals are fully supported.
|
|
the current width of drawable .
|
|
the current height of drawable .
|
Returns : |
the newly created surface |
cairo_surface_t* cairo_xlib_surface_create_for_bitmap (Display *dpy, Pixmap bitmap, Screen *screen, int width, int height);
Creates an Xlib surface that draws to the given bitmap. This will be drawn to as a CAIRO_FORMAT_A1 object.
|
an X Display |
|
an X Drawable, (a depth-1 Pixmap) |
|
the X Screen associated with bitmap
|
|
the current width of bitmap .
|
|
the current height of bitmap .
|
Returns : |
the newly created surface |
void cairo_xlib_surface_set_size (cairo_surface_t *surface, int width, int height);
Informs cairo of the new size of the X Drawable underlying the surface. For a surface created for a Window (rather than a Pixmap), this function must be called each time the size of the window changes. (For a subwindow, you are normally resizing the window yourself, but for a toplevel window, it is necessary to listen for ConfigureNotify events.)
A Pixmap can never change size, so it is never necessary to call this function on a surface created for a Pixmap.
|
a cairo_surface_t for the XLib backend |
|
the new width of the surface |
|
the new height of the surface |
void cairo_xlib_surface_set_drawable (cairo_surface_t *surface, Drawable drawable, int width, int height);
Informs cairo of a new X Drawable underlying the surface. The drawable must match the display, screen and format of the existing drawable or the application will get X protocol errors and will probably terminate. No checks are done by this function to ensure this compatibility.
|
a cairo_surface_t for the XLib backend |
|
the new drawable for the surface |
|
the width of the new drawable |
|
the height of the new drawable |