cairomm: Cairo::Win32Surface Class Reference

# Cairo::Win32Surface Class Reference

A Win32Surface provides a way to render within Microsoft Windows. More...

Inherits Cairo::Surface.

List of all members.

## Public Member Functions

| Win32Surface (cairo_surface_t*cobject, bool has_reference=false)
| Create a C++ wrapper for the C instance.
virtual | ~Win32Surface ()
HDC | get_dc () const
| Returns the HDC associated with this surface, or NULL if none.
RefPtr< ImageSurface > | get_image ()
| Returns a ImageSurface that refers to the same bits as the DIB of the Win32 surface.

## Static Public Member Functions

static RefPtr< Win32Surface > | create (HDC hdc)
| Creates a cairo surface that targets the given DC.
static RefPtr< Win32Surface > | create (Format format, int width, int height)
static RefPtr< Win32Surface > | create_with_dib (Format format, int width, int height)
| Creates a device-independent-bitmap surface not associated with any particular existing surface or device context.
static RefPtr< Win32Surface > | create_with_ddb (HDC hdc, Format format, int width, int height)
| Creates a device-independent-bitmap surface not associated with any particular existing surface or device context.

## Detailed Description

A Win32Surface provides a way to render within Microsoft Windows.

If you want to draw to the screen within a Microsoft Windows application, you should use this Surface type.

Note:
  For this Surface to be available, cairo must have been compiled with Win32 support

## Constructor & Destructor Documentation

Cairo::Win32Surface::Win32Surface | ( | cairo_surface_t * | cobject,
|  | bool | has_reference = `false` |
| ) |  |  | `[explicit]`

Create a C++ wrapper for the C instance.

This C++ instance should then be given to a RefPtr.

Parameters:

  | cobject | The C instance.
  | has_reference | whether we already have a reference. Otherwise, the constructor will take an extra reference.

virtual Cairo::Win32Surface::~Win32Surface | ( |  | ) | `[virtual]`

## Member Function Documentation

static RefPtr<Win32Surface> Cairo::Win32Surface::create | ( | Format | format,
|  | int | width,
|  | int | height |
| ) |  |  | `[static]`

Deprecated:
  use create_with_dib()

static RefPtr<Win32Surface> Cairo::Win32Surface::create | ( | HDC | hdc | ) | `[static]`

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.

Parameters:

  | hdc | the DC to create a surface for.

Returns:
  the newly created surface.

static RefPtr<Win32Surface> Cairo::Win32Surface::create_with_ddb | ( | HDC | hdc,
|  | Format | format,
|  | int | width,
|  | int | height |
| ) |  |  | `[static]`

Creates a device-independent-bitmap surface not associated with any particular existing surface or device context.

The created bitmap will be uninitialized.

Parameters:

  | 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.8

static RefPtr<Win32Surface> Cairo::Win32Surface::create_with_dib | ( | Format | format,
|  | int | width,
|  | int | height |
| ) |  |  | `[static]`

Creates a device-independent-bitmap surface not associated with any particular existing surface or device context.

The created bitmap will be unititialized.

Parameters:

  | 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.8

HDC Cairo::Win32Surface::get_dc | ( |  | ) | const

Returns the HDC associated with this surface, or NULL if none.

Also returns NULL if the surface is not a win32 surface.

Returns:
  HDC or NULL if no HDC available.

RefPtr<ImageSurface> Cairo::Win32Surface::get_image | ( |  | ) |

Returns a ImageSurface that refers to the same bits as the DIB of the Win32 surface.

If the passed-in win32 surface is not a DIB surface, the returned surface will be NULL

Returns:
  a ImageSurface (owned by the Win32Surface), or an empty RefPtr if the win32 surface is not a DIB.

Since:
  1.8

The documentation for this class was generated from the following file:

- cairomm/win32_surface.h