本文整理汇总了C++中IDirectFB::GetDisplayLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFB::GetDisplayLayer方法的具体用法?C++ IDirectFB::GetDisplayLayer怎么用?C++ IDirectFB::GetDisplayLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFB
的用法示例。
在下文中一共展示了IDirectFB::GetDisplayLayer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_display_layer_window
int get_display_layer_window() {
IDirectFB *dfb = NULL;
IDirectFBDisplayLayer *layer = NULL;
IDirectFBWindow *window = NULL;
DFBWindowDescription desc;
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb,dfb->Release);
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
push_release(layer, layer->Release);
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
desc.posx = desc.posy = desc.width = desc.height = 20;
DFBCHECK(layer->CreateWindow(layer, &desc, &window));
push_release(window, window->Release);
/* check window */
release_all();
return 0;
}
示例2: main
int
main( int argc, char *argv[] )
{
int i;
DFBResult ret;
IDirectFB *dfb;
IDirectFBDisplayLayer *layer = NULL;
App apps[1];
DFBDisplayLayerConfig config;
/* Parse arguments. */
for (i=1; i<argc; i++) {
if (!strcmp( argv[i], "-h" ))
return show_usage( argv[0] );
}
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: DirectFBCreate() failed!\n" );
return ret;
}
/* Get primary layer. */
ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: IDirectFB::GetDisplayLayer( PRIMARY ) failed!\n" );
goto out;
}
layer->GetConfiguration( layer, &config );
app_init( &apps[0], layer, 100, 50, config.width-300, config.height-150, 0 );
while (true) {
direct_thread_sleep( 1000000 );
app_update( &apps[0] );
}
out:
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}
示例3: get_display_layer
int get_display_layer() {
IDirectFB *dfb = NULL;
IDirectFBDisplayLayer *layer = NULL;
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb, dfb->Release);
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
push_release(layer, layer->Release);
release_all();
return 0;
}
示例4: main
int main(int argc, char** argv) {
IDirectFB *dfb = NULL;
IDirectFBDisplayLayer *layer = NULL;
IDirectFBSurface *surface = NULL;
IDirectFBVideoProvider *vp = NULL;
CHECK(DirectFBInit (&argc, &argv));
if (argc != 2) {
return 1;
}
CHECK(DirectFBCreate(&dfb));
/* Signals */
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGUSR1, signal_handler);
signal(SIGUSR2, signal_handler);
CHECK(dfb->GetDisplayLayer(dfb, 0, &layer));
CHECK(dfb->CreateVideoProvider(dfb, argv[1], &vp));
CHECK(layer->GetSurface(layer, &surface));
CHECK(vp->PlayTo(vp, surface, NULL, flip, surface));
while(to_exit == 0) {
sleep(1);
}
CHECK(vp->Stop(vp));
CHECK(vp->Release(vp));
CHECK(surface->Release(surface));
CHECK(layer->Release(layer));
CHECK(dfb->Release(dfb));
return 0;
}
示例5: main
int main( int argc, char *argv[] )
{
IDirectFB *dfb;
IDirectFBDisplayLayer *layer;
IDirectFBSurface *bgsurface;
IDirectFBImageProvider *provider;
IDirectFBWindow *window1;
IDirectFBWindow *window2;
IDirectFBSurface *window_surface1;
IDirectFBSurface *window_surface2;
IDirectFBEventBuffer *buffer;
DFBDisplayLayerConfig layer_config;
#if ((DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23))
DFBCardCapabilities caps;
#else
DFBGraphicsDeviceDescription caps;
#endif
IDirectFBWindow* upper;
DFBWindowID id1;
IDirectFBFont *font;
int fontheight;
int err;
int quit = 0;
DFBCHECK(DirectFBInit( &argc, &argv ));
DFBCHECK(DirectFBCreate( &dfb ));
#if ((DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23))
dfb->GetCardCapabilities( dfb, &caps );
#else
dfb->GetDeviceDescription( dfb, &caps );
#endif
dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
if (!((caps.blitting_flags & DSBLIT_BLEND_ALPHACHANNEL) &&
(caps.blitting_flags & DSBLIT_BLEND_COLORALPHA )))
{
layer_config.flags = DLCONF_BUFFERMODE;
layer_config.buffermode = DLBM_BACKSYSTEM;
layer->SetConfiguration( layer, &layer_config );
}
layer->GetConfiguration( layer, &layer_config );
layer->EnableCursor ( layer, 1 );
{
DFBFontDescription desc;
desc.flags = DFDESC_HEIGHT;
desc.height = layer_config.width/50;
DFBCHECK(dfb->CreateFont( dfb, PACKAGE_DATA_DIR"/grunge.ttf", &desc, &font ));
font->GetHeight( font, &fontheight );
}
{
DFBSurfaceDescription desc;
DFBCHECK(dfb->CreateImageProvider( dfb,
PACKAGE_DATA_DIR"/bg.png",
&provider ));
desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT;
desc.width = layer_config.width;
desc.height = layer_config.height;
DFBCHECK(dfb->CreateSurface( dfb, &desc, &bgsurface ) );
provider->RenderTo( provider, bgsurface, NULL );
provider->Release( provider );
DFBCHECK(bgsurface->SetFont( bgsurface, font ));
bgsurface->SetColor( bgsurface, 0xCF, 0xCF, 0xFF, 0xFF );
bgsurface->DrawString( bgsurface,
"Move the mouse over a window to activate it.",
-1, 10, 0, DSTF_LEFT | DSTF_TOP );
bgsurface->SetColor( bgsurface, 0xFF, 0xCF, 0xFF, 0xFF );
bgsurface->DrawString( bgsurface,
"You can drag them around, too, if you want.",
-1, 10 , 40, DSTF_LEFT | DSTF_TOP );
bgsurface->SetColor( bgsurface, 0xCF, 0xCF, 0xFF, 0xFF );
bgsurface->DrawString( bgsurface,
"The one with funky stuff happening and things flying around is an evas.",
-1, 10, 80, DSTF_LEFT | DSTF_TOP );
//.........这里部分代码省略.........
示例6: GDK_DISPLAY_OBJECT
/* Main entry point for gdk in 2.6 args are parsed
*/
GdkDisplay *
gdk_display_open (const gchar *display_name)
{
IDirectFB *directfb;
IDirectFBDisplayLayer *layer;
IDirectFBInputDevice *keyboard;
DFBResult ret;
if (_gdk_display)
{
return GDK_DISPLAY_OBJECT (_gdk_display); /* single display only */
}
ret = DirectFBInit (NULL, NULL);
if (ret != DFB_OK)
{
DirectFBError ("gdk_display_open: DirectFBInit", ret);
return NULL;
}
ret = DirectFBCreate (&directfb);
if (ret != DFB_OK)
{
DirectFBError ("gdk_display_open: DirectFBCreate", ret);
return NULL;
}
_gdk_display = g_object_new (GDK_TYPE_DISPLAY_DFB, NULL);
_gdk_display->directfb = directfb;
ret = directfb->GetDisplayLayer (directfb, DLID_PRIMARY, &layer);
if (ret != DFB_OK)
{
DirectFBError ("gdk_display_open: GetDisplayLayer", ret);
directfb->Release (directfb);
_gdk_display->directfb = NULL;
return NULL;
}
ret = directfb->GetInputDevice (directfb, DIDID_KEYBOARD, &keyboard);
if (ret != DFB_OK)
{
DirectFBError ("gdk_display_open: GetInputDevice", ret);
directfb->Release (directfb);
_gdk_display->directfb = NULL;
return NULL;
}
_gdk_display->layer = layer;
_gdk_display->keyboard = keyboard;
_gdk_directfb_keyboard_init ();
_gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL);
_gdk_visual_init ();
_gdk_windowing_window_init (_gdk_screen);
gdk_screen_set_default_colormap (_gdk_screen,
gdk_screen_get_system_colormap (_gdk_screen));
_gdk_windowing_image_init ();
_gdk_events_init ();
_gdk_input_init ();
_gdk_dnd_init ();
layer->EnableCursor (layer, 1);
g_signal_emit_by_name (gdk_display_manager_get (),
"display_opened", _gdk_display);
return GDK_DISPLAY_OBJECT (_gdk_display);
}
示例7: DirectFBInit
int
main( int argc, char *argv[] )
{
DFBResult ret;
IDirectFB *dfb;
IDirectFBDisplayLayer *layer;
/* Initialize DirectFB. */
ret = DirectFBInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "DFBTest/Window_Surface: DirectFBInit() failed!\n" );
return ret;
}
/* Create super interface. */
ret = DirectFBCreate( &dfb );
if (ret) {
D_DERROR( ret, "DFBTest/Window_Surface: DirectFBCreate() failed!\n" );
return ret;
}
dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
while (true) {
DFBWindowDescription desc;
IDirectFBWindow *window;
IDirectFBSurface *surface;
desc.flags = DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS;
desc.posx = 150;
desc.posy = 150;
desc.width = 300;
desc.height = 300;
desc.caps = DWCAPS_ALPHACHANNEL;
ret = layer->CreateWindow( layer, &desc, &window );
if (ret) {
D_DERROR( ret, "DFBTest/Window_Surface: CreateWindow() failed!\n" );
return ret;
}
window->GetSurface( window, &surface );
D_INFO( "Created window and surface, going to release window... (in 2 seconds)\n" );
usleep( 2000000 );
D_INFO("Releasing window...\n");
window->Release( window );
D_INFO("Window released, going to release surface... (in 2 seconds)\n");
usleep( 2000000 );
D_INFO("Releasing surface...\n");
surface->Release( surface );
D_INFO("Surface released, done.\n");
usleep( 5000000 );
}
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}
示例8: while
int
main( int argc, char *argv[] )
{
DFBResult ret;
bool quit = false;
int i;
IDirectFB dfb;
IDirectFBDisplayLayer layer;
IDirectFBSurface surface;
DFBDisplayLayerConfig config;
DFBDimension sizes[2] = { {400, 400}, {600, 600} };
size_t num_sizes = D_ARRAY_SIZE(sizes);
DFBInputEvent evt;
IDirectFBEventBuffer keybuffer;
/* Initialize DirectFB. */
DirectFB::Init( &argc, &argv );
/* Create super interface. */
dfb = DirectFB::Create();
layer = dfb.GetDisplayLayer( DLID_PRIMARY );
/* Create an input buffer for key events */
keybuffer = dfb.CreateInputEventBuffer( DICAPS_KEYS, DFB_TRUE );
layer.SetCooperativeLevel( DLSCL_EXCLUSIVE );
layer.GetConfiguration( &config );
config.width = sizes[0].w;
config.height = sizes[0].h;
layer.SetConfiguration( config );
surface = layer.GetSurface();
while (true) {
surface.Clear( 0, 0, 0, 0xff );
surface.SetColor( 0x00, 0xff, 0x00, 0xff );
surface.DrawRectangle( 0, 0, config.width, config.height );
surface.Flip( NULL, DSFLIP_NONE );
keybuffer.WaitForEventWithTimeout( 3, 0 );
/* Process keybuffer */
while (keybuffer.GetEvent( DFB_EVENT(&evt) )) {
if (evt.type == DIET_KEYPRESS) {
switch (DFB_LOWER_CASE(evt.key_symbol)) {
case DIKS_ESCAPE:
case DIKS_SMALL_Q:
case DIKS_BACK:
case DIKS_STOP:
case DIKS_EXIT:
/* Quit main loop & test thread */
quit = 1;
break;
case DIKS_SPACE:
case DIKS_OK:
i++;
config.width = sizes[i % num_sizes].w;
config.height = sizes[i % num_sizes].h;
layer.SetConfiguration( config );
break;
default:
break;
}
}
}
}
return 0;
}
示例9: CreateYUVSurface
static DFBResult CreateYUVSurface(_THIS, struct private_yuvhwdata *hwdata,
int width, int height, Uint32 format)
{
DFBResult ret;
IDirectFB *dfb = HIDDEN->dfb;
IDirectFBDisplayLayer *layer;
DFBDisplayLayerConfig conf;
ret = dfb->EnumDisplayLayers (dfb, enum_layers_callback, hwdata);
if (ret)
{
SetDirectFBerror("IDirectFB::EnumDisplayLayers", ret);
return ret;
}
if (!hwdata->layer_id)
return DFB_UNSUPPORTED;
ret = dfb->GetDisplayLayer (dfb, hwdata->layer_id, &layer);
if (ret)
{
SetDirectFBerror("IDirectFB::GetDisplayLayer", ret);
return ret;
}
conf.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
conf.width = width;
conf.height = height;
switch (format)
{
case SDL_YV12_OVERLAY:
conf.pixelformat = DSPF_YV12;
break;
case SDL_IYUV_OVERLAY:
conf.pixelformat = DSPF_I420;
break;
case SDL_YUY2_OVERLAY:
conf.pixelformat = DSPF_YUY2;
break;
case SDL_UYVY_OVERLAY:
conf.pixelformat = DSPF_UYVY;
break;
default:
fprintf (stderr, "SDL_DirectFB: Unsupported YUV format (0x%08x)!\n", format);
break;
}
/* Need to set coop level or newer DirectFB versions will fail here. */
ret = layer->SetCooperativeLevel (layer, DLSCL_ADMINISTRATIVE);
if (ret)
{
SetDirectFBerror("IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret);
layer->Release (layer);
return ret;
}
ret = layer->SetConfiguration (layer, &conf);
if (ret)
{
SetDirectFBerror("IDirectFBDisplayLayer::SetConfiguration", ret);
layer->Release (layer);
return ret;
}
ret = layer->GetSurface (layer, &hwdata->surface);
if (ret)
{
SetDirectFBerror("IDirectFBDisplayLayer::GetSurface", ret);
layer->Release (layer);
return ret;
}
hwdata->layer = layer;
return DFB_OK;
}
示例10: get_display_layer_surface
int get_display_layer_surface() {
int i;
IDirectFB *dfb = NULL;
IDirectFBSurface *surface = NULL;
DFBSurfaceCapabilities caps;
IDirectFBDisplayLayer *layer = NULL;
int width, height;
DFBSurfacePixelFormat p_format;
DFBCHECK(DirectFBInit(NULL, NULL));
DFBCHECK(DirectFBCreate(&dfb));
push_release(dfb, dfb->Release);
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
push_release(layer, layer->Release);
DFBCHECK(layer->SetCooperativeLevel(layer, DLSCL_EXCLUSIVE));
DFBCHECK(layer->GetSurface(layer, &surface));
push_release(surface, surface->Release);
DFBCHECK(surface->GetCapabilities(surface, &caps));
if (caps & DSCAPS_PRIMARY) {
printf("Surface Primary\n");
}
if (caps & DSCAPS_SYSTEMONLY) {
printf("Surface SystemOnly\n");
}
if (caps & DSCAPS_VIDEOONLY) {
printf("Surface VideoOnly\n");
}
if (caps & DSCAPS_DOUBLE) {
printf("Surface Double buffered\n");
}
if (caps & DSCAPS_SUBSURFACE) {
printf("Surface is a sub surface\n");
}
if (caps & DSCAPS_INTERLACED) {
printf("Surface is Interlaced\n");
}
if (caps & DSCAPS_SEPARATED) {
printf("Surface is separated\n");
}
if (caps & DSCAPS_STATIC_ALLOC) {
printf("Surface is static alloc\n");
}
if (caps & DSCAPS_TRIPLE) {
printf("Surface is triple buffered\n");
}
if (caps & DSCAPS_PREMULTIPLIED) {
printf("Surface stores premiltiplied alpha\n");
}
if (caps & DSCAPS_DEPTH) {
printf("Surface has a depth buffer\n");
}
DFBCHECK(surface->GetSize(surface, &width, &height));
printf("Surface size: %dx%d\n", width, height);
DFBCHECK(surface->GetPixelFormat(surface, &p_format));
for(i = 0; pformat_names[i].format; i++) {
if (pformat_names[i].format == p_format) {
printf("Surface pixelformat: %s\n", pformat_names[i].name);
}
}
release_all();
return 0;
}
示例11: printf
static DFBEnumerationResult
layer_cb( DFBDisplayLayerID id,
DFBDisplayLayerDescription desc,
void *arg )
{
IDirectFB *dfb = (IDirectFB*) arg;
int i;
/* Name */
printf( " Layer (%02x) %-30s", id, desc.name );
switch (id) {
case DLID_PRIMARY:
printf( " (primary layer)" );
break;
default:
break;
}
printf( "\n" );
/* Type */
printf( " Type: " );
for (i=0; layer_types[i].type; i++) {
if (desc.type & layer_types[i].type)
printf( "%s ", layer_types[i].name );
}
printf( "\n" );
/* Caps */
printf( " Caps: " );
for (i=0; layer_caps[i].capability; i++) {
if (desc.caps & layer_caps[i].capability)
printf( "%s ", layer_caps[i].name );
}
printf( "\n" );
/* Sources */
if (desc.caps & DLCAPS_SOURCES) {
DFBResult ret;
IDirectFBDisplayLayer *layer;
DFBDisplayLayerSourceDescription descs[desc.sources];
ret = dfb->GetDisplayLayer( dfb, id, &layer );
if (ret) {
DirectFBError( "DirectFB::GetDisplayLayer() failed", ret );
}
else {
ret = layer->GetSourceDescriptions( layer, descs );
if (ret) {
DirectFBError( "DirectFBDisplayLayer::GetSourceDescriptions() failed", ret );
}
else {
printf( " Sources: " );
for (i=0; i<desc.sources; i++) {
if (i > 0)
printf( ", %s", descs[i].name );
else
printf( "%s", descs[i].name );
}
printf( "\n" );
}
layer->Release( layer );
}
}
printf( "\n" );
return DFB_OK;
}
示例12: 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 );
//.........这里部分代码省略.........