本文整理汇总了C++中CBitmap::BPP方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitmap::BPP方法的具体用法?C++ CBitmap::BPP怎么用?C++ CBitmap::BPP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBitmap
的用法示例。
在下文中一共展示了CBitmap::BPP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PixelTranspType
int PixelTranspType (short nTexture, short nOrient, short nFrame, fix u, fix v)
{
CBitmap *bmP;
int bmx, bmy, w, h, offs;
ubyte c;
#if 0
tBitmapIndex *bmiP;
bmiP = gameData.pig.tex.bmIndexP + (nTexture);
LoadBitmap (*bmiP, gameStates.app.bD1Data);
bmP = BmOverride (gameData.pig.tex.bitmapP + bmiP->index);
#else
bmP = LoadFaceBitmap (nTexture, nFrame);
if (!bmP->Buffer ())
return 0;
#endif
if (bmP->Flags () & BM_FLAG_RLE)
bmP = rle_expand_texture (bmP);
w = bmP->Width ();
h = ((bmP->Type () == BM_TYPE_ALT) && bmP->Frames ()) ? w : bmP->Height ();
if (nOrient == 0) {
bmx = ((unsigned) X2I (u * w)) % w;
bmy = ((unsigned) X2I (v * h)) % h;
}
else if (nOrient == 1) {
bmx = ((unsigned) X2I ((I2X (1) - v) * w)) % w;
bmy = ((unsigned) X2I (u * h)) % h;
}
else if (nOrient == 2) {
bmx = ((unsigned) X2I ((I2X (1) - u) * w)) % w;
bmy = ((unsigned) X2I ((I2X (1) - v) * h)) % h;
}
else {
bmx = ((unsigned) X2I (v * w)) % w;
bmy = ((unsigned) X2I ((I2X (1) - u) * h)) % h;
}
offs = bmy * w + bmx;
if (bmP->Flags () & BM_FLAG_TGA) {
ubyte *p;
if (bmP->BPP () == 3) //no alpha -> no transparency
return 0;
p = bmP->Buffer () + offs * bmP->BPP ();
// check super transparency color
#if 1
if ((p [0] == 120) && (p [1] == 88) && (p [2] == 128))
#else
if ((gameOpts->ogl.bGlTexMerge) ?
(p [3] == 1) : ((p [0] == 120) && (p [1] == 88) && (p [2] == 128)))
#endif
return -1;
// check alpha
if (!p [3])
return 1;
}
else {
c = bmP->Buffer () [offs];
if (c == SUPER_TRANSP_COLOR)
return -1;
if (c == TRANSPARENCY_COLOR)
return 1;
}
return 0;
}