Luis wrote:
> Hello,
>
> I sent this question to this mailing list before, but never got an
> answer. Can somebody please point me in the right direction? I have
> been researching this topic for a long time in the usual venues but I
> couldn't get this to work (without some serious, hackish, misues of
> blit()). I'd like to have a fade effect that works smoothly. I'm using
> the XDirectFB technique of setting the opacity level of the top-most
> window. This doesn't seem to be working.
See below.
> When i do my image provider routine, i call video_fade_in() like:
>
> void
> video_start_splash (splashy_video_t * video, const gchar * background)
> {
> DFBSurfaceDescription desc;
> /* DFBDisplayLayerDescription ldesc; */
> DFBWindowDescription win_desc;
>
> /*
> * initializing Directfb
> */
> /*
> * - no-debug := suppresses debug messages
> * - quiet := suppresses all messages (but debug)
> * - graphics-vt := puts directfb vt in graphics mode
> * - no-cursor := disallow showing a cursor
> */
>
> _current_background = background;
>
> DFBCHECK (DirectFBInit (NULL, NULL));
> DirectFBSetOption ("quiet", NULL);
> DirectFBSetOption ("no-debug", NULL);
> DirectFBSetOption ("graphics-vt", NULL);
> DirectFBSetOption ("no-cursor", NULL);
> /*
> * in window-mode our dfb seems to prefer to go to the top layer
> * which masks the progress bar! commented out (libdirectfb-0.9.22)
> * This also makes the progressbar draw slower!
> */
> /*
> * DirectFBSetOption( "force-windowed", NULL);
> */
>
> DFBCHECK (DirectFBCreate (&video->dfb));
>
> video->mode = g_new0 (splashy_videomode_t, 1);
> /*
> * set our expectation to a very big number
> */
> preinit (NULL);
> video->mode->out_height = fb_vinfo.yres;
> video->mode->out_width = fb_vinfo.xres;
>
> DEBUG_PRINT ("Setting min Width (x) resolution to %d",
> video->mode->out_width);
> DEBUG_PRINT ("Setting min Height (y) resolution to %d",
> video->mode->out_height);
>
> video_set_mode (video);
If you are calling IDirectFB::SetCooperativeLevel(DFSCL_FULLSCREEN) +
IDirectFB::SetVideoMode() from video_set_mode(), it won't work.
Use IDirectFBDisplayLayer::SetCooperativeLevel(DLSCL_EXCLUSIVE) +
IDirectFBDisplayLayer::SetConfiguration() instead.
>
> DFBCHECK (video->dfb->CreateImageProvider (video->dfb, background,
> &video->provider));
> DFBCHECK (video->provider->GetSurfaceDescription (video->provider,
> &desc));
> /*
> * flags to set the default surface as main surface
> */
> desc.flags = DSDESC_CAPS;
> desc.caps = DSCAPS_PRIMARY;
>
> /*
> * store our primary layer as this will be use for setting the opacity
> * levels later
> */
> DFBCHECK (video->dfb->GetDisplayLayer(video->dfb,
> DLID_PRIMARY,&video->primary_layer));
>
> /* DFBCHECK
> (video->primary_layer->GetDescription(video->primary_layer,&ldesc));
> */
>
> /* this only applies for directfb 0.9.12 and up */
> /* ldesc.caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL |
> DLCAPS_OPACITY;*/
>
> win_desc.flags = ( DWDESC_POSX | DWDESC_POSY |
> DWDESC_WIDTH | DWDESC_HEIGHT );
> win_desc.posx = 0;
> win_desc.posy = 0;
> win_desc.width = video->mode->out_width;
> win_desc.height = video->mode->out_height;
>
> DFBCHECK (video->primary_layer->CreateWindow (video->primary_layer,
> &win_desc, &video->primary_window));
> DFBCHECK (video->primary_window->GetSurface(video->primary_window,
> &video->primary_surface));
Remove the following line: you are overwriting the window's surface.
> DFBCHECK (video->dfb->CreateSurface (video->dfb, &desc,
> &video->primary_surface));
>
> /*
> * allow surface to have alpha channels
> * fade in effect won't work with alpha channels in window
> * because we use Opacity levels
> */
> /*
> DFBCHECK (video->primary_surface->SetBlittingFlags
> (video->primary_surface,
> DSBLIT_BLEND_ALPHACHANNEL));*/
To have an alpha channeled window, add DWCAPS_ALPHACHANNEL to the window
capabilities flags.
>
> /*
> * it writes on the framebuffer the background image
> */
> video->provider->RenderTo (video->provider, video->primary_surface,
> NULL);
>
> /*
> * fade in effect
> */
>
> if (g_ascii_strncasecmp (xml_parser_get_text
> ("/splashy/fadein"),"yes",3) == 0 )
> video_fade_in (video);
>
> }
>
--
Regards,
Claudio Ciccani
[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users