TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class ImageFormat in Tinman.Terrain.Imaging

The supported image file formats.

[ShutdownSurvive]
abstract class ImageFormat extends FileFormat
  base of GdalImageFormat

Protected / Attributes

IsRegistered

Has this file format been registered?

protected property IsRegistered { get }
type bool
value true if this file format has been registered, false if not.
inherited FileFormat.IsRegistered

See also:

FileFormat.Register

Protected / Constructors

ImageFormat

Creates a new instance of ImageFormat.

protected constructor ImageFormat (string name, string description, string mime, bool isAny = false)
params name [not-empty] Value for Name
  description [not-empty] Value for Description
  mime Value for Mime
  isAny Is this an automatic file format?

Protected / Methods

CannotWrite

protected static method CannotWrite (string source, Path file)
type IOException
params source
  file

DoCanRead

Checks if the given data is equal to the identifying prefix of this file format.

[EmptyBody]
protected virtual method DoCanRead (ByteBuffer data)
type bool
params data The data to check for the presence of the identifying prefix. When this method is called, this buffer position and limit will have been set so that the remaining bytes cover the byte sequence to check, having a length of exactly Prefix bytes. The buffer position may be modified by this method.
returns true if data is equal to the identifying prefix,
false if data is not equal to the identifying prefix.
inherited FileFormat.DoCanRead

Remarks:

When overriding this method, Prefix must be overridden as well.

DoReadImage

Reads the given image.

[OwnerReturn]
protected abstract method DoReadImage (IFileData data, ReadImageFlags flags)
type IImageReader
params data The image data provider: will never be null and Validate did not report any errors.
  flags The image reading flags.
returns [not-null] The IImageReader for reading the image data. The Validate has not yet been called on it.

Exceptions:

NameFind

Finds the IFileFormat that has the given name.

protected method NameFind (string name)
type IFileFormat
params name [not-empty] The file format name.
returns The found file format or null.
inherited FileFormat.NameFind

Register

Appends this file format to the chain of the given file format.

[ThreadSafe]
protected method Register (FileFormat any)
params any [not-null] The file format chain to append to.
inherited FileFormat.Register

Public / Attributes

Description

Long description of this file format.

public virtual property Description { get }
type string
value [not-null] The description string.
inherited FileFormat.Description

Mime

The machine-readable type of this file format.

public property Mime { get }
type string
value The machine-readable media type or null if none.
inherited FileFormat.Mime

Remarks:

For details on Media Types (aka. MIME-type), please refer to this webpage:
https://www.iana.org/assignments/media-types/media-types.xhtml

Name

The file format name.

public property Name { get }
type string
value [not-null] The file format name.
inherited FileFormat.Name

Next

Returns the next file format.

[ThreadSafe]
public property Next { get }
type IFileFormat
value The next file format or null.
inherited FileFormat.Next

Remarks:

The first file format can be obtained from implementing classes. This property can be used to cycle all available file formats of the same type.

Prefix

Lengths of the binary file data prefix that identifies this file format.

public virtual property Prefix { get }
type int32
value [>=0] The file data prefix length, in bytes. If 0, there is no identifying prefix.
inherited FileFormat.Prefix

Type

The human-readable type of this file format (e.g. images, shapes, 3D models).

public property Type { get }
type string
value [not-null] The human-readable type name.
inherited FileFormat.Type

Public / Constants

Any

The file format is unknown and will be determined automatically.

public static readonly field Any
type ImageFormat

Remarks:

Use Next to walk through all registered formats.

BMP

The BMP image file format.

public static readonly field BMP
type ImageFormat

Remarks:

Write supported: yes
IANA media type: image/bmp
File extensions: .bmp
Prefix sequence: yes

DDS

The DDS image file format.

public static readonly field DDS
type ImageFormat

Remarks:

Write supported: no
IANA media type: none
File extensions: .dds
Prefix sequence: yes

GIF

The GIF image file format.

public static readonly field GIF
type ImageFormat

Remarks:

Write supported: no
IANA media type: image/gif
File extensions: .gif
Prefix sequence: yes

JPEG

The JPEG image file format.

public static readonly field JPEG
type ImageFormat

Remarks:

Write supported: no
IANA media type: image/jpeg
File extensions: .jpeg .jpg
Prefix sequence: yes

PNG

The PNG image file format.

public static readonly field PNG
type ImageFormat

Remarks:

Write supported: no
IANA media type: image/png
File extensions: .png
Prefix sequence: yes

PXB

The PXB image file format ('PiXel Buffer', proprietary).

public static readonly field PXB
type ImageFormat

Remarks:

Write supported: no
IANA media type: none
File extensions: .pxb
Prefix sequence: yes

See also:

ColorBuffer

SimpleHttp

An ISimpleHttpImage object that uses Any to decode image data.

[ShutdownSurvive]
public static readonly field SimpleHttp
type ISimpleHttpImage

Remarks:

The image format is determined from the binary file format prefix (see CanRead), falling back to the content type (see ForMime), as returned by the web server.

TGA

The TGA image file format.

public static readonly field TGA
type ImageFormat

Remarks:

Write supported: yes
IANA media type: none
File extensions: .tga
Prefix sequence: no

TIFF

The TIFF image file format.

public static readonly field TIFF
type ImageFormat

Remarks:

Write supported: no
IANA media type: image/tiff
File extensions: .tif .tiff
Prefix sequence: yes

TXB

The TXB image file format ('TeXel Buffer', proprietary).

public static readonly field TXB
type ImageFormat

Remarks:

Write supported: no
IANA media type: none
File extensions: .txb
Prefix sequence: yes

See also:

TexelBuffer

Public / Methods

CanRead

Can this file format object be used to read the given data?

public method CanRead (ByteBuffer data)
type bool
params data [not-null] The data to check. Must have at least Prefix remaining bytes, otherwise this method will always return false. The buffer will not be modified by this method.
returns true if the given data is prefixed with the identifying byte sequence of this file format,
false if the prefix is not present.
inherited FileFormat.CanRead

See also:

IFileFormat.Prefix

Can this file format object be used to read the given path?

public virtual method CanRead (string suffix, bool directory = false)
type bool
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
  directory Does the path refer to a directory (true) or to a file (false)? Defaults to false.
returns true if this file format can be used, false if not.
inherited FileFormat.CanRead

CanReadFind

Returns the first file format in the chain (see Next) that can read the given data.

public method CanReadFind (ByteBuffer data)
type IFileFormat
params data [not-null] The data to check. Must have at least Prefix remaining bytes, otherwise this method will always return false. The buffer will not be modified by this method.
returns The found file format or null.
inherited FileFormat.CanReadFind

Returns the first file format in the chain (see Next) that can read the given path.

public virtual method CanReadFind (string suffix, bool directory = false)
type IFileFormat
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
  directory Does the path refer to a directory (true) or to a file (false)? Defaults to false.
returns The found file format or null.
inherited FileFormat.CanReadFind

CanWrite

Can this file format object be used to write the given path?

public virtual method CanWrite (string suffix)
type bool
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
returns true if this file format can be used, false if not.
inherited FileFormat.CanWrite

CanWriteFind

Returns the first file format in the chain (see Next) that can write the given path.

public virtual method CanWriteFind (string suffix)
type IFileFormat
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
returns The found file format or null.
inherited FileFormat.CanWriteFind

ForName

Returns a file image format by its Name.

public static method ForName (string name)
type ImageFormat
params name [not-empty] The file image format name.
returns [not-null] The file image format or Any if not found.

PleaseIncludeInBinaryThanks

This is a method that forces the compiler / linker to include this type in the resulting binary.

public virtual method PleaseIncludeInBinaryThanks ()
inherited FileFormat.PleaseIncludeInBinaryThanks

Remarks:

Calling this stub method makes sure that all lazy constructor calls have been made.

To initialize everything, an application needs to call this method on its root module(s) (see TinmanModule), followed by a call to Initialize.

Exceptions:

ReadImage

Reads the given image.

[OwnerReturn]
public method ReadImage (IFileData data, ReadImageFlags flags)
type IImageReader
params data [not-null] The image data provider.
  flags The image reading flags.
returns [not-null] The validated IImageReader for reading the image data (see Validate).

Exceptions:

ReadTexture

Tries to read the given image data as a texture.

[OwnerReturn]
public virtual method ReadTexture (IFileData data, CubemapFace face)
type TexelBuffer
params data [not-null] The image data provider.
  face The cubemap face.
returns The read TexelBuffer or null if the given image data cannot be interpreted as a texture (pixels must be read separately and then encoded as texels).

Exceptions:

ToString

[Pure]
public override sealed method ToString ()
type string
inherited FileFormat.ToString

WriteImage

Writes an image to the given file.

[OwnerReturn]
public virtual method WriteImage (Path file)
type IImageWriter
params file [not-null] The output image file.
returns [not-null] The image writer object to use.

Exceptions: