本文整理汇总了C++中IDirectFBWindow类的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBWindow类的具体用法?C++ IDirectFBWindow怎么用?C++ IDirectFBWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDirectFBWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DirectFB_WM_GetClientSize
DFBResult
DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch)
{
SDL_DFB_WINDOWDATA(window);
IDirectFBWindow *dfbwin = windata->dfbwin;
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, cw, ch));
dfbwin->GetSize(dfbwin, cw, ch);
*cw -= windata->theme.left_size + windata->theme.right_size;
*ch -=
windata->theme.top_size + windata->theme.caption_size +
windata->theme.bottom_size;
return DFB_OK;
}
示例2: QWindowSurface
QT_BEGIN_NAMESPACE
QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window)
: QWindowSurface(window), m_pixmap(0), m_pmdata(0)
{
IDirectFBWindow *dfbWindow = static_cast<QDirectFbWindow *>(window->platformWindow())->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: lite_set_window_cursor
DFBResult
lite_set_window_cursor(LiteWindow *window, LiteCursor *cursor)
{
DFBResult res = DFB_OK;
LITE_NULL_PARAMETER_CHECK(window);
LITE_NULL_PARAMETER_CHECK(cursor);
D_DEBUG_AT(LiteCursorDomain, "Set cursor: %p for window: %p\n",
cursor, window);
IDirectFBWindow *win = window->window;
if (cursor->surface) {
res = win->SetCursorShape(win, cursor->surface, cursor->hot_x, cursor->hot_y);
}
return res;
}
示例4: Test_MoveWindow
static DFBResult
Test_MoveWindow( IDirectFBDisplayLayer *layer, void *arg )
{
int i;
DFBPoint pos;
IDirectFBWindow *window;
D_ASSERT( m_toplevel_id != 0 );
/*
* Get the top level window
*/
_T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
window->GetPosition( window, &pos.x, &pos.y );
/*
* Move the window
*/
{
DFBPoint poss[] = { { pos.x - 40, pos.y - 40 },
{ pos.x + 40, pos.y - 40 },
{ pos.x + 40, pos.y + 40 },
{ pos.x - 40, pos.y + 40 },
{ pos.x , pos.y }
};
for (i=0; i<D_ARRAY_SIZE(poss); i++) {
SHOW_TEST( "MoveTo( %4d,%4d - [%02d] )...", poss[i].x, poss[i].y, i );
_T( window->MoveTo( window, poss[i].x, poss[i].y ) );
SHOW_RESULT( "...MoveTo( %4d,%4d - [%02d] ) done.", poss[i].x, poss[i].y, i );
}
}
window->Release( window );
return DFB_OK;
}
示例5: Test_ScaleWindow
static DFBResult
Test_ScaleWindow( IDirectFBDisplayLayer *layer, void *arg )
{
int i;
IDirectFBWindow *window;
DFBWindowOptions opts;
DFBDimension size;
D_ASSERT( m_toplevel_id != 0 );
/*
* Get the top level window
*/
_T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
window->GetSize( window, &size.w, &size.h );
/*
* Enable scaling
*/
_T( window->GetOptions( window, &opts ) );
_T( window->SetOptions( window, opts | DWOP_SCALE ) );
/*
* Scale the window
*/
{
DFBDimension sizes[] = { { size.w + 40, size.h },
{ size.w + 40, size.h + 40 },
{ size.w, size.h + 40 },
{ size.w + 40, size.h - 40 },
{ size.w - 40, size.h + 40 },
{ size.w, size.h }
};
for (i=0; i<D_ARRAY_SIZE(sizes); i++) {
SHOW_TEST( "Resize( %4d,%4d - [%02d] )...", sizes[i].w, sizes[i].h, i );
_T( window->Resize( window, sizes[i].w, sizes[i].h ) );
SHOW_RESULT( "...Resize( %4d,%4d - [%02d] ) done.", sizes[i].w, sizes[i].h, i );
}
}
/*
* Restore options
*/
_T( window->SetOptions( window, opts ) );
window->Release( window );
return DFB_OK;
}
示例6: Test_RestackWindow
static DFBResult
Test_RestackWindow( IDirectFBDisplayLayer *layer, void *arg )
{
int i;
IDirectFBWindow *window;
D_ASSERT( m_toplevel_id != 0 );
/*
* Get the top level window
*/
_T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
/*
* Lower it a few times
*/
for (i=0; i<2; i++) {
SHOW_TEST( "Lower() #%d...", i+1 );
_T( window->Lower( window ) );
SHOW_RESULT( "...Lower() #%d done.", i+1 );
}
/*
* Raise it a few times
*/
for (i=0; i<2; i++) {
SHOW_TEST( "Raise() #%d...", i+1 );
_T( window->Raise( window ) );
SHOW_RESULT( "...Raise() #%d done.", i+1 );
}
/*
* Lower it to the bottom
*/
SHOW_TEST( "LowerToBottom()..." );
_T( window->LowerToBottom( window ) );
SHOW_RESULT( "...LowerToBottom() done." );
/*
* Raise it to the top
*/
SHOW_TEST( "RaiseToTop()..." );
_T( window->RaiseToTop( window ) );
SHOW_RESULT( "...RaiseToTop() done." );
window->Release( window );
return DFB_OK;
}
示例7: memcpy
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;
}
}
示例8: directfb_init_device
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;
}
示例9: 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 );
//.........这里部分代码省略.........
示例10: DirectFB_RenderCopy
static int
DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect)
{
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
IDirectFBSurface *destsurf = data->target;
DirectFB_TextureData *texturedata =
(DirectFB_TextureData *) texture->driverdata;
Uint8 alpha, r, g, b;
DFBRegion clip_region;
DFBRectangle sr, dr;
DirectFB_ActivateRenderer(renderer);
SDLtoDFBRect(srcrect, &sr);
SDLtoDFBRect_Float(dstrect, &dr);
destsurf->GetClip(destsurf, &clip_region);
dr.x += clip_region.x1;
dr.y += clip_region.y1;
if (texturedata->display) {
int px, py;
SDL_Window *window = renderer->window;
IDirectFBWindow *dfbwin = get_dfb_window(window);
SDL_DFB_WINDOWDATA(window);
SDL_VideoDisplay *display = texturedata->display;
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetSourceRectangle(dispdata->vidlayer,
sr.x, sr.y, sr.w, sr.h));
dfbwin->GetPosition(dfbwin, &px, &py);
px += windata->client.x;
py += windata->client.y;
SDL_DFB_CHECKERR(dispdata->
vidlayer->SetScreenRectangle(dispdata->vidlayer,
px + dr.x,
py + dr.y,
dr.w,
dr.h));
} else {
DFBSurfaceBlittingFlags flags = 0;
#if 0
if (texturedata->dirty.list) {
SDL_DirtyRect *dirty;
void *pixels;
int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
int pitch = texturedata->pitch;
for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
SDL_Rect *rect = &dirty->rect;
pixels =
(void *) ((Uint8 *) texturedata->pixels +
rect->y * pitch + rect->x * bpp);
DirectFB_UpdateTexture(renderer, texture, rect,
pixels,
texturedata->pitch);
}
SDL_ClearDirtyRects(&texturedata->dirty);
}
#endif
if (texturedata->isDirty)
{
SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = texture->w;
rect.h = texture->h;
DirectFB_UpdateTexture(renderer, texture, &rect, texturedata->pixels, texturedata->pitch);
}
alpha = r = g = b = 0xff;
if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA){
alpha = texture->a;
flags |= DSBLIT_BLEND_COLORALPHA;
}
if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
r = texture->r;
g = texture->g;
b = texture->b;
flags |= DSBLIT_COLORIZE;
}
SDL_DFB_CHECKERR(destsurf->
SetColor(destsurf, r, g, b, alpha));
/* ???? flags |= DSBLIT_SRC_PREMULTCOLOR; */
SetBlendMode(data, texture->blendMode, texturedata);
SDL_DFB_CHECKERR(destsurf->SetBlittingFlags(destsurf,
data->blitFlags | flags));
#if (DFB_VERSION_ATLEAST(1,2,0))
SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
texturedata->
//.........这里部分代码省略.........
示例11: main
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;
}
示例12: DirectFB_WM_ProcessEvent
int
DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
IDirectFBWindow *dfbwin = windata->dfbwin;
DFBWindowOptions wopts;
if (!windata->is_managed)
return 0;
SDL_DFB_CHECK(dfbwin->GetOptions(dfbwin, &wopts));
switch (evt->type) {
case DWET_BUTTONDOWN:
if (evt->buttons & DIBM_LEFT) {
int pos = WMPos(windata, evt->x, evt->y);
switch (pos) {
case WM_POS_NONE:
return 0;
case WM_POS_CLOSE:
windata->wm_grab = WM_POS_NONE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0,
0);
return 1;
case WM_POS_MAX:
windata->wm_grab = WM_POS_NONE;
if (window->flags & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(window);
} else {
SDL_MaximizeWindow(window);
}
return 1;
case WM_POS_CAPTION:
if (!(wopts & DWOP_KEEP_STACKING)) {
DirectFB_RaiseWindow(_this, window);
}
if (window->flags & SDL_WINDOW_MAXIMIZED)
return 1;
/* fall through */
default:
windata->wm_grab = pos;
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
SDL_DFB_CHECK(dfbwin->GrabPointer(dfbwin));
windata->wm_lastx = evt->cx;
windata->wm_lasty = evt->cy;
}
}
return 1;
case DWET_BUTTONUP:
if (!windata->wm_grab)
return 0;
if (!(evt->buttons & DIBM_LEFT)) {
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;
if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;
if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
dx = 0;
else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
dy = 0;
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
/* necessary to trigger an event - ugly */
SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx + 1, ch + dy));
SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
}
}
SDL_DFB_CHECK(dfbwin->UngrabPointer(dfbwin));
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->dfbwin->GrabPointer(gwindata->dfbwin));
windata->wm_grab = WM_POS_NONE;
return 1;
}
break;
case DWET_MOTION:
if (!windata->wm_grab)
return 0;
if (evt->buttons & DIBM_LEFT) {
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;
if (windata->wm_grab & WM_POS_CAPTION) {
if (!(wopts & DWOP_KEEP_POSITION))
SDL_DFB_CHECK(dfbwin->Move(dfbwin, dx, dy));
}
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;
/* Make sure all events are disabled for this operation ! */
SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
//.........这里部分代码省略.........
示例13: directfb_init_device
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;
}
示例14: Test_CreateSubWindow
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;
}
示例15: 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;
}