jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: XLib Surfaces: Cairo: A Vector Graphics Library jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68: jpayne@68: jpayne@68:
jpayne@68:

XLib Surfaces

jpayne@68:

XLib Surfaces — X Window System rendering using XLib

jpayne@68:
jpayne@68:
jpayne@68:

Functions

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_xlib_surface_create () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_xlib_surface_create_for_bitmap () jpayne@68:
jpayne@68: void jpayne@68: jpayne@68: cairo_xlib_surface_set_size () jpayne@68:
jpayne@68: Display * jpayne@68: jpayne@68: cairo_xlib_surface_get_display () jpayne@68:
jpayne@68: Screen * jpayne@68: jpayne@68: cairo_xlib_surface_get_screen () jpayne@68:
jpayne@68: void jpayne@68: jpayne@68: cairo_xlib_surface_set_drawable () jpayne@68:
jpayne@68: Drawable jpayne@68: jpayne@68: cairo_xlib_surface_get_drawable () jpayne@68:
jpayne@68: Visual * jpayne@68: jpayne@68: cairo_xlib_surface_get_visual () jpayne@68:
jpayne@68: int jpayne@68: jpayne@68: cairo_xlib_surface_get_width () jpayne@68:
jpayne@68: int jpayne@68: jpayne@68: cairo_xlib_surface_get_height () jpayne@68:
jpayne@68: int jpayne@68: jpayne@68: cairo_xlib_surface_get_depth () jpayne@68:
jpayne@68: void jpayne@68: jpayne@68: cairo_xlib_device_debug_cap_xrender_version () jpayne@68:
jpayne@68: int jpayne@68: jpayne@68: cairo_xlib_device_debug_get_precision () jpayne@68:
jpayne@68: void jpayne@68: jpayne@68: cairo_xlib_device_debug_set_precision () jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

Types and Values

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
#defineCAIRO_HAS_XLIB_SURFACE
jpayne@68:
jpayne@68:
jpayne@68:

Description

jpayne@68:

The XLib surface is used to render cairo graphics to X Window System jpayne@68: windows and pixmaps using the XLib library.

jpayne@68:

Note that the XLib surface automatically takes advantage of X render extension jpayne@68: if it is available.

jpayne@68:
jpayne@68:
jpayne@68:

Functions

jpayne@68:
jpayne@68:

cairo_xlib_surface_create ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_xlib_surface_create (Display *dpy,
jpayne@68:                            Drawable drawable,
jpayne@68:                            Visual *visual,
jpayne@68:                            int width,
jpayne@68:                            int height);
jpayne@68:

Creates an Xlib surface that draws to the given drawable. jpayne@68: The way that colors are represented in the drawable is specified jpayne@68: by the provided visual.

jpayne@68:

Note: If drawable jpayne@68: is a Window, then the function jpayne@68: cairo_xlib_surface_set_size() must be called whenever the size of the jpayne@68: window changes.

jpayne@68:

When drawable jpayne@68: is a Window containing child windows then drawing to jpayne@68: the created surface will be clipped by those child windows. When jpayne@68: the created surface is used as a source, the contents of the jpayne@68: children will be included.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

dpy

an X Display

 

drawable

an X Drawable, (a Pixmap or a Window)

 

visual

the visual to use for drawing to drawable jpayne@68: . The depth jpayne@68: of the visual must match the depth of the drawable. jpayne@68: Currently, only TrueColor visuals are fully supported.

 

width

the current width of drawable jpayne@68: .

 

height

the current height of drawable jpayne@68: .

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the newly created surface

jpayne@68:
jpayne@68:

Since: 1.0

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_create_for_bitmap ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_xlib_surface_create_for_bitmap (Display *dpy,
jpayne@68:                                       Pixmap bitmap,
jpayne@68:                                       Screen *screen,
jpayne@68:                                       int width,
jpayne@68:                                       int height);
jpayne@68:

Creates an Xlib surface that draws to the given bitmap. jpayne@68: This will be drawn to as a CAIRO_FORMAT_A1 object.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

dpy

an X Display

 

bitmap

an X Drawable, (a depth-1 Pixmap)

 

screen

the X Screen associated with bitmap jpayne@68:

 

width

the current width of bitmap jpayne@68: .

 

height

the current height of bitmap jpayne@68: .

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the newly created surface

jpayne@68:
jpayne@68:

Since: 1.0

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_set_size ()

jpayne@68:
void
jpayne@68: cairo_xlib_surface_set_size (cairo_surface_t *surface,
jpayne@68:                              int width,
jpayne@68:                              int height);
jpayne@68:

Informs cairo of the new size of the X Drawable underlying the jpayne@68: surface. For a surface created for a Window (rather than a Pixmap), jpayne@68: this function must be called each time the size of the window jpayne@68: changes. (For a subwindow, you are normally resizing the window jpayne@68: yourself, but for a toplevel window, it is necessary to listen for jpayne@68: ConfigureNotify events.)

jpayne@68:

A Pixmap can never change size, so it is never necessary to call jpayne@68: this function on a surface created for a Pixmap.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_surface_t for the XLib backend

 

width

the new width of the surface

 

height

the new height of the surface

 
jpayne@68:
jpayne@68:

Since: 1.0

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_display ()

jpayne@68:
Display *
jpayne@68: cairo_xlib_surface_get_display (cairo_surface_t *surface);
jpayne@68:

Get the X Display for the underlying X Drawable.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the display.

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_screen ()

jpayne@68:
Screen *
jpayne@68: cairo_xlib_surface_get_screen (cairo_surface_t *surface);
jpayne@68:

Get the X Screen for the underlying X Drawable.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the screen.

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_set_drawable ()

jpayne@68:
void
jpayne@68: cairo_xlib_surface_set_drawable (cairo_surface_t *surface,
jpayne@68:                                  Drawable drawable,
jpayne@68:                                  int width,
jpayne@68:                                  int height);
jpayne@68:

Informs cairo of a new X Drawable underlying the jpayne@68: surface. The drawable must match the display, screen jpayne@68: and format of the existing drawable or the application jpayne@68: will get X protocol errors and will probably terminate. jpayne@68: No checks are done by this function to ensure this jpayne@68: compatibility.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_surface_t for the XLib backend

 

drawable

the new drawable for the surface

 

width

the width of the new drawable

 

height

the height of the new drawable

 
jpayne@68:
jpayne@68:

Since: 1.0

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_drawable ()

jpayne@68:
Drawable
jpayne@68: cairo_xlib_surface_get_drawable (cairo_surface_t *surface);
jpayne@68:

Get the underlying X Drawable used for the surface.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the drawable.

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_visual ()

jpayne@68:
Visual *
jpayne@68: cairo_xlib_surface_get_visual (cairo_surface_t *surface);
jpayne@68:

Gets the X Visual associated with surface jpayne@68: , suitable for use with the jpayne@68: underlying X Drawable. If surface jpayne@68: was created by jpayne@68: cairo_xlib_surface_create(), the return value is the Visual passed to that jpayne@68: constructor.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the Visual or NULL if there is no appropriate Visual for jpayne@68: surface jpayne@68: .

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_width ()

jpayne@68:
int
jpayne@68: cairo_xlib_surface_get_width (cairo_surface_t *surface);
jpayne@68:

Get the width of the X Drawable underlying the surface in pixels.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the width of the surface in pixels.

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_height ()

jpayne@68:
int
jpayne@68: cairo_xlib_surface_get_height (cairo_surface_t *surface);
jpayne@68:

Get the height of the X Drawable underlying the surface in pixels.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the height of the surface in pixels.

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_surface_get_depth ()

jpayne@68:
int
jpayne@68: cairo_xlib_surface_get_depth (cairo_surface_t *surface);
jpayne@68:

Get the number of bits used to represent each pixel value.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

surface

a cairo_xlib_surface_t

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the depth of the surface in bits.

jpayne@68:
jpayne@68:

Since: 1.2

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_device_debug_cap_xrender_version ()

jpayne@68:
void
jpayne@68: cairo_xlib_device_debug_cap_xrender_version
jpayne@68:                                (cairo_device_t *device,
jpayne@68:                                 int major_version,
jpayne@68:                                 int minor_version);
jpayne@68:

Restricts all future Xlib surfaces for this devices to the specified version jpayne@68: of the RENDER extension. This function exists solely for debugging purpose. jpayne@68: It lets you find out how cairo would behave with an older version of jpayne@68: the RENDER extension.

jpayne@68:

Use the special values -1 and -1 for disabling the RENDER extension.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

device

a cairo_device_t for the Xlib backend

 

major_version

major version to restrict to

 

minor_version

minor version to restrict to

 
jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_device_debug_get_precision ()

jpayne@68:
int
jpayne@68: cairo_xlib_device_debug_get_precision (cairo_device_t *device);
jpayne@68:

Get the Xrender precision mode.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

device

a cairo_device_t for the Xlib backend

 
jpayne@68:
jpayne@68:
jpayne@68:

Returns

jpayne@68:

the render precision mode

jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

cairo_xlib_device_debug_set_precision ()

jpayne@68:
void
jpayne@68: cairo_xlib_device_debug_set_precision (cairo_device_t *device,
jpayne@68:                                        int precision);
jpayne@68:

Render supports two modes of precision when rendering trapezoids. Set jpayne@68: the precision to the desired mode.

jpayne@68:
jpayne@68:

Parameters

jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:

device

a cairo_device_t for the Xlib backend

 

precision

the precision to use

 
jpayne@68:
jpayne@68:

Since: 1.12

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

Types and Values

jpayne@68:
jpayne@68:

CAIRO_HAS_XLIB_SURFACE

jpayne@68:
#define CAIRO_HAS_XLIB_SURFACE 1
jpayne@68: 
jpayne@68:

Defined if the Xlib surface backend is available. jpayne@68: This macro can be used to conditionally compile backend-specific code.

jpayne@68:

Since: 1.0

jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68:

See Also

jpayne@68:

cairo_surface_t

jpayne@68:
jpayne@68:
jpayne@68: jpayne@68: jpayne@68: