ImageReader

Description

abstract class Tinman.Terrain.Imaging.ImageReader

Derived from

ImageReaderBase abstract

Default base class for IImageReader implementations that provides some more common functionality as ImageReaderBase.

Protected / Constructors

Image​Reader


protected constructor ImageReader → (1)

flags in : ReadImageFlags

The set of ReadImageFlags for this image reader.

Creates a new instance of ImageReader.

Subclasses must initialize the following fields (or agree to the default values):

Additionally, subclasses must call InitImageReader once.

Protected / Methods

Do​Read​All


[EmptyBody]
protected virtual method DoReadAll → ()

returns → ColorBuffer

The ColorBuffer or null if no image data has been read.

Reads the whole image and returns the ColorBuffer.

IOException

If an I/O error has occurred.

Do​Read​Scanline


protected abstract method DoReadScanline → (2)

scanlineY in : int32

Y-coordinate of the processed scanline.

scanline in : Scanline

Data buffer that holds the scanline bytes.

Processes the given scanline.

IOException

If an I/O error has occurred while processing the scanline.

Do​Skip​Scanlines


protected abstract method DoSkipScanlines → (1)

count in : int32

The number of scanlines to skip (will always be greater than zero).

Performs implementation specific actions for skipping scanlines.

The value of IImageReader.ScanlineY is updated by this class after the DoSkipScanlines returns.

IOException

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

Init​Coverage

2 overloads


protected method InitCoverage1 → (1)

coverage in : PixelCoverage

The pixel coverage.

Initializes the IImageInfo.Coverage property.


protected method InitCoverage2 → (2)

in : IImageInfo

First image info object to initialize from or null.

opt : IImageInfo = null

Second image info object to initialize from or null.

Initializes the IImageInfo.Coverage property.

If all non-null image info objects have the same pixel coverage, the IImageInfo.Coverage field will be set to the pixel coverage value of the first non-null image info object. Otherwise, the current value will be retained.

Init​File​Info


protected method InitFileInfo → (1)

in : IImageInfo

The image info from which to read the values. If null, the fields will not be updated.

Initializes the fileFormat and pathInfo fields.

Init​Gamma


protected method InitGamma → (1)

gamma in : float64

The gamma correction to apply (on top of InitGammaImplicit).

Initializes the IImageInfo.Gamma property.

Init​Gamma​Implicit


protected method InitGammaImplicit → (1)

gamma in : float64

The implicit gamma correction to apply.

Initializes the IImageInfo.Gamma property.

Init​Georef


protected method InitGeoref → (2)

in : IImageInfo

First image info object to initialize from or null.

opt : IImageInfo = null

Second image info object to initialize from or null.

Initializes the georef field.

If the current georef object is null, it will be set to the first non-null georef object (see IGeorefInfo.Georef) of the first non-null image info object. Otherwise, the current value will be retained.

Init​Image​Reader


protected method InitImageReader → (3)

width in : int32

[>0]
Image width, in pixels.

height in : int32

[>0]
Image height, in pixels.

pixelFormat opt : PixelFormat = PixelFormat.Unknown

The final pixel format. If PixelFormat.Unknown, the current pixel format will be used.

Initializes the ImageReader.

The following fields are initialized by this method:

This method must be called once during initialization.

When IImageOps.SetRange has not been called yet, this method will do so, passing PixelRange.Identity as argument.

Init​Layer

2 overloads


protected method InitLayer1 → (2)

layer in : HeightmapLayer

The heightmap layer.

format opt : PixelFormat = PixelFormat.Unknown

The layer pixel format.

Initializes the IImageInfo.Layer property.


protected method InitLayer2 → (2)

in : IImageInfo

First image info object to initialize from or null.

opt : IImageInfo = null

Second image info object to initialize from or null.

Initializes the IImageInfo.Layer property.

If the current layer value is HeightmapLayer.None, it will be set to the first height layer value different to HeightmapLayer.None (see IImageInfo.Layer) of the first non-null image info object. Otherwise, the current value will be retained.

Init​No​Data


protected method InitNoData → (1)

noData in : float64

The nodata value or Maths.NanD.

Initializes the IImageInfo.NoData property.

Init​Range


protected method InitRange → (2)

range in : PixelRange

The pixel range.

reinterpret opt : bool = false

Use identity transform instead of PixelRange.Transform?

Initializes the IImageInfo.Range property.

Init​Range​Implicit


protected method InitRangeImplicit → (1)

range in : PixelRange

The implicit pixel range.

Initializes the IImageInfo.Range property.

Init​Values


protected method InitValues → (1)

values in : RangeD

The property value.

Initializes the IImageInfo.Values property.

Not​Supported


protected static method NotSupported → (1)

feature in : string

Describes the feature that is not supported.

returns → IValidateMessage

The ready-to-throw exception.

A feature of a binary data format is not supported.

Sample​Format


protected method SampleFormat → (1)

value in : int32

The sample format code (see remarks).

Chooses the binary sample format.

Setting this property will reset the normalization value range:

The SampleRead method will use the binary sample format that has been specified here. Specifying a 16-bit format will add the PixelFormat.SixteenBits flag to pixelFormat; specifying a floating-point format will add the PixelFormat.Precision flag to pixelFormat.

Sample​Read


protected method SampleRead → (1)

stream in : IDataStream

The IDataStream to read from.

returns → int32

The sample value or -1 if void.

Reads the next sample from the image data, normalizes it, applies gamma correction and returns the resulting value as a 24-bit unsigned integer.

IOException

If an I/O error has occurred.

Sample​Read​No​Gamma


protected method SampleReadNoGamma → (1)

stream in : IDataStream

The IDataStream to read from.

returns → int32

The sample value or -1 if void.

Reads the next sample from the image data, normalizes it and returns the resulting value as a 24-bit unsigned integer.

IOException

If an I/O error has occurred.

Sample​Skip


protected method SampleSkip → (1)

stream in : IDataStream

The IDataStream to read from.

Skips the next sample from the image data.

IOException

If an I/O error has occurred.

Sample​Translate


protected method SampleTranslate → (1)

sample in : float64

The sample value.

returns → int32

The translated sample value or -1 if no data.

Translates the given sample value to [0..16777215]. The translated sample value is clamped to the output range.

Sample​Translate​No​Gamma


protected method SampleTranslateNoGamma → (1)

sample in : float64

The sample value.

returns → int32

The translated sample value or -1 if no data.

Translates the given sample value to [0..16777215], skipping gamma correction. The translated sample value is clamped to the output range.

Scanline​Translate


protected method ScanlineTranslate → (1)

scanline in : Scanline

The scanline to process.

Translates all samples in the given scanline.

Protected / Attributes

file​Format


protected attribute fileFormat → (ImageFormat)

The image file format (see ImageFormat).

Subclasses are supposed to initialize this value.

The default value is ImageFormat.Any.

georef


protected attribute georef → (Raster)

The georef info object (see IGeorefInfo.Georef).

Subclasses are supposed to fill in this value.

The default value is null.

height


protected attribute height → (int32)

Height of the processed image.

The value of this field must not be set explicitly. It will be initialized when the InitImageReader method is called.

path​Info


protected attribute pathInfo → (Path)

The image file path (see IPathInfo.PathInfo).

Subclasses are supposed to fill in this value.

The default value is Path.Unknown.

pixel​Format


protected attribute pixelFormat → (PixelFormat)

The pixel format of the read image.

The value of this field can be set explicitly. It can be initialized when the InitImageReader method is called.

validator


protected attribute validator → (Validator)

The validator object can be used by subclasses to report errors while reading images.

width


protected attribute width → (int32)

Width of the processed image.

The value of this field must not be set explicitly. It will be initialized when the InitImageReader method is called.