本文整理汇总了C++中IDirectFBDisplayLayer::SetSrcColorKey方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBDisplayLayer::SetSrcColorKey方法的具体用法?C++ IDirectFBDisplayLayer::SetSrcColorKey怎么用?C++ IDirectFBDisplayLayer::SetSrcColorKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBDisplayLayer
的用法示例。
在下文中一共展示了IDirectFBDisplayLayer::SetSrcColorKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
main( int argc, char *argv[] )
{
DFBResult ret;
int i;
int x, y;
int dx, dy;
int sw3, sh3;
int opacity = 255;
int opacity_delta = -1;
IDirectFB *dfb;
IDirectFBDisplayLayer *layer;
IDirectFBSurface *surface;
DFBDisplayLayerConfig config;
DFBDimension size;
DFBInputEvent evt;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Layer: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Layer: DirectFBCreate() failed!\n" );
return ret;
}
dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
/* Create an input buffer for key events */
dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS,
DFB_TRUE, &keybuffer);
layer->SetCooperativeLevel( layer, DFSCL_EXCLUSIVE );
layer->GetConfiguration( layer, &config );
config.options = DLOP_OPACITY | DLOP_SRC_COLORKEY;
config.buffermode = DLBM_FRONTONLY;
layer->SetConfiguration( layer, &config );
layer->SetSrcColorKey( layer, 0x00, 0xff, 0x00 );
ret = layer->GetSurface( layer, &surface );
if (ret) {
D_DERROR( ret, "DFBTest/Layer: GetSurface() failed!\n" );
dfb->Release( dfb );
return ret;
}
surface->GetSize( surface, &size.w, &size.h );
sw3 = ((size.w / 3) + 1) & ~1;
sh3 = ((size.h / 3) + 1) & ~1;
surface->Clear( surface, 0, 0, 0, 0xff );
for (i=0; i<10; i++) {
surface->SetColor( surface, 0xff - i*16, 0xff - i*16, 0xff - i*16, 0xff );
surface->DrawRectangle( surface, i, i, size.w - i*2, size.h - i*2 );
}
surface->FillRectangle( surface, 10, size.h/2, size.w - 20, 1 );
surface->FillRectangle( surface, size.w/2, 10, 1, size.h - 20 );
surface->SetColor( surface, 0xff, 0x00, 0x00, 0xff );
surface->FillRectangle( surface, size.w/3, size.h/3, size.w/3, size.h/3 );
surface->SetColor( surface, 0x00, 0xff, 0x00, 0xff );
surface->FillRectangle( surface, size.w/3 + size.w/9, size.h/3 + size.h/9, size.w/9, size.h/9 );
surface->Flip( surface, NULL, DSFLIP_NONE );
#ifdef BUILD_AUTOMATION
sleep( 2 );
#else
sleep( 12 );
#endif
layer->SetSourceRectangle( layer, 0, 0, size.w - sw3, size.h - sh3 );
layer->SetScreenPosition( layer, 100, 100 );
layer->SetScreenRectangle( layer, 100, 100, size.w - sw3, size.h - sh3 );
sleep( 2 );
#ifdef BUILD_AUTOMATION
sleep( 20 );
quit = 1;
#endif
for (x=0, y=0, dx=1, dy=1; !quit ; x+=dx, y+=dy) {
layer->SetOpacity( layer, opacity );
//.........这里部分代码省略.........