Dear all, 

I'm using DirectFB (1.0) and I face an issue.

I've PNGs to render to ARGB surfaces.
However my platform don't have hardware accelerated alpha blending so alpha
channel is skipped and I'm using only colorkey based Blit ( I use 255,0,255
as colorKey).

I would like to load my png to a surface filled with the colorKey.
In a perfect world, I would like to have all the PNG's pixels with alpha >
50 % copied to my surface.
( if alpha > 50% use RGB values, else do nothing).

However, I cannot get this result.
Best way i've found is to :

1) create a tmp ARGB surface .
2) render the bitmap with the ImageProvider to my tmp surface.
3) fill my final ARGB surface with colorKey (255,0,255,0)
3) blit my tmp surface to my final surface with DSBLIT_BLEND_ALPHACHANNEL
blitting flag 

This is working fine when my source alpha pixels values are 255 or 0 ( even
if performances are not so good).
However, when the PNG contains intermediate opacity values, the blit of my
tmp surface to my final surface (using alpha) blend the destination pixels
with the source pixels. Therefore, it mixes my PNG data with the colorKey
RGB and I get dirty purple pixels.


How can I use a surface alpha channel only as transparency mask ? ( to get
only pixels with alpha > 50 % but no blend ) ?


I've tested many blits flags, to use SetSrc or SetDestBlendFunction with
several params, or to use 24bit  or RGB32 intermediate surface,and of course
to googlize, but none of them can help me so far.... :-(


Thanks in advance for your time and your help,


Fabien Vallée

-- 
View this message in context: 
http://www.nabble.com/Rendering-ARGB-to-colorKey-filled-surface-tp21980722p21980722.html
Sent from the DirectFB Users mailing list archive at Nabble.com.

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to