Unigine::ImageConverter Class
Header: | #include <UnigineImage.h> |
This class is used to define the convertation parameters required for the image at the import.
ImageConverter Class
Enums
MIPMAPS_MODE#
Name | Description |
---|---|
MIPMAPS_MODE_DISABLE = 0 | Mipmaps are not generated. |
MIPMAPS_MODE_POINT = 1 | Point filtering method is used at mipmap generation. |
MIPMAPS_MODE_LINEAR = 2 | Linear filtering method is used at mipmap generation. |
MIPMAPS_MODE_COMBINED = 3 | Combination of the loaded 2D image with the most detailed mipmap image. |
MIPMAPS_MODE_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 |
---|---|
COMPRESSION_QUALITY_LOW = 0 | Low quality of compression. |
COMPRESSION_QUALITY_HIGH = 1 | High quality of compression. |
RESIZE_FILTER#
Name | Description |
---|---|
RESIZE_FILTER_POINT = 0 | Point filtering method is used at resizing. |
RESIZE_FILTER_LINEAR = 1 | Linear filtering method is used at resizing. |
RANGE_MODE#
Members
ImageConverter ( ) #
Default constructor. An empty instance with default parameters is created.ImageConverter ( const Ptr<ImageConverter> & imageconverter ) #
Constructor. Creates an image converter by copying a given source image converter.Arguments
- const Ptr<ImageConverter> & imageconverter - Source image converter.
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 ( ) const#
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 FORMAT_* variables.
int getFormat ( ) const#
Returns a numerical code of the image format.Return value
Numerical code of the image format. See the FORMAT_* variables.void setResolutionMode ( ImageConverter::RESOLUTION_MODE mode ) #
Sets the resolution mode to be used for the image.Arguments
- ImageConverter::RESOLUTION_MODE mode - Resolution mode to be used for the image. One of the RESOLUTION_MODE values.
ImageConverter::RESOLUTION_MODE getResolutionMode ( ) const#
Returns the resolution mode used for the image.Return value
Resolution mode used for the image. One of the RESOLUTION_MODE values.void setResizeFilter ( ImageConverter::RESIZE_FILTER filter ) #
Sets the resize filter to be used for the image.Arguments
- ImageConverter::RESIZE_FILTER filter - Resize filter to be used for the image. One of the RESIZE_FILTER values.
ImageConverter::RESIZE_FILTER getResizeFilter ( ) const#
Returns the resize filter used for the image.Return value
Resize filter used for the image. One of the RESIZE_FILTER values.void setWidth ( int width ) #
Sets the image width, in pixels.Arguments
- int width - Image width, in pixels
int getWidth ( ) const#
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 ( ) const#
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 ( ) const#
Returns the image depth, in pixels.Return value
Image depth, in pixelsvoid setFileCompression ( Image::FILE_COMPRESSION compression ) #
Sets the image file compression type.Arguments
- Image::FILE_COMPRESSION compression - File compression type to be used for the image. One of the FILE_COMPRESSION_* values.
Image::FILE_COMPRESSION getFileCompression ( ) const#
Returns the image file compression type.Return value
File compression type used for the image. One of the FILE_COMPRESSION_* values.void setCompressionQuality ( ImageConverter::COMPRESSION_QUALITY quality ) #
Sets the image file compression quality.Arguments
- ImageConverter::COMPRESSION_QUALITY quality - Compression quality to be used for the image. One of the COMPRESSION_QUALITY_* values.
ImageConverter::COMPRESSION_QUALITY getCompressionQuality ( ) const#
Returns the image file compression quality.Return value
Compression quality used for the image. One of the COMPRESSION_QUALITY_* values.void setGPUCompression ( bool compression ) #
Defines if GPU compression is used at converting the image.Arguments
- bool compression - true to enable image compression on GPU, or false to disable it.
bool isGPUCompression ( ) const#
Returns the value specifying if GPU compression is used at converting the image.Return value
true if GPU compression is enabled; otherwise, false.void setMipmapsMode ( ImageConverter::MIPMAPS_MODE mode ) #
Sets the filtering type for the image mipmaps.Arguments
- ImageConverter::MIPMAPS_MODE mode - Mipmaps mode to be used. One of the MIPMAPS_MODE_* values.
ImageConverter::MIPMAPS_MODE getMipmapsMode ( ) const#
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 ( ) const#
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 ( ) const#
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 ( ImageConverter::RANGE_MODE mode ) #
Sets the range mode to be applied at the image conversion.Arguments
- ImageConverter::RANGE_MODE mode - Range mode to be applied at the image conversion. One of the RANGE_MODE_* values.
ImageConverter::RANGE_MODE getRangeMode ( ) const#
Returns the range mode applied at the image conversion.Return value
Range mode applied at the image conversion. One of the RANGE_MODE_* values.void setRange ( int channel, const Math::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.
- const Math::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.
Math::dvec4 getRange ( int channel ) const#
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 ( bool flipx ) #
Flips the image horizontally.Arguments
- bool flipx - true if the image is to be flipped horizontally; otherwise, false.
bool isFlipX ( ) const#
Returns the value indicating if the image is to be flipped horizontally.Return value
true if the image is to be flipped horizontally; otherwise, false.void setFlipY ( bool flipy ) #
Flips the image vertically.Arguments
- bool flipy - true if the image is to be flipped vertically; otherwise, false.
bool isFlipY ( ) const#
Returns the value indicating if the image is to be flipped vertically.Return value
true if the image is to be flipped vertically; otherwise, false.void setBlur ( int blur ) #
Sets the amount of blur in pixels.Arguments
- int blur - Amount of blur in pixels.
int getBlur ( ) const#
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 ( ) const#
Returns the image rotation angle.Return value
Rotation angle, clock-wise.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 ( Ptr<ImageConverter> & converter ) const#
Copies data from the specified source converter.Arguments
- Ptr<ImageConverter> & converter - Source converter.
Ptr<ImageConverter> clone ( ) const#
Creates a clone of the specified source converter.Return value
Converter to be cloned.bool load ( const char * path ) #
Loads the image converter settings on the disk using the specified path.Arguments
- const char * 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 ( const Ptr<Json> & json ) #
Loads the .json object with the image converter settings.Arguments
bool save ( const char * path ) const#
Saves image converter settings on the disk to the specified location.Arguments
- const char * 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 ( const Ptr<Json> & json ) const#
Saves image converter settings to the specified .json object.Arguments
void updateParameters ( const Ptr<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
bool run ( Ptr<Image> & image ) #
Runs the image converter.Arguments
Return value
true if the image has been converted successfully; otherwise, false.void * addBeginCallback ( Unigine::CallbackBase2< Ptr<ImageConverter>, Ptr<Image> > * 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(ImageConverterPtr converter, ImagePtr img);
You can set a callback function as follows:
addBeginCallback(MakeCallback(begin_callback));
Example: Setting a begin image conversion callback function for a certain class:
// callback function implementing certain actions to be performed on beginning image conversion
void ConversionBegin(ImageConverterPtr converter, ImagePtr img)
{
// insert your specific handling code here
}
// ...
virtual int AppWorldLogic::init()
{
// setting the ConversionBegin() function to handle beginning of image conversion
MyImageConverter::addBeginCallback(MakeCallback(&ConversionBegin));
}
Arguments
- Unigine::CallbackBase2< Ptr<ImageConverter>, Ptr<Image> > * func - Callback pointer.
Return value
ID of the last added begin image conversion callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.bool removeBeginCallback ( void * id ) #
Removes the specified callback from the list of begin image conversion callbacks.Arguments
- void * 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.void * addEndCallback ( Unigine::CallbackBase2< Ptr<ImageConverter>, Ptr<Image> > * func ) #
Adds a callback function to be called on completion of the image conversion. The signature of the callback function must be as follows:void end_callback(ImageConverterPtr converter, ImagePtr img);
You can set a callback function as follows:
addEndCallback(MakeCallback(end_callback));
Example: Setting an image conversion completion callback function for a certain class:
// callback function implementing certain actions to be performed on completion of image conversion
void ConversionEnd(ImageConverterPtr converter, ImagePtr img)
{
// insert your specific handling code here
}
// ...
virtual int AppWorldLogic::init()
{
// setting the ConversionEnd() function to handle completion of image conversion
MyImageConverter::addEndCallback(MakeCallback(&ConversionEnd));
}
Arguments
- Unigine::CallbackBase2< Ptr<ImageConverter>, Ptr<Image> > * func - Callback pointer.
Return value
ID of the last added image conversion completion callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.bool removeEndCallback ( void * id ) #
Removes the specified callback from the list of image conversion completion callbacks.Arguments
- void * 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)