本文整理汇总了C++中IDirectFBSurface::SetSrcColorKey方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBSurface::SetSrcColorKey方法的具体用法?C++ IDirectFBSurface::SetSrcColorKey怎么用?C++ IDirectFBSurface::SetSrcColorKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBSurface
的用法示例。
在下文中一共展示了IDirectFBSurface::SetSrcColorKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp)
{
DFBRectangle src;
DFBResult err;
IDirectFBSurface *surf;
DFBSurfaceDescription dsc;
src.x = xp;
src.y = yp;
src.w = width - xp;
src.h = height - yp;
dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED);
dsc.caps = DSCAPS_NONE;
dsc.width = width;
dsc.height = height;
dsc.preallocated[0].data = fbbuff;
dsc.preallocated[0].pitch = width * sizeof(fb_pixel_t);
err = dfb->CreateSurface(dfb, &dsc, &surf);
/* TODO: maybe we should not die if this fails? */
if (err != DFB_OK) {
fprintf(stderr, "CFbAccel::blit2FB: ");
DirectFBErrorFatal("dfb->CreateSurface(dfb, &dsc, &surf)", err);
}
if (transp)
{
surf->SetSrcColorKey(surf, 0, 0, 0);
dfbdest->SetBlittingFlags(dfbdest, DSBLIT_SRC_COLORKEY);
}
else
dfbdest->SetBlittingFlags(dfbdest, DSBLIT_BLEND_ALPHACHANNEL);
dfbdest->Blit(dfbdest, surf, &src, xoff, yoff);
surf->Release(surf);
return;
}
示例2: CreateWindow
//---------------------------------------------------------------------------------
//--------------------------wael work----------------------
//---------------------------------------------------------------------------------
status_t ServerWindow::CreateWindow (IDirectFBDisplayLayer *layer){
DFBFontDescription font_dsc;
DFBWindowDescription wdsc;
IDirectFBSurface *wsurface = NULL;
DFBSurfaceDescription dsc;
// char *title;TODO: I need to convert the fTitle from BString to char *
char title[fTitle.CountChars()+1];
fTitle.CopyInto(title, 0, fTitle.CountChars());
DFBRectangle frame;
frame.x=(int)fFrame.LeftTop().x;
frame.y=(int)fFrame.LeftTop().y;
frame.w=(int)fFrame.IntegerWidth();
frame.h=(int)fFrame.IntegerHeight();
int width1, width2, width3;
int height1, height2, height3;
//create window inside the primary layer
wdsc.flags = (DFBWindowDescriptionFlags)(DWDESC_CAPS | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_SURFACE_CAPS);
wdsc.caps = DWCAPS_ALPHACHANNEL;
wdsc.width = frame.w;
wdsc.height = frame.h;
wdsc.posx = frame.x;
wdsc.posy = frame.y;
wdsc.surface_caps = DSCAPS_FLIPPING;
DFBCHECK(layer->CreateWindow(layer, &wdsc, &window));
//Get the window surface and clear it
DFBCHECK(window->GetSurface(window, &wsurface));
DFBCHECK(wsurface->Clear (wsurface, 0x00, 0x00, 0x00, 0x00));
DFBCHECK(window->SetOpaqueRegion (window, 0, 0, frame.h, frame.w));
//Set the window options to be transparent
DFBWindowOptions options;
window->GetOptions (window, &options);
options = (DFBWindowOptions) ( options | DWOP_SHAPED );
DFBCHECK(window->SetOptions (window, options));
wsurface->SetSrcColorKey(wsurface, R, G, B);
wsurface->SetBlittingFlags(wsurface, DSBLIT_SRC_COLORKEY);
if (fType==B_FLOATING_WINDOW){
DFBCHECK (shead->GetSize(shead, &width1, &height1));
DFBCHECK (sok_button->GetSize(sok_button, &width2, &height2));
DFBCHECK (sclose_button->GetSize(sclose_button, &width3, &height3));
DFBRectangle rect;
rect.x = 0;
rect.y = 0;
rect.h = height1;
rect.w = frame.w-width2-width3;
DFBCHECK (wsurface->StretchBlit (wsurface, shead, NULL, &rect));
DFBCHECK (wsurface->Blit (wsurface, sok_button, NULL, rect.w, 0));
DFBCHECK (wsurface->Blit (wsurface, sclose_button, NULL, rect.w+width2, 0));
// Draw the window title
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 10;
font_dsc.width = 10;
DFBCHECK (app_server->dfb->CreateFont (app_server->dfb, "./decker.ttf", &font_dsc, &font));
DFBCHECK (wsurface->SetFont (wsurface, font));
DFBCHECK (wsurface->SetColor (wsurface, 0xff, 0x0, 0x0, 0xFF));
int size = 0;
DFBRectangle rect1;
DFBCHECK (font->GetStringExtents (font, title, -1, NULL, &rect1));
if (rect1.w > rect.w){
do{
size++;
DFBCHECK (font->GetStringExtents (font, title, size, NULL, &rect1));
}while (rect1.w < rect.w);
size--;
}
DFBCHECK (wsurface->DrawString (wsurface, title, size-1, 5, 2*height1/3, DSTF_LEFT));
rect.x = 0;
rect.y = height1;
rect.w = frame.w;
rect.h = frame.h-height1;
DFBCHECK (wsurface->StretchBlit (wsurface, body, NULL, &rect));
}
else if (fType==B_TITLED_WINDOW){
DFBCHECK (head->GetSize(head, &width1, &height1));
DFBCHECK (ok_button->GetSize(ok_button, &width2, &height2));
DFBCHECK (close_button->GetSize(close_button, &width3, &height3));
DFBRectangle rect;
rect.x = 0;
rect.y = 0;
rect.h = height1;
rect.w = frame.w-width2-width3;
DFBCHECK (wsurface->StretchBlit (wsurface, head, NULL, &rect));
DFBCHECK (wsurface->Blit (wsurface, ok_button, NULL, rect.w, 0));
DFBCHECK (wsurface->Blit (wsurface, close_button, NULL, rect.w+width2, 0));
// Draw the window title
//.........这里部分代码省略.........