Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
GBitmap Class Reference

#include <gBitmap.h>

+ Inheritance diagram for GBitmap:

Public Types

enum  BitmapFormat {
  Palettized = 0, Intensity = 1, RGB = 2, RGBA = 3,
  Alpha = 4, RGB565 = 5, RGB5551 = 6, Luminance = 7
}
 
enum  Constants { c_maxMipLevels = 12 }
 

Public Member Functions

 GBitmap ()
 
 GBitmap (const GBitmap &)
 
 GBitmap (const U32 in_width, const U32 in_height, const bool in_extrudeMipLevels=false, const BitmapFormat in_format=RGB)
 
virtual ~GBitmap ()
 
void allocateBitmap (const U32 in_width, const U32 in_height, const bool in_extrudeMipLevels=false, const BitmapFormat in_format=RGB)
 
void extrudeMipLevels (bool clearBorders=false)
 
void extrudeMipLevelsDetail ()
 
GBitmapcreatePowerOfTwoBitmap ()
 
void copyRect (const GBitmap *src, const RectI &srcRect, const Point2I &dstPoint)
 
BitmapFormat getFormat () const
 
bool setFormat (BitmapFormat fmt)
 
U32 getNumMipLevels () const
 
U32 getWidth (const U32 in_mipLevel=0) const
 
U32 getHeight (const U32 in_mipLevel=0) const
 
U8 * getAddress (const S32 in_x, const S32 in_y, const U32 mipLevel=U32(0))
 
const U8 * getAddress (const S32 in_x, const S32 in_y, const U32 mipLevel=U32(0)) const
 
const U8 * getBits (const U32 in_mipLevel=0) const
 
U8 * getWritableBits (const U32 in_mipLevel=0)
 
bool getColorBGRA (const U32 x, const U32 y, ColorI &rColor) const
 
bool setColorBGRA (const U32 x, const U32 y, ColorI &rColor)
 
bool getColor (const U32 x, const U32 y, ColorI &rColor) const
 
bool setColor (const U32 x, const U32 y, ColorI &rColor)
 
GPalette const * getPalette () const
 Note that on set palette, the bitmap deletes its palette. More...
 
void setPalette (GPalette *in_pPalette)
 
void deleteImage ()
 
bool readJPEG (Stream &io_rStream)
 
bool writeJPEG (Stream &io_rStream) const
 
bool readPNG (Stream &io_rStream)
 
bool writePNG (Stream &io_rStream, const bool compressHard=false) const
 
bool writePNGUncompressed (Stream &io_rStream) const
 
bool readMSBmp (Stream &io_rStream)
 
bool writeMSBmp (Stream &io_rStream) const
 
bool read (Stream &io_rStream)
 
bool write (Stream &io_rStream) const
 
- Public Member Functions inherited from ResourceInstance
 ResourceInstance ()
 
virtual ~ResourceInstance ()
 

Static Public Member Functions

static GBitmapload (const char *path)
 
static ResourceObjectfindBmpResource (const char *path)
 

Public Attributes

BitmapFormat internalFormat
 
U8 * pBits
 
U32 byteSize
 
U32 width
 
U32 height
 
U32 bytesPerPixel
 
U32 numMipLevels
 
U32 mipLevelOffsets [c_maxMipLevels]
 
bool mForce16Bit
 
GPalettepPalette
 
- Public Attributes inherited from ResourceInstance
ResourceObjectmSourceResource
 Pointer to the ResourceObject that stores all our book-keeping data. More...
 

Static Public Attributes

static U32 sBitmapIdSource = 0
 

Member Enumeration Documentation

BitmapFormat and UsageHint are written to the stream in write(...), be sure to maintain compatability if they are changed.

Enumerator
Palettized 
Intensity 
RGB 
RGBA 
Alpha 
RGB565 
RGB5551 
Luminance 
enum Constants
Enumerator
c_maxMipLevels 

Constructor & Destructor Documentation

GBitmap ( )
GBitmap ( const GBitmap rCopy)
GBitmap ( const U32  in_width,
const U32  in_height,
const bool  in_extrudeMipLevels = false,
const BitmapFormat  in_format = RGB 
)
~GBitmap ( )
virtual

Member Function Documentation

void allocateBitmap ( const U32  in_width,
const U32  in_height,
const bool  in_extrudeMipLevels = false,
const BitmapFormat  in_format = RGB 
)
void copyRect ( const GBitmap src,
const RectI srcRect,
const Point2I dstPoint 
)
GBitmap * createPowerOfTwoBitmap ( )
void deleteImage ( )
void extrudeMipLevels ( bool  clearBorders = false)
void extrudeMipLevelsDetail ( )
ResourceObject * findBmpResource ( const char *  path)
static
U8 * getAddress ( const S32  in_x,
const S32  in_y,
const U32  mipLevel = U32(0) 
)
inline
const U8 * getAddress ( const S32  in_x,
const S32  in_y,
const U32  mipLevel = U32(0) 
) const
inline
const U8 * getBits ( const U32  in_mipLevel = 0) const
inline
bool getColor ( const U32  x,
const U32  y,
ColorI rColor 
) const
bool getColorBGRA ( const U32  x,
const U32  y,
ColorI rColor 
) const
GBitmap::BitmapFormat getFormat ( ) const
inline
U32 getHeight ( const U32  in_mipLevel = 0) const
inline
U32 getNumMipLevels ( ) const
inline
const GPalette * getPalette ( ) const
inline

Note that on set palette, the bitmap deletes its palette.

U32 getWidth ( const U32  in_mipLevel = 0) const
inline
U8 * getWritableBits ( const U32  in_mipLevel = 0)
inline
GBitmap * load ( const char *  path)
static
bool read ( Stream io_rStream)
bool readJPEG ( Stream io_rStream)
bool readMSBmp ( Stream io_rStream)
bool readPNG ( Stream io_rStream)
bool setColor ( const U32  x,
const U32  y,
ColorI rColor 
)
bool setColorBGRA ( const U32  x,
const U32  y,
ColorI rColor 
)
bool setFormat ( BitmapFormat  fmt)
void setPalette ( GPalette in_pPalette)
bool write ( Stream io_rStream) const
bool writeJPEG ( Stream io_rStream) const
bool writeMSBmp ( Stream io_rStream) const
bool writePNG ( Stream io_rStream,
const bool  compressHard = false 
) const
bool writePNGUncompressed ( Stream io_rStream) const

Member Data Documentation

U32 byteSize
U32 bytesPerPixel
U32 height
BitmapFormat internalFormat
bool mForce16Bit
U32 mipLevelOffsets[c_maxMipLevels]
U32 numMipLevels
U8* pBits
GPalette* pPalette
     Note that this palette pointer is ALWAYS

owned by the bitmap, and will be deleted on exit, or written out on a write.

U32 sBitmapIdSource = 0
static
U32 width

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