Torque2D Reference
Loading...
Searching...
No Matches
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 ,
  LuminanceAlpha = 8
}
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.
void setPalette (GPalette *in_pPalette)
void deleteImage ()
void clearImage (const ColorF blendColor)
bool mergeLayer (const Point2I pos, const GBitmap *layer, const ColorF blendColor)
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.

Static Public Attributes

static U32 sBitmapIdSource = 0

Member Enumeration Documentation

◆ BitmapFormat

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 
LuminanceAlpha 

◆ Constants

enum Constants
Enumerator
c_maxMipLevels 

Constructor & Destructor Documentation

◆ GBitmap() [1/3]

GBitmap ( )

◆ GBitmap() [2/3]

GBitmap ( const GBitmap & rCopy)

◆ GBitmap() [3/3]

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

◆ ~GBitmap()

~GBitmap ( )
virtual

Member Function Documentation

◆ allocateBitmap()

void allocateBitmap ( const U32 in_width,
const U32 in_height,
const bool in_extrudeMipLevels = false,
const BitmapFormat in_format = RGB )

◆ clearImage()

void clearImage ( const ColorF blendColor)

◆ copyRect()

void copyRect ( const GBitmap * src,
const RectI & srcRect,
const Point2I & dstPoint )

◆ createPowerOfTwoBitmap()

GBitmap * createPowerOfTwoBitmap ( )

◆ deleteImage()

void deleteImage ( )

◆ extrudeMipLevels()

void extrudeMipLevels ( bool clearBorders = false)

◆ extrudeMipLevelsDetail()

void extrudeMipLevelsDetail ( )

◆ findBmpResource()

ResourceObject * findBmpResource ( const char * path)
static

◆ getAddress() [1/2]

U8 * getAddress ( const S32 in_x,
const S32 in_y,
const U32 mipLevel = U32(0) )
inline

◆ getAddress() [2/2]

const U8 * getAddress ( const S32 in_x,
const S32 in_y,
const U32 mipLevel = U32(0) ) const
inline

◆ getBits()

const U8 * getBits ( const U32 in_mipLevel = 0) const
inline

◆ getColor()

bool getColor ( const U32 x,
const U32 y,
ColorI & rColor ) const

◆ getColorBGRA()

bool getColorBGRA ( const U32 x,
const U32 y,
ColorI & rColor ) const

◆ getFormat()

GBitmap::BitmapFormat getFormat ( ) const
inline

◆ getHeight()

U32 getHeight ( const U32 in_mipLevel = 0) const
inline

◆ getNumMipLevels()

U32 getNumMipLevels ( ) const
inline

◆ getPalette()

const GPalette * getPalette ( ) const
inline

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

◆ getWidth()

U32 getWidth ( const U32 in_mipLevel = 0) const
inline

◆ getWritableBits()

U8 * getWritableBits ( const U32 in_mipLevel = 0)
inline

◆ load()

GBitmap * load ( const char * path)
static

◆ mergeLayer()

bool mergeLayer ( const Point2I pos,
const GBitmap * layer,
const ColorF blendColor )

◆ read()

bool read ( Stream & io_rStream)

◆ readJPEG()

bool readJPEG ( Stream & io_rStream)

◆ readMSBmp()

bool readMSBmp ( Stream & io_rStream)

◆ readPNG()

bool readPNG ( Stream & io_rStream)

◆ setColor()

bool setColor ( const U32 x,
const U32 y,
ColorI & rColor )

◆ setColorBGRA()

bool setColorBGRA ( const U32 x,
const U32 y,
ColorI & rColor )

◆ setFormat()

bool setFormat ( BitmapFormat fmt)

◆ setPalette()

void setPalette ( GPalette * in_pPalette)

◆ write()

bool write ( Stream & io_rStream) const

◆ writeJPEG()

bool writeJPEG ( Stream & io_rStream) const

◆ writeMSBmp()

bool writeMSBmp ( Stream & io_rStream) const

◆ writePNG()

bool writePNG ( Stream & io_rStream,
const bool compressHard = false ) const

◆ writePNGUncompressed()

bool writePNGUncompressed ( Stream & io_rStream) const

Member Data Documentation

◆ byteSize

U32 byteSize

◆ bytesPerPixel

U32 bytesPerPixel

◆ height

U32 height

◆ internalFormat

BitmapFormat internalFormat

◆ mForce16Bit

bool mForce16Bit

◆ mipLevelOffsets

U32 mipLevelOffsets[c_maxMipLevels]

◆ numMipLevels

U32 numMipLevels

◆ pBits

U8* pBits

◆ pPalette

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.

◆ sBitmapIdSource

U32 sBitmapIdSource = 0
static

◆ width

U32 width

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