-
hi folks,
i want to be able to invert the colors in a picturebox by taking each pixel and reversing its RGB value. that is, if pixel is 5,55,100 i want to change it to 250,200,155. i also want to generate the inverted image in a second picturebox leaving the original intact. how can i do this? i am interested in developing this project further, so i am looking for an efficient solution.
thanks much
shaheeb
-
use BitBlt with the ROP "vbSrcInvert":
Code:
'Module
Public 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
'Code
BitBlt Picture2.hDC, 0, 0, Picture1.Width, Picture1.height, Picture1.hDC, 0, 0, vbSrcPaint
(Not tested but should work ;))