本文整理汇总了C++中IDirectFBWindow::GetSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBWindow::GetSurface方法的具体用法?C++ IDirectFBWindow::GetSurface怎么用?C++ IDirectFBWindow::GetSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBWindow
的用法示例。
在下文中一共展示了IDirectFBWindow::GetSurface方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static struct graphics_device *
directfb_init_device (void)
{
struct graphics_device *gd;
DFBDeviceData *data;
IDirectFBWindow *window;
DFBWindowDescription desc;
desc.flags = (DFBWindowDescriptionFlags)(DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY);
desc.width = directfb_driver.x;
desc.height = directfb_driver.y;
desc.posx = 0;
desc.posy = 0;
retry:
if (layer->CreateWindow (layer, &desc, &window) != DFB_OK) {
if (out_of_memory(MF_GPI, NULL, 0))
goto retry;
return NULL;
}
gd = mem_alloc (sizeof (struct graphics_device));
gd->size.x1 = 0;
gd->size.y1 = 0;
window->GetSize (window, &gd->size.x2, &gd->size.y2);
gd->clip = gd->size;
data = mem_alloc (sizeof (DFBDeviceData));
data->window = window;
data->flip_pending = 0;
if (arrow)
window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);
window->GetSurface (window, &data->surface);
window->GetID (window, &data->id);
gd->driver_data = data;
gd->user_data = NULL;
directfb_add_to_table (gd);
window->AttachEventBuffer (window, events);
window->SetOpacity (window, FOCUSED_OPACITY);
return gd;
}
示例2: QPlatformBackingStore
QT_BEGIN_NAMESPACE
QDirectFbBackingStore::QDirectFbBackingStore(QWindow *window)
: QPlatformBackingStore(window), m_pixmap(0), m_pmdata(0)
{
IDirectFBWindow *dfbWindow = static_cast<QDirectFbWindow *>(window->handle())->dfbWindow();
dfbWindow->GetSurface(dfbWindow, m_dfbSurface.outPtr());
//WRONGSIZE
QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface.data());
m_pmdata = new QDirectFbBlitterPlatformPixmap;
m_pmdata->setBlittable(blitter);
m_pixmap.reset(new QPixmap(m_pmdata));
}
示例3: setPermanentState
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
const char *ptr = state.constData();
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
SurfaceFlags flags;
memcpy(&flags, ptr, sizeof(SurfaceFlags));
setSurfaceFlags(flags);
ptr += sizeof(SurfaceFlags);
DFBWindowID id;
memcpy(&id, ptr, sizeof(DFBWindowID));
if (dfbSurface)
dfbSurface->Release(dfbSurface);
if (id != (DFBWindowID)-1) {
IDirectFBWindow *dw;
layer->GetWindow(layer, id, &dw);
if (dw->GetSurface(dw, &dfbSurface) != DFB_OK)
dfbSurface = 0;
dw->Release(dw);
}
else {
dfbSurface = 0;
}
}
示例4: 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;
}
示例5: SetColor
static DFBResult
Test_CreateSubWindow( IDirectFBDisplayLayer *layer, void *arg )
{
IDirectFBWindow *window;
DFBWindowID window_id;
DFBDimension size = { m_desc_sub.width, m_desc_sub.height };
D_ASSERT( m_toplevel_id != 0 );
/* Write window ID of top level into description */
m_desc_sub.toplevel_id = m_toplevel_id;
/*
* Create a new sub window with 75% width/height and positioned at 20,20 within top level window
*/
SHOW_TEST( "CreateWindow( %d,%d - %dx%d %s + toplevel ID %u, options 0x%08x )...",
m_desc_sub.posx, m_desc_sub.posy, m_desc_sub.width, m_desc_sub.height,
dfb_pixelformat_name( m_desc_sub.pixelformat ), m_desc_sub.toplevel_id, m_desc_top.options );
_T( layer->CreateWindow( layer, &m_desc_sub, &window ) );
if (m_subcolor.valid) {
DFBColor c = m_subcolor.color;
SHOW_INFO( " - SetColor( 0x%02x, 0x%02x, 0x%02x, 0x%02x )...", c.r, c.g, c.b, c.a );
_T( window->SetColor( window, c.r, c.g, c.b, c.a ) );
}
/*
* Query its surface and clear it with light gray (if not input or color only)
*/
if (!(m_desc_sub.caps & (DWCAPS_INPUTONLY | DWCAPS_COLOR) )) {
IDirectFBSurface *surface;
SHOW_INFO( " - GetSurface()..." );
_T( window->GetSurface( window, &surface ) );
SHOW_INFO( " - Clear( 0xC0, 0xC0, 0xC0, 0xFF )..." );
_T( surface->Clear( surface, 0xC0, 0xC0, 0xC0, 0xFF ) );
_T( surface->DrawRectangle( surface, 0, 0, size.w, size.h ) );
_T( surface->FillRectangle( surface, size.w / 2, 1, 1, size.h - 2 ) );
_T( surface->FillRectangle( surface, 1, size.h / 2, size.w - 2, 1 ) );
surface->Release( surface );
}
/*
* Show the window
*/
SHOW_INFO( " - SetOpacity( 255 )..." );
_T( window->SetOpacity( window, 0xff ) );
/*
* Query and print ID of new window
*/
SHOW_INFO( " - GetID()..." );
_T( window->GetID( window, &window_id ) );
/*
* Set association of new window
*/
if (m_desc_sub.parent_id) {
SHOW_INFO( " - SetAssociation( %u )...", m_desc_sub.parent_id );
_T( window->SetAssociation( window, m_desc_sub.parent_id ) );
}
/*
* Set top level window ID (user hasn't specified one)
*/
m_subwindow_id = window_id;
m_subwindow = window;
SHOW_RESULT( "...CreateWindow( %d,%d - %dx%d %s + toplevel ID %u ) done. => Sub Window ID %u",
m_desc_sub.posx, m_desc_sub.posy, m_desc_sub.width, m_desc_sub.height,
dfb_pixelformat_name( m_desc_sub.pixelformat ), m_desc_sub.toplevel_id, window_id );
return DFB_OK;
}
示例6: CreateInputBuffer
static void
TestResize( IDirectFB *dfb )
{
DFBResult ret;
DirectThread *thread;
DFBWindowDescription desc;
IDirectFBDisplayLayer *layer;
IDirectFBWindow *window;
IDirectFBSurface *surface;
DFBInputEvent evt;
IDirectFBEventBuffer *keybuffer;
quit = 0;
/* Create an input buffer for key events */
ret = dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS,
DFB_FALSE, &keybuffer);
if (ret) {
D_DERROR( ret, "DFBTest/Resize: CreateInputBuffer() failed!\n" );
return;
}
ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: Failed to get display layer!\n" );
keybuffer->Release( keybuffer );
return;
}
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT;
desc.width = 500;
desc.height = 500;
desc.pixelformat = DSPF_ARGB;
ret = layer->CreateWindow( layer, &desc, &window );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: CreateWindow() failed!\n" );
keybuffer->Release( keybuffer );
layer->Release( layer );
return;
}
ret = window->GetSurface( window, &surface );
if (ret) {
D_DERROR( ret, "DFBTest/Resize: GetSurface() failed!\n" );
keybuffer->Release( keybuffer );
window->Release( window );
layer->Release( layer );
return;
}
thread = direct_thread_create( DTT_DEFAULT, TestThread, surface, "Test" );
while (!quit) {
ret = window->Resize( window, 500, 400 );
if (ret)
D_DERROR( ret, "DFBTest/Resize: Resize() failed!\n" );
ret = window->Resize( window, 500, 500 );
if (ret)
D_DERROR( ret, "DFBTest/Resize: Resize() failed!\n" );
/* Process keybuffer */
while (keybuffer->GetEvent( keybuffer, DFB_EVENT(&evt)) == DFB_OK)
{
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;
direct_thread_join(thread);
break;
default:
break;
}
}
}
}
keybuffer->Release( keybuffer );
surface->Release( surface );
window->Release( window );
layer->Release( layer );
}
示例7: DFBCHECK
int
main( int argc, char *argv[] )
{
DFBResult ret;
int i;
int quit = 0;
const int num = 2;
Context contexts[num];
DFBCHECK(DirectFBInit( &argc, &argv ));
/* create the super interface */
DFBCHECK(DirectFBCreate( &dfb ));
DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
/* create the default font */
DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
for (i=0; i<num; i++) {
IDirectFBWindow *window;
IDirectFBSurface *surface;
IDirectFBGL *gl;
DFBWindowDescription desc;
desc.flags = DWDESC_POSX | DWDESC_POSY |
DWDESC_WIDTH | DWDESC_HEIGHT;
desc.posx = (i%3) * 200 + 10;
desc.posy = (i/3) * 200 + 10;
desc.width = 180;
desc.height = 180;
DFBCHECK(layer->CreateWindow( layer, &desc, &window ));
DFBCHECK(window->GetSurface( window, &surface ));
DFBCHECK(surface->GetGL( surface, &gl ));
contexts[i].window = window;
contexts[i].surface = surface;
contexts[i].gl = gl;
contexts[i].last_time = get_millis();
contexts[i].frames = 0;
contexts[i].fps = 0;
setup( &contexts[i] );
if (events)
DFBCHECK(window->AttachEventBuffer( window, events ));
else
DFBCHECK(window->CreateEventBuffer( window, &events ));
DFBCHECK(surface->SetFont( surface, font ));
window->SetOpacity( window, 0xff );
}
while (!quit) {
DFBWindowEvent evt;
for (i=0; i<num; i++)
update( &contexts[i] );
while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
switch (evt.type) {
case DWET_KEYDOWN:
switch (evt.key_symbol) {
case DIKS_ESCAPE:
quit = 1;
break;
default:
break;
}
break;
default:
break;
}
}
}
events->Release( events );
for (i=0; i<num; i++) {
contexts[i].gl->Release( contexts[i].gl );
contexts[i].surface->Release( contexts[i].surface );
contexts[i].window->Release( contexts[i].window );
}
font->Release( font );
layer->Release( layer );
dfb->Release( dfb );
return 0;
}
示例8: app_init
static DFBResult
app_init( App *app,
IDirectFBDisplayLayer *layer,
int x,
int y,
int width,
int height,
int index )
{
DFBResult ret;
DFBWindowDescription desc;
IDirectFBWindow *window;
IDirectFBSurface *surface;
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_CAPS;
desc.width = width;
desc.height = height;
desc.posx = x;
desc.posy = y;
desc.caps = DWCAPS_NONE; //| DWCAPS_ALPHACHANNEL | DWCAPS_DOUBLEBUFFER;
/* Create a surface for the image. */
ret = layer->CreateWindow( layer, &desc, &window );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: IDirectFBDisplayLayer::CreateWindow() failed!\n" );
return ret;
}
/* Get the surface. */
ret = window->GetSurface( window, &surface );
if (ret) {
D_DERROR( ret, "DFBTest/WindowFlip: IDirectFBWindow::GetSurface() failed!\n" );
return ret;
}
surface->Clear( surface, 0xff, 0xff, 0xff, 0xff );
surface->Flip( surface, NULL, DSFLIP_NONE );
direct_thread_sleep( 2000000 );
D_INFO( "Showing window...\n" );
direct_thread_sleep( 500000 );
window->SetOpacity( window, 0xff );
direct_thread_sleep( 500000 );
D_INFO( "Done.\n" );
direct_thread_sleep( 1000000 );
app->window = window;
app->surface = surface;
app->index = index;
app->resolution.w = width;
app->resolution.h = height;
app->anim_dirx = 5;
app->anim_diry = 5;
app->anim_x = 0;
app->anim_y = 0;
return DFB_OK;
}
示例9:
static struct graphics_device *
directfb_init_device (void)
{
struct graphics_device *gd;
DFBDeviceData *data;
IDirectFBWindow *window;
DFBWindowDescription desc;
if (!dfb || !layer)
return NULL;
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
/*desc.width = directfb_driver.x;
desc.height = directfb_driver.y;
desc.posx = 0;
desc.posy = 0;*/
desc.width = (int)w;
desc.height = (int)h;
desc.posx = (int)x;
desc.posy = (int)y;
if (layer->CreateWindow (layer, &desc, &window) != DFB_OK)
return NULL;
gd = mem_alloc (sizeof (struct graphics_device));
gd->size.x1 = 0;
gd->size.y1 = 0;
window->GetSize (window, &gd->size.x2, &gd->size.y2);
gd->clip = gd->size;
data = mem_alloc (sizeof (DFBDeviceData));
data->window = window;
data->mapped = 0;
data->flip_pending = 0;
data->flipWindow = 0;
data->ghostWindow = 0;
if (arrow)
window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);
window->GetSurface (window, &data->surface);
window->GetID (window, &data->id);
gd->drv = &directfb_driver;
gd->driver_data = data;
gd->user_data = NULL;
directfb_add_to_table (gd);
if (!events)
{
window->CreateEventBuffer (window, &events);
event_timer = install_timer (20, directfb_check_events, events);
}
else
{
window->AttachEventBuffer (window, events);
}
return gd;
}