- Classes
- Namespaces
- Interfaces
- Traits
- Index

Class

# Imagine\Gmagick\Layers

class Layers extends AbstractLayers

## Methods

LayersInterface | add(ImageInterface $image) Adds an image at the end of the layers stack | from AbstractLayers
LayersInterface | set(integer $offset, ImageInterface $image) Set an image at offset | from AbstractLayers
LayersInterface | remove(integer $offset) Removes the image at offset | from AbstractLayers
ImageInterface | get(integer $offset) Returns the image at offset | from AbstractLayers
Boolean | has(integer $offset) Returns true if a layer at offset is preset | from AbstractLayers
| __construct(Image $image, PaletteInterface $palette, Gmagick $resource) |
| merge() Merge layers into the original objects |
| coalesce() Coalesce layers. |
LayersInterface | animate(string $format, integer $delay, integer $loops) Animates layers |
| current() {@inheritdoc} |
| key() {@inheritdoc} |
| next() {@inheritdoc} |
| rewind() {@inheritdoc} |
| valid() {@inheritdoc} |
| count() {@inheritdoc} |
| offsetExists($offset) {@inheritdoc} |
| offsetGet($offset) {@inheritdoc} |
| offsetSet($offset, $image) {@inheritdoc} |
| offsetUnset($offset) {@inheritdoc} |

## Details

###
in AbstractLayers at line 19
`public LayersInterface add(ImageInterface $image)`

Adds an image at the end of the layers stack

#### Parameters

ImageInterface | $image |

#### Return Value

LayersInterface |

#### Exceptions

RuntimeException |

###
in AbstractLayers at line 29
`public LayersInterface set(integer $offset, ImageInterface $image)`

Set an image at offset

#### Parameters

integer | $offset |
ImageInterface | $image |

#### Return Value

LayersInterface |

#### Exceptions

RuntimeException |
InvalidArgumentException |
OutOfBoundsException |

###
in AbstractLayers at line 39
`public LayersInterface remove(integer $offset)`

Removes the image at offset

#### Parameters

integer | $offset |

#### Return Value

LayersInterface |

#### Exceptions

RuntimeException |
InvalidArgumentException |

###
in AbstractLayers at line 49
`public ImageInterface get(integer $offset)`

Returns the image at offset

#### Parameters

integer | $offset |

#### Return Value

ImageInterface |

#### Exceptions

RuntimeException |
InvalidArgumentException |

###
in AbstractLayers at line 57
`public Boolean has(integer $offset)`

Returns true if a layer at offset is preset

#### Parameters

integer | $offset |

#### Return Value

Boolean |

###
at line 49
`public __construct(Image $image, PaletteInterface $palette, Gmagick $resource)`

#### Parameters

Image | $image |
PaletteInterface | $palette |
Gmagick | $resource |

###
at line 59
`public merge()`

Merge layers into the original objects

#### Exceptions

RuntimeException |

###
at line 74
`public coalesce()`

Coalesce layers.

Each layer in the sequence is the same size as the first and composited with the next layer in the sequence.

###
at line 82
`public LayersInterface animate(string $format, integer $delay, integer $loops)`

Animates layers

#### Parameters

string | $format | The output output format
integer | $delay | The delay in milliseconds between two frames
integer | $loops | The number of loops, 0 means infinite

#### Return Value

LayersInterface |

#### Exceptions

InvalidArgumentException | In case an invalid argument is provided
RuntimeException | In case the driver fails to animate

###
at line 117
`public current()`

{@inheritdoc}

###
at line 146
`public key()`

{@inheritdoc}

###
at line 154
`public next()`

{@inheritdoc}

###
at line 162
`public rewind()`

{@inheritdoc}

###
at line 170
`public valid()`

{@inheritdoc}

###
at line 178
`public count()`

{@inheritdoc}

###
at line 190
`public offsetExists($offset)`

{@inheritdoc}

#### Parameters

| $offset |

###
at line 198
`public offsetGet($offset)`

{@inheritdoc}

#### Parameters

| $offset |

###
at line 206
`public offsetSet($offset, $image)`

{@inheritdoc}

#### Parameters

| $offset |
| $image |

###
at line 257
`public offsetUnset($offset)`

{@inheritdoc}

#### Parameters

| $offset |