SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::helper::io::Image Class Reference

#include <Image.h>

Inheritance diagram for sofa::helper::io::Image:

Static Public Attributes

static const charstrFromDataType [COUNT_OF_DATA_TYPES+1]
 
static const charstrFromChannelFormat [COUNT_OF_CHANNEL_FORMATS+1]
 
static const charstrFromTextureType [TEXTURE_INVALID+1]
 

Protected Attributes

unsigned char m_bLoaded
 

Public Member Functions

 Image ()
 
virtual ~Image ()
 
 Image (const Image &rhs)
 
Imageoperator= (const Image &rhs)
 
unsigned getWidth (unsigned mipmap=0) const
 
unsigned getHeight (unsigned mipmap=0) const
 
unsigned getDepth (unsigned mipmap=0) const
 
unsigned getBytesPerPixel () const
 
unsigned getBytesPerBlock () const
 
unsigned getBytesPerChannel () const
 
unsigned getChannelCount () const
 
unsigned getMipmapCount () const
 
unsigned getPixelCount () const
 
unsigned getLineSize (unsigned mipmap=0) const
 
unsigned getMipmapSize (unsigned mipmap) const
 
unsigned getMipmapRangeSize (unsigned firstMipmap, unsigned mipmaps) const
 
unsigned getImageSize () const
 
DataType getDataType () const
 
ChannelFormat getChannelFormat () const
 
TextureType getTextureType () const
 
unsigned chargetPixels ()
 
unsigned chargetMipmapPixels (unsigned mipmap)
 
unsigned chargetCubeMipmapPixels (unsigned cubeside, unsigned mipmap)
 
unsigned charget3DSliceMipmapPixels (unsigned slice, unsigned mipmap)
 
void clear ()
 
void init (unsigned width, unsigned height, unsigned depth, unsigned mipmaps, DataType dataType, ChannelFormat channelFormat)
 
void init (unsigned width, unsigned height, unsigned bpp)
 
bool isLoaded () const
 
virtual bool load (std::string filename)
 
virtual bool save (std::string filename, int compression_level=-1)
 

Static Public Member Functions

static ImageCreate (std::string filename)
 
template<class Object >
static Object * create (Object *, std::string arg="")
 

Attribute details

◆ m_bLoaded

unsigned char sofa::helper::io::Image::m_bLoaded
protected

◆ strFromChannelFormat

const char * sofa::helper::io::Image::strFromChannelFormat
static
Initial value:
=
{
"L",
"LA",
"R",
"RG",
"RGB",
"RGBA",
"BGR",
"BGRA",
"COUNT_OF_CHANNEL_FORMATS"
}

◆ strFromDataType

const char * sofa::helper::io::Image::strFromDataType
static
Initial value:
=
{
"UNORM8",
"UNORM16",
"UINT32",
"HALF",
"FLOAT",
"UCOMPRESSED",
"COUNT_OF_DATA_TYPES"
}

◆ strFromTextureType

const char * sofa::helper::io::Image::strFromTextureType
static
Initial value:
=
{
"TEXTURE_2D",
"TEXTURE_3D",
"TEXTURE_CUBE",
"TEXTURE_INVALID"
}

Constructor details

◆ Image() [1/2]

sofa::helper::io::Image::Image ( )

◆ ~Image()

sofa::helper::io::Image::~Image ( )
virtual

◆ Image() [2/2]

sofa::helper::io::Image::Image ( const Image rhs)

Function details

◆ clear()

void sofa::helper::io::Image::clear ( )

◆ create()

template<class Object >
static Object* sofa::helper::io::Image::create ( Object *  ,
std::string  arg = "" 
)
inlinestatic

◆ Create()

Image * sofa::helper::io::Image::Create ( std::string  filename)
static

◆ get3DSliceMipmapPixels()

unsigned char * sofa::helper::io::Image::get3DSliceMipmapPixels ( unsigned  slice,
unsigned  mipmap 
)

◆ getBytesPerBlock()

unsigned sofa::helper::io::Image::getBytesPerBlock ( ) const

◆ getBytesPerChannel()

unsigned sofa::helper::io::Image::getBytesPerChannel ( ) const

◆ getBytesPerPixel()

unsigned sofa::helper::io::Image::getBytesPerPixel ( ) const

◆ getChannelCount()

unsigned sofa::helper::io::Image::getChannelCount ( ) const

◆ getChannelFormat()

Image::ChannelFormat sofa::helper::io::Image::getChannelFormat ( ) const

◆ getCubeMipmapPixels()

unsigned char * sofa::helper::io::Image::getCubeMipmapPixels ( unsigned  cubeside,
unsigned  mipmap 
)

◆ getDataType()

Image::DataType sofa::helper::io::Image::getDataType ( ) const

◆ getDepth()

unsigned sofa::helper::io::Image::getDepth ( unsigned  mipmap = 0) const

◆ getHeight()

unsigned sofa::helper::io::Image::getHeight ( unsigned  mipmap = 0) const

◆ getImageSize()

unsigned sofa::helper::io::Image::getImageSize ( ) const

◆ getLineSize()

unsigned sofa::helper::io::Image::getLineSize ( unsigned  mipmap = 0) const

◆ getMipmapCount()

unsigned sofa::helper::io::Image::getMipmapCount ( ) const

◆ getMipmapPixels()

unsigned char * sofa::helper::io::Image::getMipmapPixels ( unsigned  mipmap)

◆ getMipmapRangeSize()

unsigned sofa::helper::io::Image::getMipmapRangeSize ( unsigned  firstMipmap,
unsigned  mipmaps 
) const

◆ getMipmapSize()

unsigned sofa::helper::io::Image::getMipmapSize ( unsigned  mipmap) const

◆ getPixelCount()

unsigned sofa::helper::io::Image::getPixelCount ( ) const

◆ getPixels()

unsigned char * sofa::helper::io::Image::getPixels ( )

◆ getTextureType()

Image::TextureType sofa::helper::io::Image::getTextureType ( ) const

◆ getWidth()

unsigned sofa::helper::io::Image::getWidth ( unsigned  mipmap = 0) const

◆ init() [1/2]

void sofa::helper::io::Image::init ( unsigned  width,
unsigned  height,
unsigned  bpp 
)

◆ init() [2/2]

void sofa::helper::io::Image::init ( unsigned  width,
unsigned  height,
unsigned  depth,
unsigned  mipmaps,
DataType  dataType,
ChannelFormat  channelFormat 
)

◆ isLoaded()

bool sofa::helper::io::Image::isLoaded ( ) const
inline

◆ load()

bool sofa::helper::io::Image::load ( std::string  filename)
virtual

◆ operator=()

Image & sofa::helper::io::Image::operator= ( const Image rhs)

◆ save()

bool sofa::helper::io::Image::save ( std::string  filename,
int  compression_level = -1 
)
virtual

Enum details

◆ ChannelFormat

Enumerator
LA 
RG 
RGB 
RGBA 
BGR 
BGRA 
COUNT_OF_CHANNEL_FORMATS 

◆ DataType

Enumerator
UNORM8 
UNORM16 
UINT32 
HALF 
FLOAT 
UCOMPRESSED 
COUNT_OF_DATA_TYPES 

◆ TextureType

Enumerator
TEXTURE_2D 
TEXTURE_3D 
TEXTURE_CUBE 
COUNT_OF_TEXTURE_TYPES 
TEXTURE_INVALID