Class ImageFrameCollection
Encapsulates a pixel-agnostic collection of ImageFrame instances that make up an Image.
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public abstract class ImageFrameCollection : IEnumerable<ImageFrame>, IEnumerable
Properties
| Improve this Doc View SourceCount
Gets the number of frames.
Declaration
public abstract int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Item[Int32]
Gets the ImageFrame at the specified index.
Declaration
public ImageFrame this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Property Value
Type | Description |
---|---|
ImageFrame | The ImageFrame. |
NonGenericRootFrame
Gets the root frame. (Implements RootFrame.)
Declaration
protected abstract ImageFrame NonGenericRootFrame { get; }
Property Value
Type | Description |
---|---|
ImageFrame |
RootFrame
Gets the root frame.
Declaration
public ImageFrame RootFrame { get; }
Property Value
Type | Description |
---|---|
ImageFrame |
Methods
| Improve this Doc View SourceAddFrame(ImageFrame)
Clones the source
frame and appends the clone to the end of the collection.
Declaration
public ImageFrame AddFrame(ImageFrame source)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame | source | The raw pixel data to generate the ImageFrame<TPixel> from. |
Returns
Type | Description |
---|---|
ImageFrame | The cloned ImageFrame<TPixel>. |
CloneFrame(Int32)
Creates an Image<TPixel> with only the frame at the specified index with the same metadata as the original image.
Declaration
public Image CloneFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the frame to clone. |
Returns
Type | Description |
---|---|
Image | The new Image<TPixel> with the specified frame. |
Contains(ImageFrame)
Determines whether the ImageFrameCollection<TPixel> contains the frame
.
Declaration
public abstract bool Contains(ImageFrame frame)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame | frame | The frame. |
Returns
Type | Description |
---|---|
Boolean |
|
CreateFrame()
Creates a new ImageFrame<TPixel> and appends it to the end of the collection.
Declaration
public ImageFrame CreateFrame()
Returns
Type | Description |
---|---|
ImageFrame | The new ImageFrame<TPixel>. |
CreateFrame(Color)
Creates a new ImageFrame<TPixel> and appends it to the end of the collection.
Declaration
public ImageFrame CreateFrame(Color backgroundColor)
Parameters
Type | Name | Description |
---|---|---|
Color | backgroundColor | The background color to initialize the pixels with. |
Returns
Type | Description |
---|---|
ImageFrame | The new ImageFrame<TPixel>. |
ExportFrame(Int32)
Removes the frame at the specified index and creates a new image with only the removed frame with the same metadata as the original image.
Declaration
public Image ExportFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the frame to export. |
Returns
Type | Description |
---|---|
Image | The new Image<TPixel> with the specified frame. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Cannot remove last frame. |
GetEnumerator()
Declaration
public IEnumerator<ImageFrame> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<ImageFrame> |
IndexOf(ImageFrame)
Determines the index of a specific frame
in the ImageFrameCollection.
Declaration
public abstract int IndexOf(ImageFrame frame)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame | frame | The ImageFrame to locate in the ImageFrameCollection. |
Returns
Type | Description |
---|---|
Int32 | The index of item if found in the list; otherwise, -1. |
InsertFrame(Int32, ImageFrame)
Clones and inserts the source
into the ImageFrameCollection at the specified index
.
Declaration
public ImageFrame InsertFrame(int index, ImageFrame source)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index to insert the frame at. |
ImageFrame | source | The ImageFrame to clone and insert into the ImageFrameCollection. |
Returns
Type | Description |
---|---|
ImageFrame | The cloned ImageFrame. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Frame must have the same dimensions as the image. |
MoveFrame(Int32, Int32)
Moves an ImageFrame<TPixel> from sourceIndex
to destinationIndex
.
Declaration
public abstract void MoveFrame(int sourceIndex, int destinationIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceIndex | The zero-based index of the frame to move. |
Int32 | destinationIndex | The index to move the frame to. |
NonGenericAddFrame(ImageFrame)
Implements AddFrame(ImageFrame).
Declaration
protected abstract ImageFrame NonGenericAddFrame(ImageFrame source)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame | source | The frame. |
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
NonGenericCloneFrame(Int32)
Implements CloneFrame(Int32).
Declaration
protected abstract Image NonGenericCloneFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
Image | The new image. |
NonGenericCreateFrame()
Implements CreateFrame().
Declaration
protected abstract ImageFrame NonGenericCreateFrame()
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
NonGenericCreateFrame(Color)
Implements CreateFrame().
Declaration
protected abstract ImageFrame NonGenericCreateFrame(Color backgroundColor)
Parameters
Type | Name | Description |
---|---|---|
Color | backgroundColor | The background color. |
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
NonGenericExportFrame(Int32)
Implements ExportFrame(Int32).
Declaration
protected abstract Image NonGenericExportFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
Image | The new image. |
NonGenericGetEnumerator()
Implements GetEnumerator().
Declaration
protected abstract IEnumerator<ImageFrame> NonGenericGetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<ImageFrame> | The enumerator. |
NonGenericGetFrame(Int32)
Implements the getter of the indexer.
Declaration
protected abstract ImageFrame NonGenericGetFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
ImageFrame | The frame. |
NonGenericInsertFrame(Int32, ImageFrame)
Implements InsertFrame(Int32, ImageFrame).
Declaration
protected abstract ImageFrame NonGenericInsertFrame(int index, ImageFrame source)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
ImageFrame | source | The frame. |
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
RemoveFrame(Int32)
Removes the frame at the specified index and frees all freeable resources associated with it.
Declaration
public abstract void RemoveFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the frame to remove. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Cannot remove last frame. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |