Skip to content

TiffCodec

Namespace: ThinkGeo.Core.LibTiff

Base class for all codecs within the library.

public class TiffCodec

Inheritance ObjectTiffCodec

Remarks:

A codec is a class that implements decoding, encoding, or decoding and encoding of a compression algorithm.

The library provides a collection of builtin codecs. More codecs may be registered through calls to the library and/or the builtin implementations may be overridden.

Properties

CanEncode

Gets a value indicating whether this codec can encode data.

public bool CanEncode { get; }

Property Value

Boolean
true if this codec can encode data; otherwise, false.

CanDecode

Gets a value indicating whether this codec can decode data.

public bool CanDecode { get; }

Property Value

Boolean
true if this codec can decode data; otherwise, false.

Constructors

TiffCodec(Tiff, Compression, String)

Initializes a new instance of the TiffCodec class.

public TiffCodec(Tiff tif, Compression scheme, string name)

Parameters

tif Tiff
An instance of class.

scheme Compression
The compression scheme for the codec.

name String
The name of the codec.

Methods

Init()

Initializes this instance.

public bool Init()

Returns

Boolean
true if initialized successfully

SetupDecode()

Setups the decoder part of the codec.

public bool SetupDecode()

Returns

Boolean
true if this codec successfully setup its decoder part and can decode data; otherwise, false.

Remarks:

SetupDecode is called once before TiffCodec.PreDecode(Int16).

PreDecode(Int16)

Prepares the decoder part of the codec for a decoding.

public bool PreDecode(short plane)

Parameters

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if this codec successfully prepared its decoder part and ready to decode data; otherwise, false.

Remarks:

PreDecode is called after and before decoding.

DecodeRow(Byte[], Int32, Int32, Int16)

Decodes one row of image data.

public bool DecodeRow(Byte[] buffer, int offset, int count, short plane)

Parameters

buffer Byte[]
The buffer to place decoded image data to.

offset Int32
The zero-based byte offset in at which to begin storing decoded bytes.

count Int32
The number of decoded bytes that should be placed to .

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if image data was decoded successfully; otherwise, false.

DecodeStrip(Byte[], Int32, Int32, Int16)

Decodes one strip of image data.

public bool DecodeStrip(Byte[] buffer, int offset, int count, short plane)

Parameters

buffer Byte[]
The buffer to place decoded image data to.

offset Int32
The zero-based byte offset in at which to begin storing decoded bytes.

count Int32
The number of decoded bytes that should be placed to .

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if image data was decoded successfully; otherwise, false.

DecodeTile(Byte[], Int32, Int32, Int16)

Decodes one tileView of image data.

public bool DecodeTile(Byte[] buffer, int offset, int count, short plane)

Parameters

buffer Byte[]
The buffer to place decoded image data to.

offset Int32
The zero-based byte offset in at which to begin storing decoded bytes.

count Int32
The number of decoded bytes that should be placed to .

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if image data was decoded successfully; otherwise, false.

SetupEncode()

Setups the encoder part of the codec.

public bool SetupEncode()

Returns

Boolean
true if this codec successfully setup its encoder part and can encode data; otherwise, false.

Remarks:

SetupEncode is called once before TiffCodec.PreEncode(Int16).

PreEncode(Int16)

Prepares the encoder part of the codec for a encoding.

public bool PreEncode(short plane)

Parameters

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if this codec successfully prepared its encoder part and ready to encode data; otherwise, false.

Remarks:

PreEncode is called after and before encoding.

PostEncode()

Performs any actions after encoding required by the codec.

public bool PostEncode()

Returns

Boolean
true if all post-encode actions succeeded; otherwise, false

Remarks:

PostEncode is called after encoding and can be used to release any external resources needed during encoding.

EncodeRow(Byte[], Int32, Int32, Int16)

Encodes one row of image data.

public bool EncodeRow(Byte[] buffer, int offset, int count, short plane)

Parameters

buffer Byte[]
The buffer with image data to be encoded.

offset Int32
The zero-based byte offset in at which to begin read image data.

count Int32
The maximum number of encoded bytes that can be placed to .

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if image data was encoded successfully; otherwise, false.

EncodeStrip(Byte[], Int32, Int32, Int16)

Encodes one strip of image data.

public bool EncodeStrip(Byte[] buffer, int offset, int count, short plane)

Parameters

buffer Byte[]
The buffer with image data to be encoded.

offset Int32
The zero-based byte offset in at which to begin read image data.

count Int32
The maximum number of encoded bytes that can be placed to .

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if image data was encoded successfully; otherwise, false.

EncodeTile(Byte[], Int32, Int32, Int16)

Encodes one tileView of image data.

public bool EncodeTile(Byte[] buffer, int offset, int count, short plane)

Parameters

buffer Byte[]
The buffer with image data to be encoded.

offset Int32
The zero-based byte offset in at which to begin read image data.

count Int32
The maximum number of encoded bytes that can be placed to .

plane Int16
The zero-based sample plane index.

Returns

Boolean
true if image data was encoded successfully; otherwise, false.

Close()

Flushes any internal data buffers and terminates current operation.

public void Close()

Seek(Int32)

Seeks the specified row in the strip being processed.

public bool Seek(int row)

Parameters

row Int32
The row to seek.

Returns

Boolean
true if specified row was successfully found; otherwise, false

Cleanup()

Cleanups the state of the codec.

public void Cleanup()

Remarks:

Cleanup is called when codec is no longer needed (won't be used) and can be used for example to restore tag methods that were substituted.

DefStripSize(Int32)

Calculates and/or constrains a strip size.

public int DefStripSize(int size)

Parameters

size Int32
The proposed strip size (may be zero or negative).

Returns

Int32
A strip size to use.

DefTileSize(Int32&, Int32&)

Calculate and/or constrains a tileView size

public void DefTileSize(Int32& width, Int32& height)

Parameters

width Int32&
The proposed tileView width upon the call / tileView width to use after the call.

height Int32&
The proposed tileView height upon the call / tileView height to use after the call.