# class ImageData

ImageData holds unpacked image data. The data is stored in an FieldData object as value fields. For simplicity all images are implemented as 3D images, but has an extent of 1 in Z for 2D images, and an extent of 1 in both Y and Z for 1D images. Cube maps are stored as a 3D image with Z-depth of 6 (one for each side)

# Properties

Property Description
ColorSpace Used to set the color space of the image data. Note that this applies only to integer based data types. Floating point data is always considered linear.
Name The name of the ImageData object. (Inherited from Object)

# Methods

Method Description
AddColors Adds the Colors field.
AddField Adds a field. The field must have a name that does not conflict with any of the existing field names. The field is referenced by the image after the call to AddField()
AddObserver Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
DeepCopy Copies the field setup and data from another object. To only copy the setup, set copy_data to false.
Equals Check for equality against another image data.
GetClass Get the name of the ImageData class. (Inherited from Object)
GetColors The Colors field.
GetColorsFormat The color field format specification.
GetColorsValueType The base type used by the colors field.
GetDDSCompressionType The DDS compression type for the image data.
GetField Gets a field.
GetFieldValueType Gets the value type of a field.
GetImageFields The ImageFields field data object, that holds all fields within the image.
GetInputFormat The format of the image data.
GetType The type of this image data.
GetXSize The X dimension size of this image data.
GetYSize The Y dimension size of this image data.
GetZSize The Z dimension size of this image data.
HasColors Checks if the image has a color field.
HasField Check if a field exists in the IImageData object.
IsA Returns true if ImageData is a or is a descendant of the class named as the type parameter. (Inherited from Object)
IsNull Returns true if the ImageData object is invalid. (Inherited from Object)
IsSameObjectAs Returns true if the ImageData object is valid. (Inherited from Object)
NewCopy Creates another image data object with the same field setup. To also copy the data to the new object, set copy_data to true.
NonNull Returns true if the ImageData object is valid. (Inherited from Object)
PrintInfo Prints the content/info of the ImageData object to the log. (Inherited from Object)
RemoveColors Removes the Colors field.
RemoveField Removes a field.
RemoveObserver Removes a previously added observer object. (Inherited from Object)
Reset Clears all data from the image, and removes all data fields. The type is reset to 2D.
Set1DSize The X dimension size of this image data.
Set2DSize The X and Y dimension size of this image data.
Set3DSize The X, Y and Z dimension size of this image data.
SetCubeSize The 6 uniform cube side dimensions of this image data.

# Static methods

Method Description
IsClassA Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
SafeCast SafeCast makes sure the input object is of a class that can be cast into spImageData, and if this is the case, returns the object cast into spImageData. (Inherited from Object)

# Properties details

# ColorSpace

Used to set the color space of the image data. Note that this applies only to integer based data types. Floating point data is always considered linear.

# Syntax

// Setter
void SetColorSpace( Simplygon::EImageColorSpace value ) const;

// Getter
Simplygon::EImageColorSpace GetColorSpace() const;

# SetColorSpace parameters

Type Name Min Max Description
EImageColorSpace value The value to set ColorSpace to.

# GetColorSpace return value

Type: EImageColorSpace

Default: EImageColorSpace::Undefined

Key Value Comment
Undefined 0 The color space is undefined, or using the color space of an input image data.
Linear 1 The color space is linear (linear gamma).
sRGB 2 The color space is sRGB (nominal gamma of 2.2).

# Name

The name of the ImageData object. (Inherited from Object)

# Syntax

// Setter
void SetName( const char * name ) const;

// Getter
spString GetName() const;

# SetName parameters

Type Name Min Max Description
const char * name New name of the object.

# GetName return value

Type: spString

# Methods details

# AddColors

Adds the Colors field.

# Syntax

void AddColors( Simplygon::EBaseTypes valueType , const char * format ) const;

# Parameters

Type Name Min Max Description
EBaseTypes valueType The type used to store the tuples. Use TYPES_ID_UCHAR base type for 8-bit per channel data, and TYPES_ID_USHORT base type for 16-bit per channel data.
const char * format A string that describes the format of the color field. Each character in format represents a color channel in the color tuple. All characters in the format string must be unique and uppercase. Normal values for format are: RGB, RGBA, YUV, HLS, CMYK, L and R. In these examples the tuplesize of the formats will be 3,4,3,3,4,1 and 1, respectively. The format string must be at least one character long. Use the SG_IMAGEDATA_FORMAT_[] defines to define the standard types.

# AddField

Adds a field. The field must have a name that does not conflict with any of the existing field names. The field is referenced by the image after the call to AddField()

# Syntax

void AddField( const char * name , Simplygon::EBaseTypes valueType , unsigned int tupleSize ) const;

# Parameters

Type Name Min Max Description
const char * name The name of the field to add.
EBaseTypes valueType The type of the field, types listed in BaseTypes.
unsigned int tupleSize The size of tuples in the new field.

# AddObserver

Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)

# Syntax

rid AddObserver( const spObserver & observer ) const;

# Parameters

Type Name Min Max Description
Observer observer Observer is the object that will receive events.

# Return value

Type: rid

# DeepCopy

Copies the field setup and data from another object. To only copy the setup, set copy_data to false.

# Syntax

void DeepCopy( const spImageData & source , bool copyData ) const;

# Parameters

Type Name Min Max Description
ImageData source The IImageData object to copy from.
bool copyData True if the data should be copied along with the image data properties.

# Equals

Check for equality against another image data.

# Syntax

bool Equals( const spImageData & other ) const;

# Parameters

Type Name Min Max Description
ImageData other The other image data to compare against.

# Return value

Type: bool

# GetClass

Get the name of the ImageData class. (Inherited from Object)

# Syntax

spString GetClass() const;

# Parameters

GetClass takes no parameters.

# Return value

Type: spString

# GetColors

The Colors field.

# Syntax

spValueArray GetColors() const;

# Parameters

GetColors takes no parameters.

# Return value

Type: ValueArray

# GetColorsFormat

The color field format specification.

# Syntax

spString GetColorsFormat() const;

# Parameters

GetColorsFormat takes no parameters.

# Return value

Type: spString

# GetColorsValueType

The base type used by the colors field.

# Syntax

Simplygon::EBaseTypes GetColorsValueType() const;

# Parameters

GetColorsValueType takes no parameters.

# Return value

Type: EBaseTypes

Key Value Comment
TYPES_ID_VOID 0
TYPES_ID_BOOL 1
TYPES_ID_CHAR 2
TYPES_ID_UCHAR 3
TYPES_ID_SHORT 4
TYPES_ID_USHORT 5
TYPES_ID_INT 6
TYPES_ID_UINT 7
TYPES_ID_LONG 8
TYPES_ID_ULONG 9
TYPES_ID_FLOAT 10
TYPES_ID_DOUBLE 11
TYPES_ID_REAL 12
TYPES_ID_RID 13
TYPES_ID_RCHAR 14
TYPES_ID_RHANDLE 15
TYPES_ID_STRING 16
TYPES_ID_OBJECT 17

# GetDDSCompressionType

The DDS compression type for the image data.

# Syntax

Simplygon::EDDSCompressionType GetDDSCompressionType() const;

# Parameters

GetDDSCompressionType takes no parameters.

# Return value

Type: EDDSCompressionType

Default: EDDSCompressionType::NoCompression

Key Value Comment
NoCompression -1
BC1 0
BC2 1
BC3 2
BC4 3
BC5 4

# GetField

Gets a field.

# Syntax

spValueArray GetField( const char * name ) const;

# Parameters

Type Name Min Max Description
const char * name The name of the field to get.

# Return value

Type: ValueArray

# GetFieldValueType

Gets the value type of a field.

# Syntax

Simplygon::EBaseTypes GetFieldValueType( const char * name ) const;

# Parameters

Type Name Min Max Description
const char * name The name of the field whose type to get, types listed in BaseTypes.

# Return value

Type: EBaseTypes

Key Value Comment
TYPES_ID_VOID 0
TYPES_ID_BOOL 1
TYPES_ID_CHAR 2
TYPES_ID_UCHAR 3
TYPES_ID_SHORT 4
TYPES_ID_USHORT 5
TYPES_ID_INT 6
TYPES_ID_UINT 7
TYPES_ID_LONG 8
TYPES_ID_ULONG 9
TYPES_ID_FLOAT 10
TYPES_ID_DOUBLE 11
TYPES_ID_REAL 12
TYPES_ID_RID 13
TYPES_ID_RCHAR 14
TYPES_ID_RHANDLE 15
TYPES_ID_STRING 16
TYPES_ID_OBJECT 17

# GetImageFields

The ImageFields field data object, that holds all fields within the image.

# Syntax

spFieldData GetImageFields() const;

# Parameters

GetImageFields takes no parameters.

# Return value

Type: FieldData

# GetInputFormat

The format of the image data.

# Syntax

Simplygon::EImageInputFormat GetInputFormat() const;

# Parameters

GetInputFormat takes no parameters.

# Return value

Type: EImageInputFormat

Default: EImageInputFormat::Unsupported

Key Value Comment
Unsupported -1 and unknown or unsupported file format
BMP 0
DDS 1
GIF 2
JPEG 3
PNG 4
TGA 5
TIFF 6
PSD 7
EXR 8

# GetType

The type of this image data.

# Syntax

unsigned int GetType() const;

# Parameters

GetType takes no parameters.

# Return value

Type: unsigned int

# GetXSize

The X dimension size of this image data.

# Syntax

unsigned int GetXSize() const;

# Parameters

GetXSize takes no parameters.

# Return value

Type: unsigned int

# GetYSize

The Y dimension size of this image data.

# Syntax

unsigned int GetYSize() const;

# Parameters

GetYSize takes no parameters.

# Return value

Type: unsigned int

# GetZSize

The Z dimension size of this image data.

# Syntax

unsigned int GetZSize() const;

# Parameters

GetZSize takes no parameters.

# Return value

Type: unsigned int

# HasColors

Checks if the image has a color field.

# Syntax

bool HasColors() const;

# Parameters

HasColors takes no parameters.

# Return value

Type: bool

# HasField

Check if a field exists in the IImageData object.

# Syntax

bool HasField( const char * name ) const;

# Parameters

Type Name Min Max Description
const char * name The name of the field to check for.

# Return value

Type: bool

# IsA

Returns true if ImageData is a or is a descendant of the class named as the type parameter. (Inherited from Object)

# Syntax

bool IsA( const char * type ) const;

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if ImageData is, or is a descendant of.

# Return value

Type: bool

# IsNull

Returns true if the ImageData object is invalid. (Inherited from Object)

# Syntax

bool IsNull() const;

# Parameters

IsNull takes no parameters.

# Return value

Type: bool

# IsSameObjectAs

Returns true if the ImageData object is valid. (Inherited from Object)

# Syntax

bool IsSameObjectAs( const spObject & object ) const;

# Parameters

Type Name Min Max Description
Object object Object to compare with.

# Return value

Type: bool

# NewCopy

Creates another image data object with the same field setup. To also copy the data to the new object, set copy_data to true.

# Syntax

spImageData NewCopy( bool copyData ) const;

# Parameters

Type Name Min Max Description
bool copyData If true, all data is copied.

# Return value

Type: ImageData

# NonNull

Returns true if the ImageData object is valid. (Inherited from Object)

# Syntax

bool NonNull() const;

# Parameters

NonNull takes no parameters.

# Return value

Type: bool

# PrintInfo

Prints the content/info of the ImageData object to the log. (Inherited from Object)

# Syntax

void PrintInfo() const;

# Parameters

PrintInfo takes no parameters.

# RemoveColors

Removes the Colors field.

# Syntax

void RemoveColors() const;

# Parameters

RemoveColors takes no parameters.

# RemoveField

Removes a field.

# Syntax

void RemoveField( const char * name ) const;

# Parameters

Type Name Min Max Description
const char * name The name of the field to remove.

# RemoveObserver

Removes a previously added observer object. (Inherited from Object)

# Syntax

void RemoveObserver( rid observerId ) const;

# Parameters

Type Name Min Max Description
rid observerId ObserverId is the id returned by AddObserver when the observer was added.

# Reset

Clears all data from the image, and removes all data fields. The type is reset to 2D.

# Syntax

void Reset() const;

# Parameters

Reset takes no parameters.

# Set1DSize

The X dimension size of this image data.

# Syntax

void Set1DSize( unsigned int xs ) const;

# Parameters

Type Name Min Max Description
unsigned int xs The desired X dimension size of this image data.

# Set2DSize

The X and Y dimension size of this image data.

# Syntax

void Set2DSize( unsigned int xs , unsigned int ys ) const;

# Parameters

Type Name Min Max Description
unsigned int xs The desired X dimension size of this image data.
unsigned int ys The desired Y dimension size of this image data.

# Set3DSize

The X, Y and Z dimension size of this image data.

# Syntax

void Set3DSize( unsigned int xs , unsigned int ys , unsigned int zs ) const;

# Parameters

Type Name Min Max Description
unsigned int xs The desired X dimension size of this image data.
unsigned int ys The desired Y dimension size of this image data.
unsigned int zs The desired Z dimension size of this image data.

# SetCubeSize

The 6 uniform cube side dimensions of this image data.

# Syntax

void SetCubeSize( unsigned int xs , unsigned int ys ) const;

# Parameters

Type Name Min Max Description
unsigned int xs The desired X dimension size of each cube side in this image data.
unsigned int ys The desired Y dimension size of each cube side in this image data.

# Static methods details

# IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)

# Syntax

static bool IsClassA( const char * type ) const;

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if the class is, or is a descendant of.

# Return value

Type: bool

# SafeCast

SafeCast makes sure the input object is of a class that can be cast into spImageData, and if this is the case, returns the object cast into spImageData. (Inherited from Object)

# Syntax

static spImageData SafeCast( const spObject & object ) const;

# Parameters

Type Name Min Max Description
Object object Object to cast.

# Return value

Type: ImageData