Table of Contents

Class IcoEntry

Namespace
Egami.Formats.Ico
Assembly
Egami.dll

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

Width int

The width in pixels.

Height int

The height in pixels.

BitsPerPixel int

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.

Encoding IcoEntryEncoding

How the pixels are stored: Png or Bmp.

Hotspot Point?

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

int

Encoding

How the pixels are stored: Png or Bmp.

public IcoEntryEncoding Encoding { get; init; }

Property Value

IcoEntryEncoding

Height

The height in pixels.

public int Height { get; init; }

Property Value

int

Hotspot

The cursor's hotspot, or null in an icon.

public Point? Hotspot { get; init; }

Property Value

Point?

Width

The width in pixels.

public int Width { get; init; }

Property Value

int