2 * dfb_api.c - api to dfb interface
15 static IDirectFB *dfb = NULL;
17 static IDirectFBSurface *primary = NULL;
18 static int screen_width = 0;
19 static int screen_height = 0;
20 static IDirectFBSurface *logo = NULL;
22 char dfb_image[]="./images/ivac_logo.png";
24 int main (int argc, char **argv) {
26 DFBSurfaceDescription dsc;
28 IDirectFBImageProvider *provider;
31 DirectFBInit (&argc, &argv);
32 DirectFBCreate (&dfb);
33 dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN);
34 dsc.flags=DSDESC_CAPS;
35 dsc.caps=DSCAPS_PRIMARY | DSCAPS_FLIPPING;
36 dfb->CreateSurface(dfb,&dsc,&primary);
37 primary->GetSize(primary,&screen_width,&screen_height);
38 printf("debug: w/h = %d / %d\n",screen_width,screen_height);
40 /* create the imag provider */
41 dfb->CreateImageProvider(dfb,dfb_image,&provider);
42 /* get image/provider description */
43 provider->GetSurfaceDescription(provider,&dsc);
44 printf("debug: w/h %d / %d\n",dsc.width,dsc.height);
45 /* create apropriate surface */
46 dfb->CreateSurface(dfb,&dsc,&logo);
48 provider->RenderTo(provider,logo,NULL);
50 provider->Release(provider);
53 for(i = -dsc.width; i < screen_width; i++) {
55 primary->FillRectangle(primary,0,0,screen_width,screen_height);
58 primary->Blit(primary,logo,NULL,i,(screen_height-dsc.height)/2);
61 primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC);
67 primary->Release(primary);