1: 有一种界面效果是背景图上有一层单色半透明效果。据说是a混合,现在对话框里面的OnEraseBkgnd( ) 里面绘制bmp背景图,然后再上面有个控件,例如editEx,想实现edit的背景的单色半透明效果,高手指点具体实现算法,最好考虑效率?还有是否一定要指定颜色,或者,单色bmp可不可以?
2: 想显示一个bmp图片,单次正常显示,偶次,原处绘制,不显示。如何实现?我需要在一种控件的背景判断,如何实现光栅操作?我用了  ( SRCINVERT ) ,但是变成黑色?
3: 一种控件,做一个背景图片,范围超出控件本身,隐藏的时候,超出范围的图像保持, 在对话框层调用Invalidate( ) 可以去掉,但是,InvalidateRect( rc ) 不好用,rc是在控件的坐标InflateRect( enoughDistance ),指点一下?什么原因,如何实现局部绘制。

解决方案 »

  1.   

    Alpha blending is an imaging technique that combines (blends) two images (source image and destination image) together using the weighted sum of the source and destination pixels. The weight on the source pixel is normally called the alpha value; the weight on the destination pixel is one minus alpha, where one is the largest color value. Alpha blending is defined on each color channel, instead of bitwisely.简单点说alpha blending就是source取百分之多少,destination取百分之多少,然后混合
    而不是光栅操作(bitwise)
      

  2.   

    An alpha of 0 means the source pixel is completely transparent, and 1 means completely opaque. Assuming we are using a 24-bpp or 32-bpp drawing surface, the conceptual formulae for alpha blending are:
    Dst.red   = Src.red   * alpha + (1-alpha) * Dst.red  ;
    Dst.green = Src.green * alpha + (1-alpha) * Dst.green;
    Dst.blue  = Src.blue  * alpha + (1-alpha) * Dst.blue ;
    Dst.alpha = Src.alpha * alpha + (1-alpha) * Dst.alpha;