GBitmap Class Reference

#include <gBitmap.h>

List of all members.

Public Types

 c_maxMipLevels = 12
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 GFXFormat in_format=GFXFormatR8G8B8)
virtual ~GBitmap ()
void allocateBitmap (const U32 in_width, const U32 in_height, const bool in_extrudeMipLevels=false, const GFXFormat in_format=GFXFormatR8G8B8)
void extrudeMipLevels (bool clearBorders=false)
void extrudeMipLevelsDetail ()
U32 getNumMipLevels () const
GBitmapcreatePaddedBitmap () const
GBitmapcreatePow2Bitmap () const
void copyRect (const GBitmap *in, const RectI &srcRect, const Point2I &dstPoint)
GFXFormat getFormat () const
bool setFormat (GFXFormat fmt)
U32 getWidth (const U32 in_mipLevel=0) const
U32 getHeight (const U32 in_mipLevel=0) const
U32 getDepth (const U32 in_mipLevel=0) const
U8getAddress (const S32 in_x, const S32 in_y, const U32 mipLevel=0)
const U8getAddress (const S32 in_x, const S32 in_y, const U32 mipLevel=0) const
const U8getBits (const U32 in_mipLevel=0) const
U8getWritableBits (const U32 in_mipLevel=0)
U32 getByteSize () const
U32 getBytesPerPixel () const
bool getHasTransparency () const
 Use these functions to set and get the mHasTransparency value This is used to indicate that this bitmap has pixels that have an alpha value less than 255 (used by the auto-Material mapper).
void setHasTransparency (bool hasTransparency)
bool checkForTransparency ()
 In general you will want to use this function if there is not a good spot in the bitmap loader(s) to check the alpha value of the pixels.
ColorF sampleTexel (F32 u, F32 v) const
bool getColor (const U32 x, const U32 y, ColorI &rColor) const
bool setColor (const U32 x, const U32 y, ColorI &rColor)
bool combine (const GBitmap *bitmapA, const GBitmap *bitmapB, const GFXTextureOp combineOp)
 This method will combine bitmapA and bitmapB using the operation specified by combineOp.
void deleteImage ()
bool readBitmap (const String &bmType, Stream &ioStream)
 Read a bitmap from a stream.
bool writeBitmap (const String &bmType, Stream &ioStream, U32 compressionLevel=U32_MAX)
 Write a bitmap to a stream.
bool readMNG (Stream &io_rStream)
bool writeMNG (Stream &io_rStream) const
bool read (Stream &io_rStream)
bool write (Stream &io_rStream) const
template<class T, dsize_t mapLength>
void swizzle (const Swizzle< T, mapLength > *s)

Static Public Member Functions

static Resource< GBitmapload (const Torque::Path &path)
static void sRegisterFormat (const Registration &reg)
static const RegistrationsFindRegInfo (const String &extension)
static bool sFindFiles (const Torque::Path &path, Vector< Torque::Path > &foundPaths)
 Given a path to a file, try all known extensions.

Static Public Attributes

static Vector< RegistrationsRegistrations

Private Attributes

GFXFormat mInternalFormat
U8mBits
U32 mByteSize
U32 mWidth
U32 mHeight
U32 mDepth
U32 mBytesPerPixel
U32 mNumMipLevels
U32 mMipLevelOffsets [c_maxMipLevels]
bool mHasTransparency

Static Private Attributes

static const U32 csFileVersion

Classes

struct  Registration


Member Enumeration Documentation

Enumerator:
c_maxMipLevels 


Constructor & Destructor Documentation

GBitmap::GBitmap (  ) 

GBitmap::GBitmap ( const GBitmap  ) 

GBitmap::GBitmap ( const U32  in_width,
const U32  in_height,
const bool  in_extrudeMipLevels = false,
const GFXFormat  in_format = GFXFormatR8G8B8 
)

virtual GBitmap::~GBitmap (  )  [virtual]


Member Function Documentation

static Resource<GBitmap> GBitmap::load ( const Torque::Path path  )  [static]

static void GBitmap::sRegisterFormat ( const Registration reg  )  [static]

static const Registration* GBitmap::sFindRegInfo ( const String extension  )  [static]

static bool GBitmap::sFindFiles ( const Torque::Path path,
Vector< Torque::Path > &  foundPaths 
) [static]

Given a path to a file, try all known extensions.

If the file exists on disk, fill in path with the correct extension and return true. Otherwise, return false.

void GBitmap::allocateBitmap ( const U32  in_width,
const U32  in_height,
const bool  in_extrudeMipLevels = false,
const GFXFormat  in_format = GFXFormatR8G8B8 
)

void GBitmap::extrudeMipLevels ( bool  clearBorders = false  ) 

void GBitmap::extrudeMipLevelsDetail (  ) 

U32 GBitmap::getNumMipLevels (  )  const [inline]

GBitmap* GBitmap::createPaddedBitmap (  )  const

GBitmap* GBitmap::createPow2Bitmap (  )  const

void GBitmap::copyRect ( const GBitmap in,
const RectI srcRect,
const Point2I dstPoint 
)

GFXFormat GBitmap::getFormat (  )  const [inline]

bool GBitmap::setFormat ( GFXFormat  fmt  ) 

U32 GBitmap::getWidth ( const U32  in_mipLevel = 0  )  const [inline]

U32 GBitmap::getHeight ( const U32  in_mipLevel = 0  )  const [inline]

U32 GBitmap::getDepth ( const U32  in_mipLevel = 0  )  const [inline]

U8 * GBitmap::getAddress ( const S32  in_x,
const S32  in_y,
const U32  mipLevel = 0 
) [inline]

const U8 * GBitmap::getAddress ( const S32  in_x,
const S32  in_y,
const U32  mipLevel = 0 
) const [inline]

const U8 * GBitmap::getBits ( const U32  in_mipLevel = 0  )  const [inline]

U8 * GBitmap::getWritableBits ( const U32  in_mipLevel = 0  )  [inline]

U32 GBitmap::getByteSize (  )  const [inline]

U32 GBitmap::getBytesPerPixel (  )  const [inline]

bool GBitmap::getHasTransparency (  )  const [inline]

Use these functions to set and get the mHasTransparency value This is used to indicate that this bitmap has pixels that have an alpha value less than 255 (used by the auto-Material mapper).

void GBitmap::setHasTransparency ( bool  hasTransparency  )  [inline]

bool GBitmap::checkForTransparency (  ) 

In general you will want to use this function if there is not a good spot in the bitmap loader(s) to check the alpha value of the pixels.

This function uses the texture format to loop over the bitmap bits and to check for alpha values less than 255

ColorF GBitmap::sampleTexel ( F32  u,
F32  v 
) const

bool GBitmap::getColor ( const U32  x,
const U32  y,
ColorI rColor 
) const

bool GBitmap::setColor ( const U32  x,
const U32  y,
ColorI rColor 
)

bool GBitmap::combine ( const GBitmap bitmapA,
const GBitmap bitmapB,
const GFXTextureOp  combineOp 
)

This method will combine bitmapA and bitmapB using the operation specified by combineOp.

The result will be stored in the bitmap that this method is called on. The size of the resulting bitmap will be the larger of A and B. The format of the resulting bitmap will be the format of A or B, whichever has a larger byte size.

Note:
There are some restrictions on ops and formats that will probably change based on how we use this function.

void GBitmap::deleteImage (  ) 

bool GBitmap::readBitmap ( const String bmType,
Stream ioStream 
)

Read a bitmap from a stream.

Parameters:
bmType This is a file extension to describe the type of the data [i.e. "png" for PNG file, etc]
ioStream The stream to read from

bool GBitmap::writeBitmap ( const String bmType,
Stream ioStream,
U32  compressionLevel = U32_MAX 
)

Write a bitmap to a stream.

Parameters:
bmType This is a file extension to describe the type of the data [i.e. "png" for PNG file, etc]
ioStream The stream to read from
compressionLevel Image format-specific compression level. If set to U32_MAX, we use the default compression defined when the format was registered.

bool GBitmap::readMNG ( Stream io_rStream  ) 

bool GBitmap::writeMNG ( Stream io_rStream  )  const

bool GBitmap::read ( Stream io_rStream  ) 

bool GBitmap::write ( Stream io_rStream  )  const

template<class T, dsize_t mapLength>
void GBitmap::swizzle ( const Swizzle< T, mapLength > *  s  ) 


Member Data Documentation

U8* GBitmap::mBits [private]

U32 GBitmap::mWidth [private]

U32 GBitmap::mHeight [private]

U32 GBitmap::mDepth [private]

U32 GBitmap::mMipLevelOffsets[c_maxMipLevels] [private]

const U32 GBitmap::csFileVersion [static, private]