LiTE Code Snippets

From DirectFBWiki


Various examples of LiTE code that are either useful or shows a specific technique.

Fill LiteBox with a Specific Color

static DFBResult FillBox(LiteBox *box, DFBColor *color)
{
    DFBResult res = DFB_OK;
    IDirectFBSurface *s = box->surface;

    res = s->SetColor(s, color->r, color->g, color->b, color->a);
    res = s->FillRectangle(s, box->rect.x, box->rect.y, box->rect.w, box->rect.h);
    res = s->Flip(s, NULL, 0);
    
    return res;
}

Note that this will immediately call Flip and thus force the update. In case you want to collect all changes, do not call Flip at this instance. It's generally better to put code like this into your Draw callback for a LiTEBox and wait until it's called by a window update.