TK_Image

class TK_Image

Handles the TKE_Image opcode.

TK_Image provides support for writing/reading the TKE_Image opcode object to/from an HSF file.

The HOOPS/3dGS scene-graph supports ‘image’ primitives which are defined by a position, size (width and height), and an array of bytes which is interpretted according to the specified format.

Inherits from: BBaseOpcodeHandler

Methods

void TK_Image::set_data(int size, char const *bytes = 0, unsigned char data_format = TKO_Compression_None)

protected

internal use

void TK_Image::set_name(char const *string)

protected

internal use

void TK_Image::set_name(int length)

protected

internal use

TK_Status TK_Image::compress_image(BStreamFileToolkit &tk, int active_work_area = 0)

protected

internal use

TK_Status TK_Image::decompress_image(BStreamFileToolkit &tk, int active_work_area = 0)

protected

internal use

TK_Status TK_Image::read_jpeg_header()

protected

internal use

TK_Image::TK_Image()

constructor

TK_Image::~TK_Image()
TK_Status TK_Image::Read(BStreamFileToolkit &tk)

virtual

Reads data from the toolkit buffer, decodes/decompresses it, and maps it to the opcode handlers data members. User-defined classes which need to write out custom data should utilize one of the available GetData() methods.

Parameters

tk: A reference to the BStreamFileToolkit object.

Returns

The result of the function call.
TK_Status TK_Image::Write(BStreamFileToolkit &tk)

virtual

Encodes/compresses data and writes data to the toolkit buffer. User-defined classes which need to write out custom data should utilize one of the available PutData() methods, and first write out the opcode associated with the group of binary data followed by the data itself.

Parameters

tk: A reference to the BStreamFileToolkit object.

Returns

The result of the function call.
TK_Status TK_Image::Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const

const virtual

Copies the opcode handler

Parameters

tk: A reference to the BStreamFileToolkit object.

handler: A pointer to the opcode handler object. Passed by reference.

Returns

The result of the function call.
TK_Status TK_Image::ReadAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status TK_Image::WriteAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status TK_Image::compress_image_ascii(BStreamFileToolkit &tk)
void TK_Image::Reset()

virtual

Resets the current opcode handler. This is called by the toolkit when it is done processing an opcode. This method reinitializes any opcode handler variables and frees up temporary data.

void TK_Image::SetBytes(int size, char const *bytes = 0, unsigned char data_format = TKO_Compression_None)

Sets the image data. Allocates a buffer which can hold ‘size’ bytes, and if specified, copies the data from ‘bytes’ to the buffer

char const *TK_Image::GetBytes() const

const

Returns the address of the data buffer

char *TK_Image::GetBytes()

Returns the address of the data buffer, which may be modified directly

void TK_Image::SetName(char const *string)

Sets the name of the image. Allocates the buffer and copies the string

void TK_Image::SetName(int length)

Sets the name buffer. Allocates a buffer large enough to hold a string of ‘length’ characters

char const *TK_Image::GetName() const

const

Returns the image name string

char *TK_Image::GetName()

Returns the image name string buffer, which may be modified directly

void TK_Image::SetReference(char const *string)

Sets the reference to the image data. Allocates the buffer and copies the string

void TK_Image::SetReference(int length)

Sets the reference buffer. Allocates a buffer large enough to hold a string of ‘length’ characters

char const *TK_Image::GetReference() const

const

Returns the reference string

char *TK_Image::GetReference()

Returns the reference string buffer, which may be modified directly

void TK_Image::SetPosition(float x, float y, float z)

Sets the text position using discrete float values

void TK_Image::SetPosition(float const p[])

Sets the text position using a float triplet

float const *TK_Image::GetPosition() const

const

Returns the text position as the address of a float triplet

void TK_Image::SetDPosition(double x, double y, double z)

Sets the text position using discrete double values

void TK_Image::SetDPosition(double const p[])

Sets the text position using a float triplet

double const *TK_Image::GetDPosition() const

const

Returns the text position as the address of a float triplet

void TK_Image::SetSize(int w, int h)

Sets the size of the image using discrete integer values

void TK_Image::SetSize(int const s[])

Sets the size of the image using an array of integer values

int const *TK_Image::GetSize() const

const

Returns the size of the image as the address of a pair of integers

void TK_Image::SetFormat(int f)

Sets the format of the image. Formats are specified in TKO_Image_Formats.

int TK_Image::GetFormat() const

const

Returns the format of the image. Formats are specified in TKO_Image_Formats.

void TK_Image::SetOptions(int f)

Sets the options of the image. Options are specified in TKO_Image_Formats.

int TK_Image::GetOptions() const

const

Returns the options of the image. Options are specified in TKO_Image_Formats.

void TK_Image::SetCompression(int c)

Sets how the image data is compressed. Compression types are specified in TKO_Compression.

int TK_Image::GetCompression() const

const

Returns how the image data is compressed. Compression types are specified in TKO_Compression.

Variables

char *TK_Image::m_bytes

protected

char

internal use; Image data

char *TK_Image::m_name

protected

char

internal use; name applied to image (if any)

char *TK_Image::m_reference

protected

char

internal use; external reference to image data (if any)

float TK_Image::m_position[3]

protected

float

internal use; Insertion point

double TK_Image::m_dposition[3]

protected

double

internal use; Insertion point

int TK_Image::m_size[2]

protected

int

internal use; Width & Height

int TK_Image::m_data_size

protected

int

internal use; Explicit length of data block used only for precompressed images (dxt or jpeg) passed straight through.

int TK_Image::m_name_length

protected

int

internal use; Length of name

int TK_Image::m_reference_length

protected

int

internal use; Length of reference

unsigned char TK_Image::m_format

protected

unsigned char

internal use; Format of data

unsigned int TK_Image::m_options

protected

unsigned int

internal use; Extra options (named, explicit size)

unsigned char TK_Image::m_compression

protected

unsigned char

internal use; How (or if) data is compressed in stream

unsigned char TK_Image::m_bytes_format

protected

unsigned char

internal use; Indicates if input data is already compressed

float TK_Image::m_explicit_size[2]

protected

float

internal use; non-pixel sizing

unsigned char TK_Image::m_explicit_units[2]

protected

unsigned char

internal use; non-pixel units

TK_Image_Data_Buffer TK_Image::m_work_area[2]

protected

TK_Image_Data_Buffer

internal use; Buffers for compression data

float TK_Image::m_compression_quality

protected

float

internal use; Hint to the graphics system on how much to compress.

bool TK_Image::m_jpeg_native

protected

bool

TK_Image subclasses which talk to graphics systems that are able to insert jpeg directly should set this to true