- Classes
- Namespaces
- Interfaces
- Index

Imagine API
Interface

# Imagine\Image\LayersInterface

interface LayersInterface implements Iterator, Countable, ArrayAccess

The layers interface

## Methods

| merge() Merge layers into the original objects |
LayersInterface | animate(string $format, integer $delay, integer $loops) Animates layers |
| coalesce() Coalesce layers. |
LayersInterface | add(ImageInterface $image) Adds an image at the end of the layers stack |
LayersInterface | set(integer $offset, ImageInterface $image) Set an image at offset |
LayersInterface | remove(integer $offset) Removes the image at offset |
ImageInterface | get(integer $offset) Returns the image at offset |
Boolean | has(integer $offset) Returns true if a layer at offset is preset |

## Details

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

Merge layers into the original objects

#### Exceptions

RuntimeException |

###
at line 43
`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 49
`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 60
`public LayersInterface add(ImageInterface $image)`

Adds an image at the end of the layers stack

#### Parameters

ImageInterface | $image |

#### Return Value

LayersInterface |

#### Exceptions

RuntimeException |

###
at line 74
`public LayersInterface set(integer $offset, ImageInterface $image)`

Set an image at offset

#### Parameters

integer | $offset |
ImageInterface | $image |

#### Return Value

LayersInterface |

#### Exceptions

RuntimeException |
InvalidArgumentException |
OutOfBoundsException |

###
at line 86
`public LayersInterface remove(integer $offset)`

Removes the image at offset

#### Parameters

integer | $offset |

#### Return Value

LayersInterface |

#### Exceptions

RuntimeException |
InvalidArgumentException |

###
at line 98
`public ImageInterface get(integer $offset)`

Returns the image at offset

#### Parameters

integer | $offset |

#### Return Value

ImageInterface |

#### Exceptions

RuntimeException |
InvalidArgumentException |

###
at line 107
`public Boolean has(integer $offset)`

Returns true if a layer at offset is preset

#### Parameters

integer | $offset |

#### Return Value

Boolean |