@@ -3,13 +3,16 @@ __precompile__(true)
33module ColorVectorSpace
44
55using Colors, FixedPointNumbers, SpecialFunctions
6- import StatsBase: histrange
76
87import Base: == , + , - , * , / , ^ , < , ~
98import Base: abs, abs2, clamp, convert, copy, div, eps, isfinite, isinf,
10- isnan, isless, length, mapreduce, norm, oneunit, promote_array_type ,
9+ isnan, isless, length, mapreduce, oneunit,
1110 promote_op, promote_rule, zero, trunc, floor, round, ceil, bswap,
12- mod, rem, atan2, hypot, max, min, varm, real, typemin, typemax
11+ mod, rem, atan2, hypot, max, min, real, typemin, typemax
12+ import LinearAlgebra: norm
13+ import StatsBase: histrange, varm
14+ import SpecialFunctions: gamma, lgamma, lfact
15+ import Statistics: middle
1316
1417export nan
1518
@@ -23,9 +26,9 @@ import Base: conj, sin, cos, tan, sinh, cosh, tanh,
2326 asind, atand, rad2deg, deg2rad,
2427 log, log2, log10, log1p, exponent, exp,
2528 exp2, expm1, cbrt, sqrt,
26- significand, lgamma,
27- gamma, lfact, frexp, modf,
28- float, middle
29+ significand,
30+ frexp, modf,
31+ float
2932
3033export dotc
3134
@@ -269,7 +272,7 @@ function Base.isapprox(x::AbstractArray{Cx},
269272 y:: AbstractArray{Cy} ;
270273 rtol:: Real = Base. rtoldefault (eltype (Cx),eltype (Cy),0 ),
271274 atol:: Real = 0 ,
272- norm:: Function = vecnorm ) where {Cx<: MathTypes ,Cy<: MathTypes }
275+ norm:: Function = norm ) where {Cx<: MathTypes ,Cy<: MathTypes }
273276 d = norm (x - y)
274277 if isfinite (d)
275278 return d <= atol + rtol* max (norm (x), norm (y))
@@ -291,7 +294,6 @@ float(::Type{T}) where {T<:Gray} = typeof(float(zero(T)))
291294(+ )(a:: MathTypes , b:: MathTypes ) = (+ )(promote (a, b)... )
292295(- )(a:: MathTypes , b:: MathTypes ) = (- )(promote (a, b)... )
293296
294-
295297# Arrays
296298+ (A:: AbstractArray{C} ) where {C<: MathTypes } = A
297299+ (A:: Array{C} ) where {C<: MathTypes } = A
@@ -333,7 +335,6 @@ real(::Type{C}) where {C<:AbstractGray} = real(eltype(C))
333335histrange (v:: AbstractArray{Gray{T}} , n:: Integer ) where {T} = histrange (convert (Array{Float32}, map (gray, v)), n, :right )
334336
335337# To help type inference
336- promote_array_type (F, :: Type{T} , :: Type{C} ) where {T<: Real ,C<: MathTypes } = base_colorant_type (C){Base. promote_array_type (F, T, eltype (C))}
337338promote_rule (:: Type{T} , :: Type{C} ) where {T<: Real ,C<: AbstractGray } = promote_type (T, eltype (C))
338339
339340typemin (:: Type{T} ) where {T<: ColorTypes.AbstractGray } = T (typemin (eltype (T)))
@@ -342,18 +343,4 @@ typemax(::Type{T}) where {T<:ColorTypes.AbstractGray} = T(typemax(eltype(T)))
342343typemin (:: T ) where {T<: ColorTypes.AbstractGray } = T (typemin (eltype (T)))
343344typemax (:: T ) where {T<: ColorTypes.AbstractGray } = T (typemax (eltype (T)))
344345
345- # deprecations
346- function Base. one (:: Type{C} ) where {C<: Union{TransparentGray,AbstractRGB,TransparentRGB} }
347- Base. depwarn (" one($C ) will soon switch to returning 1; you might need to switch to `oneunit`" , :one )
348- C (_onetuple (C)... )
349- end
350- _onetuple (:: Type{C} ) where {C<: Colorant{T,N} } where {T,N} = ntuple (d-> 1 , Val (N))
351-
352- for f in (:min , :max )
353- @eval begin
354- @deprecate ($ f {T<:Gray} (x:: Number , y:: AbstractArray{T} ), $ f .(x, y))
355- @deprecate ($ f {T<:Gray} (x:: AbstractArray{T} , y:: Number ), $ f .(x, y))
356- end
357- end
358-
359346end
0 commit comments