Discussion:
[directfb-users] Fwd: [directfb-dev] How to make primary surface transparent ??
Subodh Chiwate
2014-09-22 06:07:46 UTC
Permalink
-------- Original Message --------
Subject: [directfb-dev] How to make primary surface transparent ??
Date: Fri, 19 Sep 2014 19:00:55 +0530
From: Subodh Chiwate <***@ufomoviez.com><mailto:***@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 *******************
Divneil Rai WADHAWAN
2014-09-22 06:26:25 UTC
Permalink
Why didn't you tried clearing the surface? primary->( primary->, 0, 0, 0, 0);

From: directfb-users-***@directfb.org [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Subodh Chiwate
2014-09-22 06:32:51 UTC
Permalink
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-***@directfb.org<mailto:directfb-users-***@directfb.org> [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@directfb.org<mailto:directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Divneil Rai WADHAWAN
2014-09-22 06:47:51 UTC
Permalink
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:***@ufomoviez.com]
Sent: Monday, September 22, 2014 12:03 PM
To: Divneil Rai WADHAWAN; directfb-***@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-***@directfb.org<mailto:directfb-users-***@directfb.org> [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@directfb.org<mailto:directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Subodh Chiwate
2014-09-22 06:55:21 UTC
Permalink
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:***@ufomoviez.com]
Sent: Monday, September 22, 2014 12:03 PM
To: Divneil Rai WADHAWAN; directfb-***@directfb.org<mailto:directfb-***@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-***@directfb.org<mailto:directfb-users-***@directfb.org> [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@directfb.org<mailto:directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Subodh Chiwate
2014-09-22 12:47:41 UTC
Permalink
Following are frame buffer specs I am working with
https://community.freescale.com/thread/330826
I am new to both DFB and embedded systems, please forgive my ignorance with basics.
I will be really grateful if anyone could suggest links/books that will help in building expertise
on this front.
Following are detailed results of my test till now.

Resultant video ouput:
Extermely, sorry I cannot provide screenshots due to policies.
Split (horizontal compressed) screen with duplicate background layer, the upper layer shows overlay but inspite of Clear() a green band is seen in area let unpainted.

---------------------------------------------
| OL + Green (fb1) BG(fb0) |
--------------------------------------------- 1080
| BG' (fb0) |
--------------------------------------------
1920

Program debug messages:
***@freescale /unit_tests$ ./directfb_test.sh 1
(*) DirectFB/Core: Single Application Core. (2014-09-11 08:44)
(*) Direct/Memcpy: Using libc memcpy()
(*) DirectFB/Core: calling sync()...
(*) Direct/Thread: Started 'VT Switcher' (3243) [CRITICAL OTHER/OTHER 0/0] <8388608>...
(*) Direct/Thread: Started 'VT Flusher' (-1) [DEFAULT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/FBDev: Found 'DISP3 FG' (ID 0) with frame buffer at 0x17000000, 12060k (MMIO 0x00000000, 0k)
(*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: IMPS/2 Mouse (1) 1.0 (directfb.org)
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: IMPS/2 Mouse (2) 1.0 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: WM8962 Beep Generator (1) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: wm8962-audio DMIC (2) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: wm8962-audio Ext Spk (3) 0.1 (directfb.org)
(*) DirectFB/Graphics: Generic Software Rasterizer 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
(*) FBDev/Mode: Setting 1920x1072 RGB16
(*) FBDev/Mode: Switched to 1920x1072 (virtual 1920x1072) at 16 bit (RGB16), pitch 3840
(*) FBDev/Surface: Allocated 1920x1072 16 bit RGB16 buffer (index 0) at offset 0 and pitch 3840.
(*) FBDev/Mode: Setting 1920x1072 RGB32
(*) FBDev/Mode: Switched to 1920x1072 (virtual 1920x1072) at 32 bit (RGB32), pitch 7680
(*) FBDev/Surface: Allocated 1920x1072 32 bit RGB32 buffer (index 0) at offset 0 and pitch 7680.
(*) Direct/Interface: Loaded 'FT2' implementation of 'IDirectFBFont'.
(*) FBDev/Mode: Setting 1920x1072 RGB16
(*) FBDev/Mode: Switched to 1920x1072 (virtual 1920x1072) at 16 bit (RGB16), pitch 3840
(*) FBDev/Surface: Allocated 1920x1072 16 bit RGB16 buffer (index 0) at offset 0 and pitch 3840.


Following is my latest code

int main (int argc, char **argv)
{
int i, width;
DFBFontDescription font_dsc;
DFBSurfaceDescription dsc;

DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
DFBCHECK (dfb->SetVideoMode(dfb, 1920, 1072, 32));

dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_SYSTEMONLY |
DSCAPS_PRIMARY |
DSCAPS_SUBSURFACE |
DSCAPS_STATIC_ALLOC |
// DSCAPS_INTERLACED |
// DSCAPS_SEPARATED |
DSCAPS_SHARED ;// |
DSCAPS_DOUBLE ;

DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
//DFBCHECK (primary->SetPorterDuff(primary,DSPD_SRC_ATOP));
//DFBCHECK (primary->SetSrcBlendFunction(primary,DSBF_SRCCOLOR));
//DFBCHECK (primary->SetRenderOptions(primary,DSRO_ANTIALIAS));
//DFBCHECK (primary->SetBlittingFlags(primary,DSBLIT_BLEND_ALPHACHANNEL));
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 48;
DFBRectangle tar_rect;
tar_rect.x = 300 ;
tar_rect.y = 300;
tar_rect.w = width ;
tar_rect.h = 48;
DFBCHECK (primary->MakeSubSurface(primary,primary,&tar_rect));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
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));
char str[15];
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, 0xFF, 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));
}
font->Release (font);
primary->Release (primary);
dfb->Release (dfb);
return 0;
}




On 09/22/2014 12:25 PM, Subodh Chiwate wrote:
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:***@ufomoviez.com]
Sent: Monday, September 22, 2014 12:03 PM
To: Divneil Rai WADHAWAN; directfb-***@directfb.org<mailto:directfb-***@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-***@directfb.org<mailto:directfb-users-***@directfb.org> [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@directfb.org<mailto:directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Subodh Chiwate
2014-09-24 06:44:26 UTC
Permalink
Hi,
I have figured that the way the video rendering data path and the DFB path are
working is creating the issue.

The green background I see is actually the fb0, both DFB and video try to share the plane fb1 and
hence endup with no data on fb0.
Some V4l2 specific stuff going on during rendering, which I need to figure out.
Figuring a way to have both systems work in sync on Freecale imx6 platform.

On 09/22/2014 06:17 PM, Subodh Chiwate wrote:

Following are frame buffer specs I am working with
https://community.freescale.com/thread/330826
I am new to both DFB and embedded systems, please forgive my ignorance with basics.
I will be really grateful if anyone could suggest links/books that will help in building expertise
on this front.
Following are detailed results of my test till now.

Resultant video ouput:
Extermely, sorry I cannot provide screenshots due to policies.
Split (horizontal compressed) screen with duplicate background layer, the upper layer shows overlay but inspite of Clear() a green band is seen in area let unpainted.

---------------------------------------------
| OL + Green (fb1) BG(fb0) |
--------------------------------------------- 1080
| BG' (fb0) |
--------------------------------------------
1920

Program debug messages:
***@freescale /unit_tests$ ./directfb_test.sh 1
(*) DirectFB/Core: Single Application Core. (2014-09-11 08:44)
(*) Direct/Memcpy: Using libc memcpy()
(*) DirectFB/Core: calling sync()...
(*) Direct/Thread: Started 'VT Switcher' (3243) [CRITICAL OTHER/OTHER 0/0] <8388608>...
(*) Direct/Thread: Started 'VT Flusher' (-1) [DEFAULT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/FBDev: Found 'DISP3 FG' (ID 0) with frame buffer at 0x17000000, 12060k (MMIO 0x00000000, 0k)
(*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: IMPS/2 Mouse (1) 1.0 (directfb.org)
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: IMPS/2 Mouse (2) 1.0 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: WM8962 Beep Generator (1) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: wm8962-audio DMIC (2) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: wm8962-audio Ext Spk (3) 0.1 (directfb.org)
(*) DirectFB/Graphics: Generic Software Rasterizer 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
(*) FBDev/Mode: Setting 1920x1072 RGB16
(*) FBDev/Mode: Switched to 1920x1072 (virtual 1920x1072) at 16 bit (RGB16), pitch 3840
(*) FBDev/Surface: Allocated 1920x1072 16 bit RGB16 buffer (index 0) at offset 0 and pitch 3840.
(*) FBDev/Mode: Setting 1920x1072 RGB32
(*) FBDev/Mode: Switched to 1920x1072 (virtual 1920x1072) at 32 bit (RGB32), pitch 7680
(*) FBDev/Surface: Allocated 1920x1072 32 bit RGB32 buffer (index 0) at offset 0 and pitch 7680.
(*) Direct/Interface: Loaded 'FT2' implementation of 'IDirectFBFont'.
(*) FBDev/Mode: Setting 1920x1072 RGB16
(*) FBDev/Mode: Switched to 1920x1072 (virtual 1920x1072) at 16 bit (RGB16), pitch 3840
(*) FBDev/Surface: Allocated 1920x1072 16 bit RGB16 buffer (index 0) at offset 0 and pitch 3840.


Following is my latest code

int main (int argc, char **argv)
{
int i, width;
DFBFontDescription font_dsc;
DFBSurfaceDescription dsc;

DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
DFBCHECK (dfb->SetVideoMode(dfb, 1920, 1072, 32));

dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_SYSTEMONLY |
DSCAPS_PRIMARY |
DSCAPS_SUBSURFACE |
DSCAPS_STATIC_ALLOC |
// DSCAPS_INTERLACED |
// DSCAPS_SEPARATED |
DSCAPS_SHARED ;// |
DSCAPS_DOUBLE ;

DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
//DFBCHECK (primary->SetPorterDuff(primary,DSPD_SRC_ATOP));
//DFBCHECK (primary->SetSrcBlendFunction(primary,DSBF_SRCCOLOR));
//DFBCHECK (primary->SetRenderOptions(primary,DSRO_ANTIALIAS));
//DFBCHECK (primary->SetBlittingFlags(primary,DSBLIT_BLEND_ALPHACHANNEL));
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 48;
DFBRectangle tar_rect;
tar_rect.x = 300 ;
tar_rect.y = 300;
tar_rect.w = width ;
tar_rect.h = 48;
DFBCHECK (primary->MakeSubSurface(primary,primary,&tar_rect));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
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));
char str[15];
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, 0xFF, 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));
}
font->Release (font);
primary->Release (primary);
dfb->Release (dfb);
return 0;
}




On 09/22/2014 12:25 PM, Subodh Chiwate wrote:
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:***@ufomoviez.com]
Sent: Monday, September 22, 2014 12:03 PM
To: Divneil Rai WADHAWAN; directfb-***@directfb.org<mailto:directfb-***@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-***@directfb.org<mailto:directfb-users-***@directfb.org> [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@directfb.org<mailto:directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Divneil Rai WADHAWAN
2014-09-22 06:27:19 UTC
Permalink
primary->Clear(primary, 0, 0, 0, 0);

From: Divneil Rai WADHAWAN
Sent: Monday, September 22, 2014 11:56 AM
To: 'Subodh Chiwate'; directfb-***@directfb.org
Subject: RE: [directfb-users] Fwd: [directfb-dev] How to make primary surface transparent ??

Why didn't you tried clearing the surface? primary->( primary->, 0, 0, 0, 0);

From: directfb-users-***@directfb.org<mailto:directfb-users-***@directfb.org> [mailto:directfb-users-***@directfb.org] On Behalf Of Subodh Chiwate
Sent: Monday, September 22, 2014 11:38 AM
To: directfb-***@directfb.org<mailto:directfb-***@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 <***@ufomoviez.com><mailto:***@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 *******************
Loading...