Gdk.pixbuf_get_from_surface
Description: Reference for Gdk.pixbuf_get_from_surface

### Function

# Gdkpixbuf_get_from_surface

deprecated: 4.12 since: 4.0

#### Declaration [src]

    GdkPixbuf*
    gdk_pixbuf_get_from_surface (
      cairo_surface_t* surface,
      int src_x,
      int src_y,
      int width,
      int height
    )

#### Description [src]

Transfers image data from a `cairo_surface_t` and converts it to a `GdkPixbuf`.

This allows you to efficiently read individual pixels from cairo surfaces.

This function will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the `surface` contains one.

Available since: 4.0

Deprecated since: 4.12

Use `GdkTexture` and subclasses instead cairo surfaces and pixbufs.

#### Parameters

`surface`

  Type: `cairo_surface_t`

  Surface to copy from.

  The data is owned by the caller of the function.

`src_x`

  Type: `int`

  Source X coordinate within `surface`.

`src_y`

  Type: `int`

  Source Y coordinate within `surface`.

`width`

  Type: `int`

  Width in pixels of region to get.

`height`

  Type: `int`

  Height in pixels of region to get.

#### Return value

Type: `GdkPixbuf`

A newly-created pixbuf with a reference count of 1

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.