技术交流. 首先看可能取值:
cmBlackness = BLACKNESS;
cmDstInvert = DSTINVERT;
cmMergeCopy = MERGECOPY;
cmMergePaint = MERGEPAINT;
cmNotSrcCopy = NOTSRCCOPY;
cmNotSrcErase = NOTSRCERASE;
cmPatCopy = PATCOPY;
cmPatInvert = PATINVERT;
cmPatPaint = PATPAINT;
cmSrcAnd = SRCAND;
cmSrcCopy = SRCCOPY;
cmSrcErase = SRCERASE;
cmSrcInvert = SRCINVERT;
cmSrcPaint = SRCPAINT;
cmWhiteness = WHITENESS;
看效果.来点儿代码试一下:
procedure TForm3.Button1Click(Sender: TObject);
var
RC1,RC2:TRect;
begin
RC1:=Rect(0,0,img1.Width,img1.Height);
RC2:=Rect(0,0,img2.Width,img2.Height);
with img2.Canvas do
begin
CopyMode:=cmBlackness;//就改这个
CopyRect(RC1,img1.Canvas,RC2);
end;
end;
来弄个表格: 原图
CopyMode |
效果 |
Blackness |
用黑色填充目标矩形区域. |
Whiteness |
用白色填充目标矩形区域 |
DstInvert |
将目标矩形图象进行反相 |
MERGECOPY |
将源矩形图象与指定的图案刷(Pattern)进行布尔"与"运算 |
MERGEPAINT |
将源矩形图形经过反相后,与目标矩形图象进行布尔"或"运算 |
NOTSRCCOPY |
将源矩形图象经过反相后,复制到目标矩形上 |
NOTSRCERASE |
先将源矩形图象与目标矩形图象进行布尔"或"运算,然后再将得图象进行反相 |
PATCOPY |
将指定的图案刷复制到目标矩形上 |
PATINVERT |
将指定的图案刷与目标矩形图象进行布尔"异或"运算 |
PATPAINT |
先将源矩形图象进行反相,与指定的图案刷进行布尔"或"运算,再与目标矩形图象进行布尔"或"运算SRCAND 将源矩形图象与目标矩形图象进行布尔"与"运算 |
SRCCOPY |
将源矩形图象直接复制到目标矩形上 |
SRCERASE |
将目标矩形图象进行反相,再与源矩形图象进行布尔"与"运算 |
SRCINVERT |
将源矩形图象与目标矩形图象进行布尔"异或"运算 |
SRCPAINT |
将源矩形图象与目标矩形图象进行布尔"或"运算 |
好.Bye
|
请发表评论