本文整理汇总了C++中BitmapInfo::SetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapInfo::SetFlags方法的具体用法?C++ BitmapInfo::SetFlags怎么用?C++ BitmapInfo::SetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapInfo
的用法示例。
在下文中一共展示了BitmapInfo::SetFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderFrame
void UtilTest::RenderFrame()
{
int res;
// Create a blank bitmap
static Bitmap *bm = NULL;
if (!bm) {
BitmapInfo bi;
bi.SetWidth(320);
bi.SetHeight(200);
bi.SetType(BMM_TRUE_64);
bi.SetFlags(MAP_HAS_ALPHA);
bi.SetAspect(1.0f);
bm = TheManager->Create(&bi);
}
// Get the active viewport to render
// Display the bitmap
bm->Display(_T("Test"));
// Open up the renderer, render a frame and close it.
res = ip->OpenCurRenderer(NULL,ip->GetActiveViewExp().ToPointer());
res = ip->CurRendererRenderFrame(
ip->GetTime(),bm);
ip->CloseCurRenderer();
// We're done with the viewport.
}
示例2: row
BITMAPINFO *plLayerTex::GetVPDisplayDIB(TimeValue t, TexHandleMaker& thmaker, Interval &valid, BOOL mono, BOOL forceW, BOOL forceH)
{
// FIXME
fTexTime = 0;//CalcFrame(t);
// texValid = clipValid;
BITMAPINFO *bmi = NULL;
int xflags = 0;
if (fBitmapPB->GetInt(kBmpApply))
{
float clipu = fBitmapPB->GetFloat(kBmpClipU);
float clipv = fBitmapPB->GetFloat(kBmpClipV);
float clipw = fBitmapPB->GetFloat(kBmpClipW);
float cliph = fBitmapPB->GetFloat(kBmpClipH);
int discardAlpha = fBitmapPB->GetInt(kBmpDiscardAlpha);
int alphaAsRGB = (fBitmapPB->GetInt(kBmpRGBOutput) == 1);
int w = fBM->Width();
int h = fBM->Height();
Bitmap *newBM;
BitmapInfo bi;
bi.SetName(_T("y8798734"));
bi.SetType(BMM_TRUE_32);
bi.SetFlags(MAP_HAS_ALPHA);
if (fBitmapPB->GetInt(kBmpCropPlace) == 1)
{
int x0, y0, nw, nh;
int bmw = thmaker.Size();
int bmh = int(float(bmw)*float(h)/float(w));
bi.SetWidth(bmw);
bi.SetHeight(bmh);
newBM = TheManager->Create(&bi);
newBM->Fill(0,0,0,0);
nw = int(float(bmw)*clipw);
nh = int(float(bmh)*cliph);
x0 = int(float(bmw-1)*clipu);
y0 = int(float(bmh-1)*clipv);
if (nw<1) nw = 1;
if (nh<1) nh = 1;
PixelBuf row(nw);
Bitmap *tmpBM;
BitmapInfo bif2;
bif2.SetName(_T("xxxx67878"));
bif2.SetType(BMM_TRUE_32);
bif2.SetFlags(MAP_HAS_ALPHA);
bif2.SetWidth(nw);
bif2.SetHeight(nh);
tmpBM = TheManager->Create(&bif2);
tmpBM->CopyImage(fBM, COPY_IMAGE_RESIZE_LO_QUALITY, 0);
BMM_Color_64* p1 = row.Ptr();
for (int y = 0; y<nh; y++)
{
tmpBM->GetLinearPixels(0,y, nw, p1);
if (alphaAsRGB)
{
for (int ix =0; ix<nw; ix++)
p1[ix].r = p1[ix].g = p1[ix].b = p1[ix].a;
}
if (discardAlpha)
{
for (int ix = 0; ix < nw; ix++)
p1[ix].a = 0xffff;
}
newBM->PutPixels(x0, y+y0, nw, p1);
}
tmpBM->DeleteThis();
bmi = thmaker.BitmapToDIB(newBM, fUVGen->SymFlags(), xflags, forceW, forceH);
newBM->DeleteThis();
}
else
{
int x0,y0,nw,nh;
x0 = int(float(w-1)*clipu);
y0 = int(float(h-1)*clipv);
nw = int(float(w)*clipw);
nh = int(float(h)*cliph);
if (nw<1) nw = 1;
if (nh<1) nh = 1;
bi.SetWidth(nw);
bi.SetHeight(nh);
PixelBuf row(nw);
newBM = TheManager->Create(&bi);
BMM_Color_64* p1 = row.Ptr();
for (int y = 0; y<nh; y++)
{
fBM->GetLinearPixels(x0,y+y0, nw, p1);
if (alphaAsRGB)
{
for (int ix = 0; ix < nw; ix++)
p1[ix].r = p1[ix].g = p1[ix].b = p1[ix].a;
}
if (discardAlpha)
{
for (int ix = 0; ix < nw; ix++)
p1[ix].a = 0xffff;
}
//.........这里部分代码省略.........
示例3: GetStaticFrame
AWDTexture *
AWDExporter::ExportTexture(AWD *awd, awd_ncache *ncache,Texmap* tex, Class_ID cid, int subNo, AWDMaterial * mat ) {
AWDTexture *awd_tex;
const char* name;
int name_len;
bool hasAlpha = false;
MSTR path;
awd_uint8 * buf;
int buf_len;
if (!tex) return NULL;
if (tex->ClassID() != Class_ID(BMTEX_CLASS_ID, 0x00) ) return NULL;
// texture already exist in cache
awd_tex = (AWDTexture *)awd_ncache_get( ncache, tex );
if( awd_tex ) return awd_tex;
BitmapTex *bmptex = (BitmapTex*)tex;
MaxSDK::AssetManagement::AssetUser asset = bmptex->GetMap();
hasAlpha = bmptex->GetBitmap( GetStaticFrame() )->HasAlpha();
if( !asset.GetFullFilePath(path) ) {
fprintf( logfile, " export !asset.GetFullFilePath(path) : %i \n", asset.GetType() );
fflush( logfile );
//return NULL;
}
fprintf( logfile, " export : %s \n", path );
fflush( logfile );
AWD_tex_type textype = EXTERNAL;
if( GetIncludeMaps() &&
asset.GetType() == MaxSDK::AssetManagement::kBitmapAsset
) {
const char * dot;
dot = strrchr(path,'.');
if( !strcmp(dot, ".jpg")||
!strcmp(dot, ".JPG")||
!strcmp(dot, ".jpeg")||
!strcmp(dot, ".JPEG")
) {
textype = EMBEDDED_JPEG;
} else if (
!strcmp(dot, ".png")||
!strcmp(dot, ".PNG")
) {
textype = EMBEDDED_PNG;
}
if( textype == 0 ) {
fprintf( logfile, " export texture : %s \n", path );
fflush( logfile );
// try to extract data
Bitmap *bmp = bmptex->GetBitmap( GetStaticFrame() );
BitmapInfo bi;
MaxSDK::Util::Path *temppath;
bi.SetWidth( bmp->Width() );
bi.SetHeight( bmp->Height() );
if( hasAlpha ) {
bi.SetType( BMM_TRUE_32 );
bi.SetFlags( MAP_HAS_ALPHA );
path = "C:\\Users\\lepersp\\Desktop\\temp\\awdexporttempjpg.png";
textype = EMBEDDED_PNG;
} else {
bi.SetType( BMM_TRUE_24 );
path = "C:\\Users\\lepersp\\Desktop\\temp\\awdexporttempjpg.jpg";
textype = EMBEDDED_JPEG;
}
temppath = new MaxSDK::Util::Path( path );
bi.SetPath( *temppath );
bmp->OpenOutput( & bi );
bmp->Write( & bi );
bmp->Close(& bi);
}
//.........这里部分代码省略.........