Namespace Egami.Formats
Classes
- EgamiInput
The data a reader decodes: the caller's stream behind a pooled 64 KB buffer, with exact-read helpers. It also carries the context, limits and cancellation token for the load, and is the only way a reader allocates pixel memory.
- EncodeStart<TPixel>
What an encode starts from: the size, metadata and options, and the whole image when Save has one.
- FormatInfo
Describes a file format: its names, how to recognize it, and its reader and writer.
- RasterInfo
What a file's header says, read without decoding pixels.
- ReaderOptions
Options for reading. The defaults read everything leniently. Formats with options of their own derive from it, such as JpegReaderOptions.
- RowEncoder<TPixel>
One encode in progress: a still image's rows top-down with WriteRow(ReadOnlySpan<TPixel>), or whole frames with WriteFrame(Frame<TPixel>), then Complete().
- RowReader
One open image, as a format reader streams it: frames of rows at the stored size. Derive from RowReader<TNatural>, which names the natural pixel type.
- RowReader<TNatural>
An open image whose natural pixel type is
TNatural, as Load(Stream, EgamiContext?, ReaderOptions?) would give it.
- SampleImage
An image as its codestream stores it: every component's samples at their own precision and sign, with no color conversion, widening or offset. For a container that keeps its own pixel description, such as DICOM, which needs the stored values to apply its rescale, window and color rules itself. JPEG (baseline, extended 12-bit and lossless at 2 to 16 bits), JPEG 2000 and JPEG XL load this way.
- WriterOptions
Options for writing. Each format has a subclass with its own settings; writers given this base class use their defaults.
Structs
- SampleComponent
One component of a SampleImage.
Interfaces
- IFormatConverter
A writer that can convert a file of another format to its own without decoding it to pixels first, such as camera RAW data copied into a DNG unchanged. Transcode(string, string, Action<RasterOps>?, ReaderOptions?, WriterOptions?, EgamiContext?) asks the output format's writer when there are no operations and the reader options ask for nothing beyond the format's defaults; a writer that declines is used as usual.
- IFormatReader
Reads one file format. Readers are stateless and safe to share across threads. They read only through EgamiInput and allocate pixel memory only through CreateRaster<TPixel>(long, long, ClearMode), which checks the safety limits first, so no reader can allocate before the size has been checked.
- IFormatWriter
Writes one file format. Writers are stateless, safe to share across threads, and never change the raster they are given.
- IMultiImageReader
An optional interface for a format's reader whose files hold several images (TIFF pages, icon entries, DDS surfaces). LoadAll(Stream, EgamiContext?, ReaderOptions?) asks it for one options value per image and loads each as Load would, so every Load feature applies to each image. The options a reader returns name the image in a way its own IFormatReader understands, usually a ReaderOptions subclass of the format's own.
- IMultiImageWriter
An optional interface for a format's writer whose files hold several images (TIFF pages, icon entries, DDS texture arrays and cube maps), for SaveAll(IEnumerable<Raster>, Stream, FormatInfo, WriterOptions?). Without it, SaveAll takes one raster and writes it as Save would.
- IRowFormatReader
An optional interface for a format's reader: an open image that hands out rows as they are asked for, so RasterDecoder streams the format, with Region and MinimumSize applied on the way out. A reader without it still works everywhere: the decoder reads the whole image with Read(EgamiInput, ReaderOptions) and serves rows from it. Load, Probe and an incremental decode keep using IFormatReader.
- IRowFormatWriter
An optional interface for a format's writer: an encoder that takes rows and frames one at a time. A writer that implements it streams through RasterEncoder<TPixel> and Transcode(Stream, Stream, FormatInfo, Action<RasterOps>?, ReaderOptions?, WriterOptions?, EgamiContext?), and Save(Stream, FormatInfo, WriterOptions?) and SaveAsync use it in place of Write<TPixel>(Raster<TPixel>, Stream, WriterOptions), so all of them write the same bytes. A writer without it still works everywhere: the encoder gathers the image and calls Write<TPixel>(Raster<TPixel>, Stream, WriterOptions) at the end.
Enums
- RasterAccess
How a decode produces rows, as Access reports it.
- RecoveryMode
How a reader handles damaged data.
- SampleColor
What the components of a SampleImage are.
- SaveKeeps
What a writer keeps of a raster, as it is about to write it, for ReportLosses(string, SaveKeeps): everything the raster has that is not named here is reported as lost.
Delegates
- SignatureMatcher
Returns whether the first bytes of a file belong to a format.