jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68: Win32 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:

Win32 Surfaces

jpayne@68:

Win32 Surfaces — Microsoft Windows surface support

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: cairo_surface_t * jpayne@68: jpayne@68: cairo_win32_surface_create () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_win32_surface_create_with_dib () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_win32_surface_create_with_ddb () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_win32_surface_create_with_format () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_win32_printing_surface_create () jpayne@68:
jpayne@68: HDC jpayne@68: jpayne@68: cairo_win32_surface_get_dc () jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: jpayne@68: cairo_win32_surface_get_image () 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_WIN32_SURFACE
jpayne@68:
jpayne@68:
jpayne@68:

Description

jpayne@68:

The Microsoft Windows surface is used to render cairo graphics to jpayne@68: Microsoft Windows windows, bitmaps, and printing device contexts.

jpayne@68:

The surface returned by cairo_win32_printing_surface_create() is of surface jpayne@68: type CAIRO_SURFACE_TYPE_WIN32_PRINTING and is a multi-page vector surface jpayne@68: type.

jpayne@68:

The surface returned by the other win32 constructors is of surface type jpayne@68: CAIRO_SURFACE_TYPE_WIN32 and is a raster surface type.

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

Functions

jpayne@68:
jpayne@68:

cairo_win32_surface_create ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_win32_surface_create (HDC hdc);
jpayne@68:

Creates a cairo surface that targets the given DC. The DC will be jpayne@68: queried for its initial clip extents, and this will be used as the jpayne@68: size of the cairo surface. The resulting surface will always be of jpayne@68: format CAIRO_FORMAT_RGB24; should you need another surface format, jpayne@68: you will need to create one through jpayne@68: cairo_win32_surface_create_with_format() or jpayne@68: cairo_win32_surface_create_with_dib().

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:

hdc

the DC to create a surface for

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

Returns

jpayne@68:

the newly created surface, NULL on failure

jpayne@68:
jpayne@68:

Since: 1.0

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

cairo_win32_surface_create_with_dib ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_win32_surface_create_with_dib (cairo_format_t format,
jpayne@68:                                      int width,
jpayne@68:                                      int height);
jpayne@68:

Creates a device-independent-bitmap surface not associated with jpayne@68: any particular existing surface or device context. The created jpayne@68: bitmap will be uninitialized.

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:

format

format of pixels in the surface to create

 

width

width of the surface, in pixels

 

height

height of the surface, in pixels

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

Returns

jpayne@68:

the newly created surface

jpayne@68:
jpayne@68:

Since: 1.2

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

cairo_win32_surface_create_with_ddb ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_win32_surface_create_with_ddb (HDC hdc,
jpayne@68:                                      cairo_format_t format,
jpayne@68:                                      int width,
jpayne@68:                                      int height);
jpayne@68:

Creates a device-dependent-bitmap surface not associated with jpayne@68: any particular existing surface or device context. The created jpayne@68: bitmap will be uninitialized.

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:

hdc

a DC compatible with the surface to create

 

format

format of pixels in the surface to create

 

width

width of the surface, in pixels

 

height

height of the surface, in pixels

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

Returns

jpayne@68:

the newly created surface

jpayne@68:
jpayne@68:

Since: 1.4

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

cairo_win32_surface_create_with_format ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_win32_surface_create_with_format
jpayne@68:                                (HDC hdc,
jpayne@68:                                 cairo_format_t format);
jpayne@68:

Creates a cairo surface that targets the given DC. The DC will be jpayne@68: queried for its initial clip extents, and this will be used as the jpayne@68: size of the cairo surface.

jpayne@68:

Supported formats are: jpayne@68: CAIRO_FORMAT_ARGB32 jpayne@68: CAIRO_FORMAT_RGB24

jpayne@68:

Note: format jpayne@68: only tells cairo how to draw on the surface, not what jpayne@68: the format of the surface is. Namely, cairo does not (and cannot) jpayne@68: check that hdc jpayne@68: actually supports alpha-transparency.

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:

hdc

the DC to create a surface for

 

format

format of pixels in the surface to create

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

Returns

jpayne@68:

the newly created surface, NULL on failure

jpayne@68:
jpayne@68:

Since: 1.14

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

cairo_win32_printing_surface_create ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_win32_printing_surface_create (HDC hdc);
jpayne@68:

Creates a cairo surface that targets the given DC. The DC will be jpayne@68: queried for its initial clip extents, and this will be used as the jpayne@68: size of the cairo surface. The DC should be a printing DC; jpayne@68: antialiasing will be ignored, and GDI will be used as much as jpayne@68: possible to draw to the surface.

jpayne@68:

The returned surface will be wrapped using the paginated surface to jpayne@68: provide correct complex rendering behaviour; cairo_surface_show_page() and jpayne@68: associated methods must be used for correct output.

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:

hdc

the DC to create a surface for

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

Returns

jpayne@68:

the newly created surface

jpayne@68:
jpayne@68:

Since: 1.6

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

cairo_win32_surface_get_dc ()

jpayne@68:
HDC
jpayne@68: cairo_win32_surface_get_dc (cairo_surface_t *surface);
jpayne@68:

Returns the HDC associated with this surface, or NULL if none. jpayne@68: Also returns NULL if the surface is not a win32 surface.

jpayne@68:

A call to cairo_surface_flush() is required before using the HDC to jpayne@68: ensure that all pending drawing operations are finished and to jpayne@68: restore any temporary modification cairo has made to its state. A jpayne@68: call to cairo_surface_mark_dirty() is required after the state or jpayne@68: the content of the HDC has been modified.

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_surface_t

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

Returns

jpayne@68:

HDC or NULL if no HDC available.

jpayne@68:
jpayne@68:

Since: 1.2

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

cairo_win32_surface_get_image ()

jpayne@68:
cairo_surface_t *
jpayne@68: cairo_win32_surface_get_image (cairo_surface_t *surface);
jpayne@68:

Returns a cairo_surface_t image surface that refers to the same bits jpayne@68: as the DIB of the Win32 surface. If the passed-in win32 surface jpayne@68: is not a DIB surface, NULL is returned.

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_surface_t

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

Returns

jpayne@68:

a cairo_surface_t (owned by the win32 cairo_surface_t), jpayne@68: or NULL if the win32 surface is not a DIB.

jpayne@68:
jpayne@68:

Since: 1.4

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

Types and Values

jpayne@68:
jpayne@68:

CAIRO_HAS_WIN32_SURFACE

jpayne@68:
#define CAIRO_HAS_WIN32_SURFACE 1
jpayne@68: 
jpayne@68:

Defined if the Microsoft Windows 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: