### Constructor

# Gimp Layer new_from_surface

since: 2.8

#### Declaration [src]

    GimpLayer*
    gimp_layer_new_from_surface (
      GimpImage* image,
      const gchar* name,
      cairo_surface_t* surface,
      gdouble progress_start,
      gdouble progress_end
    )

#### Description [src]

Create a new layer from a `cairo_surface_t`.

This procedure creates a new layer from the given `cairo_surface_t`. The image has to be an RGB image and just like with `gimp_layer_new()` you will still need to add the layer to it.

If you pass `progress_end` > `progress_start` to this function, `gimp_progress_update()` will be called for. You have to call `gimp_progress_init()` beforehand then.

Available since: 2.8

#### Parameters

`image`

  Type: `GimpImage`

  The RGB image to which to add the layer.

  The data is owned by the caller of the function.

`name`

  Type: `const gchar*`

  The layer name.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`surface`

  Type: `cairo_surface_t`

  A Cairo image surface.

  The data is owned by the caller of the function.

`progress_start`

  Type: `gdouble`

  Start of progress.

`progress_end`

  Type: `gdouble`

  End of progress.

#### Return value

Type: `GimpLayer`

The newly created layer. The object belongs to libgimp and you should not free it.

The data is owned by the called function.