Skip to content

Commit

Permalink
Merge pull request #292 from JuliaGraphics/fbot/deps
Browse files Browse the repository at this point in the history
Run femtocleaner
  • Loading branch information
timholy authored Aug 16, 2017
2 parents 51d3189 + f25bcfb commit 7183ecc
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 144 deletions.
10 changes: 5 additions & 5 deletions src/Colors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ using FixedPointNumbers, ColorTypes, Reexport, Compat
# deprecated exports
export U8, U16

@compat AbstractGray{T} = Color{T,1}
AbstractGray{T} = Color{T,1}
using ColorTypes: TransparentGray
@compat AbstractAGray{C<:AbstractGray,T} = AlphaColor{C,T,2}
@compat AbstractGrayA{C<:AbstractGray,T} = ColorAlpha{C,T,2}
@compat Color3{T} = Color{T,3}
@compat Transparent4{C<:Color3,T} = TransparentColor{C,T,4}
AbstractAGray{C<:AbstractGray,T} = AlphaColor{C,T,2}
AbstractGrayA{C<:AbstractGray,T} = ColorAlpha{C,T,2}
Color3{T} = Color{T,3}
Transparent4{C<:Color3,T} = TransparentColor{C,T,4}

import Base: ==, +, -, *, /
import Base: convert, eltype, hex, isless, linspace, show, typemin, typemax
Expand Down
12 changes: 6 additions & 6 deletions src/algorithms.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Arithmetic
#XYZ and LMS are linear vector spaces
const Linear3 = Union{XYZ, LMS}
+{C<:Linear3}(a::C, b::C) = C(comp1(a)+comp1(b), comp2(a)+comp2(b), comp3(a)+comp3(b))
-{C<:Linear3}(a::C, b::C) = C(comp1(a)-comp1(b), comp2(a)-comp2(b), comp3(a)-comp3(b))
+(a::C, b::C) where {C<:Linear3} = C(comp1(a)+comp1(b), comp2(a)+comp2(b), comp3(a)+comp3(b))
-(a::C, b::C) where {C<:Linear3} = C(comp1(a)-comp1(b), comp2(a)-comp2(b), comp3(a)-comp3(b))
-(a::Linear3) = typeof(a)(-comp1(a), -comp2(a), -comp3(a))
*(c::Number, a::Linear3) = base_color_type(a)(c*comp1(a), c*comp2(a), c*comp3(a))
/(a::Linear3, c::Number) = base_color_type(a)(comp1(a)/c, comp2(a)/c, comp3(a)/c)
Expand Down Expand Up @@ -32,7 +32,7 @@ Args:
Returns:
A whitebalanced color.
"""
function whitebalance{T <: Color}(c::T, src_white::Color, ref_white::Color)
function whitebalance(c::T, src_white::Color, ref_white::Color) where T <: Color
c_lms = convert(LMS, c)
src_wp = convert(LMS, src_white)
dest_wp = convert(LMS, ref_white)
Expand Down Expand Up @@ -84,7 +84,7 @@ long-wavelength photopigment). `c` is the input color; the optional
argument `p` is the fraction of photopigment loss, in the range 0 (no
loss) to 1 (complete loss).
"""
function protanopic{T <: Color}(q::T, p, neutral::LMS)
function protanopic(q::T, p, neutral::LMS) where T <: Color
q = convert(LMS, q)
anchor_wavelen = q.s / q.m < neutral.s / neutral.m ? 575 : 475
anchor = colormatch(anchor_wavelen)
Expand All @@ -105,7 +105,7 @@ end
Convert a color to simulate deuteranopic color deficiency (lack of the
middle-wavelength photopigment). See the description of `protanopic` for detail about the arguments.
"""
function deuteranopic{T <: Color}(q::T, p, neutral::LMS)
function deuteranopic(q::T, p, neutral::LMS) where T <: Color
q = convert(LMS, q)
anchor_wavelen = q.s / q.l < neutral.s / neutral.l ? 575 : 475
anchor = colormatch(anchor_wavelen)
Expand All @@ -127,7 +127,7 @@ Convert a color to simulate tritanopic color deficiency (lack of the
short-wavelength photogiment). See `protanopic` for more detail about
the arguments.
"""
function tritanopic{T <: Color}(q::T, p, neutral::LMS)
function tritanopic(q::T, p, neutral::LMS) where T <: Color
q = convert(LMS, q)
anchor_wavelen = q.m / q.l < neutral.m / neutral.l ? 660 : 485
anchor = colormatch(anchor_wavelen)
Expand Down
14 changes: 7 additions & 7 deletions src/colormaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ Keyword arguments:
Returns:
A `Vector` of colors of length `n`, of the type specified in `seed`.
"""
function distinguishable_colors{T<:Color}(n::Integer,
seed::AbstractVector{T};
transform::Function = identity,
lchoices::AbstractVector = linspace(0, 100, 15),
cchoices::AbstractVector = linspace(0, 100, 15),
hchoices::AbstractVector = linspace(0, 340, 20))
function distinguishable_colors(n::Integer,
seed::AbstractVector{T};
transform::Function = identity,
lchoices::AbstractVector = linspace(0, 100, 15),
cchoices::AbstractVector = linspace(0, 100, 15),
hchoices::AbstractVector = linspace(0, 340, 20)) where T<:Color
if n <= length(seed)
return seed[1:n]
end
Expand Down Expand Up @@ -129,7 +129,7 @@ function sequential_palette(h,
M=mod(180.0+h1-h0, 360)-180.0
mod(h0+a*M, 360)
end
function mix_linearly{C<:Color}(a::C, b::C, s)
function mix_linearly(a::C, b::C, s) where C<:Color
base_color_type(C)((1-s)*comp1(a)+s*comp1(b), (1-s)*comp2(a)+s*comp2(b), (1-s)*comp3(a)+s*comp3(b))
end

Expand Down
14 changes: 7 additions & 7 deletions src/colormatch.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

@compat abstract type CMF end
@compat abstract type CIE1931_CMF <: CMF end
@compat abstract type CIE1964_CMF <: CMF end
@compat abstract type CIE1931J_CMF <: CMF end
@compat abstract type CIE1931JV_CMF <: CMF end
@compat abstract type CIE2006_2_CMF <: CMF end
@compat abstract type CIE2006_10_CMF <: CMF end
abstract type CMF end
abstract type CIE1931_CMF <: CMF end
abstract type CIE1964_CMF <: CMF end
abstract type CIE1931J_CMF <: CMF end
abstract type CIE1931JV_CMF <: CMF end
abstract type CIE2006_2_CMF <: CMF end
abstract type CIE2006_10_CMF <: CMF end

"""
colormatch(wavelength)
Expand Down
Loading

0 comments on commit 7183ecc

Please sign in to comment.