@@ -149,14 +149,11 @@ end
149149(/ )(c:: TransparentRGB , f:: Integer ) = (one (eltype (c))/ f)* c
150150
151151isfinite {T<:Normed} (c:: Colorant{T} ) = true
152- isfinite {T<:AbstractFloat} (c:: AbstractRGB{T} ) = isfinite (red (c)) && isfinite (green (c)) && isfinite (blue (c))
153- isfinite (c:: TransparentRGBFloat ) = isfinite (red (c)) && isfinite (green (c)) && isfinite (blue (c)) && isfinite (alpha (c))
152+ isfinite (c:: Colorant ) = mapreducec (isfinite, & , true , c)
154153isnan {T<:Normed} (c:: Colorant{T} ) = false
155- isnan {T<:AbstractFloat} (c:: AbstractRGB{T} ) = isnan (red (c)) || isnan (green (c)) || isnan (blue (c))
156- isnan (c:: TransparentRGBFloat ) = isnan (red (c)) || isnan (green (c)) || isnan (blue (c)) || isnan (alpha (c))
154+ isnan (c:: Colorant ) = mapreducec (isnan, | , false , c)
157155isinf {T<:Normed} (c:: Colorant{T} ) = false
158- isinf {T<:AbstractFloat} (c:: AbstractRGB{T} ) = isinf (red (c)) || isinf (green (c)) || isinf (blue (c))
159- isinf (c:: TransparentRGBFloat ) = isinf (red (c)) || isinf (green (c)) || isinf (blue (c)) || isinf (alpha (c))
156+ isinf (c:: Colorant ) = mapreducec (isinf, | , false , c)
160157abs (c:: AbstractRGB ) = abs (red (c))+ abs (green (c))+ abs (blue (c)) # should this have a different name?
161158abs {T<:Normed} (c:: AbstractRGB{T} ) = Float32 (red (c))+ Float32 (green (c))+ Float32 (blue (c)) # should this have a different name?
162159abs (c:: TransparentRGB ) = abs (red (c))+ abs (green (c))+ abs (blue (c))+ abs (alpha (c)) # should this have a different name?
@@ -238,12 +235,6 @@ min(a::AbstractGray, b::AbstractGray) = min(promote(a,b)...)
238235min (a:: Number , b:: AbstractGray ) = min (promote (a,b)... )
239236min (a:: AbstractGray , b:: Number ) = min (promote (a,b)... )
240237
241- isfinite {T<:AbstractFloat} (c:: AbstractGray{T} ) = isfinite (gray (c))
242- isfinite (c:: TransparentGrayFloat ) = isfinite (gray (c)) && isfinite (alpha (c))
243- isnan {T<:AbstractFloat} (c:: AbstractGray{T} ) = isnan (gray (c))
244- isnan (c:: TransparentGrayFloat ) = isnan (gray (c)) && isnan (alpha (c))
245- isinf {T<:AbstractFloat} (c:: AbstractGray{T} ) = isinf (gray (c))
246- isinf (c:: TransparentGrayFloat ) = isinf (gray (c)) && isnan (alpha (c))
247238norm (c:: AbstractGray ) = abs (gray (c))
248239abs (c:: TransparentGray ) = abs (gray (c))+ abs (alpha (c)) # should this have a different name?
249240abs (c:: TransparentGrayNormed ) = Float32 (gray (c)) + Float32 (alpha (c)) # should this have a different name?
@@ -357,6 +348,10 @@ histrange{T}(v::AbstractArray{Gray{T}}, n::Integer) = histrange(convert(Array{Fl
357348promote_array_type {T<:Real,C<:MathTypes} (F, :: Type{T} , :: Type{C} ) = base_colorant_type (C){Base. promote_array_type (F, T, eltype (C))}
358349promote_rule {T<:Real,C<:AbstractGray} (:: Type{T} , :: Type{C} ) = promote_type (T, eltype (C))
359350
360- typemin {T<:ColorTypes.AbstractGray} (:: Union{T,Type{T}} ) = T (typemin (eltype (T)))
361- typemax {T<:ColorTypes.AbstractGray} (:: Union{T,Type{T}} ) = T (typemax (eltype (T)))
351+ typemin {T<:ColorTypes.AbstractGray} (:: Type{T} ) = T (typemin (eltype (T)))
352+ typemax {T<:ColorTypes.AbstractGray} (:: Type{T} ) = T (typemax (eltype (T)))
353+
354+ typemin {T<:ColorTypes.AbstractGray} (:: T ) = T (typemin (eltype (T)))
355+ typemax {T<:ColorTypes.AbstractGray} (:: T ) = T (typemax (eltype (T)))
356+
362357end
0 commit comments