本文整理汇总了C++中IDirectFBWindow::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBWindow::SetColor方法的具体用法?C++ IDirectFBWindow::SetColor怎么用?C++ IDirectFBWindow::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBWindow
的用法示例。
在下文中一共展示了IDirectFBWindow::SetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}