Win32 Surfaces

## Win32 Surfaces Win32 Surfaces — Microsoft Windows surface support |

## Synopsis

    cairo_surface_t*    cairo_win32_surface_create          (HDC hdc);
    cairo_surface_t*    cairo_win32_surface_create_with_dib (cairo_format_t format,
                                                             int width,
                                                             int height);
    cairo_surface_t*    cairo_win32_surface_create_with_ddb (HDC hdc,
                                                             cairo_format_t format,
                                                             int width,
                                                             int height);
    HDC                 cairo_win32_surface_get_dc          (cairo_surface_t *surface);
    cairo_surface_t*    cairo_win32_surface_get_image       (cairo_surface_t *surface);

## Description

## Details

### cairo_win32_surface_create ()

    cairo_surface_t*    cairo_win32_surface_create          (HDC hdc);

Creates a cairo surface that targets the given DC. The DC will be queried for its initial clip extents, and this will be used as the size of the cairo surface. Also, if the DC is a raster DC, it will be queried for its pixel format and the cairo surface format will be set appropriately.

`hdc` : | the DC to create a surface for
Returns : | the newly created surface

### cairo_win32_surface_create_with_dib ()

    cairo_surface_t*    cairo_win32_surface_create_with_dib (cairo_format_t format,
                                                             int width,
                                                             int height);

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

`format` : | format of pixels in the surface to create
`width` : | width of the surface, in pixels
`height` : | height of the surface, in pixels
Returns : | the newly created surface

Since 1.2

### cairo_win32_surface_create_with_ddb ()

    cairo_surface_t*    cairo_win32_surface_create_with_ddb (HDC hdc,
                                                             cairo_format_t format,
                                                             int width,
                                                             int height);

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

`hdc` : | the DC to create a surface for
`format` : | format of pixels in the surface to create
`width` : | width of the surface, in pixels
`height` : | height of the surface, in pixels
Returns : | the newly created surface

Since 1.4

### cairo_win32_surface_get_dc ()

    HDC                 cairo_win32_surface_get_dc          (cairo_surface_t *surface);

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

`surface` : | a cairo_surface_t
Returns : | HDC or NULL if no HDC available.

Since 1.2

### cairo_win32_surface_get_image ()

    cairo_surface_t*    cairo_win32_surface_get_image       (cairo_surface_t *surface);

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

`surface` : | a cairo_surface_t
Returns : | a cairo_surface_t (owned by the win32 cairo_surface_t), or NULL if the win32 surface is not a DIB.

Since 1.4