Invert a color with Bitwise.OnesComplement?

  1. 6 months ago

    Aaron H

    10 Jan 2020 Testers Europe (Germany)

    I want to invert a color, and I'm making some dumb mistake. Can anyone tell me why this doesn't work?

    // start with some color
    dim v as variant = g.ForeColor 
    // invert it
    v = Bitwise.OnesComplement( v )
    g.ForeColor = v.ColorValue
    // and it doesn't work

    seems to work just fine for me.... but remember that it also inverts the ALPHA value.... which might make your result transparent.

  2. Norman P

    10 Jan 2020 Testers, Xojo Pro outside admiring the sunshine,...

    define "doesnt work" ?

  3. Dave S

    10 Jan 2020 Answer San Diego, California USA

    seems to work just fine for me.... but remember that it also inverts the ALPHA value.... which might make your result transparent.

  4. Aaron H

    10 Jan 2020 Testers Europe (Germany)

    Thanks Dave, that was the problem :)

or Sign Up to reply!