Results 1 to 2 of 2

Thread: invert picture

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Location
    Milwaukee, Wi
    Posts
    28
    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

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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 )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width