Class ImageFrameCollection<TPixel>
Encapsulates a pixel-specific collection of ImageFrame<TPixel> instances that make up an Image<TPixel>.
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class ImageFrameCollection<TPixel> : ImageFrameCollection, IDisposable, IEnumerable<ImageFrame>, IEnumerable<ImageFrame<TPixel>>, IEnumerable where TPixel : struct, IPixel<TPixel>
Type Parameters
Name | Description |
---|---|
TPixel | The type of the pixel. |
Properties
| Improve this Doc View SourceCount
Gets the number of frames.
Declaration
public override int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceItem[Int32]
Gets the ImageFrame<TPixel> at the specified index.
Declaration
public ImageFrame<TPixel> this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Property Value
Type | Description |
---|---|
ImageFrame<TPixel> | The ImageFrame<TPixel>. |
NonGenericRootFrame
Gets the root frame. (Implements RootFrame.)
Declaration
protected override ImageFrame NonGenericRootFrame { get; }
Property Value
Type | Description |
---|---|
ImageFrame |
Overrides
| Improve this Doc View SourceRootFrame
Gets the root frame.
Declaration
public ImageFrame<TPixel> RootFrame { get; }
Property Value
Type | Description |
---|---|
ImageFrame<TPixel> |
Methods
| Improve this Doc View SourceAddFrame(TPixel[])
Creates a new frame from the pixel data with the same dimensions as the other frames and inserts the new frame at the end of the collection.
Declaration
public ImageFrame<TPixel> AddFrame(TPixel[] source)
Parameters
Type | Name | Description |
---|---|---|
TPixel[] | source | The raw pixel data to generate the ImageFrame<TPixel> from. |
Returns
Type | Description |
---|---|
ImageFrame<TPixel> | The new ImageFrame<TPixel>. |
AddFrame(ImageFrame<TPixel>)
Clones the source
frame and appends the clone to the end of the collection.
Declaration
public ImageFrame<TPixel> AddFrame(ImageFrame<TPixel> source)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame<TPixel> | source | The raw pixel data to generate the ImageFrame<TPixel> from. |
Returns
Type | Description |
---|---|
ImageFrame<TPixel> | The cloned ImageFrame<TPixel>. |
AddFrame(ReadOnlySpan<TPixel>)
Creates a new frame from the pixel data with the same dimensions as the other frames and inserts the new frame at the end of the collection.
Declaration
public ImageFrame<TPixel> AddFrame(ReadOnlySpan<TPixel> source)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<TPixel> | source | The raw pixel data to generate the ImageFrame<TPixel> from. |
Returns
Type | Description |
---|---|
ImageFrame<TPixel> | The new 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<TPixel> CloneFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the frame to clone. |
Returns
Type | Description |
---|---|
Image<TPixel> | The new Image<TPixel> with the specified frame. |
Contains(ImageFrame)
Determines whether the ImageFrameCollection<TPixel> contains the frame
.
Declaration
public override bool Contains(ImageFrame frame)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame | frame | The frame. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
| Improve this Doc View SourceContains(ImageFrame<TPixel>)
Determines whether the ImageFrameCollection<TPixel> contains the frame
.
Declaration
public bool Contains(ImageFrame<TPixel> frame)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame<TPixel> | 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<TPixel> CreateFrame()
Returns
Type | Description |
---|---|
ImageFrame<TPixel> | The new ImageFrame<TPixel>. |
CreateFrame(TPixel)
Creates a new ImageFrame<TPixel> and appends it to the end of the collection.
Declaration
public ImageFrame<TPixel> CreateFrame(TPixel backgroundColor)
Parameters
Type | Name | Description |
---|---|---|
TPixel | backgroundColor | The background color to initialize the pixels with. |
Returns
Type | Description |
---|---|
ImageFrame<TPixel> | The new ImageFrame<TPixel>. |
Dispose(Boolean)
Disposes the object and frees resources for the Garbage Collector.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | Whether to dispose of managed and unmanaged objects. |
Overrides
| Improve this Doc View SourceExportFrame(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<TPixel> ExportFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the frame to export. |
Returns
Type | Description |
---|---|
Image<TPixel> | 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 override 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. |
Overrides
| Improve this Doc View SourceIndexOf(ImageFrame<TPixel>)
Determines the index of a specific frame
in the ImageFrameCollection<TPixel>.
Declaration
public int IndexOf(ImageFrame<TPixel> frame)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame<TPixel> | frame | The ImageFrame<TPixel> to locate in the ImageFrameCollection<TPixel>. |
Returns
Type | Description |
---|---|
Int32 | The index of item if found in the list; otherwise, -1. |
InsertFrame(Int32, ImageFrame<TPixel>)
Clones and inserts the source
into the ImageFrameCollection<TPixel> at the specified index
.
Declaration
public ImageFrame<TPixel> InsertFrame(int index, ImageFrame<TPixel> source)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index to insert the frame at. |
ImageFrame<TPixel> | source | The ImageFrame<TPixel> to clone and insert into the ImageFrameCollection<TPixel>. |
Returns
Type | Description |
---|---|
ImageFrame<TPixel> | The cloned ImageFrame<TPixel>. |
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 override 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. |
Overrides
| Improve this Doc View SourceNonGenericAddFrame(ImageFrame)
Implements AddFrame(ImageFrame).
Declaration
protected override ImageFrame NonGenericAddFrame(ImageFrame source)
Parameters
Type | Name | Description |
---|---|---|
ImageFrame | source | The frame. |
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
Overrides
| Improve this Doc View SourceNonGenericCloneFrame(Int32)
Implements CloneFrame(Int32).
Declaration
protected override Image NonGenericCloneFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
Image | The new image. |
Overrides
| Improve this Doc View SourceNonGenericCreateFrame()
Implements CreateFrame().
Declaration
protected override ImageFrame NonGenericCreateFrame()
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
Overrides
| Improve this Doc View SourceNonGenericCreateFrame(Color)
Implements CreateFrame().
Declaration
protected override ImageFrame NonGenericCreateFrame(Color backgroundColor)
Parameters
Type | Name | Description |
---|---|---|
Color | backgroundColor | The background color. |
Returns
Type | Description |
---|---|
ImageFrame | The new frame. |
Overrides
| Improve this Doc View SourceNonGenericExportFrame(Int32)
Implements ExportFrame(Int32).
Declaration
protected override Image NonGenericExportFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
Image | The new image. |
Overrides
| Improve this Doc View SourceNonGenericGetEnumerator()
Implements GetEnumerator().
Declaration
protected override IEnumerator<ImageFrame> NonGenericGetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<ImageFrame> | The enumerator. |
Overrides
| Improve this Doc View SourceNonGenericGetFrame(Int32)
Implements the getter of the indexer.
Declaration
protected override ImageFrame NonGenericGetFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
ImageFrame | The frame. |
Overrides
| Improve this Doc View SourceNonGenericInsertFrame(Int32, ImageFrame)
Implements InsertFrame(Int32, ImageFrame).
Declaration
protected override 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. |
Overrides
| Improve this Doc View SourceRemoveFrame(Int32)
Removes the frame at the specified index and frees all freeable resources associated with it.
Declaration
public override void RemoveFrame(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the frame to remove. |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Cannot remove last frame. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable<ImageFrame<TPixel>>.GetEnumerator()
Declaration
IEnumerator<ImageFrame<TPixel>> IEnumerable<ImageFrame<TPixel>>.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<ImageFrame<TPixel>> |
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |