Base.inv(p::RGB) = RGB(1 - p.r, 1 - p.g, 1 - p.b)
I was trying to mess around with some of the common filters like inverting the colors, and it seems this would be well defined.
Also, I think this one allocates, so avoiding that would be nice
Is there a reason to not want to overload inv? would also want to generalize it to more than just RGB (its just the one I'm familiar with)
this would make it really easy to then take an image and just inv.(img) and get that classic "invert colors" effect
Base.inv(p::RGB) = RGB(1 - p.r, 1 - p.g, 1 - p.b)I was trying to mess around with some of the common filters like inverting the colors, and it seems this would be well defined.
Also, I think this one allocates, so avoiding that would be nice
Is there a reason to not want to overload
inv? would also want to generalize it to more than just RGB (its just the one I'm familiar with)this would make it really easy to then take an image and just
inv.(img)and get that classic "invert colors" effect