UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::Image Class

Interface for image manipulation. See Image class in UnigineScript core library for more details.

To use this class, include the UnigineImage.h file.

Related classes:
Unigine::Image::Pixel
Unigine::Image::Pixelf
Unigine::Image::Pixeli

Unigine::Image Class

Members


virtual ~Image ()

Virtual destructor.

static Ptr< Image > create ()

Image constructor.

Return value

Pointer to the created image.

static Ptr< Image > create (const char * name)

Image constructor.

Arguments

  • const char * name - Image name.

Return value

Pointer to the created image with the specified name.

static Ptr< Image > create (const Ptr< Image > & image)

Image copy constructor.

Arguments

  • const Ptr< Image > & image - Image pointer.

Return value

Pointer to the created image with specified name.

virtual void grab () =0

Sets the owner flag to 1 for the Image pointer. The Image should not be handled by the engine after this function is called.

virtual void release () =0

Sets the owner flag to 0 for the Image pointer. The Image should be handled by the engine after this function is called.

virtual int isOwner () const =0

Returns the owner flag of the pointer. If the pointer is owner, on its deletion the object also will be deleted.

Return value

Returns the owner flag.

virtual int create2D (int width, int height, int format, int num_mipmaps) const =0

Creates an empty 2D image.

Arguments

Return value

Returns 1 if the 2D image is created successfully; otherwise, 0.

virtual int create3D (int width, int height, int depth, int format, int num_mipmaps) const =0

Creates an empty 3D image.

Arguments

  • int width - Image width in pixels.
  • int height - Image height in pixels.
  • int depth - Image depth.
  • int format - Image format. See the Unigine::Image:: Enumeration with FORMAT_* prefixes.
  • int num_mipmaps - Number of mipmaps to generate. This is an optional argument.

Return value

Returns 1 if the 3D image is created successfully; otherwise, 0.

virtual int createCube (int width, int height, int format, int num_mipmaps) const =0

Creates an empty cube image.

Arguments

Return value

Returns 1 if the Cube image is created successfully; otherwise, 0.

virtual int create2DArray (int width, int height, int num_layers, int format, int num_mipmaps) const =0

Create a 2D Array image.

Arguments

  • int width - Image width in pixels.
  • int height - Image height in pixels.
  • int num_layers - Number of image layers.
  • int format - Image format. See the Unigine::Image:: Enumeration with FORMAT_* prefixes.
  • int num_mipmaps - Number of mipmaps to generate. This is an optional argument.

Return value

Returns 1 if the 2D Array image is created successfully; otherwise, 0.

virtual int createCubeArray (int width, int height, int num_layers, int format, int num_mipmaps) const =0

Create a Cube Array image.

Arguments

  • int width - Image width in pixels.
  • int height - Image height in pixels.
  • int num_layers - Number of image layers.
  • int format - Image format. See the Unigine::Image:: Enumeration with FORMAT_* prefixes.
  • int num_mipmaps - Number of mipmaps to generate. This is an optional argument.

Return value

Returns 1 if the Cube Array image is created successfully; otherwise, 0.

virtual int info (const char * name) const =0

Returns an information about a given image.

Arguments

  • const char * name - Name of the image file. The following file formats are supported: TGA, JPG, PNG, DDS.

Return value

Returns 1 if the image exists; otherwise, 0.

virtual int load (const char * name) const =0

Loads an image from a specified file.

Arguments

  • const char * name - Name of the image file. The following file formats are supported: TGA, JPG, PNG, DDS, PSD, PPM, PGM, HDR, SGI.

Return value

Returns 1 if the image is loaded successfully; otherwise, 0.

virtual int info (const unsigned char * data, int size) const =0

Returns an information about the image of a given size.

Arguments

  • const unsigned char * data - Pointer to data associated with the image.
  • int size - Size of the image data in bytes.

Return value

Returns 1 if the image exists; otherwise, 0.

virtual int load (const char * name, int offset) const =0

Loads an image from a specified file with given mipmap offset.

Arguments

  • const char * name - Name of the image file.
  • int offset - Mipmap offset value for the loaded image.

Return value

Returns 1 if the image is loaded successfully; otherwise, 0.

virtual int load (const unsigned char * data, int size) const =0

Loads the image (.jpeg or .png) of a given size.

Arguments

  • const unsigned char * data - Pointer to data associated with the image.
  • int size - Size of the image data in bytes.

Return value

Returns 1 if the image is loaded successfully; otherwise, 0.

virtual int save (const char * name, float quality) const =0

Saves the image to a specified file. The following file formats are supported:
  • DDS
  • JPG
  • PNG
  • PSD
  • TGA

Arguments

  • const char * name - Name of the file (with the specified extension) to save image data.
  • float quality - Quality of JPG compression in range [0;1]. The default value is 0.85f.

Return value

Returns 1 if the image is saved successfully; otherwise, 0.

virtual void clear () const =0

Clears all data associated with the image and resets its type, format, size to default. Also the number of image layers and mipmaps is set to 1.

virtual int isLoaded () const =0

Returns a value indicating whether the image is loaded.

Return value

Returns 1 if the image is loaded successfully; otherwise, 0.

virtual int getType () const =0

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.

virtual const char * getTypeName () const =0

Returns an image type name.

Return value

Image type name: 2D for a 2D image, 3D for a 3D image, Cube for a cube image, 2D_Array for a 2D Array.

virtual int is2DType () const =0

Returns a value indicating if the image is 2D image.

Return value

Returns 1 if the image is 2D; otherwise, 0.

virtual int is3DType () const =0

Returns a value indicating if the image is 3D image.

Return value

Returns 1 if the image is 3D; otherwise, 0.

virtual int isCubeType () const =0

Returns a value indicating if the image is Cube image.

Return value

Returns 1 if the image is Cube; otherwise, 0.

virtual int isArrayType () const =0

Returns a value indicating if the image is Array image.

Return value

Returns 1 if the image is Array; otherwise, 0.

virtual int getFormat () const =0

Returns a numerical code of the image format.

Return value

Numerical code of the image format. See the Unigine::Image:: Enumeration with FORMAT_* prefixes.

virtual const char * getFormatName () const =0

Returns an image format name. For more details about image formats see the article on ImageDDS tool.

Return value

Format name. The following values can be returned: R8, RG8, RGB8, RGBA8, R16, RG16, RGB16, RGBA16, R16F, RG16F, RGB16F, RGBA16F, R32F, RG32F, RGB32F, RGBA32F, RGB565, RGBA4, RGB5A1, RGB10A2, DXT1, DXT3, DXT5, ATI1, ATI2, ZLC1, ZLC2.

virtual int isRawFormat () const =0

Returns a value indicating if the image is uncompressed (stored in R8, RG8, RGB8, RGBA8, R16, RG16, RGB16, RGBA16, R16F, RG16F, RGB16F, RGBA16F, R32F, RG32F, RGB32F, RGBA32F, RGB565, RGBA4, RGB5A1 or RGB10A2 format).

Return value

Returns 1 if the image is uncompressed; otherwise, 0.

virtual int isUCharFormat () const =0

Returns a value indicating if the image is stored in an unsigned char format (R8, RG8, RGB8, RGBA8, DXT1, DXT3, DXT5, ATI1 or ATI2).

Return value

Returns 1 if the image is in unsigned char format; otherwise, 0.

virtual int isUShortFormat () const =0

Returns a value indicating if the image is stored in an unsigned short format (R16, RG16, RGB16 or RGBA16).

Return value

Returns 1 if the image is in unsigned short format; otherwise, 0.

virtual int isHalfFormat () const =0

Returns a value indicating if the image is stored in a half-float format (R16F, RG16F, RGB16F or RGBA16F).

Return value

Returns 1 if the image is in half-float format; otherwise, 0.

virtual int isFloatFormat () const =0

Returns a value indicating if the image is stored in a float format (R32F, RG32F, RGB32F or RGBA32F).

Return value

Returns 1 if the image is in float format; otherwise, 0 is returned.

virtual int isCombinedFormat () const =0

Returns a value indicating if the image is stored in a combined format (RGB565, RGBA4, RGB5A1 or RGB10A2).

Return value

Returns 1 if the image is in combined format; otherwise, 0.

virtual int isCompressedFormat () const =0

Returns a value indicating if the image is stored in a compressed format (DXT1, DXT3, DXT5, ATI1, ATI2, ZLC1 or ZLC2).

Return value

Returns 1 if the image is in a compressed format; otherwise, 0.

virtual int isZCompressedFormat () const =0

Returns a value indicating if the image is stored in a ZLIB compressed format (ZLC1 or ZLC2).

Return value

Returns 1 if the image is in a z compressed format; otherwise, 0.

virtual int getWidth (int level) const =0

Returns the image width on a given mipmap level.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Image width if the image exists (its width is larger than 0); otherwise, 1.

virtual int getHeight (int level) const =0

Returns the image height on a given mipmap level.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Image height if the image exists (its height is larger than 0); otherwise, 1.

virtual int getDepth (int level) const =0

Returns the image depth on a given mipmap level.

Arguments

  • int level - Mipmap level in range of 0 to the total number of mipmaps. This is an optional argument.

Return value

Image depth if the image exists (its depth is larger than 0); otherwise, 1.

virtual int getNumMipmaps () const =0

Returns a number of mipmaps stored with the image.

Return value

Number of mipmap levels.

virtual int getNumLayers () const =0

Returns a number of layers in the image.

Return value

Number of layers.

virtual int getNumFaces () const =0

Returns a number of faces in the image.

Return value

Number of faces.

virtual size_t getSize () const =0

Returns the current image size.

Return value

Image size in bytes.

virtual size_t getSize (int level) const =0

Returns the image size on a given mipmap level.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps.

Return value

Image size in bytes.

virtual size_t getOffset (int level) const =0

Returns the image offset on a given mipmap level.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps.

Return value

Image offset in bytes.

virtual size_t getStride (int level) const =0

Returns the image stride on a given mipmap level.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps.

Return value

Image stride in bytes.

virtual int getNumChannels () const =0

Returns the number of channels.

Return value

Number of channels.

virtual int getPixelSize () const =0

Returns the uncompressed image pixel size.

Return value

Pixel size in bytes.

virtual int getBlockSize () const =0

Returns the compressed image block size.

Return value

Block size in bytes.

virtual int set (int channel, int value) const =0

Sets a value for a given image channel. Compressed and combined image formats are not supported.

Arguments

  • int channel - Channel number in range of 0 to (number of channels - 1).
  • int value - Value in range of 0 to 255 for 8-bit formats and in range of 0 to 65535 for 16-bit formats.

Return value

Returns 1 if the value is set successfully; otherwise, 0.

virtual int swap (int channel, int index) const =0

Swaps two channels of the image.

Arguments

  • int channel - First channel number in range of 0 to (number of channels - 1).
  • int index - Second channel number in range of 0 to (number of channels - 1).

Return value

Returns 1 if the values are swapped successfully; otherwise, 0.

virtual int copy (const Ptr< Image > & image, int layer) const =0

Copies a specified layer between images.

Arguments

  • const Ptr< Image > & image - Source image.
  • int layer - Layer number.

Return value

Returns 1 if the layer is copied successfully; otherwise, 0.

virtual int copy (const Ptr< Image > & image, int channel, int index) const =0

Copies a channel value of a specified image into a specified channel of the current image. Compressed and combined image formats are not supported for both the source and the target images. The images must have the same dimensions.

Arguments

  • const Ptr< Image > & image - Source image.
  • int channel - Destination channel.
  • int index - Source channel.

Return value

Returns 1 if the channel value is copied successfully; otherwise, 0.

virtual int copy (const Ptr< Image > & image, int x0, int y0, int x1, int y1, int width, int height, int safe) const =0

Copies a region of a specified image into a specified region of the current image. ZLIB compressed formats are not supported.

Arguments

  • const Ptr< Image > & image - Source image, from which a region will be copied.
  • int x0 - X coordinate of a position in the image, where data will be copied to.
  • int y0 - Y coordinate of a position in the image, where data will be copied to.
  • int x1 - X coordinate of a position in a source image, where data will be copied from.
  • int y1 - Y coordinate of a position in a source image, where data will be copied from.
  • int width - Width of an image region to copy.
  • int height - Height of an image region to copy.
  • int safe - Safe copying with respect to destination image boundaries.

Return value

Returns 1 if the image region is copied successfully; otherwise, 0.

virtual int blend (const Ptr< Image > & image, int x0, int y0, int x1, int y1, int width, int height, float scale, int safe) const =0

Blends a region of a specified image with a specified region of the current image. Compressed, combined, half-float and float formats are not supported. Images of different formats can be blended as follows:
  • R8 with R8, RG8;
  • RG8 with RG8, RGB8;
  • RGB8 with RGB8, RGBA8;
  • RGBA8 with RGBA8 only;
  • R16 with R16, RG16;
  • RG16 with RG16, RGB16;
  • RGB16 with RGB16, RGBA16;
  • RGBA16 with RGBA16 only;

Arguments

  • const Ptr< Image > & image - Source image to be blended with the current image.
  • int x0 - X coordinate of a position in the current image.
  • int y0 - Y coordinate of a position in the current image.
  • int x1 - X coordinate of a position in a source image, which is blended with the current image.
  • int y1 - Y coordinate of a position in a source image, which is blended with the current image.
  • int width - Width of the blending region.
  • int height - Height of the blending region.
  • float scale - Scale of blending:
    • If blended images are of the same format, the blended image is multiplied by scale value and is added to the destination image.
    • If a source image has one more channel compared to the current one, it will serve as alpha value. This channel value is multiplied by scale and is used to alpha blend the images.
    • The default scale value is 1.0f.
  • int safe - Safe blending with respect to destination image boundaries.

Return value

Returns 1 if blending is successful; otherwise, 0.

virtual int compare (const Ptr< Image > & image, int x0, int y0, int x1, int y1, int width, int height) const =0

Compares a region of a specified image with a specified region of the current image. Compressed, combined, half-float and float formats are not supported.

Arguments

  • const Ptr< Image > & image - Source image to compare the current image with.
  • int x0 - X coordinate of a position in the current image.
  • int y0 - Y coordinate of a position in the current image.
  • int x1 - X coordinate of a position in the source image.
  • int y1 - Y coordinate of a position in the source image.
  • int width - Width of a region to compare.
  • int height - Height of a region to compare.

Return value

Returns 1 if the regions match; otherwise, 0.

virtual int resize (int width, int height, int filter) const =0

Resizes the image. Only the 2D or cube image can be resized. Compressed and combined image formats cannot be resized.

Arguments

  • int width - New image width.
  • int height - New image height.
  • int filter - Quality setting, accepts one of the FILTER_* values.

Return value

Returns 1 if the image is resized successfully; otherwise, 0.

virtual int rotate (int angle) const =0

Rotates the image by a given angle (with the step of 90 degrees). Only the 2D or cube image can be rotated. Compressed and combined image formats cannot be rotated.

Arguments

  • int angle - Angle that is multiplied by the step (angle * 90) to set the image rotation degree.

Return value

Returns 1 if the image is rotated successfully; otherwise, 0.

virtual int blur (int size) const =0

Filters the image using two-pass Gaussian blur. Only the 2D or cube image can be resized. Compressed and combined image formats are not supported.

Arguments

  • int size - Blur filter size. It is the number of neighbouring source pixels (from all sides) that are averaged for each blurred destination pixel. For example, if blur = 2, two pixels from each side are and the blurring kernel is 5x5 pixels.

Return value

Returns 1 if the image is blurred successfully or the size of blur filter is 0; otherwise, 0.

virtual int extrude (int num) const =0

Extrudes a contour of the image in the alpha=0 region on the given number of pixels. Only images of the RGBA8 and RGBA16 formats can be extruded.

Arguments

  • int num - Number of contour pixels.

Return value

Returns 1 if the image contour is extruded successfully; otherwise, 0.

virtual int normalize () const =0

Creates a three-component normal map out of the image.

Return value

Returns 1 if the normal map is created successfully; otherwise, 0.

virtual int invert () const =0

Inverts the image value. Only R8, RG8, RGB8, RGBA8, R16, RG16, RGB16, RGBA16, R32F, RG32F, RGB32F and RGBA32F formats can be inverted.

Return value

Returns 1 if the image is inverted successfully; otherwise, 0.

virtual int flipX () const =0

Flips the 2D image horizontally. Compressed and combined image formats are not supported.

Return value

Returns 1 if the image is flipped successfully; otherwise, 0.

virtual int flipY () const =0

Flips the 2D image vertically. Compressed and combined image formats are not supported.

Return value

Returns 1 if the image is flipped successfully; otherwise, 0.

virtual int sign () const =0

Converts the image from unsigned type to signed char. Only R8, RG8, RGB8, RGBA8, R16, RG16, RGB16, RGBA16, ATI1 and ATI2 formats can be converted.

Return value

Returns 1 if the image is converted successfully; otherwise, 0.

virtual int createMipmaps (int filter, float gamma) const =0

Generates mipmaps for the image. Mipmaps cannot be created for compressed and combined image formats.

Arguments

  • int filter - Filter type to be used: box or point. The default filter is box. See the Unigine::Image Enumerations with FILTER_* prefixes at the end of the article.
  • float gamma - Gamma correction value. If 1 is provided, no gamma correction is applied. This is an optional argument.

Return value

Returns 1 if the mipmaps are generated successfully; otherwise, 0.

virtual int decombineMipmaps () const =0

Decombines the loaded 2D image and the mipmap images. The number of mipmaps must be larger than 1. Compressed image formats cannot be decombined.

Return value

Returns 1 if the mipmaps are decombined successfully; otherwise, 0.

virtual int combineMipmaps () const =0

Combines the loaded 2D image with the mipmap image. Only one mipmap image can be combined. Compressed image formats cannot be combined.

Return value

Returns 1 if the image and mipmaps are combined successfully; otherwise, 0.

virtual int convertToType (int type) const =0

Converts the image to a specified type. The following conversions are possible:
  1. 2D (height should be proportional to width) to 3D. Target dimensions are width × height × height/width.
  2. 2D (height should divide by four, width should divide by three) to cube image.
  3. 3D to 2D. Target dimensions are width × height*depth.
  4. 3D to 2D image array. Target dimensions are width × height.
  5. Cube to 2D. Target dimensions are width*4 × height*3.
  6. Cube to 2D image array. Target dimensions are width × height.
  7. 2D image array to 2D. Target dimensions are width × height*number of image layers.

Arguments

Return value

Returns 1 if the image is converted successfully; otherwise, 0.

virtual int convertToFormat (int format) const =0

Converts the image to a specified format. To see all of the possible conversions, see the convertToFormat() function in the article on Image Class in the UnigineScript Core Library section.

Arguments

Return value

Returns 1 if the image is converted successfully; otherwise, 0.

virtual int decombine () const =0

Converts the image from the combined format to a correct one. The following conversions are available:
  • RGB565 to RGB8
  • RGBA4 to RGBA8
  • RGB5A1 to RGBA8
  • RGB10A2 to RGBA16

Return value

Returns 1 if the image is converted successfully; otherwise, 0.

virtual int combine (int format) const =0

Converts the image to a combined format. The following conversions are available:
  • RGB8 to RGB565
  • RGBA8 to RGBA4 if the format is specified as RGBA4; otherwise, RGBA8 is converted to RGB5A1 by default
  • RGBA16 to RGB10A2

Arguments

  • int format - Combined format to convert the image into. This is an optional argument. If no format is specified, default conversion will be performed.

Return value

Returns 1 if the image is successfully converted to the combined format; otherwise, 0.

virtual int decompress () const =0

Decompresses the image from the compressed format to a correct one. The following conversions are available:
  • DXT1 to RGBA8
  • DXT1 without alpha data to RGB8
  • DXT3 to RGBA8
  • DXT5 to RGBA8
  • ATI1 to R8
  • ATI2 to RG8

Return value

Returns 1 if the image is decompressed successfully; otherwise, 0.

virtual int compress (int format) const =0

Converts the image to a compressed format. The following conversions are available:
  • ZLC1 to ZLC1
  • ZLC2 to ZLC2

Arguments

  • int format - Format that the image should be converted to.

Return value

Returns 1 if the image is compressed successfully; otherwise, 0.

virtual void set2D (int x, int y, const Pixel & p) const =0

Sets a color for a given pixel of a 2D image. Compressed formats are not supported.

Arguments

  • int x - X coordinate of a pixel.
  • int y - Y coordinate of a pixel.
  • const Pixel & p - Color with components normalized in range from 0 to 1.

virtual Pixel get2D (int x, int y) const =0

Returns a color of a given pixel of a 2D image. Compressed formats are not supported.

Arguments

  • int x - X integer coordinate of a pixel in range [0; width].
  • int y - Y integer coordinate of a pixel in range [0; height].

Return value

Color of the target pixel normalized in range [0;1]. Each component is an integer value.

virtual Pixel get2D (float x, float y) const =0

Returns a color of a given pixel of a 2D image. Compressed formats are not supported.

Arguments

  • float x - X coordinate of a pixel normalized in range [0;1].
  • float y - Y coordinate of a pixel normalized in range [0;1].

Return value

Color of the target pixel normalized in range [0;1]. Each component is a float value.

virtual void set3D (int x, int y, int z, const Pixel & p) const =0

Sets a color of a given pixel of a 3D image. Compressed formats are not supported.

Arguments

  • int x - X coordinate of a pixel.
  • int y - Y coordinate of a pixel.
  • int z - Z coordinate of a pixel.
  • const Pixel & p - Color with components normalized in range from 0 to 1.

virtual Pixel get3D (int x, int y, int z) const =0

Returns a color of a given pixel of a 3D image. Compressed formats are not supported.

Arguments

  • int x - X integer coordinate of a pixel in range [0;width].
  • int y - Y integer coordinate of a pixel in range [0;height].
  • int z - Z integer coordinate of a pixel in range [0;depth].

Return value

Color of the target pixel with components normalized in range from 0 to 1.

virtual Pixel get3D (float x, float y, float z) const =0

Returns a color of a given pixel of a 3D image. Compressed formats are not supported.

Arguments

  • float x - X coordinate of a pixel normalized in range [0;1].
  • float y - Y coordinate of a pixel normalized in range [0;1].
  • float z - Z coordinate of a pixel normalized in range [0;1].

Return value

Color of the target pixel with components normalized in range from 0 to 1.

virtual void setCube (int x, int y, int face, const Pixel & p) const =0

Sets a color of a given pixel. The image must be of the Cube type. Compressed formats are not supported.

Arguments

  • int x - X coordinate of a pixel.
  • int y - Y coordinate of a pixel.
  • int face - Face number in range from 0 to 5.
  • const Pixel & p - Color with components normalized in range from 0 to 1.

virtual Pixel getCube (int x, int y, int face) const =0

Returns a color of a given pixel. The image must be of the Cube type. Compressed formats are not supported.

Arguments

  • int x - X integer coordinate of a pixel in range [0;width].
  • int y - Y integer coordinate of a pixel in range [0;height].
  • int face - Face number in range from 0 to 5.

Return value

Color with components normalized in range from 0 to 1.

virtual Pixel getCube (float x, float y, int face) const =0

Returns a color of a given pixel. The image must be of the Cube type. Compressed formats are not supported.

Arguments

  • float x - X coordinate of a pixel normalized in range [0;1].
  • float y - Y coordinate of a pixel normalized in range [0;1].
  • int face - Face number in range from 0 to 5.

Return value

Color with components normalized in range from 0 to 1.

virtual Pixel getCube (const vec3 & direction) const =0

Returns a color of a given pixel. The image must be of the Cube type.

Arguments

  • const vec3 & direction - Cube direction vector used for color sampling.

Return value

Color of the target pixel with components normalized in range from 0 to 1.

virtual void set2DArray (int x, int y, int layer, const Pixel & p) const =0

Sets a color of a given pixel. The image must be a 2D image array. Compressed formats are not supported.

Arguments

  • int x - X coordinate of a pixel.
  • int y - Y coordinate of a pixel.
  • int layer - Image layer number.
  • const Pixel & p - Color with components normalized in range from 0 to 1.

virtual Pixel get2DArray (int x, int y, int layer) const =0

Returns a color of a given pixel. The image must be a 2D image array. Compressed formats are not supported.

Arguments

  • int x - X integer coordinate of a pixel in range [0;width].
  • int y - Y integer coordinate of a pixel in range [0;height].
  • int layer - Image layer number.

Return value

Color of the target pixel with components normalized in range from 0 to 1.

virtual Pixel get2DArray (float x, float y, int layer) const =0

Returns a color of a given pixel. The image must be a 2D image array. Compressed formats are not supported.

Arguments

  • float x - X coordinate of a pixel normalized in range [0;1].
  • float y - Y coordinate of a pixel normalized in range [0;1].
  • int layer - Image layer number.

Return value

Color of the target pixel with components normalized in range from 0 to 1.

virtual void setCubeArray (int x, int y, int face, int layer, const Pixel & p) const =0

Sets a color of a given pixel. The image must be of the Cube Array type. Compressed formats are not supported.

Arguments

  • int x - X coordinate of a pixel.
  • int y - Y coordinate of a pixel.
  • int face - Face number in range from 0 to 5.
  • int layer - Image layer number.
  • const Pixel & p - Color with components normalized in range from 0 to 1.

virtual Pixel getCubeArray (int x, int y, int face, int layer) const =0

Returns a color of a given pixel. The image must be of the Cube Array type. Compressed formats are not supported.

Arguments

  • int x - X integer coordinate of a pixel in range [0;width].
  • int y - Y integer coordinate of a pixel in range [0;height].
  • int face - Face number in range from 0 to 5.
  • int layer - Image layer number.

Return value

Color with components normalized in range from 0 to 1.

virtual Pixel getCubeArray (float x, float y, int face, int layer) const =0

Returns a color of a given pixel. The image must be of the Cube Array type. Compressed formats are not supported.

Arguments

  • float x - X coordinate of a pixel normalized in range [0;1].
  • float y - Y coordinate of a pixel normalized in range [0;1].
  • int face - Face number in range from 0 to 5.
  • int layer - Image layer number.

Return value

Color with components normalized in range from 0 to 1.

virtual Pixel getCubeArray (const vec3 & direction, int layer) const =0

Returns a color of a given pixel. The image must be of the Cube Array type.

Arguments

  • const vec3 & direction - Cube direction vector used for color sampling.
  • int layer - Image layer number.

Return value

Color of the target pixel with components normalized in range from 0 to 1.

virtual unsigned char * getPixels () const =0

Returns the pointer to the array of pixels.

Return value

Pointer to the array of pixels.

virtual unsigned char * getPixels2D (int level) const =0

Returns the pointer to the array of pixels with the given mipmap level for the 2D image.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Pointer to the array of pixels.

virtual unsigned char * getPixels3D (int level) const =0

Returns the pointer to the array of pixels with the given mipmap level for the 3D image.

Arguments

  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Pointer to the array of pixels.

virtual unsigned char * getPixelsCube (int face, int level) const =0

Returns the pointer to the array of pixels with the given mipmap level for the cube image.

Arguments

  • int face - Face number in range from 0 to 5.
  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Pointer to the array of pixels.

virtual unsigned char * getPixels2DArray (int layer, int level) const =0

Returns the pointer to the array of pixels with the given mipmap level and image layer for the 2D Array image.

Arguments

  • int layer - Number of the image layer.
  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Pointer to the array of pixels.

virtual unsigned char * getPixelsCubeArray (int face, int layer, int level) const =0

Returns the pointer to the array of pixels with the given mipmap level and image layer for the Cube Array image.

Arguments

  • int face - Face number in range from 0 to 5.
  • int layer - Number of the image layer.
  • int level - Mipmap level in range from 0 to the total number of mipmaps. This is an optional argument.

Return value

Pointer to the array of pixels.

Unigine::Image::anonymous_14 Enumeration

IMAGE_2D = 0
IMAGE_3D
IMAGE_CUBE
IMAGE_2D_ARRAY
IMAGE_CUBE_ARRAY

Unigine::Image::anonymous_15 Enumeration

FORMAT_R8 = 0
FORMAT_RG8
FORMAT_RGB8
FORMAT_RGBA8
FORMAT_R16
FORMAT_RG16
FORMAT_RGB16
FORMAT_RGBA16
FORMAT_R16F
FORMAT_RG16F
FORMAT_RGB16F
FORMAT_RGBA16F
FORMAT_R32F
FORMAT_RG32F
FORMAT_RGB32F
FORMAT_RGBA32F
FORMAT_RGB565
FORMAT_RGBA4
FORMAT_RGB5A1
FORMAT_RGB10A2
FORMAT_DXT1
FORMAT_DXT3
FORMAT_DXT5
FORMAT_ATI1
FORMAT_ATI2
FORMAT_ZLC1
FORMAT_ZLC2

Unigine::Image::anonymous_16 Enumeration

FILTER_POINT = 0
FILTER_LINEAR
Last update: 2017-07-03