Table of Contents

Class FrameList<TPixel>

Namespace
Egami
Assembly
Egami.dll

The frames of a raster, all the same size and pixel type. There is always at least one. Frames added from anywhere are copied, so a frame belongs to one raster only.

public sealed class FrameList<TPixel> : IReadOnlyList<Frame<TPixel>>, IReadOnlyCollection<Frame<TPixel>>, IEnumerable<Frame<TPixel>>, IEnumerable where TPixel : unmanaged, IPixelType<TPixel>

Type Parameters

TPixel

The pixel type.

Inheritance
FrameList<TPixel>
Implements
Inherited Members

Examples

using Raster<Rgba8> clip = Raster.Load<Rgba8>("pan.gif");
FrameList<Rgba8> frames = clip.Frames;

// Play the clip forward and then backward: append the middle frames in reverse.
for (int i = frames.Count - 2; i > 0; i--)
{
    Frame<Rgba8> copy = frames.Add(frames[i]);
    copy.Metadata.Delay = TimeSpan.FromMilliseconds(80);
    copy.Metadata.Disposal = FrameDisposal.None;
    copy.Metadata.Blend = FrameBlend.Source;
}

frames.RemoveAt(0);
clip.Save("pan-bounce.gif");

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

this[int]

Gets the element at the specified index in the read-only list.

public Frame<TPixel> this[int index] { get; }

Parameters

index int

The zero-based index of the element to get.

Property Value

Frame<TPixel>

The element at the specified index in the read-only list.

Methods

Add(Frame<TPixel>)

Appends a copy of frame's pixels and metadata, from this raster or another.

public Frame<TPixel> Add(Frame<TPixel> frame)

Parameters

frame Frame<TPixel>

The frame to copy. It must be the raster's size.

Returns

Frame<TPixel>

The new frame.

Exceptions

ArgumentException

The frame is not the raster's size.

LimitExceededException

All frames together would break MaxTotalBytes.

ObjectDisposedException

The raster has been disposed.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<Frame<TPixel>> GetEnumerator()

Returns

IEnumerator<Frame<TPixel>>

An enumerator that can be used to iterate through the collection.

Insert(int, Frame<TPixel>)

Inserts a copy of frame's pixels and metadata at index.

public Frame<TPixel> Insert(int index, Frame<TPixel> frame)

Parameters

index int

Where the copy goes, 0 to Count.

frame Frame<TPixel>

The frame to copy. It must be the raster's size.

Returns

Frame<TPixel>

The new frame.

Exceptions

ArgumentOutOfRangeException

index is outside 0 to Count.

ArgumentException

The frame is not the raster's size.

LimitExceededException

All frames together would break MaxTotalBytes.

ObjectDisposedException

The raster has been disposed.

Move(int, int)

Moves the frame at from to to, without copying pixels.

public void Move(int from, int to)

Parameters

from int

The frame to move.

to int

Its new position, counted after it is taken out.

Exceptions

ArgumentOutOfRangeException

An index is not a frame.

ObjectDisposedException

The raster has been disposed.

RemoveAt(int)

Removes the frame at index and returns its memory.

public void RemoveAt(int index)

Parameters

index int

The frame to remove.

Exceptions

ArgumentOutOfRangeException

index is not a frame.

InvalidOperationException

It is the only frame; a raster always has one.

ObjectDisposedException

The raster has been disposed.