2 * dfb_api.c - api to dfb interface
12 #define MY_FONT_HEIGHT 18
17 static IDirectFB *dfb = NULL;
18 static IDirectFBSurface *primary = NULL;
19 static int screen_width = 0;
20 static int screen_height = 0;
22 static IDirectFBSurface *logo = NULL;
24 static IDirectFBFont *font = NULL;
25 static char *text_top="Internet Video / Audio Conferencing";
28 char dfb_image[]="./images/ivac_logo.png";
30 char dfb_font[]="./fonts/decker.ttf";
32 int main (int argc, char **argv) {
34 DFBFontDescription font_dsc;
35 DFBSurfaceDescription dsc;
37 IDirectFBImageProvider *provider;
40 DirectFBInit(&argc,&argv);
42 dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
43 dsc.flags=DSDESC_CAPS;
44 // dsc.caps=DSCAPS_PRIMARY | DSCAPS_FLIPPING;
45 dsc.caps=DSCAPS_PRIMARY;
46 dfb->CreateSurface(dfb,&dsc,&primary);
47 primary->GetSize(primary,&screen_width,&screen_height);
48 printf("debug: w/h = %d / %d\n",screen_width,screen_height);
50 /* create the imag provider */
51 dfb->CreateImageProvider(dfb,dfb_image,&provider);
52 /* get image/provider description */
53 provider->GetSurfaceDescription(provider,&dsc);
54 printf("debug: w/h %d / %d\n",dsc.width,dsc.height);
55 /* create apropriate surface */
56 dfb->CreateSurface(dfb,&dsc,&logo);
58 provider->RenderTo(provider,logo,NULL);
59 provider->Release(provider);
62 font_dsc.flags=DFDESC_HEIGHT;
63 font_dsc.height=MY_FONT_HEIGHT;
64 dfb->CreateFont(dfb,dfb_font,&font_dsc,&font);
67 primary->SetFont(primary,font);
68 font->GetStringWidth(font,text_top,-1,&font_width);
71 /* slide logo + write text_top */
72 for(i = -dsc.width; i < screen_width; i++) {
74 primary->FillRectangle(primary,0,0,screen_width,screen_height);
77 primary->SetColor(primary,0x0,0x0,0x0,0xff);
78 primary->DrawString(primary,text_top,-1,(screen_width/2)-(font_width/2),
79 screen_height/4,DSTF_LEFT);
82 primary->Blit(primary,logo,NULL,i,(screen_height-dsc.height)/2);
85 primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC);
94 primary->Release(primary);