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 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
- int width - Image width in pixels.
- int height - Image height in pixels.
- 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 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
- int width - Image width in pixels.
- int height - Image height in pixels.
- 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 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 texture 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 texture array 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 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 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 unsigned char * data, int size) const =0
Loads 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 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 texture 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 texture 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 texture array.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, R5G6B5, RGBA4, RGB5A1, RGB10A2, DXT1, DXT3, DXT5, ATI1, ATI2, ETC1, ETC2, ETC5, EAC1, EAC2, ATC1, ATC3, ATC5, PVR4, 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, R5G6B5, 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, ATI2, ETC1 or PVR4).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 (R5G6B5, 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, ETC1, PVR4, 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 texture array. The default is 1.Return value
Number of layers.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 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 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) 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.
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 flipX () const =0
Return value
Returns 1 if the image is flipped successfully; otherwise, 0.virtual int flipY () const =0
Return value
Returns 1 if the image is flipped successfully; otherwise, 0.virtual int expand () const =0
Return value
Returns 1 if the image is converted successfully; otherwise, 0.virtual int normalize () const =0
Return value
Returns 1 if the normal map is created successfully; 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 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:- 2D (height should be proportional to width) to 3D. Target dimensions are width × height × height/width.
- 2D (height should divide by four, width should divide by three) to cube image. Target dimensions are width/4 × height/3.
- 3D to 2D. Target dimensions are width × height*depth.
- 3D to 2D texture array. Target dimensions are width × height.
- Cube to 2D. Target dimensions are width*4 × height*3.
- Cube to 2D texture array. Target dimensions are width × height.
- 2D texture array to 2D. Target dimensions are width × height*number of texture layers.
Arguments
- int type - Type for conversion. See the Unigine::Image:: Enumeration with IMAGE_* prefixes.
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
- int format - Format for conversion. See the Unigine::Image:: format enumeration with FORMAT_* prefixes.
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:- R5G6B5 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 R5G6B5
- 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
- ETC1 to RGB8
- ETC2 to RGB8
- ETC5 to RGBA8
- EAC1 to R8
- EAC2 to RG8
- ATC1 to RGB8
- ATC3 to RGBA8
- ATC5 to RGBA8
- PVR4 to RGBA8
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
- R8 to EAC1 if the format is specified as EAC1; otherwise, R8 is converted to ATI1
- RG8 to EAC2 if the format is specified as EAC2; otherwise, RG8 is converted to ATI2
- RGB8 to ATC1 if the format is specified as ATC1; to ETC1 if the format is specified as EAC1; to ETC2 if the format is specified as EAC2; otherwise, to DXT1
- RGBA8 to DXT3 if the format is specified as DXT3; ETC5 if the format is specified as ETC5; ATC3 if the format is specified as ATC3; ATC5 if the format is specified as ATC5; PVR4 if the format is specified as PVR4; otherwise, to DXT5.
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 void set2D (int x, int y, int r, int g, int b, int a) const =0
Sets a color for a given pixel of a 2D image. Compressed formats are not supported. Value is in range of 0 to 255 for 8-bit formats and in range of 0 to 65535 for 16-bit formats.Arguments
- int x - X coordinate of a pixel.
- int y - Y coordinate of a pixel.
- int r - Red component of a color.
- int g - Green component of a color.
- int b - Blue component of a color.
- int a - Alpha component of a color.
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 void set3D (int x, int y, int z, int r, int g, int b, int a) const =0
Sets a color of a given pixel of a 3D image. Compressed formats are not supported. Value is in range of 0 to 255 for 8-bit formats and in range of 0 to 65535 for 16-bit formats.Arguments
- int x - X coordinate of a pixel.
- int y - Y coordinate of a pixel.
- int z - Z coordinate of a pixel.
- int r - Red component of a color.
- int g - Green component of a color.
- int b - Blue component of a color.
- int a - Alpha component of a color.
virtual Pixel get3D (int x, int y, int z) const =0
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 void setCube (int x, int y, int face, int r, int g, int b, int a) const =0
Sets a color of a given pixel. The image must be of the cube type. Compressed formats are not supported. Value is in range of 0 to 255 for 8-bit formats and in range from 0 to 65535 for 16-bit formats.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 r - Red component of a color.
- int g - Green component of a color.
- int b - Blue component of a color.
- int a - Alpha component of a color.
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 float * direction) const =0
Returns a color of a given pixel. The image must be of the cube type.Arguments
- const float * 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 texture array. Compressed formats are not supported.Arguments
- int x - X coordinate of a pixel.
- int y - Y coordinate of a pixel.
- int layer - Texture layer number.
- const Pixel & p - Color with components normalized in range from 0 to 1.
virtual void set2DArray (int x, int y, int layer, int r, int g, int b, int a) const =0
Sets a color of a given pixel. The image must be a 2D texture array. Compressed formats are not supported. Value is in range of 0 to 255 for 8-bit formats and in range from 0 to 65535 for 16-bit formats.Arguments
- int x - X coordinate of a pixel.
- int y - Y coordinate of a pixel.
- int layer - Texture layer number.
- int r - Red component of a color.
- int g - Green component of a color.
- int b - Blue component of a color.
- int a - Alpha component of a color.
virtual Pixel get2DArray (int x, int y, int layer) const =0
Returns a color of a given pixel. The image must be a 2D texture 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 - Texture 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 texture 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 - Texture 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 texture layer for the 2D array image.Arguments
- int layer - Number of the texture 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_12 Enumeration
IMAGE_2D
= 0
IMAGE_3D
IMAGE_CUBE
IMAGE_2D_ARRAY
Unigine::Image::anonymous_13 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_R5G6B5
FORMAT_RGBA4
FORMAT_RGB5A1
FORMAT_RGB10A2
FORMAT_DXT1
FORMAT_DXT3
FORMAT_DXT5
FORMAT_ATI1
FORMAT_ATI2
FORMAT_ETC1
FORMAT_ETC2
FORMAT_ETC5
FORMAT_EAC1
FORMAT_EAC2
FORMAT_ATC1
FORMAT_ATC3
FORMAT_ATC5
FORMAT_PVR4
FORMAT_ZLC1
FORMAT_ZLC2
Unigine::Image::anonymous_14 Enumeration
FILTER_POINT
= 0
FILTER_BOX
Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter