arsa  2.7
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
irr::video::IImage Class Referenceabstract

Interface for software image data. More...

#include <IImage.h>

Inheritance diagram for irr::video::IImage:
irr::IReferenceCounted

Public Member Functions

 IImage (ECOLOR_FORMAT format, const core::dimension2d< u32 > &size, bool deleteMemory)
 constructor More...
 
virtual ~IImage ()
 destructor More...
 
ECOLOR_FORMAT getColorFormat () const
 Returns the color format. More...
 
const core::dimension2d< u32 > & getDimension () const
 Returns width and height of image data. More...
 
u32 getBitsPerPixel () const
 Returns bits per pixel. More...
 
u32 getBytesPerPixel () const
 Returns bytes per pixel. More...
 
u32 getImageDataSizeInBytes () const
 Returns image data size in bytes. More...
 
u32 getImageDataSizeInPixels () const
 Returns image data size in pixels. More...
 
u32 getPitch () const
 Returns pitch of image. More...
 
u32 getRedMask () const
 Returns mask for red value of a pixel. More...
 
u32 getGreenMask () const
 Returns mask for green value of a pixel. More...
 
u32 getBlueMask () const
 Returns mask for blue value of a pixel. More...
 
u32 getAlphaMask () const
 Returns mask for alpha value of a pixel. More...
 
voidgetData () const
 Use this to get a pointer to the image data. More...
 
_IRR_DEPRECATED_ voidlock ()
 Lock function. Use this to get a pointer to the image data. More...
 
_IRR_DEPRECATED_ void unlock ()
 Unlock function. More...
 
core::dimension2du getMipMapsSize (u32 mipmapLevel) const
 Get the mipmap size for this image for a certain mipmap level. More...
 
voidgetMipMapsData (irr::u32 mipLevel=1) const
 Get mipmaps data. More...
 
void setMipMapsData (void *data, bool ownForeignMemory, bool deleteMemory)
 Set mipmaps data. More...
 
virtual SColor getPixel (u32 x, u32 y) const =0
 Returns a pixel. More...
 
virtual void setPixel (u32 x, u32 y, const SColor &color, bool blend=false)=0
 Sets a pixel. More...
 
virtual void copyToScaling (void *target, u32 width, u32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0)=0
 Copies the image into the target, scaling the image to fit. More...
 
virtual void copyToScaling (IImage *target)=0
 Copies the image into the target, scaling the image to fit. More...
 
virtual void copyTo (IImage *target, const core::position2d< s32 > &pos=core::position2d< s32 >(0, 0))=0
 copies this surface into another More...
 
virtual void copyTo (IImage *target, const core::position2d< s32 > &pos, const core::rect< s32 > &sourceRect, const core::rect< s32 > *clipRect=0)=0
 copies this surface into another More...
 
virtual void copyToWithAlpha (IImage *target, const core::position2d< s32 > &pos, const core::rect< s32 > &sourceRect, const SColor &color, const core::rect< s32 > *clipRect=0, bool combineAlpha=false)=0
 copies this surface into another, using the alpha mask and cliprect and a color to add with More...
 
virtual void copyToScalingBoxFilter (IImage *target, s32 bias=0, bool blend=false)=0
 copies this surface into another, scaling it to fit, applying a box filter More...
 
virtual void fill (const SColor &color)=0
 fills the surface with given color More...
 
_IRR_DEPRECATED_ bool isCompressed () const
 Inform whether the image is compressed. More...
 
_IRR_DEPRECATED_ bool hasMipMaps () const
 Check whether the image has MipMaps. More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 

Static Public Member Functions

static core::dimension2du getMipMapsSize (const core::dimension2du &sizeLevel0, u32 mipmapLevel)
 Calculate mipmap size for a certain level. More...
 
static u32 getBitsPerPixelFromFormat (const ECOLOR_FORMAT format)
 get the amount of Bits per Pixel of the given color format More...
 
static u32 getDataSizeFromFormat (ECOLOR_FORMAT format, u32 width, u32 height)
 calculate image data size in bytes for selected format, width and height. More...
 
static bool isCompressedFormat (const ECOLOR_FORMAT format)
 check if this is compressed color format More...
 
static bool isDepthFormat (const ECOLOR_FORMAT format)
 check if the color format is only viable for depth/stencil textures More...
 
static bool isFloatingPointFormat (const ECOLOR_FORMAT format)
 Check if the color format uses floating point values for pixels. More...
 

Protected Attributes

ECOLOR_FORMAT Format
 
core::dimension2d< u32Size
 
u8Data
 
u8MipMapsData
 
u32 BytesPerPixel
 
u32 Pitch
 
bool DeleteMemory
 
bool DeleteMipMapsMemory
 
core::irrAllocator< u8Allocator
 

Additional Inherited Members

- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Detailed Description

Interface for software image data.

Image loaders create these images from files. IVideoDrivers convert these images into their (hardware) textures. NOTE: Floating point formats are not well supported yet. Basically only getData() works for them.

Definition at line 25 of file IImage.h.

Constructor & Destructor Documentation

◆ IImage()

irr::video::IImage::IImage ( ECOLOR_FORMAT  format,
const core::dimension2d< u32 > &  size,
bool  deleteMemory 
)
inline

constructor

Definition at line 30 of file IImage.h.

30  :
31  Format(format), Size(size), Data(0), MipMapsData(0), BytesPerPixel(0), Pitch(0), DeleteMemory(deleteMemory), DeleteMipMapsMemory(false)
32  {
35  }
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
get the amount of Bits per Pixel of the given color format
Definition: IImage.h:364
GLsizeiptr size
SDL_AudioFormat format
Definition: SDL_audio.h:194
T Width
Width of the dimension.
Definition: dimension2d.h:204
ECOLOR_FORMAT Format
Definition: IImage.h:534
core::dimension2d< u32 > Size
Definition: IImage.h:535
bool DeleteMipMapsMemory
Definition: IImage.h:544

◆ ~IImage()

virtual irr::video::IImage::~IImage ( )
inlinevirtual

destructor

Definition at line 38 of file IImage.h.

39  {
40  if (DeleteMemory)
41  delete[] Data;
42 
45  }
core::irrAllocator< u8 > Allocator
Definition: IImage.h:546
void deallocate(T *ptr)
Deallocate memory for an array of objects.
Definition: irrAllocator.h:39
bool DeleteMipMapsMemory
Definition: IImage.h:544

Member Function Documentation

◆ copyTo() [1/2]

virtual void irr::video::IImage::copyTo ( IImage target,
const core::position2d< s32 > &  pos = core::position2ds32 >(0, 0) 
)
pure virtual

copies this surface into another

NOTE: mipmaps are ignored

◆ copyTo() [2/2]

virtual void irr::video::IImage::copyTo ( IImage target,
const core::position2d< s32 > &  pos,
const core::rect< s32 > &  sourceRect,
const core::rect< s32 > *  clipRect = 0 
)
pure virtual

copies this surface into another

NOTE: mipmaps are ignored

◆ copyToScaling() [1/2]

virtual void irr::video::IImage::copyToScaling ( void target,
u32  width,
u32  height,
ECOLOR_FORMAT  format = ECF_A8R8G8B8,
u32  pitch = 0 
)
pure virtual

Copies the image into the target, scaling the image to fit.

NOTE: mipmaps are ignored

◆ copyToScaling() [2/2]

virtual void irr::video::IImage::copyToScaling ( IImage target)
pure virtual

Copies the image into the target, scaling the image to fit.

NOTE: mipmaps are ignored

◆ copyToScalingBoxFilter()

virtual void irr::video::IImage::copyToScalingBoxFilter ( IImage target,
s32  bias = 0,
bool  blend = false 
)
pure virtual

copies this surface into another, scaling it to fit, applying a box filter

NOTE: mipmaps are ignored

◆ copyToWithAlpha()

virtual void irr::video::IImage::copyToWithAlpha ( IImage target,
const core::position2d< s32 > &  pos,
const core::rect< s32 > &  sourceRect,
const SColor color,
const core::rect< s32 > *  clipRect = 0,
bool  combineAlpha = false 
)
pure virtual

copies this surface into another, using the alpha mask and cliprect and a color to add with

NOTE: mipmaps are ignored

Parameters
combineAlpha- When true then combine alpha channels. When false replace target image alpha with source image alpha.

◆ fill()

virtual void irr::video::IImage::fill ( const SColor color)
pure virtual

fills the surface with given color

◆ getAlphaMask()

u32 irr::video::IImage::getAlphaMask ( ) const
inline

Returns mask for alpha value of a pixel.

Definition at line 145 of file IImage.h.

146  {
147  switch (Format)
148  {
149  case ECF_A1R5G5B5:
150  return 0x1 << 15;
151  case ECF_R5G6B5:
152  return 0x0;
153  case ECF_R8G8B8:
154  return 0x0;
155  case ECF_A8R8G8B8:
156  return 0xFF000000;
157  default:
158  return 0x0;
159  }
160  }
16 bit color format used by the software driver.
Definition: SColor.h:26
ECOLOR_FORMAT Format
Definition: IImage.h:534
Standard 16 bit color format.
Definition: SColor.h:29

◆ getBitsPerPixel()

u32 irr::video::IImage::getBitsPerPixel ( ) const
inline

Returns bits per pixel.

Definition at line 60 of file IImage.h.

61  {
62 
64  }
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
get the amount of Bits per Pixel of the given color format
Definition: IImage.h:364
ECOLOR_FORMAT Format
Definition: IImage.h:534

◆ getBitsPerPixelFromFormat()

static u32 irr::video::IImage::getBitsPerPixelFromFormat ( const ECOLOR_FORMAT  format)
inlinestatic

get the amount of Bits per Pixel of the given color format

Definition at line 364 of file IImage.h.

365  {
366  switch(format)
367  {
368  case ECF_A1R5G5B5:
369  return 16;
370  case ECF_R5G6B5:
371  return 16;
372  case ECF_R8G8B8:
373  return 24;
374  case ECF_A8R8G8B8:
375  return 32;
376  case ECF_DXT1:
377  return 16;
378  case ECF_DXT2:
379  case ECF_DXT3:
380  case ECF_DXT4:
381  case ECF_DXT5:
382  return 32;
383  case ECF_PVRTC_RGB2:
384  return 12;
385  case ECF_PVRTC_ARGB2:
386  case ECF_PVRTC2_ARGB2:
387  return 16;
388  case ECF_PVRTC_RGB4:
389  return 24;
390  case ECF_PVRTC_ARGB4:
391  case ECF_PVRTC2_ARGB4:
392  return 32;
393  case ECF_ETC1:
394  case ECF_ETC2_RGB:
395  return 24;
396  case ECF_ETC2_ARGB:
397  return 32;
398  case ECF_D16:
399  return 16;
400  case ECF_D32:
401  return 32;
402  case ECF_D24S8:
403  return 32;
404  case ECF_R8:
405  return 8;
406  case ECF_R8G8:
407  return 16;
408  case ECF_R16:
409  return 16;
410  case ECF_R16G16:
411  return 32;
412  case ECF_R16F:
413  return 16;
414  case ECF_G16R16F:
415  return 32;
416  case ECF_A16B16G16R16F:
417  return 64;
418  case ECF_R32F:
419  return 32;
420  case ECF_G32R32F:
421  return 64;
422  case ECF_A32B32G32R32F:
423  return 128;
424  default:
425  return 0;
426  }
427  }
16 bit format using 16 bits for depth.
Definition: SColor.h:123
DXT3 color format.
Definition: SColor.h:49
PVRTC RGB 4bpp.
Definition: SColor.h:64
DXT4 color format.
Definition: SColor.h:52
64 bit format using 32 bits for the red and green channels.
Definition: SColor.h:101
64 bit format using 16 bits for the red, green, blue and alpha channels.
Definition: SColor.h:95
32 bit format using 32 bits for the red channel.
Definition: SColor.h:98
16 bit format using 16 bits for the red channel.
Definition: SColor.h:89
32 bit format using 24 bits for depth and 8 bits for stencil.
Definition: SColor.h:129
PVRTC RGB 2bpp.
Definition: SColor.h:58
SDL_AudioFormat format
Definition: SDL_audio.h:194
PVRTC2 ARGB 4bpp.
Definition: SColor.h:73
128 bit format using 32 bits for the red, green, blue and alpha channels.
Definition: SColor.h:104
16 bit color format used by the software driver.
Definition: SColor.h:26
8 bit format using 8 bits for the red channel.
Definition: SColor.h:109
DXT2 color format.
Definition: SColor.h:46
PVRTC2 ARGB 2bpp.
Definition: SColor.h:70
16 bit format using 16 bits for the red channel.
Definition: SColor.h:115
32 bit format using 16 bits for the red and green channels.
Definition: SColor.h:118
DXT5 color format.
Definition: SColor.h:55
Standard 16 bit color format.
Definition: SColor.h:29
ETC1 RGB.
Definition: SColor.h:76
DXT1 color format.
Definition: SColor.h:43
32 bit format using 32 bits for depth.
Definition: SColor.h:126
32 bit format using 16 bits for the red and green channels.
Definition: SColor.h:92
16 bit format using 8 bits for the red and green channels.
Definition: SColor.h:112
PVRTC ARGB 4bpp.
Definition: SColor.h:67
PVRTC ARGB 2bpp.
Definition: SColor.h:61

◆ getBlueMask()

u32 irr::video::IImage::getBlueMask ( ) const
inline

Returns mask for blue value of a pixel.

Definition at line 127 of file IImage.h.

128  {
129  switch (Format)
130  {
131  case ECF_A1R5G5B5:
132  return 0x1F;
133  case ECF_R5G6B5:
134  return 0x1F;
135  case ECF_R8G8B8:
136  return 0x000000FF;
137  case ECF_A8R8G8B8:
138  return 0x000000FF;
139  default:
140  return 0x0;
141  }
142  }
16 bit color format used by the software driver.
Definition: SColor.h:26
ECOLOR_FORMAT Format
Definition: IImage.h:534
Standard 16 bit color format.
Definition: SColor.h:29

◆ getBytesPerPixel()

u32 irr::video::IImage::getBytesPerPixel ( ) const
inline

Returns bytes per pixel.

Definition at line 67 of file IImage.h.

68  {
69  return BytesPerPixel;
70  }

◆ getColorFormat()

ECOLOR_FORMAT irr::video::IImage::getColorFormat ( ) const
inline

Returns the color format.

Definition at line 48 of file IImage.h.

49  {
50  return Format;
51  }
ECOLOR_FORMAT Format
Definition: IImage.h:534

◆ getData()

void* irr::video::IImage::getData ( ) const
inline

Use this to get a pointer to the image data.

Returns
Pointer to the image data. What type of data is pointed to depends on the color format of the image. For example if the color format is ECF_A8R8G8B8, it is of u32.

Definition at line 167 of file IImage.h.

168  {
169  return Data;
170  }

◆ getDataSizeFromFormat()

static u32 irr::video::IImage::getDataSizeFromFormat ( ECOLOR_FORMAT  format,
u32  width,
u32  height 
)
inlinestatic

calculate image data size in bytes for selected format, width and height.

Definition at line 430 of file IImage.h.

431  {
432  u32 imageSize = 0;
433 
434  switch (format)
435  {
436  case ECF_DXT1:
437  imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 8;
438  break;
439  case ECF_DXT2:
440  case ECF_DXT3:
441  case ECF_DXT4:
442  case ECF_DXT5:
443  imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 16;
444  break;
445  case ECF_PVRTC_RGB2:
446  case ECF_PVRTC_ARGB2:
447  imageSize = (core::max_<u32>(width, 16) * core::max_<u32>(height, 8) * 2 + 7) / 8;
448  break;
449  case ECF_PVRTC_RGB4:
450  case ECF_PVRTC_ARGB4:
451  imageSize = (core::max_<u32>(width, 8) * core::max_<u32>(height, 8) * 4 + 7) / 8;
452  break;
453  case ECF_PVRTC2_ARGB2:
454  imageSize = core::ceil32(width / 8.0f) * core::ceil32(height / 4.0f) * 8;
455  break;
456  case ECF_PVRTC2_ARGB4:
457  case ECF_ETC1:
458  case ECF_ETC2_RGB:
459  imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 8;
460  break;
461  case ECF_ETC2_ARGB:
462  imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 16;
463  break;
464  default: // uncompressed formats
466  imageSize *= height;
467  break;
468  }
469 
470  return imageSize;
471  }
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
get the amount of Bits per Pixel of the given color format
Definition: IImage.h:364
DXT3 color format.
Definition: SColor.h:49
PVRTC RGB 4bpp.
Definition: SColor.h:64
DXT4 color format.
Definition: SColor.h:52
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
REALINLINE s32 ceil32(f32 x)
Definition: irrMath.h:651
PVRTC RGB 2bpp.
Definition: SColor.h:58
SDL_AudioFormat format
Definition: SDL_audio.h:194
PVRTC2 ARGB 4bpp.
Definition: SColor.h:73
GLfloat f
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
DXT2 color format.
Definition: SColor.h:46
PVRTC2 ARGB 2bpp.
Definition: SColor.h:70
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
Definition: SDL_opengl.h:1974
DXT5 color format.
Definition: SColor.h:55
ETC1 RGB.
Definition: SColor.h:76
DXT1 color format.
Definition: SColor.h:43
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
PVRTC ARGB 4bpp.
Definition: SColor.h:67
PVRTC ARGB 2bpp.
Definition: SColor.h:61

◆ getDimension()

const core::dimension2d<u32>& irr::video::IImage::getDimension ( ) const
inline

Returns width and height of image data.

Definition at line 54 of file IImage.h.

55  {
56  return Size;
57  }
core::dimension2d< u32 > Size
Definition: IImage.h:535

◆ getGreenMask()

u32 irr::video::IImage::getGreenMask ( ) const
inline

Returns mask for green value of a pixel.

Definition at line 109 of file IImage.h.

110  {
111  switch (Format)
112  {
113  case ECF_A1R5G5B5:
114  return 0x1F << 5;
115  case ECF_R5G6B5:
116  return 0x3F << 5;
117  case ECF_R8G8B8:
118  return 0x0000FF00;
119  case ECF_A8R8G8B8:
120  return 0x0000FF00;
121  default:
122  return 0x0;
123  }
124  }
16 bit color format used by the software driver.
Definition: SColor.h:26
ECOLOR_FORMAT Format
Definition: IImage.h:534
Standard 16 bit color format.
Definition: SColor.h:29

◆ getImageDataSizeInBytes()

u32 irr::video::IImage::getImageDataSizeInBytes ( ) const
inline

Returns image data size in bytes.

Definition at line 73 of file IImage.h.

74  {
76  }
T Width
Width of the dimension.
Definition: dimension2d.h:204
ECOLOR_FORMAT Format
Definition: IImage.h:534
core::dimension2d< u32 > Size
Definition: IImage.h:535
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
calculate image data size in bytes for selected format, width and height.
Definition: IImage.h:430
T Height
Height of the dimension.
Definition: dimension2d.h:206

◆ getImageDataSizeInPixels()

u32 irr::video::IImage::getImageDataSizeInPixels ( ) const
inline

Returns image data size in pixels.

Definition at line 79 of file IImage.h.

80  {
81  return Size.Width * Size.Height;
82  }
T Width
Width of the dimension.
Definition: dimension2d.h:204
core::dimension2d< u32 > Size
Definition: IImage.h:535
T Height
Height of the dimension.
Definition: dimension2d.h:206

◆ getMipMapsData()

void* irr::video::IImage::getMipMapsData ( irr::u32  mipLevel = 1) const
inline

Get mipmaps data.

Note that different mip levels are just behind each other in memory block. So if you just get level 1 you also have the data for all other levels. There is no level 0 - use getData to get the original image data.

Definition at line 225 of file IImage.h.

226  {
227  if ( MipMapsData && mipLevel > 0)
228  {
229  size_t dataSize = 0;
230  core::dimension2du mipSize(Size);
231  u32 i = 1; // We want the start of data for this level, not end.
232 
233  while (i != mipLevel)
234  {
235  if (mipSize.Width > 1)
236  mipSize.Width >>= 1;
237 
238  if (mipSize.Height > 1)
239  mipSize.Height >>= 1;
240 
241  dataSize += getDataSizeFromFormat(Format, mipSize.Width, mipSize.Height);
242 
243  ++i;
244  if ( mipSize.Width == 1 && mipSize.Height == 1 && i < mipLevel)
245  return 0;
246  }
247 
248  return MipMapsData + dataSize;
249  }
250 
251  return 0;
252  }
dimension2d< u32 > dimension2du
Typedef for an unsigned integer dimension.
Definition: dimension2d.h:212
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
ECOLOR_FORMAT Format
Definition: IImage.h:534
core::dimension2d< u32 > Size
Definition: IImage.h:535
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
calculate image data size in bytes for selected format, width and height.
Definition: IImage.h:430
GLenum GLsizei dataSize

◆ getMipMapsSize() [1/2]

core::dimension2du irr::video::IImage::getMipMapsSize ( u32  mipmapLevel) const
inline

Get the mipmap size for this image for a certain mipmap level.

level 0 will be full image size. Every further level is half the size. Doesn't care if the image actually has mipmaps, just which size would be needed.

Definition at line 193 of file IImage.h.

194  {
195  return getMipMapsSize(Size, mipmapLevel);
196  }
core::dimension2du getMipMapsSize(u32 mipmapLevel) const
Get the mipmap size for this image for a certain mipmap level.
Definition: IImage.h:193
core::dimension2d< u32 > Size
Definition: IImage.h:535

◆ getMipMapsSize() [2/2]

static core::dimension2du irr::video::IImage::getMipMapsSize ( const core::dimension2du sizeLevel0,
u32  mipmapLevel 
)
inlinestatic

Calculate mipmap size for a certain level.

level 0 will be full image size. Every further level is half the size.

Definition at line 201 of file IImage.h.

202  {
203  core::dimension2du result(sizeLevel0);
204  u32 i=0;
205  while (i != mipmapLevel)
206  {
207  if (result.Width>1)
208  result.Width >>= 1;
209  if (result.Height>1)
210  result.Height>>=1;
211  ++i;
212 
213  if ( result.Width == 1 && result.Height == 1 && i < mipmapLevel )
214  return core::dimension2du(0,0);
215  }
216  return result;
217  }
dimension2d< u32 > dimension2du
Typedef for an unsigned integer dimension.
Definition: dimension2d.h:212
GLuint64EXT * result
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

◆ getPitch()

u32 irr::video::IImage::getPitch ( ) const
inline

Returns pitch of image.

Definition at line 85 of file IImage.h.

86  {
87  return Pitch;
88  }

◆ getPixel()

virtual SColor irr::video::IImage::getPixel ( u32  x,
u32  y 
) const
pure virtual

Returns a pixel.

◆ getRedMask()

u32 irr::video::IImage::getRedMask ( ) const
inline

Returns mask for red value of a pixel.

Definition at line 91 of file IImage.h.

92  {
93  switch (Format)
94  {
95  case ECF_A1R5G5B5:
96  return 0x1F << 10;
97  case ECF_R5G6B5:
98  return 0x1F << 11;
99  case ECF_R8G8B8:
100  return 0x00FF0000;
101  case ECF_A8R8G8B8:
102  return 0x00FF0000;
103  default:
104  return 0x0;
105  }
106  }
16 bit color format used by the software driver.
Definition: SColor.h:26
ECOLOR_FORMAT Format
Definition: IImage.h:534
Standard 16 bit color format.
Definition: SColor.h:29

◆ hasMipMaps()

_IRR_DEPRECATED_ bool irr::video::IImage::hasMipMaps ( ) const
inline

Check whether the image has MipMaps.

Returns
True if image has MipMaps, else false.

Definition at line 358 of file IImage.h.

359  {
360  return (getMipMapsData() != 0);
361  }
void * getMipMapsData(irr::u32 mipLevel=1) const
Get mipmaps data.
Definition: IImage.h:225

◆ isCompressed()

_IRR_DEPRECATED_ bool irr::video::IImage::isCompressed ( ) const
inline

Inform whether the image is compressed.

Definition at line 351 of file IImage.h.

352  {
354  }
ECOLOR_FORMAT Format
Definition: IImage.h:534
static bool isCompressedFormat(const ECOLOR_FORMAT format)
check if this is compressed color format
Definition: IImage.h:474

◆ isCompressedFormat()

static bool irr::video::IImage::isCompressedFormat ( const ECOLOR_FORMAT  format)
inlinestatic

check if this is compressed color format

Definition at line 474 of file IImage.h.

475  {
476  switch(format)
477  {
478  case ECF_DXT1:
479  case ECF_DXT2:
480  case ECF_DXT3:
481  case ECF_DXT4:
482  case ECF_DXT5:
483  case ECF_PVRTC_RGB2:
484  case ECF_PVRTC_ARGB2:
485  case ECF_PVRTC2_ARGB2:
486  case ECF_PVRTC_RGB4:
487  case ECF_PVRTC_ARGB4:
488  case ECF_PVRTC2_ARGB4:
489  case ECF_ETC1:
490  case ECF_ETC2_RGB:
491  case ECF_ETC2_ARGB:
492  return true;
493  default:
494  return false;
495  }
496  }
DXT3 color format.
Definition: SColor.h:49
PVRTC RGB 4bpp.
Definition: SColor.h:64
DXT4 color format.
Definition: SColor.h:52
PVRTC RGB 2bpp.
Definition: SColor.h:58
SDL_AudioFormat format
Definition: SDL_audio.h:194
PVRTC2 ARGB 4bpp.
Definition: SColor.h:73
DXT2 color format.
Definition: SColor.h:46
PVRTC2 ARGB 2bpp.
Definition: SColor.h:70
DXT5 color format.
Definition: SColor.h:55
ETC1 RGB.
Definition: SColor.h:76
DXT1 color format.
Definition: SColor.h:43
PVRTC ARGB 4bpp.
Definition: SColor.h:67
PVRTC ARGB 2bpp.
Definition: SColor.h:61

◆ isDepthFormat()

static bool irr::video::IImage::isDepthFormat ( const ECOLOR_FORMAT  format)
inlinestatic

check if the color format is only viable for depth/stencil textures

Definition at line 499 of file IImage.h.

500  {
501  switch(format)
502  {
503  case ECF_D16:
504  case ECF_D32:
505  case ECF_D24S8:
506  return true;
507  default:
508  return false;
509  }
510  }
16 bit format using 16 bits for depth.
Definition: SColor.h:123
32 bit format using 24 bits for depth and 8 bits for stencil.
Definition: SColor.h:129
SDL_AudioFormat format
Definition: SDL_audio.h:194
32 bit format using 32 bits for depth.
Definition: SColor.h:126

◆ isFloatingPointFormat()

static bool irr::video::IImage::isFloatingPointFormat ( const ECOLOR_FORMAT  format)
inlinestatic

Check if the color format uses floating point values for pixels.

Definition at line 513 of file IImage.h.

514  {
516  return false;
517 
518  switch(format)
519  {
520  case ECF_R16F:
521  case ECF_G16R16F:
522  case ECF_A16B16G16R16F:
523  case ECF_R32F:
524  case ECF_G32R32F:
525  case ECF_A32B32G32R32F:
526  return true;
527  default:
528  break;
529  }
530  return false;
531  }
64 bit format using 32 bits for the red and green channels.
Definition: SColor.h:101
64 bit format using 16 bits for the red, green, blue and alpha channels.
Definition: SColor.h:95
32 bit format using 32 bits for the red channel.
Definition: SColor.h:98
16 bit format using 16 bits for the red channel.
Definition: SColor.h:89
SDL_AudioFormat format
Definition: SDL_audio.h:194
128 bit format using 32 bits for the red, green, blue and alpha channels.
Definition: SColor.h:104
32 bit format using 16 bits for the red and green channels.
Definition: SColor.h:92
static bool isCompressedFormat(const ECOLOR_FORMAT format)
check if this is compressed color format
Definition: IImage.h:474

◆ lock()

_IRR_DEPRECATED_ void* irr::video::IImage::lock ( )
inline

Lock function. Use this to get a pointer to the image data.

Use getData instead.

Returns
Pointer to the image data. What type of data is pointed to depends on the color format of the image. For example if the color format is ECF_A8R8G8B8, it is of u32. Be sure to call unlock() after you don't need the pointer any more.

Definition at line 178 of file IImage.h.

179  {
180  return getData();
181  }
void * getData() const
Use this to get a pointer to the image data.
Definition: IImage.h:167

◆ setMipMapsData()

void irr::video::IImage::setMipMapsData ( void data,
bool  ownForeignMemory,
bool  deleteMemory 
)
inline

Set mipmaps data.

This method allows you to put custom mipmaps data for image.

Parameters
dataA byte array with pixel color information
ownForeignMemoryIf true, the image will use the data pointer directly and own it afterward. If false, the memory will by copied internally.
deleteMemoryWhether the memory is deallocated upon destruction.

Definition at line 263 of file IImage.h.

264  {
265  if (data != MipMapsData)
266  {
268  {
270 
271  DeleteMipMapsMemory = false;
272  }
273 
274  if (data)
275  {
276  if (ownForeignMemory)
277  {
278  MipMapsData = static_cast<u8*>(data);
279 
280  DeleteMipMapsMemory = deleteMemory;
281  }
282  else
283  {
284  u32 dataSize = 0;
285  u32 width = Size.Width;
286  u32 height = Size.Height;
287 
288  do
289  {
290  if (width > 1)
291  width >>= 1;
292 
293  if (height > 1)
294  height >>= 1;
295 
297  } while (width != 1 || height != 1);
298 
300  memcpy(MipMapsData, data, dataSize);
301 
302  DeleteMipMapsMemory = true;
303  }
304  }
305  else
306  {
307  MipMapsData = 0;
308  }
309  }
310  }
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
core::irrAllocator< u8 > Allocator
Definition: IImage.h:546
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
T * allocate(size_t cnt)
Allocate memory for an array of objects.
Definition: irrAllocator.h:33
T Width
Width of the dimension.
Definition: dimension2d.h:204
ECOLOR_FORMAT Format
Definition: IImage.h:534
core::dimension2d< u32 > Size
Definition: IImage.h:535
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
calculate image data size in bytes for selected format, width and height.
Definition: IImage.h:430
T Height
Height of the dimension.
Definition: dimension2d.h:206
void deallocate(T *ptr)
Deallocate memory for an array of objects.
Definition: irrAllocator.h:39
GLenum GLsizei dataSize
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
bool DeleteMipMapsMemory
Definition: IImage.h:544

◆ setPixel()

virtual void irr::video::IImage::setPixel ( u32  x,
u32  y,
const SColor color,
bool  blend = false 
)
pure virtual

Sets a pixel.

◆ unlock()

_IRR_DEPRECATED_ void irr::video::IImage::unlock ( )
inline

Unlock function.

Should be called after the pointer received by lock() is not needed anymore.

Definition at line 186 of file IImage.h.

187  {
188  }

Member Data Documentation

◆ Allocator

core::irrAllocator<u8> irr::video::IImage::Allocator
protected

Definition at line 546 of file IImage.h.

◆ BytesPerPixel

u32 irr::video::IImage::BytesPerPixel
protected

Definition at line 540 of file IImage.h.

◆ Data

u8* irr::video::IImage::Data
protected

Definition at line 537 of file IImage.h.

◆ DeleteMemory

bool irr::video::IImage::DeleteMemory
protected

Definition at line 543 of file IImage.h.

◆ DeleteMipMapsMemory

bool irr::video::IImage::DeleteMipMapsMemory
protected

Definition at line 544 of file IImage.h.

◆ Format

ECOLOR_FORMAT irr::video::IImage::Format
protected

Definition at line 534 of file IImage.h.

◆ MipMapsData

u8* irr::video::IImage::MipMapsData
protected

Definition at line 538 of file IImage.h.

◆ Pitch

u32 irr::video::IImage::Pitch
protected

Definition at line 541 of file IImage.h.

◆ Size

core::dimension2d<u32> irr::video::IImage::Size
protected

Definition at line 535 of file IImage.h.


The documentation for this class was generated from the following file: