Windows AlphaBlend函数

var
  BlendFunc: TBlendFunction;
begin
  BlendFunc.BlendOp := AC_SRC_OVER;
  BlendFunc.BlendFlags := 0;
  BlendFunc.SourceConstantAlpha := TrackBar1.Position;

  if bit.PixelFormat = pf32bit then
    BlendFunc.AlphaFormat := AC_SRC_ALPHA
  else
    BlendFunc.AlphaFormat := 0;


  Windows.AlphaBlend(Canvas.Handle,                 {目标 DC}
                     0, 0, bit.Width, bit.Height, {目标位置与大小}
                     bit.Canvas.Handle,             {源 DC}
                     0, 0, bit.Width, bit.Height,   {源位置与大小}
                     BlendFunc                      {透明相关的结构}
                     );
end;
posted @ 2013-10-06 21:35  热血小伙  阅读(361)  评论(0编辑  收藏  举报