Here is the latest code I am testing Clear() with. The old code had Green as background just to verify if that was cauisng the issue. But with Alpha set to 0, color becomes irrelevant on rendering.
for (i = 300; i > 0; i--) { sprintf(str,"%d",i); DFBCHECK (font->GetStringWidth (font, str, -1, &width)); DFBCHECK (primary->Clear (primary, 0x0, 0x0, 0x0, 0x0)); DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF)); DFBCHECK (primary->FillRectangle (primary, 0 , 0 , width , 48)); DFBCHECK (primary->SetColor (primary, 0xFF, 0x0, 0x0, 0xFF)); DFBCHECK (primary->DrawString (primary, str /* text */, -1, 0, 0, DSTF_TOPLEFT)); DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAIT)); usleep(100); } Looks like some blending issue with fb0 and fb1. On 09/22/2014 12:17 PM, Divneil Rai WADHAWAN wrote: In your code, you are doing. DFBCHECK (primary->SetColor (primary, 0x0, 0xFF, 0x0, 0x0)); It's RGBA, so, green is 0xFF. From: Subodh Chiwate [mailto:subodh.chiw...@ufomoviez.com] Sent: Monday, September 22, 2014 12:03 PM To: Divneil Rai WADHAWAN; directfb-users@directfb.org<mailto:directfb-users@directfb.org> Subject: Re: [directfb-users] Fwd: [directfb-dev] How to make primary surface transparent ?? I tried it but still get a green background. I am using following command line parameters to have this app run as an overlay on fb0. ./dfb_alphachannel_demo --dfb:fbdev=/dev/fb1,bg-none,quiet,no-cursor,hardware,sync,thrifty-surface-buffers,deinit-check,no-banner,no-trace,no-debug,agp=8,session=3,dma,init-lay er=0,layer-bg-none,autoflip-window On 09/22/2014 11:56 AM, Divneil Rai WADHAWAN wrote: Why didn't you tried clearing the surface? primary->( primary->, 0, 0, 0, 0); From: directfb-users-boun...@directfb.org<mailto:directfb-users-boun...@directfb.org> [mailto:directfb-users-boun...@directfb.org] On Behalf Of Subodh Chiwate Sent: Monday, September 22, 2014 11:38 AM To: directfb-users@directfb.org<mailto:directfb-users@directfb.org> Subject: [directfb-users] Fwd: [directfb-dev] How to make primary surface transparent ?? -------- Original Message -------- Subject: [directfb-dev] How to make primary surface transparent ?? Date: Fri, 19 Sep 2014 19:00:55 +0530 From: Subodh Chiwate <subodh.chiw...@ufomoviez.com><mailto:subodh.chiw...@ufomoviez.com> To: <directfb-...@diretfb.org><mailto:directfb-...@diretfb.org> Hi, I am trying to make a primary surface transparent, so that I can display text as timer on the display. I am trying to overwrite same string with opposite alpha as a hack that just seems too wrong to do in practice .. :) Please help. I am using DFB 1.4 on embedded platform. #include <stdio.h> #include <stdlib.h> #include <string.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 ); \ } \ } static IDirectFBFont *font = NULL; static char *text = "DirectFB Rulez !!!"; int main (int argc, char **argv) { int i, width; DFBFontDescription font_dsc; DFBSurfaceDescription dsc; IDirectFBDisplayLayer *videolayer = NULL; DFBCHECK (DirectFBInit (&argc, &argv)); DFBCHECK (DirectFBCreate (&dfb)); DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)); dsc.flags = DSDESC_CAPS; dsc.caps = DSCAPS_SYSTEMONLY | DSCAPS_PRIMARY | DSCAPS_SUBSURFACE | DSCAPS_STATIC_ALLOC | DSCAPS_INTERLACED | DSCAPS_SEPARATED | DSCAPS_SHARED | DSCAPS_FLIPPING ; DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary )); DFBCHECK (primary->SetPorterDuff(primary,DSPD_DST_OUT)); DFBCHECK (primary->SetSrcBlendFunction(primary,DSBF_INVSRCCOLOR)); font_dsc.flags = DFDESC_HEIGHT; font_dsc.height = 48; DFBCHECK (dfb->CreateFont (dfb, "/usr/share/directfb-examples/fonts/decker.ttf", &font_dsc, &font)); DFBCHECK (primary->SetFont (primary, font)); DFBCHECK (font->GetStringWidth (font, text, -1, &width)); DFBRectangle tar_rect; tar_rect.x = 300 ; tar_rect.y = 300; tar_rect.w = width ; tar_rect.h = 100; DFBCHECK (primary->MakeSubSurface(primary,primary,&tar_rect)); DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height)); char str[15]; int prev= 300; for (i = 300; i > 0; i--) { DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0x0)); //DFBCHECK (primary->FillRectangle (primary, 0 , 0 , width , 100)); sprintf(str,"%d",prev); DFBCHECK (primary->DrawString (primary, str /* text */, -1, 0, 0, DSTF_TOPLEFT)); DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAIT)); bzero(str,15); sprintf(str,"%d",i); DFBCHECK (primary->SetColor (primary, 0x0, 0xFF, 0x0, 0x0)); DFBCHECK (primary->DrawString (primary, str /* text */, -1, 0, 0, DSTF_TOPLEFT)); DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAIT)); bzero(str,15); prev = i; usleep(200); } font->Release (font); primary->Release (primary); dfb->Release (dfb); return 0; } -- Regards, Subodh _______________________________________________ directfb-dev mailing list directfb-...@directfb.org<mailto:directfb-...@directfb.org> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev . -- Regards, Subodh -- **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. UFOMoviez India Ltd. has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. UFOMoviez India Ltd. reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the UFOMoviez India Ltd.'s e-mail system. ***************** End of Disclaimer ******************* -- Regards, Subodh -- **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. UFOMoviez India Ltd. has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. UFOMoviez India Ltd. reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the UFOMoviez India Ltd.'s e-mail system. ***************** End of Disclaimer ******************* -- Regards, Subodh -- **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. UFOMoviez India Ltd. has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. UFOMoviez India Ltd. reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the UFOMoviez India Ltd.'s e-mail system. ***************** End of Disclaimer *******************
_______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users