12 IDirectFB *dfb = NULL;
13 IDirectFBSurface *primary = NULL;
15 int screen_height = 0;
17 #define DFBCHECK(x...) \
21 fprintf(stderr,"file: %s , line: %d !\n\t",__FILE__,__LINE__); \
22 DirectFBErrorFatal( #x, err ); \
26 IDirectFBSurface *logo = NULL;
27 IDirectFBFont *font = NULL;
28 char *text = "directfb photoshow (written by hackbard 2003)";
30 int main(int argc,char **argv) {
32 DFBSurfaceDescription dsc;
33 DFBFontDescription font_dsc;
34 IDirectFBImageProvider *img_prov;
36 DFBCHECK(DirectFBInit (&argc, &argv));
38 DFBCHECK(DirectFBCreate(&dfb));
39 DFBCHECK(dfb->SetCooperativeLevel(dfb,DFSCL_FULLSCREEN));
41 dsc.flags=DSDESC_CAPS;
42 dsc.caps=DSCAPS_PRIMARY|DSCAPS_FLIPPING;
43 DFBCHECK(dfb->CreateSurface(dfb,&dsc,&primary));
45 font_dsc.flags = DFDESC_HEIGHT;
47 DFBCHECK(dfb->CreateFont(dfb,"./decker.ttf",&font_dsc,&font));
48 DFBCHECK(primary->SetFont(primary,font));
50 DFBCHECK(primary->GetSize(primary,&screen_width,&screen_height));
51 fprintf(stdout,"dimensions: %dx%d\n",screen_width,screen_height);
54 DFBCHECK(primary->SetColor(primary,0x00,0x00,0x00,0x00));
55 DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height));
56 DFBCHECK(primary->SetColor(primary,0x80,0x80,0xff,0xff));
57 DFBCHECK(primary->DrawString(primary,text,-1,5,screen_height/2,DSTF_LEFT));
58 DFBCHECK(primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC));
63 DFBCHECK(dfb->CreateImageProvider(dfb,argv[i],&img_prov));
64 DFBCHECK(img_prov->GetSurfaceDescription(img_prov,&dsc));
65 DFBCHECK(dfb->CreateSurface(dfb,&dsc,&logo ));
66 DFBCHECK(img_prov->RenderTo(img_prov,logo,NULL));
67 img_prov->Release(img_prov);
68 DFBCHECK (primary->SetColor(primary,0x00,0x00,0x00,0x00));
69 DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height));
70 DFBCHECK(primary->SetColor(primary,0x80,0x80,0xff,0xff));
71 DFBCHECK(primary->DrawLine(primary,0,0,screen_width-1,screen_height-1));
72 if((screen_width>=dsc.width)&&(screen_height>=dsc.height)) {
73 DFBCHECK(primary->Blit(primary,logo,NULL,(screen_width-dsc.width)/2,(screen_height-dsc.height)/2));
76 DFBCHECK(primary->StretchBlit(primary,logo,NULL,NULL));
78 DFBCHECK(primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC));
83 primary->Release(logo);
84 primary->Release(primary);