Results 1 to 10 of 10

Thread: Inverting colors

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Location
    Milwaukee, Wi
    Posts
    28
    i posted a similar question under graphics, but i suspect the solution will come from an API call, so here goes. I want to be able to load a picture into a picturebox and then pixel by pixel, reverse the RGB values and generate the inverted image into a second picturebox. so if a pixel is 5,55,100, it will be reversed to 250,200,155. i want to develop an application that simulates a photographic enlarger. i am looking for an efficient solution to accomplish this.

    thans for your help,

    Shaheeb

  2. #2
    Guest
    To get a certian pixel, use the GetPixel method. To Set the pixel, you use the SetPixel method. Then when you get the pixel, convert it into RGB and Invert the numbers.

    Say, for example, if the picture is 50x100...

    Code:
    For i = 1 to 50
       For o = 1 to 100
        Retval = GetPixel(Picture1.hDC, i, o)
        SetPixel pictur1.hdc, i, o, RGB(red, green, blue)
       Next o
    Next i

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use Bitblt api with this ROP: vbSrcInvert
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Guest
    I found another way. You can draw a box using the Line method. (Make sure the draw mode is Invert)

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Meg, it's slower
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Guest
    by what? a microsecond??

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Does that matter?

  8. #8
    Guest
    I said that as a Joke. Now that computer's are 600Mhz, I can't event notice the difference.

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    µµµµµµµµµ Yes it matters µµµµµµµµ ok, depending on what you're doing, but i haven't done any tests yet, so i can't say how much
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10
    Guest
    Well, for me it doesn't matter.

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