# Gimp.Layer.new_from_surface

    function new_from_surface(image: Gimp.Image, name: String, surface: cairo.Surface, progress_start: Number(gdouble), progress_end: Number(gdouble)): Gimp.Layer {
        // Gjs wrapper for gimp_layer_new_from_surface()
    }

Create a new layer from a [type@cairo.Surface].

This procedure creates a new layer from the given [type@cairo.Surface]. 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.

Since 2.8

image

  The RGB image to which to add the layer.

name

  The layer name.

surface

  A Cairo image surface.

progress_start

  start of progress

progress_end

  end of progress

Returns

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