This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.ImageConverter Class

This class is used to define the convertation parameters required for the image at the import.

ImageConverter Class

Enums

MIPMAPS_MODE#

NameDescription
DISABLE = 0Mipmaps are not generated.
POINT = 1Point filtering method is used at mipmap generation.
LINEAR = 2Linear filtering method is used at mipmap generation.
COMBINED = 3Combination of the loaded 2D image with the most detailed mipmap image.
GGX = 4Generation of mipmaps for cubemap images (IMAGE_CUBE or IMAGE_CUBE_ARRAY) using GGX BRDF microfacet model.

RESOLUTION_MODE#

NameDescription
AUTO = 0Resolution set by the converter depending on the image format (for example, the 2D image is converted to 2D array / 3D image).
ORIGINAL = 1Resolution of the original image.
MANUAL = 2Resolution set manually in the converter.

COMPRESSION_QUALITY#

NameDescription
LOW = 0Low quality of compression.
HIGH = 1High quality of compression.

RESIZE_FILTER#

NameDescription
POINT = 0Point filtering method used for resizing.
LINEAR = 1Linear filtering method used for resizing.
MIN = 2Minimum filtering method used for resizing.

RANGE_MODE#

NameDescription
DISABLE = 0Image values are not normalized.
NORMALIZE = 1Values in all channels of the image are normalized altogeter to the values from 0 to 1 (i.e. overall brightness of the image). Recommended to be used for colors.
NORMALIZE_PER_CHANNEL = 2Normalization to the values from 0 to 1 is performed for each channel of the image separately.
MANUAL = 3Normalization to manually set values is performed.

Properties

int Type#

The Numerical code of the image type: 0 for a 2D image, 1 for a 3D image, 2 for a cube image, 3 for a 2D Array. See the Unigine::Image:: Enumeration with IMAGE_* prefixes.

int Format#

The Numerical code of the image format. See the FORMAT_* variables.

ImageConverter.RESOLUTION_MODE ResolutionMode#

The Resolution mode used for the image. One of the RESOLUTION_MODE values.

ImageConverter.RESIZE_FILTER ResizeFilter#

The Resize filter used for the image. One of the RESIZE_FILTER values.

int Width#

The Image width, in pixels

int Height#

The Image height, in pixels

int Depth#

The Image depth, in pixels

Image.FILE_COMPRESSION FileCompression#

The File compression type used for the image. One of the FILE_COMPRESSION_* values.

ImageConverter.COMPRESSION_QUALITY CompressionQuality#

The Compression quality used for the image. One of the COMPRESSION_QUALITY_* values.

bool GPUCompression#

The true if GPU compression is enabled; otherwise, false.

ImageConverter.MIPMAPS_MODE MipmapsMode#

The Mipmaps mode to be used. One of the MIPMAPS_MODE_* values.

float MipmapsGamma#

The Gamma correction value used for the mipmaps.

float GGXMipmapsQuality#

The Quality of the GGX mipmaps for the cubemap image.

ImageConverter.RANGE_MODE RangeMode#

The Range mode applied at the image conversion. One of the RANGE_MODE_* values.

bool FlipX#

The true if the image is to be flipped horizontally; otherwise, false.

bool FlipY#

The true if the image is to be flipped vertically; otherwise, false.

int Blur#

The Amount of blur in pixels.

int Rotate#

The Rotation angle, clock-wise.

Members


ImageConverter ( ) #

Default constructor. An empty instance with default parameters is created.

ImageConverter ( ImageConverter imageconverter ) #

Constructor. Creates an image converter by copying a given source image converter.

Arguments

  • ImageConverter imageconverter - Source image converter.

void SetRange ( int channel, dvec4 value ) #

Sets the range to be applied at the image conversion.
Notice
The range of the final image will be clamped, if the set range values exceed the maximum values of the image conversion format.

Arguments

  • int channel - Number of the channel to be inverted, in the range from 0 to the total number of channels.
  • dvec4 value - Range values: x and y coordinates of the value specify the original range, z and w specify the range to which the image will be converted.

dvec4 GetRange ( int channel ) #

Returns the range to be applied at the image conversion.

Arguments

  • int channel - Number of the channel to be inverted, in the range from 0 to the total number of channels.

Return value

Range values: x and y coordinates of the value specify the original range, z and w specify the range to which the image will be converted.

bool GetInvertChannel ( int channel ) #

Returns the value indicating if the channel needs to be inverted.

Arguments

  • int channel - Number of the channel to be inverted, in the range from 0 to the total number of channels.

Return value

true if the channel needs to be inverted; otherwise, false.

void SetInvertChannel ( int channel, bool value ) #

Inverts the values stored in the specified channel. Channels of images of half (FORMAT_R16F to FORMAT_RGBA16F) and float (FORMAT_R32F to FORMAT_RGBA32F) formats cannot be inverted.

Arguments

  • int channel - Number of the channel to be inverted, in the range from 0 to the total number of channels.
  • bool value - true if the channel needs to be inverted; otherwise, false.

void Reset ( ) #

Sets the converter to the default values.

void Copy ( ImageConverter converter ) #

Copies data from the specified source converter.

Arguments

  • ImageConverter converter - Source converter.

ImageConverter Clone ( ) #

Creates a clone of the specified source converter.

Return value

Converter to be cloned.

bool Load ( string path ) #

Loads the image converter settings on the disk using the specified path.

Arguments

  • string path - Path to the file with the image converter settings.

Return value

true if the image converter settings are loaded successfully; otherwise, false.

void Load ( Json json ) #

Loads the .json object with the image converter settings.

Arguments

  • Json json - Object with the image converter settings.

bool Save ( string path ) #

Saves image converter settings on the disk to the specified location.

Arguments

  • string path - Path to the file to store the image converter settings.

Return value

true if the image converter settings are saved successfully; otherwise, false.

void Save ( Json json ) #

Saves image converter settings to the specified .json object.

Arguments

  • Json json - Object with the image converter settings.

void UpdateParameters ( Image image ) #

Validates the parameters of the image converter for the specified image. This method allows checking the resulting parameters before converting the image.

Arguments

  • Image image - Image to be converted.

bool Run ( Image image ) #

Runs the image converter.

Arguments

  • Image image - Image to be converted.

Return value

true if the image has been converted successfully; otherwise, false.

IntPtr AddBeginCallback ( BeginDelegate func ) #

Adds a callback function to be called on beginning image conversion. The signature of the callback function must be as follows:
Source code (C#)
void begin_callback(ImageConverter converter, Image img);

You can set a callback function as follows:

Source code (C#)
AddBeginCallback((converter, img) 
						=> begin_callback(converter, img));

Example: Setting a begin image conversion callback function:

Source code (C#)
class AppWorldLogic : WorldLogic
{

	/*...*/

	// callback function implementing certain actions to be performed on beginning image conversion
	private void ConversionBegin(ImageConverter converter, Image img)
	{
		// insert your specific handling code here
	}

	/*...*/

	public override bool Init()
	{
		// setting the ConversionBegin() function to handle beginning of the image conversion
		MyImageConverter.AddBeginCallback((converter, img) 
						=> ConversionBegin(converter, img));

		return true;
		}
	/*...*/
}

Arguments

  • BeginDelegate func - Callback function with the following signature:
    void BeginDelegate(ImageConverter converter, Image img)

Return value

ID of the last added begin image conversion callback, if the callback was added successfully; otherwise, null. This ID can be used to remove this callback when necessary.

bool RemoveBeginCallback ( IntPtr id ) #

Removes the specified callback from the list of begin image conversion callbacks.

Arguments

  • IntPtr id - Begin callback ID obtained when adding it.

Return value

True if the begin image conversion callback with the given ID was removed successfully; otherwise false.

void ClearBeginCallback ( ) #

Clears all added begin image conversion callbacks.

IntPtr AddEndCallback ( EndDelegate func ) #

Adds a callback function to be called on completion of image conversion. The signature of the callback function must be as follows:
Source code (C#)
void end_callback(ImageConverter converter, Image img);

You can set a callback function as follows:

Source code (C#)
AddEndCallback((converter, img) 
						=> end_callback(converter, img));

Example: Setting an image conversion completion callback function:

Source code (C#)
class AppWorldLogic : WorldLogic
{

	/*...*/

	// callback function implementing certain actions to be performed on completion of image conversion
	private void ConversionEnd(ImageConverter converter, Image img)
	{
		// insert your specific handling code here
	}

	/*...*/

	public override bool Init()
	{
		// setting the ConversionEnd() function to handle completion of image conversion
		MyImageConverter.AddEndCallback((converter, img) 
						=> ConversionEnd(converter, img));

		return true;
		}
	/*...*/
}

Arguments

  • EndDelegate func - Callback function with the following signature:
    void EndDelegate(ImageConverter converter, Image img)

Return value

ID of the last added image conversion completion callback, if the callback was added successfully; otherwise, null. This ID can be used to remove this callback when necessary.

bool RemoveEndCallback ( IntPtr id ) #

Removes the specified callback from the list of image conversion completion callbacks.

Arguments

  • IntPtr id - End callback ID obtained when adding it.

Return value

True if the image conversion completion callback with the given ID was removed successfully; otherwise false.

void ClearEndCallback ( ) #

Clears all added image conversion completion callbacks.
Last update: 2022-12-14
Build: ()