Hello,<br><br>Anybody can help me with directfb backend ? In cairo-1.11.2 directfb backend works, but in the git version don't. I would like to know what i have to do. See the code below ... in this example a IDirectFBWindow was created and painted with directfb and cairo, but this last one doesn't work.<span class="HOEnZb"><font color="#888888">. </font></span><br clear="all">
<br>// g++ simple.cpp `pkg-config --cflags --libs directfb cairo`<br>// ----------------------------------------- simple.cpp ---------------------------------------------<br>#include <stdio.h><br>#include <unistd.h><br>
<br>#include <directfb.h><br>#include <cairo-directfb.h><br><br>static int screen_width = 0;<br>static int screen_height = 0;<br><br>int main (int argc, char **argv)<br>{<br> // init dfb<br> IDirectFB *dfb = NULL;<br>
IDirectFBDisplayLayer *layer = NULL;<br> DFBSurfaceDescription dsc;<br> DFBDisplayLayerConfig layer_dsc;<br> <br> DirectFBInit (&argc, &argv);<br> DirectFBCreate (&dfb);<br><br> dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);<br>
layer->SetCooperativeLevel (layer, DLSCL_ADMINISTRATIVE);<br><br> layer_dsc.flags = DLCONF_BUFFERMODE;<br> layer_dsc.buffermode = DLBM_BACKSYSTEM;<br> layer->SetConfiguration (layer, &layer_dsc);<br>
<br> // create window<br> IDirectFBWindow *window = NULL;<br> IDirectFBSurface *surface = NULL;<br> DFBWindowDescription desc;<br><br> desc.flags = (DFBWindowDescriptionFlags)(DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS | DWDESC_PIXELFORMAT);<br>
desc.caps = (DFBWindowCapabilities)(DSCAPS_NONE | DWCAPS_ALPHACHANNEL);<br> desc.pixelformat = DSPF_ARGB;<br> desc.posx = 0;<br> desc.posy = 0;<br> desc.width = 720;<br> desc.height = 480;<br><br> layer->CreateWindow (layer, &desc, &window);<br>
window->SetOpacity (window, 0xFF);<br> window->GetSurface (window, &surface);<br><br> // drawing<br> surface->SetColor (surface, 0x40, 0x60, 0x80, 0xff);<br> surface->FillRectangle (surface, 0, 0, screen_width, screen_height);<br>
surface->SetColor (surface, 0x80, 0x80, 0xff, 0xff);<br> surface->DrawLine (surface, 0, screen_height / 2, screen_width - 1, screen_height / 2); <br> surface->SetColor (surface, 0x00, 0x00, 0xff, 0xa0);<br> surface->FillRectangle (surface, 100, 100, 300, 300);<br>
surface->SetColor (surface, 0x80, 0x00, 0x00, 0xa0);<br> surface->FillRectangle (surface, 200, 200, 300, 300);<br> <br> surface->Flip (surface, NULL, (DFBSurfaceFlipFlags)0);<br> <br> cairo_surface_t *cairo_surface;<br>
cairo_t *cairo_context;<br> <br> cairo_surface = cairo_directfb_surface_create(dfb, surface);<br> cairo_context = cairo_create(cairo_surface);<br> <br> cairo_set_source_rgba(cairo_context, 0x80/255.0, 0x80/255.0, 0x80/255.0, 0xff/255.0);<br>
cairo_rectangle(cairo_context, 150, 150, 300, 300);<br> cairo_fill(cairo_context);<br> <br> cairo_destroy(cairo_context);<br> cairo_surface_destroy(cairo_surface);<br> <br> sleep (5);<br><br> // release<br>
surface->Release( surface );<br> dfb->Release( dfb );<br> <br> return 23;<br>}<br>// ---------------------------------------- end ----------------------------------------------------------<br><br>-- <br>Jefferson Ferreira<br>