本文整理汇总了C++中IDirectFBDisplayLayer::SetCooperativeLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBDisplayLayer::SetCooperativeLevel方法的具体用法?C++ IDirectFBDisplayLayer::SetCooperativeLevel怎么用?C++ IDirectFBDisplayLayer::SetCooperativeLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBDisplayLayer
的用法示例。
在下文中一共展示了IDirectFBDisplayLayer::SetCooperativeLevel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeCursor
void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *)
{
int xSpot;
int ySpot;
QPixmap map;
if (cursor->shape() != Qt::BitmapCursor) {
m_image->set(cursor->shape());
xSpot = m_image->hotspot().x();
ySpot = m_image->hotspot().y();
QImage *i = m_image->image();
map = QPixmap::fromImage(*i);
} else {
QPoint point = cursor->hotSpot();
xSpot = point.x();
ySpot = point.y();
map = cursor->pixmap();
}
DFBResult res;
IDirectFBDisplayLayer *layer = toDfbLayer(m_screen);
IDirectFBSurface* surface(QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.handle()));
res = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
if (res != DFB_OK) {
DirectFBError("Failed to set DLSCL_ADMINISTRATIVE", res);
return;
}
layer->SetCursorShape(layer, surface, xSpot, ySpot);
layer->SetCooperativeLevel(layer, DLSCL_SHARED);
}
示例2: dfb_create_window
/* DFB API */
IDirectFBWindow* dfb_create_window (IDirectFB *dfb, int x, int y, int width, int height, gboolean isAlpha)
{
DFBResult err;
DFBWindowDescription dsc;
IDirectFBWindow *window = NULL;
IDirectFBDisplayLayer *layer = NULL;
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
dsc.flags = DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT;
dsc.posx = x;
dsc.posy = y;
dsc.width = width;
dsc.height = height;
if(isAlpha) {
dsc.flags |= DWDESC_CAPS;
dsc.caps = DWCAPS_ALPHACHANNEL;
}
err = layer->CreateWindow (layer, &dsc, &window);
if (err!=DR_OK) {
ZError(DBG_INIT, "Failed to dfb_create_window.");
return NULL;
}
/* Set ZKPlayer to Bottom but upper ZImagePlayer */
DFBCHECK(window->LowerToBottom(window));
DFBCHECK(window->SetOpacity(window, 0x0));
return window;
}
示例3: 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;
}
示例4: sizeof
void
DirectFB_InitModes(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
IDirectFBDisplayLayer *layer = NULL;
SDL_VideoDisplay display;
DFB_DisplayData *dispdata = NULL;
SDL_DisplayMode mode;
DFBGraphicsDeviceDescription caps;
DFBDisplayLayerConfig dlc;
struct screen_callback_t *screencbdata;
int tcw[DFB_MAX_SCREENS];
int tch[DFB_MAX_SCREENS];
int i;
DFBResult ret;
SDL_DFB_ALLOC_CLEAR(screencbdata, sizeof(*screencbdata));
screencbdata->numscreens = 0;
for (i = 0; i < DFB_MAX_SCREENS; i++) {
screencbdata->gralayer[i] = -1;
screencbdata->vidlayer[i] = -1;
}
SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &EnumScreensCallback,
screencbdata));
for (i = 0; i < screencbdata->numscreens; i++) {
IDirectFBScreen *screen;
SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb,
screencbdata->screenid
[i], &screen));
screencbdata->aux = i;
SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &EnumLayersCallback,
screencbdata));
screen->GetSize(screen, &tcw[i], &tch[i]);
screen->Release(screen);
}
/* Query card capabilities */
devdata->dfb->GetDeviceDescription(devdata->dfb, &caps);
for (i = 0; i < screencbdata->numscreens; i++) {
SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
screencbdata->gralayer
[i], &layer));
SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer,
DLSCL_ADMINISTRATIVE));
layer->EnableCursor(layer, 1);
SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0));
if (devdata->use_yuv_underlays) {
dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
dlc.pixelformat = DSPF_ARGB;
dlc.options = DLOP_ALPHACHANNEL;
ret = layer->SetConfiguration(layer, &dlc);
if (ret != DFB_OK) {
/* try AiRGB if the previous failed */
dlc.pixelformat = DSPF_AiRGB;
SDL_DFB_CHECKERR(layer->SetConfiguration(layer, &dlc));
}
}
/* Query layer configuration to determine the current mode and pixelformat */
dlc.flags = DLCONF_ALL;
SDL_DFB_CHECKERR(layer->GetConfiguration(layer, &dlc));
mode.format = DirectFB_DFBToSDLPixelFormat(dlc.pixelformat);
if (mode.format == SDL_PIXELFORMAT_UNKNOWN) {
SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat);
goto error;
}
mode.w = dlc.width;
mode.h = dlc.height;
mode.refresh_rate = 0;
mode.driverdata = NULL;
SDL_DFB_ALLOC_CLEAR(dispdata, sizeof(*dispdata));
dispdata->layer = layer;
dispdata->pixelformat = dlc.pixelformat;
dispdata->cw = tcw[i];
dispdata->ch = tch[i];
/* YUV - Video layer */
dispdata->vidID = screencbdata->vidlayer[i];
dispdata->vidIDinuse = 0;
SDL_zero(display);
//.........这里部分代码省略.........
示例5: 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;
}
示例6: 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;
}
示例7: 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 );
//.........这里部分代码省略.........