Class Bitmap. More...
#include <bitmap.h>
Inherited by NL3D::ITexture.
Public Types | |
| enum | TType { RGBA = 0, Luminance, Alpha, AlphaLuminance, DXTC1, DXTC1Alpha, DXTC3, DXTC5, DsDt, ModeCount, DonTKnow = 0xffffffff } |
Public Member Functions | |
| CBitmap () | |
| virtual | ~CBitmap () |
| void | swap (CBitmap &other) |
| uint8 | load (NLMISC::IStream &f, uint mipMapSkip=0) |
| Read a bitmap(TGA or DDS) from an IStream. | |
| void | makeDummy () |
| Make a dummy "?" texture. | |
| void | makeNonPowerOf2Dummy () |
| Make a dummy "2" texture. | |
| bool | convertToType (TType type) |
| Convert bitmap to another type conversion to rgba always work. | |
| TType | getPixelFormat () const |
| Return the format of pixels stored at the present time in the object buffer. | |
| virtual uint32 | getWidth (uint32 numMipMap=0) const |
| Return the image width, or a mipmap width. | |
| virtual uint32 | getHeight (uint32 numMipMap=0) const |
| Return the image height, or a mipmap height. | |
| uint32 | getSize (uint32 numMipMap=0) const |
| Return the size (in pixels) of the image: <=> getHeight()*getWidth(). | |
| uint32 | getMipMapCount () const |
| Return the number of mipmaps. | |
| uint32 | computeNeededMipMapCount () const |
| void | rotateCCW () |
| Rotate a bitmap in CCW mode. | |
| void | buildMipMaps () |
| Build the mipmaps of the bitmap if they don't exist. | |
| void | releaseMipMaps () |
| Release the mipmaps of the bitmap if they exist. | |
| void | reset (TType type=RGBA) |
| Reset the buffer. | |
| void | resample (sint32 nNewWidth, sint32 nNewHeight) |
| Resample the bitmap. | |
| void | resize (sint32 nNewWidth, sint32 nNewHeight, TType newType=DonTKnow, bool resetTo0=true) |
| Resize the bitmap. | |
| void | resizeMipMap (uint32 numMipMap, sint32 nNewWidth, sint32 nNewHeight, bool resetTo0=true) |
| ADVANCED USE Resize a single mipmap level. | |
| void | setMipMapCount (uint32 mmc) |
| ADVANCED USE To use in conjunction with resizeMipMap. | |
| bool | writeTGA (NLMISC::IStream &f, uint32 d=0, bool upsideDown=false) |
| Write a TGA (24 or 32 bits) from the object pixels buffer. | |
| bool | writePNG (NLMISC::IStream &f, uint32 d=0) |
| Write a PNG (24 or 32 bits) from the object pixels buffer. | |
| bool | writeJPG (NLMISC::IStream &f, uint8 quality=80) |
| Write a JPG from the object pixels buffer. | |
| void | loadGrayscaleAsAlpha (bool loadAsAlpha) |
| Tell the bitmap to load grayscale bitmap as alpha or luminance format. | |
| bool | isGrayscaleAsAlpha () const |
| Tell if the bitmap loads grayscale bitmap as alpha or luminance format. | |
| 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 IMPORTANT : copy to self is not handled correctly. | |
| void | blit (const CBitmap &src, sint srcX, sint srcY, sint srcWidth, sint srcHeight, sint destX, sint destY) |
| Extended version of blit. | |
| CRGBAF | getColor (float x, float y) const |
| Get the color in the bitmap for the first mipmap The mipmaps must be built. | |
| CRGBAF | getColor (float x, float y, bool tileU, bool tileV) const |
| CRGBA | getPixelColor (sint x, sint y, uint32 numMipMap=0) const |
| Get the pixel at the given coorrdinate. | |
| void | flipH () |
| Horizontal flip (all the columns are flipped) Works only with RGBA, and DXTC formats (only if w/h is a power of 2). | |
| void | flipV () |
| Vertical flip (all the rows are flipped) Works only with RGBA, and DXTC formats (only if w/h is a power of 2). | |
| void | rot90CW () |
| Rotation of the bitmap of 90 degree in clockwise. | |
| void | rot90CCW () |
| Rotation of the bitmap of 90 degree in counter clockwise. | |
| void | blend (CBitmap &Bm0, CBitmap &Bm1, uint16 factor, bool inputBitmapIsMutable=false) |
| Set this bitmap as the result of the blend bewteen 2 bitmap REQUIRE : - Bm0 and Bm1 should have the same size. | |
| void | getData (uint8 *&extractData) |
| void | getDibData (uint8 *&extractData) |
| CBitmap & | operator= (const CBitmap &from) |
Static Public Member Functions | |
| static void | loadSize (NLMISC::IStream &f, uint32 &width, uint32 &height) |
| Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream. | |
| static void | loadSize (const std::string &path, uint32 &retWidth, uint32 &retHeight) |
| same than other loadSize(), but with a pathName. | |
Public Attributes | |
| enum NLMISC::CBitmap::TType | PixelFormat |
Static Public Attributes | |
| static const uint32 | bitPerPixels [ModeCount] |
| static const uint32 | DXTC1HEADER = NL_MAKEFOURCC('D','X', 'T', '1') |
| static const uint32 | DXTC3HEADER = NL_MAKEFOURCC('D','X', 'T', '3') |
| static const uint32 | DXTC5HEADER = NL_MAKEFOURCC('D','X', 'T', '5') |
Protected Attributes | |
| CObjectVector< uint8 > | _Data [MAX_MIPMAP] |
| uint8 | _MipMapCount |
| bool | _LoadGrayscaleAsAlpha |
| uint32 | _Width |
| uint32 | _Height |
Private Member Functions | |
| uint32 | blend (uint32 &n0, uint32 &n1, uint32 coef0) |
| blend 2 integers between 0 and 255 . | |
| uint8 | readDDS (NLMISC::IStream &f, uint mipMapSkip) |
| Read a DDS from an IStream. | |
| uint8 | readTGA (NLMISC::IStream &f) |
| Read a TGA from an IStream. | |
| uint8 | readPNG (NLMISC::IStream &f) |
| bool | decompressDXT1 (bool alpha) |
| Decompress bitmap compressed with S3TC DXT1 algorithm. | |
| bool | decompressDXT3 () |
| Decompress bitmap compressed with S3TC DXT3 algorithm. | |
| bool | decompressDXT5 () |
| Decompress bitmap compressed with S3TC DXT3 algorithm. | |
| void | resamplePicture32 (const NLMISC::CRGBA *pSrc, NLMISC::CRGBA *pDest, sint32 nSrcWidth, sint32 nSrcHeight, sint32 nDestWidth, sint32 nDestHeight) |
| The resample function. | |
| void | resamplePicture32Fast (const NLMISC::CRGBA *pSrc, NLMISC::CRGBA *pDest, sint32 nSrcWidth, sint32 nSrcHeight, sint32 nDestWidth, sint32 nDestHeight) |
| The FAST resample function : works only when reducing the size by two and when the image is square. | |
| float | getColorInterp (float x, float y, float xy00, float xy01, float xy10, float xy11) const |
| Quadratic interpolator. | |
| CRGBA | getRGBAPixel (sint x, sint y, uint32 numMipMap) const |
| void | makeDummyFromBitField (const uint8 bitmap[1024]) |
| void | flipHDXTCBlockColor (uint8 *bitColor, uint32 w) |
| void | flipVDXTCBlockColor (uint8 *bitColor, uint32 h) |
| void | flipHDXTCBlockAlpha3 (uint8 *bitColor, uint32 w) |
| void | flipVDXTCBlockAlpha3 (uint8 *bitColor, uint32 h) |
| void | flipHDXTCBlockAlpha5 (uint8 *bitColor, uint32 w) |
| void | flipVDXTCBlockAlpha5 (uint8 *bitColor, uint32 h) |
| void | flipDXTC (bool vertical) |
| void | flipDXTCMipMap (bool vertical, uint mm, uint type) |
Static Private Member Functions | |
| static void | uncompress (uint16 color, NLMISC::CRGBA &) |
| Extracting RGBA infos from a 16bits word. | |
|
| |
| bool | convertToDXTC5 () |
| Change bitmap format. | |
| 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 () |
| 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 |
| static CRGBA | getDXTCColorFromBlock (const uint8 *block, sint x, sint y) |
| name DXTC single texel read | |
| CObjectVector< uint8 > & | getPixels (uint32 numMipMap=0) |
| Return the pixels buffer of the image, or of one of its mipmap. | |
| const CObjectVector< uint8 > & | getPixels (uint32 numMipMap=0) const |
| void | unattachPixels (CObjectVector< uint8 > *mipmapDestArray, uint maxMipMapCount=MAX_MIPMAP) |
| Gain ownership of this texture datas. | |
Class Bitmap.
Definition at line 90 of file bitmap.h.
| NLMISC::CBitmap::CBitmap | ( | ) | [inline] |
Definition at line 288 of file bitmap.h.
References _Height, _LoadGrayscaleAsAlpha, _MipMapCount, _Width, PixelFormat, and RGBA.
| bool NLMISC::CBitmap::alphaLuminanceToAlpha | ( | ) | [private] |
Definition at line 855 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, Alpha, NLMISC::contReset(), PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToAlpha().
| bool NLMISC::CBitmap::alphaLuminanceToLuminance | ( | ) | [private] |
Definition at line 770 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::contReset(), Luminance, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToLuminance().
| bool NLMISC::CBitmap::alphaLuminanceToRGBA | ( | ) | [private] |
Definition at line 612 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToRGBA().
| bool NLMISC::CBitmap::alphaToAlphaLuminance | ( | ) | [private] |
Definition at line 700 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, AlphaLuminance, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToAlphaLuminance().
| bool NLMISC::CBitmap::alphaToLuminance | ( | ) | [private] |
Definition at line 757 of file bitmap.cpp.
References _Height, _Width, Luminance, and PixelFormat.
Referenced by convertToLuminance().
| bool NLMISC::CBitmap::alphaToRGBA | ( | ) | [private] |
Definition at line 583 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToRGBA().
| void NLMISC::CBitmap::blend | ( | CBitmap & | Bm0, | |
| CBitmap & | Bm1, | |||
| uint16 | factor, | |||
| bool | inputBitmapIsMutable = false | |||
| ) |
Set this bitmap as the result of the blend bewteen 2 bitmap REQUIRE : - Bm0 and Bm1 should have the same size.
| factor | The blend factor. 0 means the result is equal to Bm0, 256 means the result is equal to Bm1 | |
| inputBitmapIsMutable | when true, bitmap can be converted in place when needed (no copy done) |
blend 4 component at each pass
Definition at line 3631 of file bitmap.cpp.
References _Data, _Height, _Width, convertToRGBA(), NLMISC::CSystemInfo::hasMMX(), nlassert, PixelFormat, resize(), and RGBA.
blend 2 integers between 0 and 255 .
| n0 | first integer | |
| n1 | second integer | |
| coef | coefficient for the first integer (must be in [0,256]) |
Definition at line 1431 of file bitmap.cpp.
Referenced by decompressDXT5(), and NL3D::CTextureBlend::doGenerate().
| void NLMISC::CBitmap::blit | ( | const CBitmap & | src, | |
| sint | srcX, | |||
| sint | srcY, | |||
| sint | srcWidth, | |||
| sint | srcHeight, | |||
| sint | destX, | |||
| sint | destY | |||
| ) |
Extended version of blit.
The destinaion of the blit is 'this' bitmap Source and dest rect are clamped as necessary. For now, only RGBA is uspported (an asertion occurs otherwise) mipmap are not updated. IMPORTANT : copy to self is not handled correctly
Definition at line 2530 of file bitmap.cpp.
References getHeight(), getPixels(), getWidth(), nlassert, PixelFormat, and RGBA.
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 IMPORTANT : copy to self is not handled correctly.
Definition at line 2599 of file bitmap.cpp.
References _Data, _Height, _Width, bitPerPixels, DonTKnow, DXTC1, DXTC1Alpha, DXTC3, DXTC5, nlassert, and PixelFormat.
Referenced by NL3D::CTextureGrouped::doGenerate(), and NL3D::CCoarseMeshBuild::expand().
| void NLMISC::CBitmap::buildMipMaps | ( | ) |
Build the mipmaps of the bitmap if they don't exist.
Work only in RGBA mode...
Definition at line 1515 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLMISC::CRGBA::G, NLMISC::isPowerOf2(), PixelFormat, NLMISC::CRGBA::R, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and RGBA.
Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CTextureMem::doGenerate(), flipH(), flipV(), NL3D::CDriverD3D::generateD3DTexture(), resample(), rot90CCW(), rot90CW(), and NL3D::CDriverGL::setupTextureEx().
| uint32 NLMISC::CBitmap::computeNeededMipMapCount | ( | ) | const |
Definition at line 1584 of file bitmap.cpp.
References _Height, _MipMapCount, _Width, and NLMISC::isPowerOf2().
Referenced by NL3D::CDriverD3D::generateD3DTexture().
| bool NLMISC::CBitmap::convertToAlpha | ( | ) | [private] |
Definition at line 914 of file bitmap.cpp.
References Alpha, AlphaLuminance, alphaLuminanceToAlpha(), Luminance, luminanceToAlpha(), PixelFormat, RGBA, and rgbaToAlpha().
Referenced by convertToType().
| bool NLMISC::CBitmap::convertToAlphaLuminance | ( | ) | [private] |
Definition at line 945 of file bitmap.cpp.
References Alpha, AlphaLuminance, alphaToAlphaLuminance(), Luminance, luminanceToAlphaLuminance(), PixelFormat, RGBA, and rgbaToAlphaLuminance().
Referenced by convertToType().
| bool NLMISC::CBitmap::convertToDXTC5 | ( | ) | [private] |
Change bitmap format.
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 508 of file bitmap.cpp.
Referenced by convertToType().
| bool NLMISC::CBitmap::convertToLuminance | ( | ) | [private] |
Definition at line 883 of file bitmap.cpp.
References Alpha, AlphaLuminance, alphaLuminanceToLuminance(), alphaToLuminance(), Luminance, PixelFormat, RGBA, and rgbaToLuminance().
Referenced by convertToType().
| bool NLMISC::CBitmap::convertToRGBA | ( | ) | [private] |
Definition at line 975 of file bitmap.cpp.
References Alpha, AlphaLuminance, alphaLuminanceToRGBA(), alphaToRGBA(), decompressDXT1(), decompressDXT3(), decompressDXT5(), DXTC1, DXTC1Alpha, DXTC3, DXTC5, Luminance, luminanceToRGBA(), PixelFormat, and RGBA.
Referenced by blend(), and convertToType().
| bool NLMISC::CBitmap::convertToType | ( | CBitmap::TType | type | ) |
Convert bitmap to another type conversion to rgba always work.
No-op if already rgba.
| type | new type for the bitmap |
Definition at line 1019 of file bitmap.cpp.
References Alpha, AlphaLuminance, convertToAlpha(), convertToAlphaLuminance(), convertToDXTC5(), convertToLuminance(), convertToRGBA(), DXTC5, Luminance, PixelFormat, and RGBA.
Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CHeightMap::buildFromBitmap(), NL3D::CZoneLighter::getTexture(), NL3D::CTileBank::getTileNoiseMap(), and NL3D::CDriverGL::setupTextureEx().
Decompress bitmap compressed with S3TC DXT1 algorithm.
| alpha | if alpha is true there's alpha. |
Definition at line 1058 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLMISC::CRGBA::blendFromui(), NLMISC::CRGBA::G, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CRGBA::R, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, NLMISC::CRGBA::set(), NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), and uncompress().
Referenced by convertToRGBA().
| bool NLMISC::CBitmap::decompressDXT3 | ( | ) | [private] |
Decompress bitmap compressed with S3TC DXT3 algorithm.
| EAllocationFailure | : can't allocate memory. |
Definition at line 1183 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::CRGBA::B, NLMISC::CRGBA::blendFromui(), NLMISC::CRGBA::G, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CRGBA::R, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), and uncompress().
Referenced by convertToRGBA().
| bool NLMISC::CBitmap::decompressDXT5 | ( | ) | [private] |
Decompress bitmap compressed with S3TC DXT3 algorithm.
| EAllocationFailure | : can't allocate memory. |
Definition at line 1293 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, blend(), NLMISC::CRGBA::blendFromui(), G, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), and uncompress().
Referenced by convertToRGBA().
| void NLMISC::CBitmap::flipDXTC | ( | bool | vertical | ) | [private] |
Definition at line 3455 of file bitmap.cpp.
References _MipMapCount, DXTC1, DXTC1Alpha, DXTC3, DXTC5, flipDXTCMipMap(), getHeight(), getWidth(), NLMISC::isPowerOf2(), and PixelFormat.
Definition at line 3358 of file bitmap.cpp.
References _Data, flipHDXTCBlockAlpha3(), flipHDXTCBlockAlpha5(), flipHDXTCBlockColor(), flipVDXTCBlockAlpha3(), flipVDXTCBlockAlpha5(), flipVDXTCBlockColor(), getHeight(), getWidth(), NLMISC::MAX_MIPMAP, nlassert, and swap().
Referenced by flipDXTC().
| void NLMISC::CBitmap::flipH | ( | ) |
Horizontal flip (all the columns are flipped) Works only with RGBA, and DXTC formats (only if w/h is a power of 2).
Definition at line 3483 of file bitmap.cpp.
References _Data, _MipMapCount, buildMipMaps(), flipDXTC(), getHeight(), getWidth(), PixelFormat, releaseMipMaps(), and RGBA.
Referenced by NL3D::CDriverGL::setupTextureEx().
Definition at line 3230 of file bitmap.cpp.
References INT64_CONSTANT.
Referenced by flipDXTCMipMap().
Definition at line 3292 of file bitmap.cpp.
References INT64_CONSTANT.
Referenced by flipDXTCMipMap().
Definition at line 3187 of file bitmap.cpp.
Referenced by flipDXTCMipMap().
| void NLMISC::CBitmap::flipV | ( | ) |
Vertical flip (all the rows are flipped) Works only with RGBA, and DXTC formats (only if w/h is a power of 2).
Definition at line 3522 of file bitmap.cpp.
References _Data, _MipMapCount, buildMipMaps(), flipDXTC(), getHeight(), getWidth(), PixelFormat, releaseMipMaps(), and RGBA.
Referenced by NL3D::CDriverGL::getBuffer(), readTGA(), and NL3D::CDriverGL::setupTextureEx().
Definition at line 3325 of file bitmap.cpp.
References INT64_CONSTANT.
Referenced by flipDXTCMipMap().
Definition at line 2855 of file bitmap.cpp.
References NLMISC::CRGBAF::A, Alpha, NLMISC::CRGBAF::B, DXTC1, DXTC1Alpha, DXTC3, DXTC5, G, NLMISC::CRGBAF::G, getColorInterp(), getHeight(), getPixelColor(), getPixels(), getWidth(), Luminance, nlassert, PixelFormat, NLMISC::CRGBAF::R, RGBA, and NLMISC::wrap().
Get the color in the bitmap for the first mipmap The mipmaps must be built.
If not just return the bilinear at the given point. NB: coordinates are clamped.
| tiled | If false coordinate are clamped, else the bitmap is considered to tile |
Definition at line 2737 of file bitmap.cpp.
References NLMISC::CRGBAF::A, Alpha, NLMISC::CRGBAF::B, DXTC1, DXTC1Alpha, DXTC3, DXTC5, G, NLMISC::CRGBAF::G, getColorInterp(), getHeight(), getPixelColor(), getPixels(), getWidth(), Luminance, nlassert, PixelFormat, NLMISC::CRGBAF::R, and RGBA.
| float NLMISC::CBitmap::getColorInterp | ( | float | x, | |
| float | y, | |||
| float | xy00, | |||
| float | xy01, | |||
| float | xy10, | |||
| float | xy11 | |||
| ) | const [private] |
Quadratic interpolator.
Definition at line 2726 of file bitmap.cpp.
References NLMISC::clamp().
Referenced by getColor().
| void NLMISC::CBitmap::getData | ( | uint8 *& | extractData | ) |
Definition at line 4021 of file bitmap.cpp.
References _Data, _Height, _Width, Alpha, Luminance, nlstop, PixelFormat, and RGBA.
| void NLMISC::CBitmap::getDibData | ( | uint8 *& | extractData | ) |
Definition at line 4039 of file bitmap.cpp.
References _Data, _Height, _Width, Alpha, Luminance, nlstop, PixelFormat, and RGBA.
Definition at line 3868 of file bitmap.cpp.
References NLMISC::CRGBA::Black, getDXTCColorFromBlock(), getHeight(), getPixels(), and getWidth().
Referenced by getPixelColor().
Definition at line 3881 of file bitmap.cpp.
References NLMISC::CRGBA::Black, getDXTCColorFromBlock(), getHeight(), getPixels(), and getWidth().
Referenced by getPixelColor().
Definition at line 3897 of file bitmap.cpp.
References NLMISC::CRGBA::Black, getDXTCColorFromBlock(), getHeight(), getPixels(), and getWidth().
Referenced by getPixelColor().
| CRGBA NLMISC::CBitmap::getDXTCColorFromBlock | ( | const uint8 * | block, | |
| sint | x, | |||
| sint | y | |||
| ) | [static, private] |
name DXTC single texel read
Definition at line 3808 of file bitmap.cpp.
References NLMISC::CRGBA::A, NLMISC::CRGBA::blendFromui(), NLMISC::CRGBA::set(), and uncompress().
Referenced by getDXTC1Texel(), getDXTC3Texel(), and getDXTC5Texel().
Return the image height, or a mipmap height.
| mipMap | mipmap level |
Definition at line 1481 of file bitmap.cpp.
References _Height, and _Width.
Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CTextureGrouped::areValid(), blit(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CHeightMap::buildFromBitmap(), NL3D::CFontManager::computeString(), NL3D::CFastHLSModifier::convertDDSBitmap(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureCube::doGenerate(), draw2dLine(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::fillBuffer(), NL3D::CDriverD3D::fillBuffer(), flipDXTC(), flipDXTCMipMap(), flipH(), flipV(), NL3D::CPatchDLMContext::generate(), NL3D::CDriverD3D::generateD3DTexture(), getColor(), getDXTC1Texel(), getDXTC3Texel(), getDXTC5Texel(), getRGBAPixel(), getSize(), NL3D::GetTextureSize(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CTextureDrvInfosGL::initFrameBufferObject(), NL3D::CDriverGL::isTextureRectangle(), NL3D::CZoneLighter::lightWater(), CEGUI::NeLTexture::loadFromFile(), NL3D::CShapeBank::processWSUploadTexture(), RenderTriangle(), rot90CCW(), rot90CW(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), NL3D::CDriverD3D::uploadTexture(), and NL3D::CAsyncTextureManager::uploadTexturePart().
| uint32 NLMISC::CBitmap::getMipMapCount | ( | ) | const [inline] |
Return the number of mipmaps.
Level0 is a mipmap...
Definition at line 419 of file bitmap.h.
References _MipMapCount.
Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CDriverD3D::generateD3DTexture(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), NL3D::CDriverD3D::uploadTexture(), NL3D::CAsyncTextureManager::uploadTexturePart(), and NL3D::CAsyncTextureManager::validDXTCMipMap().
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 3954 of file bitmap.cpp.
References NLMISC::CRGBA::Black, DXTC1, DXTC1Alpha, DXTC3, DXTC5, getDXTC1Texel(), getDXTC3Texel(), getDXTC5Texel(), getRGBAPixel(), nlstop, PixelFormat, and RGBA.
Referenced by getColor().
| TType NLMISC::CBitmap::getPixelFormat | ( | ) | const [inline] |
Return the format of pixels stored at the present time in the object buffer.
Definition at line 385 of file bitmap.h.
References PixelFormat.
Referenced by NL3D::CTextureGrouped::areValid(), NL3D::CFastHLSModifier::convertDDSBitmap(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureCube::doGenerate(), NL3D::CDriverGL::fillBuffer(), NL3D::CDriverD3D::generateD3DTexture(), NL3D::CDriverD3D::getD3DDestTextureFormat(), NL3D::getGlSrcTextureFormat(), NL3D::CDriverGL::getGlTextureFormat(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CTextureFar::rebuildPatch(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CAsyncTextureManager::update(), NL3D::CDriverGL::uploadTexture(), NL3D::CDriverD3D::uploadTexture(), NL3D::CDriverD3D::uploadTextureInternal(), NL3D::CAsyncTextureManager::uploadTexturePart(), and NL3D::CAsyncTextureManager::validDXTCMipMap().
| const CObjectVector<uint8>& NLMISC::CBitmap::getPixels | ( | uint32 | numMipMap = 0 |
) | const [inline] |
| CObjectVector<uint8>& NLMISC::CBitmap::getPixels | ( | uint32 | numMipMap = 0 |
) | [inline] |
Return the pixels buffer of the image, or of one of its mipmap.
Return a reference of an array in pixel format get with getPixelFormat().
Definition at line 350 of file bitmap.h.
References _Data.
Referenced by NL3D::CHLSColorTexture::addMask(), blit(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CHLSColorTexture::buildColorVersion(), NL3D::CHeightMap::buildFromBitmap(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CTextureDLM::copyRect(), NL3D::CTextureDLM::CTextureDLM(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureMem::doGenerate(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), draw2dLine(), NL3D::CTextureFont::dumpTextureFont(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::fillBuffer(), NL3D::CDriverD3D::fillBuffer(), NL3D::CTextureDLM::fillRect(), NL3D::CDriverGL::getBufferPart(), NL3D::CDriverD3D::getBufferPart(), getColor(), getDXTC1Texel(), getDXTC3Texel(), getDXTC5Texel(), getRGBAPixel(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CZoneLighter::lightWater(), NL3D::CTextureDLM::modulateAndfillRect565(), NL3D::CTextureDLM::modulateAndfillRect8888(), NL3D::CTextureDLM::modulateConstantAndfillRect(), NL3D::CTextureFar::rebuildPatch(), NL3D::CTextureNear::refillRect(), RenderTriangle(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverD3D::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), and NL3D::CDriverD3D::uploadTextureInternal().
Definition at line 3798 of file bitmap.cpp.
References NLMISC::CRGBA::Black, getHeight(), getPixels(), and getWidth().
Referenced by getPixelColor().
Return the size (in pixels) of the image: <=> getHeight()*getWidth().
| mipMap | mipmap level |
Definition at line 1505 of file bitmap.cpp.
References getHeight(), and getWidth().
Referenced by NL3D::CShapeBank::processWSUploadTexture(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverD3D::setupTextureEx(), NL3D::CAsyncTextureManager::update(), and NL3D::CAsyncTextureManager::uploadTexturePart().
Return the image width, or a mipmap width.
| mipMap | mipmap level |
Definition at line 1456 of file bitmap.cpp.
References _Height, and _Width.
Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CShadowMapManager::allocateTexture(), NL3D::CTextureGrouped::areValid(), blit(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CHeightMap::buildFromBitmap(), NL3D::CFontManager::computeString(), NL3D::CFastHLSModifier::convertDDSBitmap(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CTextureDLM::copyRect(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureCube::doGenerate(), draw2dLine(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::fillBuffer(), NL3D::CDriverD3D::fillBuffer(), NL3D::CTextureDLM::fillRect(), flipDXTC(), flipDXTCMipMap(), flipH(), flipV(), NL3D::CPatchDLMContext::generate(), NL3D::CDriverD3D::generateD3DTexture(), getColor(), getDXTC1Texel(), getDXTC3Texel(), getDXTC5Texel(), getRGBAPixel(), getSize(), NL3D::GetTextureSize(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CTextureDrvInfosGL::initFrameBufferObject(), NL3D::CDriverGL::isTextureRectangle(), NL3D::CZoneLighter::lightWater(), CEGUI::NeLTexture::loadFromFile(), NL3D::CTextureDLM::modulateAndfillRect565(), NL3D::CTextureDLM::modulateAndfillRect8888(), NL3D::CTextureDLM::modulateConstantAndfillRect(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CTextureNear::refillRect(), RenderTriangle(), rot90CCW(), rot90CW(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), NL3D::CDriverD3D::uploadTexture(), and NL3D::CAsyncTextureManager::uploadTexturePart().
| bool NLMISC::CBitmap::isGrayscaleAsAlpha | ( | ) | const [inline] |
Tell if the bitmap loads grayscale bitmap as alpha or luminance format.
Definition at line 545 of file bitmap.h.
References _LoadGrayscaleAsAlpha.
| uint8 NLMISC::CBitmap::load | ( | NLMISC::IStream & | f, | |
| uint | mipMapSkip = 0 | |||
| ) |
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).
| IStream | The stream must be in reading mode. | |
| mipMapSkip | if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped. |
| ESeekFailed | : seek has failed |
Definition at line 101 of file bitmap.cpp.
References NLMISC::IStream::begin, NLMISC::DDS_HEADER, NLMISC::IStream::isReading(), nlassert, NLMISC::PNG_HEADER, readDDS(), readPNG(), readTGA(), NLMISC::IStream::seek(), and NLMISC::IStream::serial().
Referenced by NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CTextureMem::doGenerate(), and CEGUI::NeLTexture::loadFromFile().
| void NLMISC::CBitmap::loadGrayscaleAsAlpha | ( | bool | loadAsAlpha | ) | [inline] |
Tell the bitmap to load grayscale bitmap as alpha or luminance format.
| loadAsAlpha | is true to load grayscale bitmaps as alpha. false to load grayscale bitmaps as luminance. default value is true. |
Definition at line 534 of file bitmap.h.
References _LoadGrayscaleAsAlpha.
Referenced by NL3D::CTextureFile::buildBitmapFromFile(), and NL3D::CTileBank::getTileNoiseMap().
| void NLMISC::CBitmap::loadSize | ( | const std::string & | path, | |
| uint32 & | retWidth, | |||
| uint32 & | retHeight | |||
| ) | [static] |
same than other loadSize(), but with a pathName.
Definition at line 3176 of file bitmap.cpp.
References loadSize(), and NLMISC::CIFile::open().
| void NLMISC::CBitmap::loadSize | ( | NLMISC::IStream & | f, | |
| uint32 & | width, | |||
| uint32 & | height | |||
| ) | [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.
| 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. |
| ESeekFailed | : seek has failed |
Definition at line 2981 of file bitmap.cpp.
References NLMISC::IStream::begin, NLMISC::IStream::current, NLMISC::DDS_HEADER, DDSD_LINEARSIZE, NLMISC::IStream::isReading(), NLMISC::JPG_HEADER, NL_MAKEFOURCC, nlassert, NLMISC_BSWAP16, NLMISC_BSWAP32, nlwarning, NLMISC::PNG_HEADER, NLMISC::IStream::seek(), NLMISC::IStream::serial(), and NLMISC::IStream::serialCheck().
Referenced by NL3D::GetTextureSize(), and loadSize().
| bool NLMISC::CBitmap::luminanceToAlpha | ( | ) | [private] |
Definition at line 829 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, Alpha, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToAlpha().
| bool NLMISC::CBitmap::luminanceToAlphaLuminance | ( | ) | [private] |
Definition at line 672 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, AlphaLuminance, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToAlphaLuminance().
| bool NLMISC::CBitmap::luminanceToRGBA | ( | ) | [private] |
Definition at line 555 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToRGBA().
| void NLMISC::CBitmap::makeDummy | ( | ) |
Make a dummy "?" texture.
Useful for file not found. Mode is rgba.
Definition at line 187 of file bitmap.cpp.
References makeDummyFromBitField().
Referenced by NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CreateDummyMesh(), NL3D::CTextureMultiFile::doGenerate(), NL3D::CTextureMem::doGenerate(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), and NL3D::CTextureBlend::doGenerate().
| void NLMISC::CBitmap::makeDummyFromBitField | ( | const uint8 | bitmap[1024] | ) | [private] |
Definition at line 275 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::MAX_MIPMAP, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, and NLMISC::CRGBA::set().
Referenced by makeDummy(), and makeNonPowerOf2Dummy().
| void NLMISC::CBitmap::makeNonPowerOf2Dummy | ( | ) |
Make a dummy "2" texture.
Useful for file not power of 2. Mode is rgba.
Definition at line 231 of file bitmap.cpp.
References makeDummyFromBitField().
Referenced by NL3D::CTextureFile::buildBitmapFromFile().
Reimplemented in NL3D::ITexture, NL3D::CTextureFile, and NL3D::CTextureGrouped.
Definition at line 627 of file bitmap.h.
References _Data, _Height, _LoadGrayscaleAsAlpha, _MipMapCount, _Width, NLMISC::MAX_MIPMAP, and PixelFormat.
| uint8 NLMISC::CBitmap::readDDS | ( | NLMISC::IStream & | f, | |
| uint | mipMapSkip | |||
| ) | [private] |
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.
| IStream | The stream must be in reading mode. |
| EDDSBadHeader | : surface is header is not valid. |
Definition at line 301 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::IStream::current, DDSD_LINEARSIZE, DXTC1, DXTC1Alpha, DXTC1HEADER, DXTC3, DXTC3HEADER, DXTC5, DXTC5HEADER, NLMISC::getPowerOf2(), min, nlwarning, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), NLMISC::IStream::seek(), NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by load().
| uint8 NLMISC::CBitmap::readPNG | ( | NLMISC::IStream & | f | ) | [private] |
Definition at line 42 of file bitmap_png.cpp.
References _Data, _Height, _Width, Alpha, NLMISC::IStream::isReading(), Luminance, nlwarning, PixelFormat, NLMISC::readPNGData(), resize(), and RGBA.
Referenced by load().
| uint8 NLMISC::CBitmap::readTGA | ( | NLMISC::IStream & | f | ) | [private] |
Read a TGA from an IStream.
TGA pictures can be in 24 or 32 bits, RLE or uncompressed
| f | IStream (must be a reading stream) |
Definition at line 1970 of file bitmap.cpp.
References _Data, _Height, _LoadGrayscaleAsAlpha, _MipMapCount, _Width, Alpha, NLMISC::IStream::begin, NLMISC::IStream::end, flipV(), NLMISC::IStream::getPos(), NLMISC::IStream::isReading(), Luminance, nlinfo, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), RGBA, NLMISC::IStream::seek(), NLMISC::IStream::serial(), and NLMISC::IStream::serialBuffer().
Referenced by load().
| void NLMISC::CBitmap::releaseMipMaps | ( | ) |
Release the mipmaps of the bitmap if they exist.
Work for any mode.
Definition at line 1606 of file bitmap.cpp.
References _Data, _MipMapCount, NLMISC::contReset(), and NLMISC::MAX_MIPMAP.
Referenced by NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), flipH(), flipV(), resample(), resize(), rot90CCW(), rot90CW(), and NL3D::CDriverGL::setupTextureEx().
Resample the bitmap.
If mipmaps exist they are deleted, then rebuilt after resampling.
| nNewWidth | width after resample | |
| nNewHeight | height after resample |
Definition at line 1623 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, buildMipMaps(), NLMISC::contReset(), nlassert, PixelFormat, releaseMipMaps(), resamplePicture32(), NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and RGBA.
Referenced by NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CDriverD3D::generateD3DTexture(), and NL3D::CDriverGL::setupTextureEx().
| void NLMISC::CBitmap::resamplePicture32 | ( | const NLMISC::CRGBA * | pSrc, | |
| NLMISC::CRGBA * | pDest, | |||
| sint32 | nSrcWidth, | |||
| sint32 | nSrcHeight, | |||
| sint32 | nDestWidth, | |||
| sint32 | nDestHeight | |||
| ) | [private] |
The resample function.
| 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 1747 of file bitmap.cpp.
References nlassert, and resamplePicture32Fast().
Referenced by resample().
| void NLMISC::CBitmap::resamplePicture32Fast | ( | const NLMISC::CRGBA * | pSrc, | |
| NLMISC::CRGBA * | pDest, | |||
| sint32 | nSrcWidth, | |||
| sint32 | nSrcHeight, | |||
| sint32 | nDestWidth, | |||
| sint32 | nDestHeight | |||
| ) | [private] |
The FAST resample function : works only when reducing the size by two and when the image is square.
| 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 1937 of file bitmap.cpp.
References NLMISC::CRGBA::avg4(), and nlassert.
Referenced by resamplePicture32().
| void NLMISC::CBitmap::reset | ( | TType | type = RGBA |
) |
Reset the buffer.
Mipmaps are deleted and bitmap is not valid anymore.
| type | is the new type used for this texture |
Definition at line 1728 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::contReset(), PixelFormat, and NLMISC::CObjectVector< T, EnableObjectBehavior >::resize().
Referenced by NL3D::CHLSColorTexture::buildColorVersion(), NL3D::CDriverGL::getBufferPart(), and NL3D::ITexture::release().
| void NLMISC::CBitmap::resize | ( | sint32 | nNewWidth, | |
| sint32 | nNewHeight, | |||
| TType | newType = DonTKnow, |
|||
| bool | resetTo0 = true | |||
| ) |
Resize the bitmap.
If mipmaps exist they are deleted and not rebuilt. This is not a crop. Pixels are lost after resize.
| 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. | |
| resetTo0 | by default the vector are filled by 0. set false to gain performances. |
Definition at line 1674 of file bitmap.cpp.
References _Height, _Width, DonTKnow, PixelFormat, releaseMipMaps(), and resizeMipMap().
Referenced by blend(), NL3D::CHLSColorTexture::buildColorVersion(), NL3D::CTextureDLM::CTextureDLM(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureNear::CTextureNear(), NL3D::CTextureMem::doGenerate(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureFar::doGenerate(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), NL3D::CTextureCross::doGenerate(), NL3D::CTextureFont::dumpTextureFont(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::getBufferPart(), NL3D::CDriverD3D::getBufferPart(), and readPNG().
| void NLMISC::CBitmap::resizeMipMap | ( | uint32 | numMipMap, | |
| sint32 | nNewWidth, | |||
| sint32 | nNewHeight, | |||
| bool | resetTo0 = true | |||
| ) |
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.
| numMipMap | id of the mipmap | |
| nNewWidth | width after resize | |
| nNewHeight | height after resize | |
| resetTo0 | by default the vector are filled by 0. set false to gain performances. |
Definition at line 1694 of file bitmap.cpp.
References _Data, bitPerPixels, NLMISC::contReset(), NLMISC::CObjectVector< T, EnableObjectBehavior >::fill(), NLMISC::MAX_MIPMAP, nlassert, PixelFormat, and NLMISC::CObjectVector< T, EnableObjectBehavior >::resize().
Referenced by NL3D::CHLSColorTexture::buildColorVersion(), and resize().
| bool NLMISC::CBitmap::rgbaToAlpha | ( | ) | [private] |
Definition at line 801 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, Alpha, NLMISC::contReset(), PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToAlpha().
| bool NLMISC::CBitmap::rgbaToAlphaLuminance | ( | ) | [private] |
Definition at line 643 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, AlphaLuminance, NLMISC::contReset(), PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToAlphaLuminance().
| bool NLMISC::CBitmap::rgbaToLuminance | ( | ) | [private] |
Definition at line 728 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, NLMISC::contReset(), Luminance, PixelFormat, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and NLMISC::CObjectVector< T, EnableObjectBehavior >::size().
Referenced by convertToLuminance().
| void NLMISC::CBitmap::rot90CCW | ( | ) |
Rotation of the bitmap of 90 degree in counter clockwise.
Definition at line 3595 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, buildMipMaps(), NLMISC::contReset(), getHeight(), getWidth(), PixelFormat, releaseMipMaps(), NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and RGBA.
| void NLMISC::CBitmap::rot90CW | ( | ) |
Rotation of the bitmap of 90 degree in clockwise.
Definition at line 3560 of file bitmap.cpp.
References _Data, _Height, _MipMapCount, _Width, buildMipMaps(), NLMISC::contReset(), getHeight(), getWidth(), PixelFormat, releaseMipMaps(), NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), and RGBA.
| void NLMISC::CBitmap::rotateCCW | ( | ) |
Rotate a bitmap in CCW mode.
Definition at line 2504 of file bitmap.cpp.
References _Data, _Height, _Width, Alpha, AlphaLuminance, Luminance, PixelFormat, and RGBA.
| void NLMISC::CBitmap::setMipMapCount | ( | uint32 | mmc | ) |
ADVANCED USE To use in conjunction with resizeMipMap.
Setup the correct total number of mipmap No validity check is made. It is the user responsabitility fo setup correct mipmap count.
Definition at line 1719 of file bitmap.cpp.
References _MipMapCount.
Referenced by NL3D::CHLSColorTexture::buildColorVersion().
| void NLMISC::CBitmap::swap | ( | CBitmap & | other | ) |
Definition at line 3977 of file bitmap.cpp.
References _Data, _Height, _LoadGrayscaleAsAlpha, _MipMapCount, _Width, NLMISC::MAX_MIPMAP, PixelFormat, and NLMISC::CObjectVector< T, EnableObjectBehavior >::swap().
Referenced by NL3D::CTextureFar::allocatePatch(), NL3D::CTextureFile::buildBitmapFromFile(), flipDXTCMipMap(), flipVDXTCBlockAlpha3(), flipVDXTCBlockColor(), NL3D::CTextureFar::removePatch(), NL3D::CTextureFar::touchPatchULAndNext(), and NL3D::CTextureFar::tryAllocatePatch().
| void NLMISC::CBitmap::unattachPixels | ( | CObjectVector< uint8 > * | mipmapDestArray, | |
| uint | maxMipMapCount = MAX_MIPMAP | |||
| ) |
Gain ownership of this texture datas.
As a result, the bitmap is reseted (put in the same state than when ctor is called, e.g a single mipmap with null size) The CObjectVector objects that contains the bitmap (one per mipmap) datas are 'swapped' with those in the array provided by the caller. NB : The user must provide at least min(getMipMapCount(), maxMipMapCount) entries in the array
| mipmapArray | Array of mipmap that receive the bitmap datas | |
| maxMipMapCount | Max number of mipmap to be copied in the destination array. |
Definition at line 3991 of file bitmap.cpp.
References _Data, _Height, _LoadGrayscaleAsAlpha, _MipMapCount, _Width, NLMISC::CObjectVector< T, EnableObjectBehavior >::clear(), min, nlassert, PixelFormat, RGBA, and NLMISC::CObjectVector< T, EnableObjectBehavior >::swap().
| void NLMISC::CBitmap::uncompress | ( | uint16 | color, | |
| NLMISC::CRGBA & | r | |||
| ) | [inline, static, private] |
Extracting RGBA infos from a 16bits word.
(used by S3TC decompression)
| color | a 16bits integer | |
| r | a CRGBA |
Definition at line 1443 of file bitmap.cpp.
References NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLMISC::CRGBA::G, and NLMISC::CRGBA::R.
Referenced by decompressDXT1(), decompressDXT3(), decompressDXT5(), and getDXTCColorFromBlock().
| bool NLMISC::CBitmap::writeJPG | ( | NLMISC::IStream & | f, | |
| uint8 | quality = 80 | |||
| ) | [inline] |
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
| f | IStream (must be a reading stream) | |
| quality | 0=very bad quality 100=best quality |
Definition at line 726 of file bitmap.h.
References nlwarning.
| bool NLMISC::CBitmap::writePNG | ( | NLMISC::IStream & | f, | |
| uint32 | d = 0 | |||
| ) |
Write a PNG (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
| f | IStream (must be a reading stream) | |
| d | depth : 8 or 16 or 24 or 32 (0 for automatic) |
Definition at line 290 of file bitmap_png.cpp.
References _Data, _Height, _Width, Alpha, NLMISC::IStream::isReading(), Luminance, nlwarning, PixelFormat, RGBA, NLMISC::setPNGError(), NLMISC::setPNGWarning(), and NLMISC::writePNGData().
| bool NLMISC::CBitmap::writeTGA | ( | NLMISC::IStream & | f, | |
| uint32 | d = 0, |
|||
| bool | upsideDown = false | |||
| ) |
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
| f | IStream (must be a reading stream) | |
| d | depth : 8 or 16 or 24 or 32 (0 for automatic) | |
| upsideDown | if true, the bitmap will be saved with the upside down |
Definition at line 2319 of file bitmap.cpp.
References _Data, _Height, _Width, Alpha, NLMISC::IStream::isReading(), Luminance, PixelFormat, RGBA, and NLMISC::IStream::serial().
Referenced by NL3D::CTextureFont::dumpTextureFont(), NL3D::CZoneLighter::lightWater(), and NL3D::CNELU::screenshot().
CObjectVector<uint8> NLMISC::CBitmap::_Data[MAX_MIPMAP] [protected] |
Reimplemented in NL3D::CTextureMem.
Definition at line 93 of file bitmap.h.
Referenced by alphaLuminanceToAlpha(), alphaLuminanceToLuminance(), alphaLuminanceToRGBA(), alphaToAlphaLuminance(), alphaToRGBA(), blend(), blit(), buildMipMaps(), decompressDXT1(), decompressDXT3(), decompressDXT5(), NL3D::CTextureCross::doGenerate(), flipDXTCMipMap(), flipH(), flipV(), getData(), getDibData(), getPixels(), luminanceToAlpha(), luminanceToAlphaLuminance(), luminanceToRGBA(), makeDummyFromBitField(), operator=(), readDDS(), readPNG(), readTGA(), NL3D::CTextureFont::rebuildLetter(), releaseMipMaps(), resample(), reset(), resizeMipMap(), rgbaToAlpha(), rgbaToAlphaLuminance(), rgbaToLuminance(), rot90CCW(), rot90CW(), rotateCCW(), swap(), unattachPixels(), writePNG(), and writeTGA().
uint32 NLMISC::CBitmap::_Height [protected] |
Definition at line 99 of file bitmap.h.
Referenced by alphaLuminanceToAlpha(), alphaLuminanceToLuminance(), alphaLuminanceToRGBA(), alphaToAlphaLuminance(), alphaToLuminance(), alphaToRGBA(), blend(), blit(), buildMipMaps(), CBitmap(), computeNeededMipMapCount(), decompressDXT1(), decompressDXT3(), decompressDXT5(), getData(), getDibData(), getHeight(), getWidth(), luminanceToAlpha(), luminanceToAlphaLuminance(), luminanceToRGBA(), makeDummyFromBitField(), operator=(), readDDS(), readPNG(), readTGA(), resample(), reset(), resize(), rgbaToAlpha(), rgbaToAlphaLuminance(), rgbaToLuminance(), rot90CCW(), rot90CW(), rotateCCW(), swap(), unattachPixels(), writePNG(), and writeTGA().
bool NLMISC::CBitmap::_LoadGrayscaleAsAlpha [protected] |
Definition at line 97 of file bitmap.h.
Referenced by CBitmap(), isGrayscaleAsAlpha(), loadGrayscaleAsAlpha(), operator=(), readTGA(), swap(), and unattachPixels().
uint8 NLMISC::CBitmap::_MipMapCount [protected] |
Definition at line 96 of file bitmap.h.
Referenced by alphaLuminanceToAlpha(), alphaLuminanceToLuminance(), alphaLuminanceToRGBA(), alphaToAlphaLuminance(), alphaToRGBA(), buildMipMaps(), CBitmap(), computeNeededMipMapCount(), decompressDXT1(), decompressDXT3(), decompressDXT5(), flipDXTC(), flipH(), flipV(), getMipMapCount(), luminanceToAlpha(), luminanceToAlphaLuminance(), luminanceToRGBA(), makeDummyFromBitField(), operator=(), readDDS(), readTGA(), releaseMipMaps(), resample(), reset(), rgbaToAlpha(), rgbaToAlphaLuminance(), rgbaToLuminance(), rot90CCW(), rot90CW(), setMipMapCount(), swap(), and unattachPixels().
uint32 NLMISC::CBitmap::_Width [protected] |
Definition at line 98 of file bitmap.h.
Referenced by alphaLuminanceToAlpha(), alphaLuminanceToLuminance(), alphaLuminanceToRGBA(), alphaToAlphaLuminance(), alphaToLuminance(), alphaToRGBA(), blend(), blit(), buildMipMaps(), CBitmap(), computeNeededMipMapCount(), decompressDXT1(), decompressDXT3(), decompressDXT5(), getData(), getDibData(), getHeight(), getWidth(), luminanceToAlpha(), luminanceToAlphaLuminance(), luminanceToRGBA(), makeDummyFromBitField(), operator=(), readDDS(), readPNG(), readTGA(), NL3D::CTextureFar::rebuildPatch(), resample(), reset(), resize(), rgbaToAlpha(), rgbaToAlphaLuminance(), rgbaToLuminance(), rot90CCW(), rot90CW(), rotateCCW(), swap(), unattachPixels(), writePNG(), and writeTGA().
const uint32 NLMISC::CBitmap::bitPerPixels [static] |
{
32,
8,
8,
16,
4,
4,
8,
8,
16
}
Definition at line 281 of file bitmap.h.
Referenced by blit(), NL3D::CShapeBank::processWSUploadTexture(), resizeMipMap(), NL3D::CAsyncTextureManager::update(), NL3D::CDriverD3D::uploadTextureInternal(), and NL3D::CAsyncTextureManager::uploadTexturePart().
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(), blend(), blit(), NL3D::CTextureFile::buildBitmapFromFile(), buildMipMaps(), CBitmap(), convertToAlpha(), convertToAlphaLuminance(), convertToLuminance(), convertToRGBA(), convertToType(), decompressDXT1(), decompressDXT3(), decompressDXT5(), flipDXTC(), flipH(), flipV(), getColor(), getData(), getDibData(), getPixelColor(), getPixelFormat(), luminanceToAlpha(), luminanceToAlphaLuminance(), luminanceToRGBA(), makeDummyFromBitField(), operator=(), readDDS(), readPNG(), readTGA(), resample(), reset(), resize(), resizeMipMap(), rgbaToAlpha(), rgbaToAlphaLuminance(), rgbaToLuminance(), rot90CCW(), rot90CW(), rotateCCW(), NL3D::sameDXTCFormat(), swap(), unattachPixels(), writePNG(), and writeTGA().
1.6.1