Delphi – TCanvas.CopyRect方法中参数CopyMode的意义
技术交流.
首先看可能取值:
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;
好.Bye