Class IcoEntry
One entry of an icon's directory, as read from the entry's own header.
public sealed record IcoEntry : IEquatable<IcoEntry>
- Inheritance
-
IcoEntry
- Implements
- Inherited Members
Examples
// Probe reads only the directory: the sizes an icon holds, without decoding a pixel.
RasterInfo info = Raster.Probe("app.ico");
Console.WriteLine($"{info.ImageCount} entries; Load gives {info.Width}×{info.Height}");
using Raster best = Raster.Load("app.ico");
foreach (IcoEntry entry in ((IcoDetails)best.Metadata.FormatDetails!).Entries)
{
Console.WriteLine($"{entry.Width}×{entry.Height}, {entry.BitsPerPixel} bits, {entry.Encoding}");
}
Constructors
IcoEntry(int, int, int, IcoEntryEncoding, Point?)
One entry of an icon's directory, as read from the entry's own header.
public IcoEntry(int Width, int Height, int BitsPerPixel, IcoEntryEncoding Encoding, Point? Hotspot)
Parameters
WidthintThe width in pixels.
HeightintThe height in pixels.
BitsPerPixelintThe bits a pixel: 1, 4, 8, 16, 24 or 32 for BMP entries; the PNG's bit depth times its channels for PNG entries.
EncodingIcoEntryEncodingHotspotPoint?The cursor's hotspot, or null in an icon.
Examples
// Probe reads only the directory: the sizes an icon holds, without decoding a pixel.
RasterInfo info = Raster.Probe("app.ico");
Console.WriteLine($"{info.ImageCount} entries; Load gives {info.Width}×{info.Height}");
using Raster best = Raster.Load("app.ico");
foreach (IcoEntry entry in ((IcoDetails)best.Metadata.FormatDetails!).Entries)
{
Console.WriteLine($"{entry.Width}×{entry.Height}, {entry.BitsPerPixel} bits, {entry.Encoding}");
}
Properties
BitsPerPixel
The bits a pixel: 1, 4, 8, 16, 24 or 32 for BMP entries; the PNG's bit depth times its channels for PNG entries.
public int BitsPerPixel { get; init; }
Property Value
Encoding
public IcoEntryEncoding Encoding { get; init; }
Property Value
Height
The height in pixels.
public int Height { get; init; }
Property Value
Hotspot
The cursor's hotspot, or null in an icon.
public Point? Hotspot { get; init; }
Property Value
Width
The width in pixels.
public int Width { get; init; }