|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CBitmap Class ReferenceClass Bitmap.
More...
#include <bitmap.h>
Inheritance diagram for NLMISC::CBitmap:
List of all members.
[NOHEADER] |
CRGBA | getDXTC1Texel (sint x, sint y, uint32 numMipMap) const |
CRGBA | getDXTC3Texel (sint x, sint y, uint32 numMipMap) const |
CRGBA | getDXTC5Texel (sint x, sint y, uint32 numMipMap) const |
CRGBA | getDXTCColorFromBlock (const uint8 *block, sint x, sint y) |
Public Types |
enum | TType {
RGBA = 0,
Luminance,
Alpha,
AlphaLuminance,
DXTC1,
DXTC1Alpha,
DXTC3,
DXTC5,
DsDt,
ModeCount,
DonTKnow = 0xffffffff
} |
Public Methods |
| CBitmap () |
virtual | ~CBitmap () |
uint8 | load (NLMISC::IStream &f, uint mipMapSkip=0) |
| Read a bitmap(TGA or DDS) from an IStream. More...
|
void | makeDummy () |
| Make a dummy "?" texture. More...
|
bool | convertToType (TType type) |
| Convert bitmap to another type conversion to rgba always work. More...
|
TType | getPixelFormat () const |
| Return the format of pixels stored at the present time in the object buffer. More...
|
virtual uint32 | getWidth (uint32 numMipMap=0) const |
| Return the image width, or a mipmap width. More...
|
virtual uint32 | getHeight (uint32 numMipMap=0) const |
| Return the image height, or a mipmap height. More...
|
uint32 | getSize (uint32 numMipMap=0) const |
| Return the size (in pixels) of the image: <=> getHeight()*getWidth(). More...
|
uint32 | getMipMapCount () const |
| Return the number of mipmaps. More...
|
void | rotateCCW () |
| Rotate a bitmap in CCW mode. More...
|
void | buildMipMaps () |
| Build the mipmaps of the bitmap if they don't exist. More...
|
void | releaseMipMaps () |
| Release the mipmaps of the bitmap if they exist. More...
|
void | reset (TType type=RGBA) |
| Reset the buffer. More...
|
void | resample (sint32 nNewWidth, sint32 nNewHeight) |
| Resample the bitmap. More...
|
void | resize (sint32 nNewWidth, sint32 nNewHeight, TType newType=DonTKnow) |
| Resize the bitmap. More...
|
void | resizeMipMap (uint32 numMipMap, sint32 nNewWidth, sint32 nNewHeight) |
| ADVANCED USE Resize a single mipmap level. More...
|
void | setMipMapCount (uint32 mmc) |
| ADVANCED USE To use in conjunction with resizeMipMap. More...
|
bool | writeTGA (NLMISC::IStream &f, uint32 d, bool upsideDown=false) |
| Write a TGA (24 or 32 bits) from the object pixels buffer. More...
|
bool | writeJPG (NLMISC::IStream &f, uint8 quality=80) |
| Write a JPG from the object pixels buffer. More...
|
void | loadGrayscaleAsAlpha (bool loadAsAlpha) |
| Tell the bitmap to load grayscale bitmap as alpha or luminance format. More...
|
bool | isGrayscaleAsAlpha () const |
| Tell if the bitmap loads grayscale bitmap as alpha or luminance format. More...
|
bool | blit (const CBitmap *src, sint32 x, sint32 y) |
| Perform a simple blit from the source to this bitmap at the (x, y) pos The dimension of the original bitmap are preserved For now, this texture and the source must have the same format With DXTC format, the dest coordinates must be a multiple of 4 mipmap are not rebuild when present. More...
|
CRGBAF | getColor (float x, float y) const |
| Get the color in the bitmap given a pixel size The mipmaps must be built. More...
|
CRGBA | getPixelColor (sint x, sint y, uint32 numMipMap=0) const |
| Get the pixel at the given coorrdinate. More...
|
void | flipH () |
| Horizontal flip (all the columns are flipped). More...
|
void | flipV () |
| Vertical flip (all the rows are flipped). More...
|
void | rot90CW () |
| Rotation of the bitmap of 90 degree in clockwise. More...
|
void | rot90CCW () |
| Rotation of the bitmap of 90 degree in counter clockwise. More...
|
void | blend (const CBitmap &Bm0, const CBitmap &Bm1, uint16 factor) |
| Set this bitmap as the result of the blend bewteen 2 bitmap REQUIRE : - Bm0 and Bm1 should have the same size. More...
|
|
std::vector< uint8 > & | getPixels (uint32 numMipMap=0) |
const std::vector< uint8 > & | getPixels (uint32 numMipMap=0) const |
Static Public Methods |
void | loadSize (NLMISC::IStream &f, uint32 &width, uint32 &height) |
| Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream. More...
|
void | loadSize (const std::string &path, uint32 &retWidth, uint32 &retHeight) |
| same than other loadSize(), but with a pathName. More...
|
Public Attributes |
enum NLMISC::CBitmap::TType | PixelFormat |
Static Public Attributes |
const uint32 | bitPerPixels [ModeCount] |
const uint32 | DXTC1HEADER = NL_MAKEFOURCC('D','X', 'T', '1') |
const uint32 | DXTC3HEADER = NL_MAKEFOURCC('D','X', 'T', '3') |
const uint32 | DXTC5HEADER = NL_MAKEFOURCC('D','X', 'T', '5') |
Protected Attributes |
std::vector< uint8 > | _Data [MAX_MIPMAP] |
uint8 | _MipMapCount |
bool | _LoadGrayscaleAsAlpha |
uint32 | _Width |
uint32 | _Height |
Private Methods |
uint32 | blend (uint32 &n0, uint32 &n1, uint32 coef0) |
| blend 2 integers between 0 and 255 . More...
|
uint8 | readDDS (NLMISC::IStream &f, uint mipMapSkip) |
| Read a DDS from an IStream. More...
|
uint8 | readTGA (NLMISC::IStream &f) |
| Read a TGA from an IStream. More...
|
bool | decompressDXT1 (bool alpha) |
| Decompress bitmap compressed with S3TC DXT1 algorithm. More...
|
bool | decompressDXT3 () |
| Decompress bitmap compressed with S3TC DXT3 algorithm. More...
|
bool | decompressDXT5 () |
| Decompress bitmap compressed with S3TC DXT3 algorithm. More...
|
void | resamplePicture32 (const NLMISC::CRGBA *pSrc, NLMISC::CRGBA *pDest, sint32 nSrcWidth, sint32 nSrcHeight, sint32 nDestWidth, sint32 nDestHeight) |
| The resample function. More...
|
float | getColorInterp (float x, float y, float xy00, float xy01, float xy10, float xy11) const |
| Quadratic interpolator. More...
|
CRGBA | CBitmap::getRGBAPixel (sint x, sint y, uint32 numMipMap) const |
|
bool | convertToDXTC5 () |
bool | convertToRGBA () |
bool | luminanceToRGBA () |
bool | alphaToRGBA () |
bool | alphaLuminanceToRGBA () |
bool | convertToLuminance () |
bool | rgbaToLuminance () |
bool | alphaToLuminance () |
bool | alphaLuminanceToLuminance () |
bool | convertToAlpha () |
bool | rgbaToAlpha () |
bool | luminanceToAlpha () |
bool | alphaLuminanceToAlpha () |
bool | convertToAlphaLuminance () |
bool | rgbaToAlphaLuminance () |
bool | luminanceToAlphaLuminance () |
bool | alphaToAlphaLuminance () |
Static Private Methods |
void | uncompress (uint16 color, NLMISC::CRGBA &) |
| Extracting RGBA infos from a 16bits word. More...
|
Detailed Description
Class Bitmap.
-
Author:
-
Stephane Coutelas , Nevrax France
-
Date:
-
2000
Definition at line 86 of file bitmap.h.
Member Enumeration Documentation
enum NLMISC::CBitmap::TType
|
|
|
-
Enumeration values:
-
RGBA |
|
Luminance |
|
Alpha |
|
AlphaLuminance |
|
DXTC1 |
|
DXTC1Alpha |
|
DXTC3 |
|
DXTC5 |
|
DsDt |
|
ModeCount |
|
DonTKnow |
|
Definition at line 233 of file bitmap.h.
Referenced by getPixelFormat. |
Constructor & Destructor Documentation
NLMISC::CBitmap::CBitmap |
( |
|
) |
[inline] |
|
virtual NLMISC::CBitmap::~CBitmap |
( |
|
) |
[inline, virtual] |
|
Member Function Documentation
bool NLMISC::CBitmap::alphaLuminanceToAlpha |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::alphaLuminanceToLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::alphaLuminanceToRGBA |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::alphaToAlphaLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::alphaToLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::alphaToRGBA |
( |
|
) |
[private] |
|
void NLMISC::CBitmap::blend |
( |
const CBitmap & |
Bm0, |
|
|
const CBitmap & |
Bm1, |
|
|
uint16 |
factor |
|
) |
|
|
|
Set this bitmap as the result of the blend bewteen 2 bitmap REQUIRE : - Bm0 and Bm1 should have the same size.
- Both bitmap should be convertible to RGBA pixel format. The result is a RGBA bitmap. NB: this just works with the first mipmaps
-
Parameters:
-
factor |
The blend factor. 0 means the result is equal to Bm0, 256 means the result is equal to Bm1 |
Definition at line 2751 of file bitmap.cpp.
References _Data, _Height, _Width, CBitmap, nlassert, resize, and RGBA. |
bool NLMISC::CBitmap::blit |
( |
const CBitmap * |
src, |
|
|
sint32 |
x, |
|
|
sint32 |
y |
|
) |
|
|
|
Perform a simple blit from the source to this bitmap at the (x, y) pos The dimension of the original bitmap are preserved For now, this texture and the source must have the same format With DXTC format, the dest coordinates must be a multiple of 4 mipmap are not rebuild when present.
-
Returns:
-
true if the params were corrects and if the blit occures. In debug build there's an assertion
Definition at line 2267 of file bitmap.cpp.
References _Data, _Height, _Width, bitPerPixels, DonTKnow, DXTC1, DXTC1Alpha, DXTC3, DXTC5, height, nlassert, PixelFormat, src, width, x, and y.
Referenced by NL3D::CTextureGrouped::doGenerate. |
void NLMISC::CBitmap::buildMipMaps |
( |
|
) |
|
|
|
Build the mipmaps of the bitmap if they don't exist.
Work only in RGBA mode... -
See also:
-
releaseMipMaps().
Definition at line 1375 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::isPowerOf2, PixelFormat, RGBA, and w.
Referenced by NL3D::CTextureMem::doGenerate, flipH, flipV, resample, rot90CCW, and rot90CW. |
CRGBA NLMISC::CBitmap::CBitmap::getRGBAPixel |
( |
sint |
x, |
|
|
sint |
y, |
|
|
uint32 |
numMipMap |
|
) |
const [private] |
|
bool NLMISC::CBitmap::convertToAlpha |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::convertToAlphaLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::convertToDXTC5 |
( |
|
) |
[private] |
|
|
about DXTC1 to DXTC5 : Does nothing if the format is not DXTC1 about alpha encoding : alpha0 == alpha1 code(x,y) == 7 for every (x,y)
about luminance to alpha and alpha to luminance : the buffer keeps unchanged
Definition at line 387 of file bitmap.cpp.
Referenced by convertToType. |
bool NLMISC::CBitmap::convertToLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::convertToRGBA |
( |
|
) |
[private] |
|
|
Definition at line 845 of file bitmap.cpp.
References Alpha, AlphaLuminance, alphaLuminanceToRGBA, alphaToRGBA, decompressDXT1, decompressDXT3, decompressDXT5, DXTC1, DXTC1Alpha, DXTC3, DXTC5, Luminance, luminanceToRGBA, and RGBA.
Referenced by convertToType. |
bool NLMISC::CBitmap::convertToType |
( |
TType |
type |
) |
|
|
|
Convert bitmap to another type conversion to rgba always work.
No-op if already rgba. -
Parameters:
-
type |
new type for the bitmap |
-
Returns:
-
true if conversion succeeded, false else
Definition at line 889 of file bitmap.cpp.
References Alpha, AlphaLuminance, convertToAlpha, convertToAlphaLuminance, convertToDXTC5, convertToLuminance, convertToRGBA, DXTC5, Luminance, PixelFormat, RGBA, and type.
Referenced by NL3D::CHLSColorTexture::addMask, NL3D::CLodCharacterTmpBitmap::build, NL3D::CHeightMap::buildFromBitmap, and NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap. |
bool NLMISC::CBitmap::decompressDXT1 |
( |
bool |
alpha |
) |
[private] |
|
|
Decompress bitmap compressed with S3TC DXT1 algorithm.
-
Parameters:
-
alpha |
if alpha is true there's alpha. |
Definition at line 928 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::CRGBA::A, alpha, NLMISC::CRGBA::B, NLMISC::CRGBA::blendFromui, NLMISC::CRGBA::G, height, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CRGBA::R, RGBA, NLMISC::CRGBA::set, src, uncompress, width, x, and y.
Referenced by convertToRGBA. |
bool NLMISC::CBitmap::decompressDXT3 |
( |
|
) |
[private] |
|
|
Decompress bitmap compressed with S3TC DXT3 algorithm.
-
Exceptions:
-
Definition at line 1043 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, alpha, NLMISC::CRGBA::B, NLMISC::CRGBA::blendFromui, NLMISC::CRGBA::G, height, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CRGBA::R, RGBA, src, uncompress, width, x, and y.
Referenced by convertToRGBA. |
bool NLMISC::CBitmap::decompressDXT5 |
( |
|
) |
[private] |
|
|
Decompress bitmap compressed with S3TC DXT3 algorithm.
-
Exceptions:
-
Definition at line 1153 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, alpha, NLMISC::CRGBA::B, blend, NLMISC::CRGBA::blendFromui, NLMISC::CRGBA::G, height, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CRGBA::R, RGBA, src, uncompress, width, x, and y.
Referenced by convertToRGBA. |
void NLMISC::CBitmap::flipH |
( |
|
) |
|
|
void NLMISC::CBitmap::flipV |
( |
|
) |
|
|
CRGBAF NLMISC::CBitmap::getColor |
( |
float |
x, |
|
|
float |
y |
|
) |
const |
|
|
Get the color in the bitmap given a pixel size The mipmaps must be built.
If not just return the bilinear at the given point. The input x and y must be clamped between 0 and 1
Definition at line 2405 of file bitmap.cpp.
References Alpha, DXTC1, DXTC1Alpha, DXTC3, DXTC5, getColorInterp, getHeight, getPixelColor, getPixels, getWidth, Luminance, nlassert, PixelFormat, RGBA, x, and y. |
float NLMISC::CBitmap::getColorInterp |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
xy00, |
|
|
float |
xy01, |
|
|
float |
xy10, |
|
|
float |
xy11 |
|
) |
const [private] |
|
CRGBA NLMISC::CBitmap::getDXTCColorFromBlock |
( |
const uint8 * |
block, |
|
|
sint |
x, |
|
|
sint |
y |
|
) |
[static, private] |
|
uint32 NLMISC::CBitmap::getHeight |
( |
uint32 |
numMipMap = 0 |
) |
const [virtual] |
|
|
Return the image height, or a mipmap height.
-
Parameters:
-
-
Returns:
-
image height (0 if mipmap not found)
Definition at line 1341 of file bitmap.cpp.
References _Height, _Width, and w.
Referenced by NL3D::CLodCharacterTmpBitmap::build, NL3D::CTextureFile::buildBitmapFromFile, flipH, flipV, getColor, getDXTC1Texel, getDXTC3Texel, getDXTC5Texel, getSize, rot90CCW, rot90CW, and NL3D::CHLSColorTexture::setBitmap. |
uint32 NLMISC::CBitmap::getMipMapCount |
( |
|
) |
const [inline] |
|
|
Get the pixel at the given coorrdinate.
Works in RGBA and DXTC modes. Outside of the bitmap it returns Black (or if mipmap is not found)
Definition at line 2974 of file bitmap.cpp.
References DXTC1, DXTC1Alpha, DXTC3, DXTC5, getDXTC1Texel, getDXTC3Texel, getDXTC5Texel, nlstop, RGBA, x, and y.
Referenced by getColor. |
TType NLMISC::CBitmap::getPixelFormat |
( |
|
) |
const [inline] |
|
const std::vector<uint8>& NLMISC::CBitmap::getPixels |
( |
uint32 |
numMipMap = 0 |
) |
const [inline] |
|
std::vector<uint8>& NLMISC::CBitmap::getPixels |
( |
uint32 |
numMipMap = 0 |
) |
[inline] |
|
|
Return a reference of an array in pixel format get with getPixelFormat(). -
Returns:
-
vector<uint8>& RGBA pixels
Definition at line 307 of file bitmap.h.
References _Data.
Referenced by NL3D::CTextureFile::buildBitmapFromFile, NL3D::CHLSColorTexture::buildColorVersion, NL3D::CTextureDLM::copyRect, NL3D::CTextureFont::CTextureFont, NL3D::CTextureMem::doGenerate, NL3D::CTextureBump::doGenerate, NL3D::CTextureFont::dumpTextureFont, NL3D::CTextureDLM::fillRect, getColor, getDXTC1Texel, getDXTC3Texel, getDXTC5Texel, NL3D::CTextureDLM::modulateAndfillRect565, NL3D::CTextureDLM::modulateAndfillRect8888, NL3D::CTextureDLM::modulateConstantAndfillRect, NL3D::CTextureFar::rebuildRectangle, NL3D::CTextureNear::refillRect, and NL3D::CHLSColorTexture::setBitmap. |
uint32 NLMISC::CBitmap::getSize |
( |
uint32 |
numMipMap = 0 |
) |
const |
|
uint32 NLMISC::CBitmap::getWidth |
( |
uint32 |
numMipMap = 0 |
) |
const [virtual] |
|
|
Return the image width, or a mipmap width.
-
Parameters:
-
-
Returns:
-
image width (0 if mipmap not found)
Definition at line 1316 of file bitmap.cpp.
References _Height, _Width, and w.
Referenced by NL3D::CLodCharacterTmpBitmap::build, NL3D::CTextureFile::buildBitmapFromFile, NL3D::CTextureDLM::copyRect, NL3D::CTextureDLM::fillRect, flipH, flipV, getColor, getDXTC1Texel, getDXTC3Texel, getDXTC5Texel, getSize, NL3D::CTextureDLM::modulateAndfillRect565, NL3D::CTextureDLM::modulateAndfillRect8888, NL3D::CTextureDLM::modulateConstantAndfillRect, NL3D::CTextureNear::refillRect, rot90CCW, rot90CW, and NL3D::CHLSColorTexture::setBitmap. |
bool NLMISC::CBitmap::isGrayscaleAsAlpha |
( |
|
) |
const [inline] |
|
|
Tell if the bitmap loads grayscale bitmap as alpha or luminance format.
-
Returns:
-
true if the bitmap loads grayscale bitmaps as alpha, false if it loads grayscale bitmaps as luminance.
Definition at line 480 of file bitmap.h.
References _LoadGrayscaleAsAlpha. |
|
Read a bitmap(TGA or DDS) from an IStream.
Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and uncompressed TGA (24 and 32 bits). -
Parameters:
-
IStream |
The stream must be in reading mode. |
mipMapSkip |
if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped. |
-
Returns:
-
image depth (24 or 32), or 0 if load failed
-
Exceptions:
-
Definition at line 94 of file bitmap.cpp.
References NLMISC::IStream::begin, NLMISC::DDS, depth, height, NLMISC::IStream::isReading, nlassert, readDDS, readTGA, NLMISC::IStream::seek, NLMISC::IStream::serial, NLMISC::IStream::TSeekOrigin, and width.
Referenced by NL3D::CTextureFile::buildBitmapFromFile, and NL3D::CTextureMem::doGenerate. |
void NLMISC::CBitmap::loadGrayscaleAsAlpha |
( |
bool |
loadAsAlpha |
) |
[inline] |
|
|
Tell the bitmap to load grayscale bitmap as alpha or luminance format.
-
Parameters:
-
loadAsAlpha |
is true to load grayscale bitmaps as alpha. false to load grayscale bitmaps as luminance. default value is true. |
Definition at line 469 of file bitmap.h.
References _LoadGrayscaleAsAlpha. |
void NLMISC::CBitmap::loadSize |
( |
const std::string & |
path, |
|
|
uint32 & |
retWidth, |
|
|
uint32 & |
retHeight |
|
) |
[static] |
|
|
Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream.
load just header of the file. Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and uncompressed TGA (24 and 32 bits). NB: at the end, f is seeked to begin. -
Parameters:
-
IStream |
The stream must be in reading mode. |
width |
the width of the image. 0 if fails. |
height |
the height of the image. 0 if fails. |
-
Exceptions:
-
Definition at line 2515 of file bitmap.cpp.
References NLMISC::IStream::begin, NLMISC::DDS, DDSD_LINEARSIZE, depth, height, NLMISC::IStream::isReading, nlassert, NLMISC::IStream::seek, NLMISC::IStream::serial, and width.
Referenced by loadSize. |
bool NLMISC::CBitmap::luminanceToAlpha |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::luminanceToAlphaLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::luminanceToRGBA |
( |
|
) |
[private] |
|
void NLMISC::CBitmap::makeDummy |
( |
|
) |
|
|
|
Make a dummy "?" texture.
Usefull for file not found. Mode is rgba.
Definition at line 156 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, PixelFormat, RGBA, and NLMISC::CRGBA::set.
Referenced by NL3D::CTextureFile::buildBitmapFromFile, NL3D::CTextureMultiFile::doGenerate, NL3D::CTextureMem::doGenerate, NL3D::CTextureGrouped::doGenerate, NL3D::CTextureBump::doGenerate, and NL3D::CTextureBlend::doGenerate. |
|
Read a DDS from an IStream.
The bitmap is readen as a set of bytes and stocked compressed. Width and Height are multiple of 4. -
Parameters:
-
IStream |
The stream must be in reading mode. |
-
Returns:
-
image depth
-
Exceptions:
-
Definition at line 216 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, DDSD_LINEARSIZE, DXTC1, DXTC1Alpha, DXTC1HEADER, DXTC3, DXTC3HEADER, DXTC5, DXTC5HEADER, NLMISC::getPowerOf2, min, PixelFormat, NLMISC::IStream::seek, NLMISC::IStream::serial, NLMISC::IStream::serialBuffer, and w.
Referenced by load. |
|
Read a TGA from an IStream.
TGA pictures can be in 24 or 32 bits, RLE or uncompressed -
Parameters:
-
f |
IStream (must be a reading stream) |
-
Returns:
-
image depth if succeed, 0 else
Definition at line 1749 of file bitmap.cpp.
References _Data, _Height, _LoadGrayscaleAsAlpha, _MipMapCount, _Width, Alpha, NLMISC::IStream::begin, depth, NLMISC::IStream::end, NLMISC::IStream::getPos, height, imageSize, NLMISC::IStream::isReading, Luminance, nlinfo, PixelFormat, r, RGBA, NLMISC::IStream::seek, NLMISC::IStream::serial, NLMISC::IStream::serialBuffer, NLMISC::toto, width, x, and y.
Referenced by load. |
void NLMISC::CBitmap::releaseMipMaps |
( |
|
) |
|
|
|
Release the mipmaps of the bitmap if they exist.
Work for any mode. -
See also:
-
buildMipMaps().
Definition at line 1446 of file bitmap.cpp.
References _Data, _MipMapCount, NLMISC::contReset, and NLMISC::MAX_MIPMAP.
Referenced by NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap, NL3D::CTextureBump::doGenerate, flipH, flipV, resample, resize, rot90CCW, and rot90CW. |
void NLMISC::CBitmap::resample |
( |
sint32 |
nNewWidth, |
|
|
sint32 |
nNewHeight |
|
) |
|
|
|
Resample the bitmap.
If mipmaps exist they are deleted, then rebuilt after resampling. -
Parameters:
-
nNewWidth |
width after resample |
nNewHeight |
height after resample |
Definition at line 1461 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, buildMipMaps, NLMISC::contReset, nlassert, PixelFormat, releaseMipMaps, resamplePicture32, and RGBA. |
|
The resample function.
-
Parameters:
-
pSrc |
CRGBA array |
pDest |
CRGBA array for storing resampled texture |
nSrcWidth |
original width |
nSrcHeight |
original height |
nDestWidth |
width after resample |
nDestHeight |
height after resample |
Definition at line 1567 of file bitmap.cpp.
References nlassert.
Referenced by resample. |
void NLMISC::CBitmap::reset |
( |
TType |
type = RGBA |
) |
|
|
void NLMISC::CBitmap::resize |
( |
sint32 |
nNewWidth, |
|
|
sint32 |
nNewHeight, |
|
|
TType |
newType = DonTKnow |
|
) |
|
|
|
Resize the bitmap.
If mipmaps exist they are deleted and not rebuilt. This is not a crop. Pixels are lost after resize. -
Parameters:
-
nNewWidth |
width after resize |
nNewHeight |
height after resize |
newType |
is the new type of the bitmap. If don_t_know, keep the same pixel format that before. |
Definition at line 1498 of file bitmap.cpp.
References _Height, _Width, DonTKnow, PixelFormat, releaseMipMaps, and resizeMipMap.
Referenced by blend, NL3D::CHLSColorTexture::buildColorVersion, NL3D::CTextureFont::CTextureFont, NL3D::CTextureMem::doGenerate, NL3D::CTextureGrouped::doGenerate, and NL3D::CTextureCross::doGenerate. |
void NLMISC::CBitmap::resizeMipMap |
( |
uint32 |
numMipMap, |
|
|
sint32 |
nNewWidth, |
|
|
sint32 |
nNewHeight |
|
) |
|
|
|
ADVANCED USE Resize a single mipmap level.
resize() should have been called before. This is not a crop. Pixels are lost after resize. No validity check is made. It is the user responsabitility fo setup correct mipmap size. -
Parameters:
-
numMipMap |
id of the mipmap |
nNewWidth |
width after resize |
nNewHeight |
height after resize |
Definition at line 1518 of file bitmap.cpp.
References _Data, bitPerPixels, NLMISC::contReset, DXTC1, DXTC1Alpha, DXTC3, DXTC5, NLMISC::MAX_MIPMAP, nlassert, and PixelFormat.
Referenced by NL3D::CHLSColorTexture::buildColorVersion, and resize. |
bool NLMISC::CBitmap::rgbaToAlpha |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::rgbaToAlphaLuminance |
( |
|
) |
[private] |
|
bool NLMISC::CBitmap::rgbaToLuminance |
( |
|
) |
[private] |
|
void NLMISC::CBitmap::rot90CCW |
( |
|
) |
|
|
|
Rotation of the bitmap of 90 degree in counter clockwise.
Definition at line 2714 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, buildMipMaps, NLMISC::contReset, getHeight, getWidth, PixelFormat, releaseMipMaps, and RGBA. |
void NLMISC::CBitmap::rot90CW |
( |
|
) |
|
|
|
Rotation of the bitmap of 90 degree in clockwise.
Definition at line 2679 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, buildMipMaps, NLMISC::contReset, getHeight, getWidth, PixelFormat, releaseMipMaps, and RGBA. |
void NLMISC::CBitmap::rotateCCW |
( |
|
) |
|
|
void NLMISC::CBitmap::setMipMapCount |
( |
uint32 |
mmc |
) |
|
|
|
Write a JPG from the object pixels buffer.
If the current pixel format is not rgba then the method does nothing If the pixel format is Alpha then we save in 8 bpp -
Parameters:
-
f |
IStream (must be a reading stream) |
quality |
0=very bad quality 100=best quality |
-
Returns:
-
true if succeed, false else
Definition at line 616 of file bitmap.h.
References nlwarning. |
|
Write a TGA (24 or 32 bits) from the object pixels buffer.
If the current pixel format is not rgba then the method does nothing If the pixel format is Alpha then we save in 8 bpp -
Parameters:
-
f |
IStream (must be a reading stream) |
d |
depth : 8 or 16 or 24 or 32 |
upsideDown |
if true, the bitmap will be saved with the upside down |
-
Returns:
-
true if succeed, false else
Definition at line 2086 of file bitmap.cpp.
References _Data, _Height, _Width, Alpha, depth, height, NLMISC::IStream::isReading, PixelFormat, r, RGBA, NLMISC::IStream::serial, width, x, and y. |
Member Data Documentation
|
Reimplemented in NL3D::CTextureMem.
Definition at line 89 of file bitmap.h.
Referenced by alphaLuminanceToAlpha, alphaLuminanceToLuminance, alphaLuminanceToRGBA, alphaToAlphaLuminance, alphaToRGBA, blend, blit, buildMipMaps, decompressDXT1, decompressDXT3, decompressDXT5, NL3D::CTextureCross::doGenerate, flipH, flipV, getPixels, luminanceToAlpha, luminanceToAlphaLuminance, luminanceToRGBA, makeDummy, readDDS, readTGA, NL3D::CTextureFont::rebuildLetter, releaseMipMaps, resample, reset, resizeMipMap, rgbaToAlpha, rgbaToAlphaLuminance, rgbaToLuminance, rot90CCW, rot90CW, rotateCCW, and writeTGA. |
uint32 NLMISC::CBitmap::_Height [protected]
|
|
|
Definition at line 95 of file bitmap.h.
Referenced by alphaLuminanceToAlpha, alphaLuminanceToLuminance, alphaLuminanceToRGBA, alphaToAlphaLuminance, alphaToLuminance, alphaToRGBA, blend, blit, buildMipMaps, CBitmap, decompressDXT1, decompressDXT3, decompressDXT5, NL3D::CTextureFar::doGenerate, getHeight, getWidth, luminanceToAlpha, luminanceToAlphaLuminance, luminanceToRGBA, makeDummy, readDDS, readTGA, NL3D::CTextureFar::rebuildRectangle, resample, reset, resize, rgbaToAlpha, rgbaToAlphaLuminance, rgbaToLuminance, rot90CCW, rot90CW, rotateCCW, and writeTGA. |
bool NLMISC::CBitmap::_LoadGrayscaleAsAlpha [protected]
|
|
uint8 NLMISC::CBitmap::_MipMapCount [protected]
|
|
|
Definition at line 92 of file bitmap.h.
Referenced by alphaLuminanceToAlpha, alphaLuminanceToLuminance, alphaLuminanceToRGBA, alphaToAlphaLuminance, alphaToRGBA, buildMipMaps, CBitmap, decompressDXT1, decompressDXT3, decompressDXT5, flipH, flipV, getMipMapCount, luminanceToAlpha, luminanceToAlphaLuminance, luminanceToRGBA, makeDummy, readDDS, readTGA, releaseMipMaps, resample, reset, rgbaToAlpha, rgbaToAlphaLuminance, rgbaToLuminance, rot90CCW, rot90CW, and setMipMapCount. |
uint32 NLMISC::CBitmap::_Width [protected]
|
|
|
Definition at line 94 of file bitmap.h.
Referenced by alphaLuminanceToAlpha, alphaLuminanceToLuminance, alphaLuminanceToRGBA, alphaToAlphaLuminance, alphaToLuminance, alphaToRGBA, blend, blit, buildMipMaps, CBitmap, decompressDXT1, decompressDXT3, decompressDXT5, NL3D::CTextureFar::doGenerate, getHeight, getWidth, luminanceToAlpha, luminanceToAlphaLuminance, luminanceToRGBA, makeDummy, readDDS, readTGA, NL3D::CTextureFar::rebuildRectangle, resample, reset, resize, rgbaToAlpha, rgbaToAlphaLuminance, rgbaToLuminance, rot90CCW, rot90CW, rotateCCW, and writeTGA. |
const uint32 NLMISC::CBitmap::bitPerPixels [static]
|
|
const uint32 NLMISC::CBitmap::DXTC1HEADER = NL_MAKEFOURCC('D','X', 'T', '1') [static]
|
|
const uint32 NLMISC::CBitmap::DXTC3HEADER = NL_MAKEFOURCC('D','X', 'T', '3') [static]
|
|
const uint32 NLMISC::CBitmap::DXTC5HEADER = NL_MAKEFOURCC('D','X', 'T', '5') [static]
|
|
|
Referenced by alphaLuminanceToAlpha, alphaLuminanceToLuminance, alphaLuminanceToRGBA, alphaToAlphaLuminance, alphaToLuminance, alphaToRGBA, blit, NL3D::CTextureFile::buildBitmapFromFile, buildMipMaps, CBitmap, convertToType, decompressDXT1, decompressDXT3, decompressDXT5, flipH, flipV, getColor, getPixelFormat, luminanceToAlpha, luminanceToAlphaLuminance, luminanceToRGBA, makeDummy, readDDS, readTGA, resample, reset, resize, resizeMipMap, rgbaToAlpha, rgbaToAlphaLuminance, rgbaToLuminance, rot90CCW, rot90CW, and writeTGA. |
The documentation for this class was generated from the following files:
|
|