[MPlayer-dev-eng] Draw Alpha
Ivan Kalvatchev
iive at yahoo.com
Wed Nov 28 19:07:38 CET 2001
Few days ago i sow coments about drawing subtitles for
DVD. I sow the equation that is used for computing, i
sow that some changes are made. I didn't mind it, but
later I realize that the formula is wrong. I couldn't
find the fix and today i chaked the source. This is
form osd_template.c:
if(srca[x])dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x];
or in float:
dst=src*alpha+osd;
The right formula is:
dst=src*alpha+osd*(1.0-alpha);
so when alpha=1 we get dst=src;
and when alpha=0 we get dst=osd;
As you work with sharp colors 0,255 you may not notice
it, becouse of overflow (0xFF=-1), but in case you
have osd=127 you should have strange effects (not
tested:)
So with the right formula it is just a matter of
preferences does alpha==0 means transparent or solid.
Best Regards
Ivan Kalvachev
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
More information about the MPlayer-dev-eng
mailing list