|
|
Title | Calculate the XOR of two images |
Description | This example shows how to calculate the XOR of two images in Visual Basic. |
Keywords | XOR, image, PaintPicture, image processing |
Categories | Graphics |
|
|
Taking the XOR of two images shows where the images differ. The result is black where the images are the same and not black elsewhere.
This is quite simple in Visual Basic 6. The program simply copies one image into a result PictureBox and then uses PaintPicture to copy the second image on top while specifying the vbSrcInvert opcode.
|
|
Private Sub cmdGo_Click()
' Copy the first picture into the result.
picResult.Picture = Picture1.Picture
' Copy the second picture on in XOR mode.
picResult.PaintPicture Picture2.Picture, 0, 0, _
OpCode:=vbSrcInvert
End Sub
|
|
|
|
|
|