函数一:DrawInvertedBitmap
DrawInvertedBitmap()在指定位置绘制位图的镜像图,
它使用 StretchBlt()进行镜像。
当源和目标的宽度的相反时,图像进行横向镜像;反之,进行纵向镜像。
// DrawInvertedBitmap - Draws the bitmap after inverting it
// hBimtap - Bitmap handle
// hPal - Palette to use when drawing the bitmap
// bLateral - Flag to indicate whether to invert laterally or vertically
// xDest - X coordinate of top left corner to draw at
// yDest - Y coordinate of top left corner to draw at
void DrawInvertedBitmap( CDC *pDC, HBITMAP hBitmap, HPALETTE hPal, BOOL bLateral,
int xDest, int yDest )
{
// Create a memory DC compatible with the destination DC
CDC memDC;
memDC.CreateCompatibleDC( pDC );
// GetInvertedBitmap - Creates a new bitmap with the inverted image
// Returns - Handle to a new bitmap with inverted image
// hBitmap - Bitmap to invert
// bLateral - Flag to indicate whether to invert laterally or vertically
HBITMAP GetInvertedBitmap( HBITMAP hBitmap, BOOL bLateral )
{
// Create a memory DC compatible with the display
CDC sourceDC, destDC;
sourceDC.CreateCompatibleDC( NULL );
destDC.CreateCompatibleDC( NULL );