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 : IDisposable, IEnumerable<ImageFrame>, IEnumerable
Properties
| Edit this page View SourceCount
Gets the number of frames.
Declaration
public abstract int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Gets the ImageFrame at the specified index.
Declaration
public ImageFrame this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | 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
| Edit this page 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(int)
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 |
---|---|---|
int | 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 |
---|---|
bool |
|
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>. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Disposes the object and frees resources for the Garbage Collector.
Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Whether to dispose of managed and unmanaged objects. |
EnsureNotDisposed()
Throws ObjectDisposedException if the image frame is disposed.
Declaration
protected void EnsureNotDisposed()
ExportFrame(int)
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 |
---|---|---|
int | 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. |
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 |
---|---|
int | The index of item if found in the list; otherwise, -1. |
InsertFrame(int, 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 |
---|---|---|
int | 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(int, int)
Moves an ImageFrame<TPixel> from sourceIndex
to destinationIndex
.
Declaration
public abstract void MoveFrame(int sourceIndex, int destinationIndex)
Parameters
Type | Name | Description |
---|---|---|
int | sourceIndex | The zero-based index of the frame to move. |
int | 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(int)
Implements CloneFrame(int).
Declaration
protected abstract Image NonGenericCloneFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
int | 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(int)
Implements ExportFrame(int).
Declaration
protected abstract Image NonGenericExportFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
int | 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(int)
Implements the getter of the indexer.
Declaration
protected abstract ImageFrame NonGenericGetFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index. |
Returns
Type | Description |
---|---|
ImageFrame | The frame. |
NonGenericInsertFrame(int, ImageFrame)
Implements InsertFrame(int, ImageFrame).
Declaration
protected abstract ImageFrame NonGenericInsertFrame(int index, ImageFrame source)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index. |
ImageFrame | source | The frame. |
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
RemoveFrame(int)
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 |
---|---|---|
int | index | The zero-based index of the frame to remove. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Cannot remove last frame. |