管理员
  
- 积分
- 165371
- 金钱
- 165371
- 注册时间
- 2010-12-1
- 在线时间
- 2110 小时
|
发表于 2011-10-16 21:20:42
|
显示全部楼层
回复【楼主位】muc520:
---------------------------------
他这个是在电脑上用ps处理好,做成一个图片放到SD卡,然后加载进来的.
这种效果叫alpha blending,你百度一下就知道了.原理比较简单,就是两张图片采用一个算法,把他们叠加起来.
//快速ALPHA BLENDING算法.
//src:源颜色
//dst:目标颜色
//alpha:透明程度(0~32)
//返回值:混合后的颜色.
u16 gui_alpha_blend565(u16 src,u16 dst,u8 alpha)
{
u32 src2;
u32 dst2;
//Convert to 32bit |-----GGGGGG-----RRRRR------BBBBB|
src2=((src<<16)|src)&0x07E0F81F;
dst2=((dst<<16)|dst)&0x07E0F81F;
//Perform blending R:G:B with alpha in range 0..32
//Note that the reason that alpha may not exceed 32 is that there are only
//5bits of space between each R:G:B value, any higher value will overflow
//into the next component and deliver ugly result.
dst2=((((dst2-src2)*alpha)>>5)+src2)&0x07E0F81F;
return (dst2>>16)|dst2;
}
这是一个快速alphablending的算法.老外写的. |
|