interface Tinman.Terrain.Imaging.IImageReader

Base interface for classes that read images sequentially by scanline.

When an image is read, the following processing is performed:

  1. Images are read one scanline at a time (see Scanline), starting with the scanline at image pixel Y-coordinate zero. The color channels ( PixelChannel.Red, PixelChannel.Green, PixelChannel.Blue, PixelChannel.Intensity) and / or alpha channel (PixelChannel.Alpha) of each raw pixel in a scanline are processed as described below.

  2. Void regions (see IImageInfo.NoData):
    If any channel value of the raw pixel is equal to the no-data value, the output pixel is set to void (see Scanline.Set_Void) and further processing is skipped.

  3. Range normalization (see IImageInfo.Range):
    A linear transformation (see PixelRange.Transform) is applied to all channel values of the raw pixel, outputting a normalized pixel.

  4. Gamma correction (see IImageInfo.Gamma):
    The color channel values of the normalized pixel are fed into the gamma correction formula, producing the color channel values of the linear pixel. Gamma correction is not applied to alpha channel values.

  5. The channel values of the linear pixel are clamped to the range [0..16777215] and round to 24-bit integer values (see Scanline.Pixels).

Public / Methods


public method ReadAll → ()

returns → ColorBuffer

The color buffer.

Reads the entire image into a color buffer.

This method must only be called when the current scanline is zero (see ScanlineY). An implementation should delegate to ColorBuffer.FromImage4, unless it is capable of providing a more efficient way.


If an I/O error has occurred while reading scanline data.


public method ReadScanline → (1)

scanline in : Scanline

The output buffer for the read scanline pixels.

returns → int32

Y-coordinate of processed scanline.

Reads the next scanline.


If an I/O error has occurred while reading scanline data.


public method ReadValues → ()

Enables computation of the range of raw pixel values.

When this method is called, the raw pixel value range (see IImageInfo.Values) is reset and subsequent calls to ReadScanline will update it, according to the actual raw pixel values that have been read.


public method ReadValuesAll → ()

returns → RangeD

The raw pixel value range.

Reads the entire image to build the raw pixel value range.

This method is used when the additional pass over the image data is triggered by the use of ReadImageFlags.Range.


If an I/O error has occurred while reading scanline data.


public method SkipScanlines → (1)

count in : int32

The number of scanlines to skip.

Skips the given number of scanlines.


If an I/O error has occurred while skipping scanline data.

Public / Attributes


public attribute HasFinished → (get)

value : bool

true if the whole image has been read, false if not.

Has the image reader finished (i.e. the whole image has been read)?


public attribute ScanlineY → (get)

value : int32

The scanline Y-coordinate.

The Y-coordinate that will be read upon the next call to ReadScanline.