Class RasterList
- Namespace
- Egami
- Assembly
- Egami.dll
The images of a file that holds several, each its own raster with its own size, pixel type and metadata: a TIFF's pages, an icon's entries. The list owns them: disposing it disposes every raster.
public sealed class RasterList : IReadOnlyList<Raster>, IReadOnlyCollection<Raster>, IEnumerable<Raster>, IEnumerable, IDisposable
- Inheritance
-
RasterList
- Implements
- Inherited Members
Examples
// Every page at its own size and pixel type. The list owns the rasters.
using RasterList pages = Raster.LoadAll("scan.tif");
foreach (Raster page in pages)
{
Console.WriteLine($"{page.Width} × {page.Height}");
}
// Keep one page after the list is gone.
using Raster first = pages.Detach(0);
Remarks
Frames are for animation and share one size; images of different sizes come as a list. Take a raster out of the list with Detach(int) to keep it after the list is disposed.
Properties
Count
Gets the number of images.
public int Count { get; }
Property Value
this[int]
Gets an image.
public Raster this[int index] { get; }
Parameters
indexintIts position in the file's order.
Property Value
- Raster
The raster, still owned by the list.
Exceptions
- ArgumentOutOfRangeException
indexis outside the list.- InvalidOperationException
The raster was taken with Detach(int).
Methods
Detach(int)
Takes an image out of the list's ownership; the caller must dispose it. The list keeps an empty place.
public Raster Detach(int index)
Parameters
indexintThe image's position.
Returns
- Raster
The raster, now owned by the caller.
Examples
// Every page at its own size and pixel type. The list owns the rasters.
using RasterList pages = Raster.LoadAll("scan.tif");
foreach (Raster page in pages)
{
Console.WriteLine($"{page.Width} × {page.Height}");
}
// Keep one page after the list is gone.
using Raster first = pages.Detach(0);
Exceptions
- ArgumentOutOfRangeException
indexis outside the list.- InvalidOperationException
The raster was already taken.
Dispose()
Disposes every raster still in the list.
public void Dispose()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Raster> GetEnumerator()
Returns
- IEnumerator<Raster>
An enumerator that can be used to iterate through the collection.