Skip to main content

PictureFormats class

Namespace: Arlecchino.Pictures · Assembly: Arlecchino.Pictures

The formats that can be read, and the two questions asked of them: which format a file is, and what it holds. A file is recognized by what is in it rather than by what it is called.

public static class PictureFormats

Fields

MemberSummary
DefaultPixelsHow many pixels are read at once when a caller does not say. A header states its own size, so a small file can ask for an enormous picture.

Properties

MemberSummary
AllEvery format that is read, in the order a file is offered to them.

Methods

MemberSummary
For(ReadOnlySpan<byte>)Which format the file is.
Read(ReadOnlySpan<byte>)Reads a picture of whichever format it turns out to be.
Read(ReadOnlySpan<byte>, PictureLimits)Reads a picture of whichever format it turns out to be.

Fields in detail

DefaultPixels

public static int DefaultPixels { get; }

How many pixels are read at once when a caller does not say. A header states its own size, so a small file can ask for an enormous picture.

Type int

Properties in detail

All

public static IReadOnlyList<IPictureFormat> All { get; }

Every format that is read, in the order a file is offered to them.

Type IReadOnlyList<T><IPictureFormat>

Methods in detail

For(ReadOnlySpan<byte>)

public static IPictureFormat? For(ReadOnlySpan<byte> head);

Which format the file is.

Parameters

NameTypeDescription
headReadOnlySpan<T><byte>The head of a file; the signatures are all short.

Returns IPictureFormat — The format, or null when none of them claims it.

Read(ReadOnlySpan<byte>)

public static Raster? Read(ReadOnlySpan<byte> bytes);

Reads a picture of whichever format it turns out to be.

Parameters

NameTypeDescription
bytesReadOnlySpan<T><byte>The whole file.

Returns Raster — The pixels, or null when nothing here can read it.

Read(ReadOnlySpan<byte>, PictureLimits)

public static Raster? Read(ReadOnlySpan<byte> bytes, PictureLimits limits);

Reads a picture of whichever format it turns out to be.

Parameters

NameTypeDescription
bytesReadOnlySpan<T><byte>The whole file.
limitsPictureLimitsWhat the caller will hold and what it has a use for.

Returns Raster — The pixels, or null when nothing here can read it.