Class TiffCodec
Base class for all codecs within the library.
Inheritance
Inherited Members
Namespace: BitMiracle.LibTiff.Classic
Assembly: BitMiracle.LibTiff.NET.dll
Syntax
public class TiffCodec
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.
Constructors
| Improve this Doc View SourceTiffCodec(Tiff, Compression, String)
Initializes a new instance of the TiffCodec class.
Declaration
public TiffCodec(Tiff tif, Compression scheme, string name)
Parameters
Type | Name | Description |
---|---|---|
Tiff | tif | An instance of Tiff class. |
Compression | scheme | The compression scheme for the codec. |
System.String | name | The name of the codec. |
Fields
| Improve this Doc View Sourcem_name
Codec name.
Declaration
protected string m_name
Field Value
Type | Description |
---|---|
System.String |
m_scheme
Compression scheme this codec impelements.
Declaration
protected Compression m_scheme
Field Value
Type | Description |
---|---|
Compression |
m_tif
An instance of Tiff.
Declaration
protected Tiff m_tif
Field Value
Type | Description |
---|---|
Tiff |
Properties
| Improve this Doc View SourceCanDecode
Gets a value indicating whether this codec can decode data.
Declaration
public virtual bool CanDecode { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
CanEncode
Gets a value indicating whether this codec can encode data.
Declaration
public virtual bool CanEncode { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceCleanup()
Cleanups the state of the codec.
Declaration
public virtual 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.
Close()
Flushes any internal data buffers and terminates current operation.
Declaration
public virtual void Close()
DecodeRow(Byte[], Int32, Int32, Int16)
Decodes one row of image data.
Declaration
public virtual bool DecodeRow(byte[] buffer, int offset, int count, short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to place decoded image data to. |
System.Int32 | offset | The zero-based byte offset in |
System.Int32 | count | The number of decoded bytes that should be placed
to |
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
DecodeStrip(Byte[], Int32, Int32, Int16)
Decodes one strip of image data.
Declaration
public virtual bool DecodeStrip(byte[] buffer, int offset, int count, short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to place decoded image data to. |
System.Int32 | offset | The zero-based byte offset in |
System.Int32 | count | The number of decoded bytes that should be placed
to |
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
DecodeTile(Byte[], Int32, Int32, Int16)
Decodes one tile of image data.
Declaration
public virtual bool DecodeTile(byte[] buffer, int offset, int count, short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to place decoded image data to. |
System.Int32 | offset | The zero-based byte offset in |
System.Int32 | count | The number of decoded bytes that should be placed
to |
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
DefStripSize(Int32)
Calculates and/or constrains a strip size.
Declaration
public virtual int DefStripSize(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | The proposed strip size (may be zero or negative). |
Returns
Type | Description |
---|---|
System.Int32 | A strip size to use. |
DefTileSize(ref Int32, ref Int32)
Calculate and/or constrains a tile size
Declaration
public virtual void DefTileSize(ref int width, ref int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The proposed tile width upon the call / tile width to use after the call. |
System.Int32 | height | The proposed tile height upon the call / tile height to use after the call. |
EncodeRow(Byte[], Int32, Int32, Int16)
Encodes one row of image data.
Declaration
public virtual bool EncodeRow(byte[] buffer, int offset, int count, short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer with image data to be encoded. |
System.Int32 | offset | The zero-based byte offset in |
System.Int32 | count | The maximum number of encoded bytes that can be placed
to |
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
EncodeStrip(Byte[], Int32, Int32, Int16)
Encodes one strip of image data.
Declaration
public virtual bool EncodeStrip(byte[] buffer, int offset, int count, short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer with image data to be encoded. |
System.Int32 | offset | The zero-based byte offset in |
System.Int32 | count | The maximum number of encoded bytes that can be placed
to |
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
EncodeTile(Byte[], Int32, Int32, Int16)
Encodes one tile of image data.
Declaration
public virtual bool EncodeTile(byte[] buffer, int offset, int count, short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer with image data to be encoded. |
System.Int32 | offset | The zero-based byte offset in |
System.Int32 | count | The maximum number of encoded bytes that can be placed
to |
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Init()
Initializes this instance.
Declaration
public virtual bool Init()
Returns
Type | Description |
---|---|
System.Boolean |
|
PostEncode()
Performs any actions after encoding required by the codec.
Declaration
public virtual bool PostEncode()
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
PostEncode is called after encoding and can be used to release any external resources needed during encoding.
PreDecode(Int16)
Prepares the decoder part of the codec for a decoding.
Declaration
public virtual bool PreDecode(short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
PreDecode is called after SetupDecode() and before decoding.
PreEncode(Int16)
Prepares the encoder part of the codec for a encoding.
Declaration
public virtual bool PreEncode(short plane)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | plane | The zero-based sample plane index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
PreEncode is called after SetupEncode() and before encoding.
Seek(Int32)
Seeks the specified row in the strip being processed.
Declaration
public virtual bool Seek(int row)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row to seek. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetupDecode()
Setups the decoder part of the codec.
Declaration
public virtual bool SetupDecode()
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
SetupDecode is called once before PreDecode(Int16).
SetupEncode()
Setups the encoder part of the codec.
Declaration
public virtual bool SetupEncode()
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
SetupEncode is called once before PreEncode(Int16).