Irrlicht 3D Engine
irr::video::IImage Class Referenceabstract

Interface for software image data. More...

#include <IImage.h>

+ Inheritance diagram for irr::video::IImage:

Public Member Functions

 IImage (ECOLOR_FORMAT format, const core::dimension2d< u32 > &size, bool deleteMemory)
 constructor More...
 
virtual ~IImage ()
 destructor 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 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 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 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 fill (const SColor &color)=0
 fills the surface with given color More...
 
u32 getAlphaMask () const
 Returns mask for alpha value of a pixel. More...
 
u32 getBitsPerPixel () const
 Returns bits per pixel. More...
 
u32 getBlueMask () const
 Returns mask for blue value of a pixel. More...
 
u32 getBytesPerPixel () const
 Returns bytes per pixel. More...
 
ECOLOR_FORMAT getColorFormat () const
 Returns the color format. More...
 
void * getData () const
 Use this to get a pointer to the image data. More...
 
const core::dimension2d< u32 > & getDimension () const
 Returns width and height of image data. More...
 
u32 getGreenMask () const
 Returns mask for green value of a pixel. More...
 
u32 getImageDataSizeInBytes () const
 Returns image data size in bytes. More...
 
u32 getImageDataSizeInPixels () const
 Returns image data size in pixels. More...
 
void * getMipMapsData () const
 Get mipmaps data. More...
 
u32 getPitch () const
 Returns pitch of image. More...
 
virtual SColor getPixel (u32 x, u32 y) const =0
 Returns a pixel. More...
 
u32 getRedMask () const
 Returns mask for red value of a pixel. More...
 
_IRR_DEPRECATED_ bool hasMipMaps () const
 Check whether the image has MipMaps. More...
 
_IRR_DEPRECATED_ bool isCompressed () const
 Inform whether the image is compressed. More...
 
_IRR_DEPRECATED_ void * lock ()
 Lock function. Use this to get a pointer to the image data. More...
 
void setMipMapsData (void *data, bool ownForeignMemory, bool deleteMemory)
 Set mipmaps data. More...
 
virtual void setPixel (u32 x, u32 y, const SColor &color, bool blend=false)=0
 Sets a pixel. More...
 
_IRR_DEPRECATED_ void unlock ()
 Unlock function. More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 

Static Public Member Functions

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 isRenderTargetOnlyFormat (const ECOLOR_FORMAT format)
 Check if the color format is only viable for RenderTarget textures. More...
 

Protected Attributes

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

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.

References BytesPerPixel, Format, getBitsPerPixelFromFormat(), Pitch, Size, and irr::core::dimension2d< T >::Width.

◆ ~IImage()

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

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

◆ 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

◆ 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.

◆ copyToScaling() [2/2]

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

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

◆ 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

◆ 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

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.

References irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_R5G6B5, irr::video::ECF_R8G8B8, and Format.

◆ getBitsPerPixel()

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

Returns bits per pixel.

Definition at line 60 of file IImage.h.

References Format, and getBitsPerPixelFromFormat().

◆ getBitsPerPixelFromFormat()

◆ getBlueMask()

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

Returns mask for blue value of a pixel.

Definition at line 127 of file IImage.h.

References irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_R5G6B5, irr::video::ECF_R8G8B8, and Format.

◆ getBytesPerPixel()

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

Returns bytes per pixel.

Definition at line 67 of file IImage.h.

References BytesPerPixel.

◆ getColorFormat()

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

Returns the color format.

Definition at line 48 of file IImage.h.

References Format.

◆ 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.

References Data.

Referenced by lock().

◆ getDataSizeFromFormat()

◆ 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.

References Size.

◆ getGreenMask()

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

Returns mask for green value of a pixel.

Definition at line 109 of file IImage.h.

References irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_R5G6B5, irr::video::ECF_R8G8B8, and Format.

◆ getImageDataSizeInBytes()

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

Returns image data size in bytes.

Definition at line 73 of file IImage.h.

References Format, getDataSizeFromFormat(), irr::core::dimension2d< T >::Height, Size, and irr::core::dimension2d< T >::Width.

◆ getImageDataSizeInPixels()

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

Returns image data size in pixels.

Definition at line 79 of file IImage.h.

References irr::core::dimension2d< T >::Height, Size, and irr::core::dimension2d< T >::Width.

◆ getMipMapsData()

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

Get mipmaps data.

Definition at line 191 of file IImage.h.

References MipMapsData.

Referenced by hasMipMaps().

◆ getPitch()

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

Returns pitch of image.

Definition at line 85 of file IImage.h.

References Pitch.

◆ 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.

References irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_R5G6B5, irr::video::ECF_R8G8B8, and Format.

◆ 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 294 of file IImage.h.

References getMipMapsData().

◆ isCompressed()

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

Inform whether the image is compressed.

Definition at line 287 of file IImage.h.

References Format, and isCompressedFormat().

◆ isCompressedFormat()

◆ 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 435 of file IImage.h.

References irr::video::ECF_D16, irr::video::ECF_D24S8, and irr::video::ECF_D32.

◆ isRenderTargetOnlyFormat()

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

Check if the color format is only viable for RenderTarget textures.

Since we don't have support for e.g. floating point IImage formats one should test if the color format can be used for arbitrary usage, or if it is restricted to RTTs.

Definition at line 452 of file IImage.h.

References irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, irr::video::ECF_DXT1, irr::video::ECF_DXT2, irr::video::ECF_DXT3, irr::video::ECF_DXT4, irr::video::ECF_DXT5, irr::video::ECF_ETC1, irr::video::ECF_ETC2_ARGB, irr::video::ECF_ETC2_RGB, irr::video::ECF_PVRTC2_ARGB2, irr::video::ECF_PVRTC2_ARGB4, irr::video::ECF_PVRTC_ARGB2, irr::video::ECF_PVRTC_ARGB4, irr::video::ECF_PVRTC_RGB2, irr::video::ECF_PVRTC_RGB4, irr::video::ECF_R5G6B5, and irr::video::ECF_R8G8B8.

◆ 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.

References getData().

◆ 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 205 of file IImage.h.

References irr::core::irrAllocator< T >::allocate(), Allocator, irr::core::irrAllocator< T >::deallocate(), DeleteMipMapsMemory, Format, getDataSizeFromFormat(), irr::core::dimension2d< T >::Height, MipMapsData, Size, and irr::core::dimension2d< T >::Width.

Referenced by irr::video::IVideoDriver::addTexture().

◆ 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.

Member Data Documentation

◆ Allocator

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

Definition at line 494 of file IImage.h.

Referenced by setMipMapsData(), and ~IImage().

◆ BytesPerPixel

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

Definition at line 488 of file IImage.h.

Referenced by getBytesPerPixel(), and IImage().

◆ Data

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

Definition at line 485 of file IImage.h.

Referenced by getData(), and ~IImage().

◆ DeleteMemory

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

Definition at line 491 of file IImage.h.

Referenced by ~IImage().

◆ DeleteMipMapsMemory

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

Definition at line 492 of file IImage.h.

Referenced by setMipMapsData(), and ~IImage().

◆ Format

◆ MipMapsData

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

Definition at line 486 of file IImage.h.

Referenced by getMipMapsData(), setMipMapsData(), and ~IImage().

◆ Pitch

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

Definition at line 489 of file IImage.h.

Referenced by getPitch(), and IImage().

◆ Size

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

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