@@ -30,7 +30,7 @@ isdefined(Base, :get_extension) || using Requires
3030
3131export RGBRGB, complement, nan, dotc, dot, ⋅ , hadamard, ⊙ , tensor, ⊗ , norm, varmult, stdmult
3232
33- MathTypes{T,C<: Union{AbstractGray{T},AbstractRGB{T}} } = Union{C,TransparentColor{C,T}}
33+ MathTypes{T,C<: Union{AbstractGray{T},AbstractRGB{T},CMY } } = Union{C,TransparentColor{C,T}}
3434
3535# # Version compatibility with ColorTypes
3636# ## TODO : Remove the definitons other than `one` when dropping ColorTypes v0.10 support
@@ -161,6 +161,7 @@ channels(c::AbstractGray) = (gray(c),)
161161channels (c:: TransparentGray ) = (gray (c), alpha (c))
162162channels (c:: AbstractRGB ) = (red (c), green (c), blue (c))
163163channels (c:: TransparentRGB ) = (red (c), green (c), blue (c), alpha (c))
164+ channels (c:: CMY ) = (cyan (c), magenta (c), yellow (c))
164165
165166if reinterpret (N0f16, 0xBADb )^ 2 === N0f16 (float (reinterpret (N0f16, 0xBADb ))^ 2 )
166167 function _mul (x:: N0f8 , y:: N0f8 )
291292dotc (x:: T , y:: T ) where {T<: AbstractRGB } = 0.200f0 * acc (red (x))* acc (red (y)) + 0.771f0 * acc (green (x))* acc (green (y)) + 0.029f0 * acc (blue (x))* acc (blue (y))
292293dotc (x:: AbstractRGB , y:: AbstractRGB ) = dotc (promote (x, y)... )
293294
295+ # CMY
296+ function (/ )(c:: CMY , f:: AbstractFloat )
297+ r = oneunit (divtype (eltype (c), typeof (f))) / f
298+ _mapc (rettype (/ , c, f), v -> v * r, c)
299+ end
300+ (+ )(a:: CMY , b:: CMY ) = _mapc (rettype (+ , a, b), + , a, b)
301+ (- )(a:: CMY , b:: CMY ) = _mapc (rettype (- , a, b), - , a, b)
302+
294303# Scalar Gray
295304const unaryops = (:~ , :conj , :abs ,
296305 :sin , :cos , :tan , :sinh , :cosh , :tanh ,
0 commit comments