how to compliment a digital pin

It might be, but it isn't since HIGH == 1 and LOW == 0 and ~1 == -2

It doesn't matter; digitalWrite follows the C convention that zero is false or LOW, and anything else (i.e. non-zero) is true or HIGH.

digitalWrite (pin, (HIGH + LOW) - digitalRead (pin));