Bitblt函数(API)详解

Bitblt作用将某一内存块的数据传送到另一内存块,前一内存块被称为"源",后一内存块被称为"目标"图象程序开发者使用Blit的函数在内存中将某页面上的一幅位图经过一定的变换转移到另一个页面上
原形说明:
Declare Function BitBlt Lib "gdi32" Alias "BitBlt"(ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
hDestDC As Long, //目标设备环境的句柄
x As Long, //目标设备环境的矩形区域的左上角的x坐标
y As Long, //目标设备环境的矩形区域的左上角的y坐标
nWidth As Long, //目标设备环境的矩形区域的宽度值
nHeight As Long, //目标设备环境的矩形区域的高度值
hSrcDC As Long, //源设备环境的句柄
xSrc As Long, //源设备环境的矩形区域的左上角的x坐标
ySrc As Long, //源设备环境的矩形区域的左上角的y坐标
dwRop As Long, //光栅操作符
dwRop参数是光栅操作代码(Rop),它是指源位图与目标位图以及图案刷的颜色值进行布尔运算的方式,以下列出了常用的光栅操作码及含义
BLACKNESS 用黑色填充目标矩形区域.
DSTINVERT 将目标矩形图象进行反相.
MERGECOPY 将源矩形图象与指定的图案刷(Pattern)进行布尔"与"运算.
MERGEPAINT 将源矩形图形经过反相后,与目标矩形图象进行布尔"或"运算.
NOTSRCCOPY 将源矩形图象经过反相后,复制到目标矩形上.
NOTSRCERASE 先将源矩形图象与目标矩形图象进行布尔"或"运算,然后再将得图象进行反相.
PATCOPY 将指定的图案刷复制到目标矩形上.
PATINVERT 将指定的图案刷与目标矩形图象进行布尔"异或"运算.
PATPAINT 先将源矩形图象进行反相,与指定的图案刷进行布尔"或"运算,再与目标矩形图象进行布尔"或"运算SRCAND 将源矩形图象与目标矩形图象进行布尔"与"运算.
SRCCOPY 将源矩形图象直接复制到目标矩形上.
SRCERASE 将目标矩形图象进行反相,再与源矩形图象进行布尔"与"运算.
SRCINVERT 将源矩形图象与目标矩形图象进行布尔"异或"运算.
SRCPAINT 将源矩形图象与目标矩形图象进行布尔"或"运算.
WHITENESS 用白色填充目标矩形区域.

代码
[DllImport("gdi32.dll")]
public static extern bool BitBlt(
IntPtr hwndObject, int nXDest, int nYDest, int nWidth,
int nHeight, IntPtr hwndObjSource, int nXSrc, int nYSrc,
int dwRop);

public enum TernaryRasterOperations
{
SRCCOPY = 0x00CC0020, /* dest = source*/
SRCPAINT = 0x00EE0086, /* dest = source OR dest*/
SRCAND = 0x008800C6, /* dest = source AND dest*/
SRCINVERT = 0x00660046, /* dest = source XOR dest*/
SRCERASE = 0x00440328, /* dest = source AND (NOT dest )*/
NOTSRCCOPY = 0x00330008, /* dest = (NOT source)*/
NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
MERGECOPY = 0x00C000CA, /* dest = (source AND pattern)*/
MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest*/
PATCOPY = 0x00F00021, /* dest = pattern*/
PATPAINT = 0x00FB0A09, /* dest = DPSnoo*/
PATINVERT = 0x005A0049, /* dest = pattern XOR dest*/
DSTINVERT = 0x00550009, /* dest = (NOT dest)*/
BLACKNESS = 0x00000042, /* dest = BLACK*/
WHITENESS = 0x00FF0062, /* dest = WHITE*/
}

 



转载:http://blog.csdn.net/maconel/archive/2004/07/12/39384.aspx

posted @ 2011-01-11 13:32  把爱延续  阅读(12598)  评论(0编辑  收藏  举报