对一个24位图像进行平移、缩放、旋转三种操作即可,

解决方案 »

  1.   

    Bitblt / StretchBlt即可
    旋转的稍微麻烦一点,但例子也很多
      

  2.   

    以前写的,通用部分。使用时,你得自己将相应的变量定义并正确赋值才能用。旋转:
        if (nFlag == RO_CLOCKWISE) // 顺时针旋转
        {
            if (nBitCount == 24)
            {
                RGBTRIPLE *pSrc, *pDst;
                for (j = 0; j < ndstHeight; j++)
                {
                    pSrc = (RGBTRIPLE *)psrcBits + j;
                    pDst = (RGBTRIPLE *)(pdesBits + ndesLineBytes * (ndstHeight-1-j));
                    for (i = 0; i < ndstWidth; i++)
                        pDst[i] = *(RGBTRIPLE *)((PUCHAR)pSrc + nsrcLineBytes * i);
                }
            }
        }
        else  // 逆时针旋转
        {
            if (nBitCount == 24)
            {
                RGBTRIPLE *pSrc, *pDst;
                for(j = 0; j < ndstHeight; j++)
                {
                    pSrc = (RGBTRIPLE *)(psrcBits + nsrcLineBytes * (ndstWidth-1)) + j;
                    pDst = (RGBTRIPLE *)(pdesBits + ndesLineBytes * j);
                    for(i = 0; i < ndstWidth; i++)
                        pDst[i] = *(RGBTRIPLE *)((PUCHAR)pSrc - nsrcLineBytes * i);
                }
            }
        }平移实在没什么好说的。我也没写。
      

  3.   

    使用GDI+
    或者使用SetWorldTransform
      

  4.   

    旋转角度:
            POINT centerPt = CPoint(100, 100); // 旋转中心点        int nGraphicsMode = SetGraphicsMode(hDc, GM_ADVANCED);
            XFORM xform;
            if ( m_iAngle != 0 )
            {
                double fangle = (double)m_iAngle / 180. * 3.1415926; // m_iAngle 角度
                xform.eM11 = (float)cos(fangle);
                xform.eM12 = (float)sin(fangle);
                xform.eM21 = (float)-sin(fangle);
                xform.eM22 = (float)cos(fangle);
                xform.eDx = (float)(centerPt.x - cos(fangle)*centerPt.x + sin(fangle)*centerPt.y);
                xform.eDy = (float)(centerPt.y - cos(fangle)*centerPt.y - sin(fangle)*centerPt.x);            SetWorldTransform(hDc, &xform);
            }
    在这里画图,就是旋转的了.            ::Rectangle(hDc,
                          centerPt.x - 20,
                          centerPt.y - 30, 
                          centerPt.x + 20,
                          centerPt.y + 30 );