Unigine.ImageConverter Class
This class is used to define the convertation parameters required for the image at the import.
ImageConverter Class
Enums
MIPMAPS_MODE#
Name | Description |
---|---|
DISABLE = 0 | Mipmaps are not generated. |
POINT = 1 | Point filtering method is used at mipmap generation. |
LINEAR = 2 | Linear filtering method is used at mipmap generation. |
COMBINED = 3 | Combination of the loaded 2D image with the most detailed mipmap image. |
GGX = 4 | Generation of mipmaps for cubemap images (IMAGE_CUBE or IMAGE_CUBE_ARRAY) using GGX BRDF microfacet model. |
RESOLUTION_MODE#
COMPRESSION_QUALITY#
Name | Description |
---|---|
LOW = 0 | Low quality of compression. |
HIGH = 1 | High quality of compression. |
RESIZE_FILTER#
Name | Description |
---|---|
POINT = 0 | Point filtering method is used at resizing. |
LINEAR = 1 | Linear filtering method is used at resizing. |
RANGE_MODE#
Properties
int Type#
Returns a numerical code of the image type.
set
Sets a numerical code of the image type.
set value -
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#
Returns a numerical code of the image format.
set
Sets a numerical code of the image format.
set value -
Numerical code of the image format. See the FORMAT_* variables.
ImageConverter.RESOLUTION_MODE ResolutionMode#
Returns the resolution mode used for the image.
set
Sets the resolution mode to be used for the image.
set value -
Resolution mode to be used for the image. One of the RESOLUTION_MODE values.
ImageConverter.RESIZE_FILTER ResizeFilter#
Returns the resize filter used for the image.
set
Sets the resize filter to be used for the image.
set value -
Resize filter to be used for the image. One of the RESIZE_FILTER values.
int Width#
Returns the image width, in pixels.
set
Sets the image width, in pixels.
set value -
Image width, in pixels
int Height#
Returns the image height, in pixels.
set
Sets the image height, in pixels.
set value -
Image height, in pixels
int Depth#
Returns the image depth, in pixels.
set
Sets the image depth, in pixels.
set value -
Image depth, in pixels
Image.FILE_COMPRESSION FileCompression#
Returns the image file compression type.
set
Sets the image file compression type.
set value -
File compression type to be used for the image. One of the FILE_COMPRESSION_* values.
ImageConverter.COMPRESSION_QUALITY CompressionQuality#
Returns the image file compression quality.
set
Sets the image file compression quality.
set value -
Compression quality to be used for the image. One of the COMPRESSION_QUALITY_* values.
bool GPUCompression#
Returns the value specifying if GPU compression is used at converting the image.
set
Defines if GPU compression is used at converting the image.
set value -
true to enable image compression on GPU, or false to disable it.
ImageConverter.MIPMAPS_MODE MipmapsMode#
Returns the filtering type set for the image mipmaps.
set
Sets the filtering type for the image mipmaps.
set value -
Mipmaps mode to be used. One of the MIPMAPS_MODE_* values.
float MipmapsGamma#
Returns the gamma correction value used for the mipmaps.
set
Sets the gamma correction value to be used for the mipmaps.
set value -
Gamma correction value to be used for the mipmaps.
float GGXMipmapsQuality#
Returns the quality of mipmaps generated for cubemap images using the GGX BRDF microfacet model.
set
Sets the quality for mipmaps generated for cubemap images using the GGX BRDF microfacet model. The value is applied when the mipmap mode is set to GGX.
set value -
Quality of the GGX mipmaps for the cubemap image.
ImageConverter.RANGE_MODE RangeMode#
Returns the range mode applied at the image conversion.
set
Sets the range mode to be applied at the image conversion.
set value -
Range mode to be applied at the image conversion. One of the RANGE_MODE_* values.
bool FlipX#
Returns the value indicating if the image is to be flipped horizontally.
set
Flips the image horizontally.
set value -
true if the image is to be flipped horizontally; otherwise, false.
bool FlipY#
Returns the value indicating if the image is to be flipped vertically.
set
Flips the image vertically.
set value -
true if the image is to be flipped vertically; otherwise, false.
int Blur#
Returns the amount of blur in pixels.
set
Sets the amount of blur in pixels.
set value -
Amount of blur in pixels.
int Rotate#
Returns the image rotation angle.
set
Sets the image rotation angle.
set value -
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.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:void begin_callback(ImageConverter converter, Image img);
You can set a callback function as follows:
AddBeginCallback((converter, img)
=> begin_callback(converter, img));
Example: Setting a begin image conversion callback function:
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:void end_callback(ImageConverter converter, Image img);
You can set a callback function as follows:
AddEndCallback((converter, img)
=> end_callback(converter, img));
Example: Setting an image conversion completion callback function:
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:
2021-02-17
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)