@@ -32,6 +32,7 @@ export RGBRGB, complement, nan, dotc, dot, ⋅, hadamard, ⊙, tensor, ⊗, norm
3232MathTypes{T,C} = Union{AbstractRGB{T},TransparentRGB{C,T},AbstractGray{T},TransparentGray{C,T}}
3333
3434# # Version compatibility with ColorTypes
35+ # ## TODO : Remove the definitons other than `one` when dropping ColorTypes v0.10 support
3536
3637if ! hasmethod (zero, (Type{TransparentGray},))
3738 zero (:: Type{C} ) where {C<: TransparentGray } = C (0 ,0 )
@@ -40,7 +41,7 @@ if !hasmethod(zero, (Type{TransparentGray},))
4041 zero (p:: Colorant ) = zero (typeof (p))
4142end
4243
43- if ! hasmethod (one, (Type{TransparentGray},))
44+ if ! hasmethod (one, (Type{TransparentGray},)) # specification change is planned for ColorTypes v0.12
4445 Base. one (:: Type{C} ) where {C<: TransparentGray } = C (1 ,1 )
4546 Base. one (:: Type{C} ) where {C<: AbstractRGB } = C (1 ,1 ,1 )
4647 Base. one (:: Type{C} ) where {C<: TransparentRGB } = C (1 ,1 ,1 ,1 )
@@ -53,6 +54,16 @@ if !hasmethod(isfinite, (Colorant,))
5354 isnan (c:: Colorant ) = mapreducec (isnan, | , false , c)
5455end
5556
57+ if which (< , Tuple{AbstractGray,AbstractGray}). module === Base
58+ (< )(g1:: AbstractGray , g2:: AbstractGray ) = gray (g1) < gray (g2)
59+ (< )(c:: AbstractGray , r:: Real ) = gray (c) < r
60+ (< )(r:: Real , c:: AbstractGray ) = r < gray (c)
61+ end
62+ if ! hasmethod (isless, Tuple{AbstractGray,Real})
63+ isless (c:: AbstractGray , r:: Real ) = isless (gray (c), r)
64+ isless (r:: Real , c:: AbstractGray ) = isless (r, gray (c))
65+ end
66+
5667if isdefined (ColorTypes, :nan )
5768 using ColorTypes: nan
5869else
@@ -291,16 +302,6 @@ min(a::AbstractGray, b::Number) = min(promote(a,b)...)
291302atan (x:: AbstractGray , y:: AbstractGray ) = atan (gray (x), gray (y))
292303hypot (x:: AbstractGray , y:: AbstractGray ) = hypot (gray (x), gray (y))
293304
294- if which (< , Tuple{AbstractGray,AbstractGray}). module === Base # planned for ColorTypes 0.11
295- (< )(g1:: AbstractGray , g2:: AbstractGray ) = gray (g1) < gray (g2)
296- (< )(c:: AbstractGray , r:: Real ) = gray (c) < r
297- (< )(r:: Real , c:: AbstractGray ) = r < gray (c)
298- end
299- if ! hasmethod (isless, Tuple{AbstractGray,Real}) # planned for ColorTypes 0.11
300- isless (c:: AbstractGray , r:: Real ) = isless (gray (c), r)
301- isless (r:: Real , c:: AbstractGray ) = isless (r, gray (c))
302- end
303-
304305dotc (x:: C , y:: C ) where {C<: AbstractGray } = acc (gray (x))* acc (gray (y))
305306dotc (x:: AbstractGray , y:: AbstractGray ) = dotc (promote (x, y)... )
306307
0 commit comments