我有发牌、出牌的动画和内存绘图的代码,只涉及BitBlt,却没有透明位图、MaskBlt和TransparentBlt的代码。

解决方案 »

  1.   

    http://www.csdn.net/develop/read_article.asp?id=9480也许会对你有帮助
      

  2.   

    to azuo_lee:
      能否把你的代码给我一份,谢先![email protected]
    to All :
      谢谢大家!
      

  3.   

    BOOL TransparentBlt(
      HDC hdcDest,
      int nXOriginDest,
      int nYOriginDest,
      int nWidthDest,
      int hHeightDest,
      HDC hdcSrc,
      int nXOriginSrc,
      int nYOriginSrc,
      int nWidthSrc,
      int nHeightSrc,
      UINT crTransparent
    );
     
    Parameters
    hdcDest 
    Handle to the destination device context. 
    nXOriginDest 
    Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nYOriginDest 
    Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nWidthDest 
    Specifies the width, in logical units, of the destination rectangle. 
    hHeightDest 
    Handle to the height, in logical units, of the destination rectangle. 
    hdcSrc 
    Handle to the source device context. 
    nXOriginSrc 
    Specifies the x-coordinate, in logical units, of the source rectangle. 
    nYOriginSrc 
    Specifies the y-coordinate, in logical units, of the source rectangle. 
    nWidthSrc 
    Specifies the width, in logical units, of the source rectangle. 
    nHeightSrc 
    Specifies the height, in logical units, of the source rectangle. 
    crTransparent 
    The RGB color in the source bitmap to treat as transparent. 
    Return Values
    If the function succeeds, the return value is TRUE.If the function fails, the return value is FALSE. ///////////////////////////////////////////////AlphaBlend(
      HDC hdcDest,
      int nXOriginDest,
      int nYOriginDest,
      int nWidthDest,
      int hHeightDest,
      HDC hdcSrc,
      int nXOriginSrc,
      int nYOriginSrc,
      int nWidthSrc,
      int nHeightSrc,
      BLENDFUNCTION blendFunction
    );
     
    Parameter
    hdcDest 
    Handle to the destination device context. 
    nXOriginDest 
    Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nYOriginDest 
    Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nWidthDest 
    Specifies the width, in logical units, of the destination rectangle. 
    hHeightDset 
    Handle to the height, in logical units, of the destination rectangle. 
    hdcSrc 
    Handle to the source device context. 
    nXOriginSrc 
    Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle. 
    nYOriginSrc 
    Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle. 
    nWidthSrc 
    Specifies the width, in logical units, of the source rectangle. 
    nHeightSrc 
    Specifies the height, in logical units, of the source rectangle. 
    blendFunction 
    Specifies the alpha blending function for source and destination bitmaps, a global alpha value to be applied to the entire source bitmap, and format information for the source bitmap. The source and destination blend functions are currently limited to AC_SRC_OVER. See the BLENDFUNCTION and EMRALPHABLEND structures. ///////////////////////////////////////
    BOOL TransparentImage(HDC hdcDest, LONG DstX, LONG DstY, LONG DstCx, LONG DstCy, HANDLE hSrc, LONG SrcX, LONG SrcY, LONG SrcCx, LONG SrcCy, COLORREF TransparentColor );At a Glance
    Header file: Wingdi.h 
    Component: mgblt2 
    Platforms: H/PC 
    Windows CE versions: 2.0 and later 
    Parameters
    hdcDest 
    Handle to a device context. 
    DstX 
    Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    DstY 
    Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    DstCx 
    Specifies the width, in logical units, of the destination rectangle. 
    DistCy 
    Specifies the height, in logical units, of the destination rectangle. 
    hSrc 
    Specifies a source device context or a source bitmap. 
    SrcX 
    Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle. 
    SrcY 
    Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle. 
    SrcCx 
    Specifies the width, in logical units, of the source rectangle. 
    SrcCy 
    Specifies the height, in logical units, of the source rectangle. 
    TransparentColor 
    Indicates the color in the bitmap that will be rendered transparent. 
    Return Values
    If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      

  4.   

    内存绘图可以使用DIB,用SetDIBBits画,很快。拖动如果用异或就简单了。
    如果不是,可以将窗口背景保存为位图,每拖动一次,就将背景重画一次,速度完全够用。
      

  5.   

    to  c_z_y(用力) :
    有源码吗?给一份参考一下
      

  6.   

    嘿嘿,这网站上就有啊,还打着灯笼四处找光.
    http://www.csdn.net/dev/Visual%20c++/source%20code/
    如果没有的话,我光盘里多的是.
    给我你的E-mail就ok了.
       
      

  7.   

    我有一个DIB类,呵呵。只有1、透明位图的显示;2、内存绘图的代码;涉及GDI函数:BitBlt、MaskBlt 、TransBitBlt()、、、、
      

  8.   

    我要拖拉机的程序,咯咯
    [email protected]
      

  9.   

    to  zfan333(whale) :
    有源码吗?给一份参考一下 [email protected]
      

  10.   

    给分的就有,没给分的不给....kane_yj查收