Results 1 to 6 of 6

Thread: [RESOLVED] Inverting colors

  1. #1

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Resolved [RESOLVED] Inverting colors

    How do you invert colors? My guess to just subtract it from vbWhite, but that would mean inverted gray is gray, so that can't be right.

    Anyone know?

  2. #2

  3. #3
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Inverting colors

    Wild guess....Have you tried using Xor?

    Maybe something like,
    NewColor = 255 Xor TheColor
    or
    NewColor = vbWhite Xor TheColor

    ?

  4. #4

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Inverting colors

    Quote Originally Posted by RhinoBull
    That's the solution I proposed in the OP: subtract it from vbWhite. Thanks much for the link confirming this is how to do it.
    Last edited by Ellis Dee; Sep 5th, 2008 at 09:54 PM.

  5. #5

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Inverting colors

    Quote Originally Posted by Edgemeal
    Wild guess....Have you tried using Xor?

    Maybe something like,
    NewColor = 255 Xor TheColor
    or
    NewColor = vbWhite Xor TheColor

    ?
    Looks like we both guessed correctly, as doing an Xor like that is functionally equivalent to subtracting the color from vbWhite, and RhinoBull's link confirms that subtracting the color from vbWhite is indeed how you invert a color.

    I like the Xor method better, though, because it's chock full of computery goodness.

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: [RESOLVED] Inverting colors

    because it's chock full of computery goodness.
    I'm not sure what that really means, but it sounds good!

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