+int get_primary_surface_size(void) {
+ get_surface_size(primary,&screen_width,&screen_height);
+ return 1;
+}
+
+int create_logo_surface(void) {
+ DFBSurfaceDescription desc;
+ DFBImageDescription image_desc;
+ dfb->CreateImageProvider(dfb,dfb_image,&image_provider);
+ image_provider->GetSurfaceDescription(image_provider,&desc);
+ image_provider->GetImageDescription(image_provider,&image_desc);
+ printf("image description: caps=%x red=%hhd green=%hhd blue=%hhd\n",image_desc.caps,
+ image_desc.colorkey_r,
+ image_desc.colorkey_g,
+ image_desc.colorkey_b);
+ dfb->CreateSurface(dfb,&desc,&logo);
+ image_provider->RenderTo(image_provider,logo,NULL);
+ image_provider->Release(image_provider);
+ return 1;
+}
+
+int create_video_surface(void) {
+ DFBSurfaceDescription desc;
+ DFBVideoProviderCapabilities caps;
+ dfb->CreateVideoProvider(dfb,dfb_video_dev,&video_provider);
+ video_provider->GetSurfaceDescription(video_provider,&desc);
+ video_provider->GetCapabilities(video_provider,&caps);
+ printf("video capabilities: %x\n",caps);
+ dfb->CreateSurface(dfb,&desc,&video);
+ video_provider->PlayTo(video_provider,video,NULL,NULL,NULL);
+ video_provider->Release(video_provider);
+ return 1;
+}
+
+int clear_screen(IDirectFBSurface *surface) {
+ surface->FillRectangle(surface,0,0,screen_width,screen_height);
+ return 1;
+}
+
+int release_surface(IDirectFBSurface *surface) {
+ surface->Release(surface);
+ return 1;
+}
+
+int release_dfb(void) {
+ dfb->Release(dfb);
+ return 1;
+}
+
+
+/* test api app */
+int main (int argc, char **argv) {
+
+ dfb_init(&argc,argv);
+
+ check_accel();
+
+ create_primary_surface();
+ printf("primary surface created\n");
+
+ // create_video_surface();
+ create_logo_surface();
+
+ get_primary_surface_size();
+
+ clear_screen(primary);
+
+ // primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC);
+
+ sleep(5);
+
+ release_surface(primary);
+
+ return 1;
+}