ImageConverter Class
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
This class is used to define the convertation parameters required for the image at the import.
ImageConverter Class
Members
ImageConverter ( ) #
Default constructor. An empty instance with default parameters is created.void setType ( int type ) #
Sets a numerical code of the image type.Arguments
- int type - 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 getType ( ) #
Returns a numerical code of the image type.Return 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.void setFormat ( int format ) #
Sets a numerical code of the image format.Arguments
- int format - Numerical code of the image format. See the IMAGE_FORMAT_* variables.
int getFormat ( ) #
Returns a numerical code of the image format.Return value
Numerical code of the image format. See the IMAGE_FORMAT_* variables.void setResolutionMode ( int mode ) #
Sets the resolution mode to be used for the image.Arguments
- int mode - Resolution mode to be used for the image. One of the IMAGE_CONVERTER_RESOLUTION_MODE_* values.
int getResolutionMode ( ) #
Returns the resolution mode used for the image.Return value
Resolution mode used for the image. One of the IMAGE_CONVERTER_RESOLUTION_MODE_* values.void setResizeFilter ( int filter ) #
Sets the resize filter to be used for the image.Arguments
- int filter - Resize filter to be used for the image. One of the IMAGE_CONVERTER_RESIZE_FILTER_* values.
int getResizeFilter ( ) #
Returns the resize filter used for the image.Return value
Resize filter used for the image. One of the IMAGE_CONVERTER_RESIZE_FILTER_* values.void setWidth ( int width ) #
Sets the image width, in pixels.Arguments
- int width - Image width, in pixels
int getWidth ( ) #
Returns the image width, in pixels.Return value
Image width, in pixelsvoid setHeight ( int height ) #
Sets the image height, in pixels.Arguments
- int height - Image height, in pixels
int getHeight ( ) #
Returns the image height, in pixels.Return value
Image height, in pixelsvoid setDepth ( int depth ) #
Sets the image depth, in pixels.Arguments
- int depth - Image depth, in pixels
int getDepth ( ) #
Returns the image depth, in pixels.Return value
Image depth, in pixelsvoid setFileCompression ( int compression ) #
Sets the image file compression type.Arguments
- int compression - File compression type to be used for the image. One of the FILE_COMPRESSION_* values.
int getFileCompression ( ) #
Returns the image file compression type.Return value
File compression type used for the image. One of the FILE_COMPRESSION_* values.void setCompressionQuality ( int quality ) #
Sets the image file compression quality.Arguments
- int quality - Compression quality to be used for the image. One of the COMPRESSION_QUALITY_* values.
int getCompressionQuality ( ) #
Returns the image file compression quality.Return value
Compression quality used for the image. One of the COMPRESSION_QUALITY_* values.void setGPUCompression ( int compression ) #
Defines if GPU compression is used at converting the image.Arguments
- int compression - 1 to enable image compression on GPU, or 0 to disable it.
int isGPUCompression ( ) #
Returns the value specifying if GPU compression is used at converting the image.Return value
1 if GPU compression is enabled; otherwise, 0.void setMipmapsMode ( int mode ) #
Sets the filtering type for the image mipmaps.Arguments
- int mode - Mipmaps mode to be used. One of the MIPMAPS_MODE_* values.
int getMipmapsMode ( ) #
Returns the filtering type set for the image mipmaps.Return value
Mipmaps mode to be used. One of the MIPMAPS_MODE_* values.void setMipmapsGamma ( float gamma ) #
Sets the gamma correction value to be used for the mipmaps.Arguments
- float gamma - Gamma correction value to be used for the mipmaps.
float getMipmapsGamma ( ) #
Returns the gamma correction value used for the mipmaps.Return value
Gamma correction value used for the mipmaps.void setGGXMipmapsQuality ( float quality ) #
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.Arguments
- float quality - Quality of the GGX mipmaps for the cubemap image.
float getGGXMipmapsQuality ( ) #
Returns the quality of mipmaps generated for cubemap images using the GGX BRDF microfacet model.Return value
Quality of the GGX mipmaps for the cubemap image.void setRangeMode ( int mode ) #
Sets the range mode to be applied at the image conversion.Arguments
- int mode - Range mode to be applied at the image conversion. One of the IMAGE_CONVERTER_RANGE_MODE_* values.
int getRangeMode ( ) #
Returns the range mode applied at the image conversion.Return value
Range mode applied at the image conversion. One of the IMAGE_CONVERTER_RANGE_MODE_* values.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.void setFlipX ( int flipx ) #
Flips the image horizontally.Arguments
- int flipx - 1 if the image is to be flipped horizontally; otherwise, 0.
int isFlipX ( ) #
Returns the value indicating if the image is to be flipped horizontally.Return value
1 if the image is to be flipped horizontally; otherwise, 0.void setFlipY ( int flipy ) #
Flips the image vertically.Arguments
- int flipy - 1 if the image is to be flipped vertically; otherwise, 0.
int isFlipY ( ) #
Returns the value indicating if the image is to be flipped vertically.Return value
1 if the image is to be flipped vertically; otherwise, 0.void setBlur ( int blur ) #
Sets the amount of blur in pixels.Arguments
- int blur - Amount of blur in pixels.
int getBlur ( ) #
Returns the amount of blur in pixels.Return value
Amount of blur in pixels.void setRotate ( int rotate ) #
Sets the image rotation angle.Arguments
- int rotate - Rotation angle, clock-wise.
int getRotate ( ) #
Returns the image rotation angle.Return value
Rotation angle, clock-wise.int 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
1 if the channel needs to be inverted; otherwise, 0.void setInvertChannel ( int channel, int 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.
- int value - 1 if the channel needs to be inverted; otherwise, 0.
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.int 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
1 if the image converter settings are loaded successfully; otherwise, 0.int 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
1 if the image converter settings are saved successfully; otherwise, 0.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.
int run ( Image & image ) #
Runs the image converter.Arguments
- Image & image - Image to be converted.
Return value
1 if the image has been converted successfully; otherwise, 0.Last update:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)