Hi!

I got the directfb image
example<http://directfb.org/docs/DirectFB_Tutorials/image.html>,
and I'm trying to blit an image, as stated
here<http://mail.directfb.org/pipermail/directfb-dev/2009-October/005299.html>.
So, this is my code:

#include <stdio.h>
#include <unistd.h>

#include <directfb.h>

static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width = 0;
static int screen_height = 0;
#define DFBCHECK(x...)                                         \
  {                                                            \
    DFBResult err = x;                                         \
                                                               \
    if (err != DFB_OK)                                         \
      {                                                        \
        fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
        DirectFBErrorFatal( #x, err );                         \
      }                                                        \
  }

/* reflection against y */
static int DFB_FIXED_POINT_ONE = 1;
static const s32 mat_y[9] = {
 -DFB_FIXED_POINT_ONE, 0,                   0,
  0,                   DFB_FIXED_POINT_ONE, 0,
  0,                   0,                   DFB_FIXED_POINT_ONE
};

static IDirectFBSurface *logo = NULL;
int main(int argc, char **argv) {
    int i;

    DFBSurfaceDescription dsc;
    IDirectFBImageProvider *provider;
    DFBCHECK(DirectFBInit (&argc, &argv));
    DFBCHECK(DirectFBCreate (&dfb));
    DFBCHECK(dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
    dsc.flags = DSDESC_CAPS;
    dsc.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY | DSCAPS_FLIPPING);
    DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
    DFBCHECK(primary->GetSize (primary, &screen_width, &screen_height));
    DFBCHECK(dfb->CreateImageProvider (dfb, "iconC.png", &provider));
    DFBCHECK(provider->GetSurfaceDescription (provider, &dsc));
    DFBCHECK(dfb->CreateSurface( dfb, &dsc, &logo ));
    DFBCHECK(provider->RenderTo (provider, logo, NULL));
    provider->Release(provider);
    for (i = -dsc.width; i < screen_width; i++) {

        DFBCHECK(primary->SetRenderOptions(primary, DSRO_MATRIX));
        DFBCHECK(primary->SetMatrix(primary, mat_y));

        DFBCHECK(primary->FillRectangle (primary, 0, 0, screen_width,
screen_height));
        DFBCHECK(primary->Blit (primary, logo, NULL, i, (screen_height
- dsc.height) / 2));
        DFBCHECK(primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
        usleep(1000*10); // 10 microseconds
    }
    logo->Release(logo);
    primary->Release(primary);
    dfb->Release(dfb);
    return 23;
}

I'm using DirectFB 1.4.11. The output of this program is a lot of:

`(!!!)  *** WARNING [rotation not yet implemented] *** [gfxcard.c:2075
in dfb_gfxcard_blit()]`
`(!!!)  *** WARNING [rotation not yet implemented] *** [gfxcard.c:2075
in dfb_gfxcard_blit()]`
`(!!!)  *** WARNING [rotation not yet implemented] *** [gfxcard.c:2075
in dfb_gfxcard_blit()]`

Is this a problem of my DFB version? Is there a way to make this example
run and blit the image?

*(by the way, I didn't understand the DFB_FIXED_POINT_ONE variable, so I
give any value to it to try)*



*Wellington B. de Carvalho***
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to