ImageReader
Description
- Derived from
-
ImageReaderBase abstract
Default base class for IImageReader implementations that provides some more common functionality as ImageReaderBase.
Protected / Constructors
ImageReader
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
DoReadAll
Reads the whole image and returns the ColorBuffer.
- IOException
-
If an I/O error has occurred.
DoReadScanline
Processes the given scanline.
- IOException
-
If an I/O error has occurred while processing the scanline.
DoSkipScanlines
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.
InitCoverage
2 overloads
Initializes the IImageInfo.Coverage property.
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.
InitGeoref
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.
InitImageReader
Initializes the ImageReader.
The following fields are initialized by this method:
-
width
-
height
-
pixelFormat
If pixelFormat opt is not PixelFormat.Unknown. -
IImageInfo.Layer
If IImageInfo.Layer is equal to HeightmapLayer.None, it will be set to HeightmapLayer.Elevation resp. HeightmapLayer.Texture when the final pixel format is PixelFormat.Grayscale resp. PixelFormat.Truecolor.
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.
InitLayer
2 overloads
Initializes the IImageInfo.Layer property.
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.
SampleFormat
Chooses the binary sample format.
Setting this property will reset the normalization value range:
-
-2
: 16-bit signed integer => PixelRange.DefaultInt16 -
-1
: 8-bit signed integer => PixelRange.DefaultInt8 -
0
: 32-bit floating point => PixelRange.DefaultFloat32 -
1
: 8-bit unsigned integer => PixelRange.DefaultUInt8 -
2
: 16-bit unsigned integer => PixelRange.DefaultUInt16
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.
- See also
SampleRead
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.
- See also
SampleReadNoGamma
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.
- See also
SampleSkip
Skips the next sample from the image data.
- IOException
-
If an I/O error has occurred.
- See also
SampleTranslate
Translates the given sample value to [0..16777215]
. The translated sample value is clamped to the output range.
Protected / Attributes
fileFormat
The image file format (see ImageFormat).
Subclasses are supposed to initialize this value.
The default value is ImageFormat.Any.
georef
The georef info object (see IGeorefInfo.Georef).
Subclasses are supposed to fill in this value.
The default value is null
.
height
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.
pathInfo
The image file path (see IPathInfo.PathInfo).
Subclasses are supposed to fill in this value.
The default value is Path.Unknown.
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.
width
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.