Skip to content

Commit

Permalink
Work around JuliaLang/julia#8818
Browse files Browse the repository at this point in the history
This should fix numerous related errors in other packages
  • Loading branch information
timholy committed Nov 7, 2014
1 parent 4e85369 commit e880cbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/colorspaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ const CVconcrete = (HSV, HSL, XYZ, xyY, Lab, Luv, LCHab, LCHuv, DIN99, DIN99d, D
const CVparametric = tuple(RGB, CVconcrete...)
const CVfractional = (RGB, XYZ)
const CVfloatingpoint = (HSV, HSL, xyY, Lab, Luv, LCHab, LCHuv, DIN99, DIN99d, DIN99o, LMS)
const CVAlpha = (RGBA, HSVA, HSLA, XYZA, xyYA, LabA, LCHabA, LuvA, LCHuvA, DIN99A, DIN99dA, DIN99oA, LMSA)

for CV in CVparametric
@eval begin
Expand Down
12 changes: 7 additions & 5 deletions src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,17 @@ convert{C,T}(::Type{AlphaColorValue{C,T}}, c::AlphaColorValue{C,T}) = c
function convert{C,T,D,U}(::Type{AlphaColorValue{C,T}}, c::AbstractAlphaColorValue{D,U})
AlphaColorValue{C,T}(convert(C, c.c), c.alpha)
end
function convert{D,T}(AC::TypeConstructor, c::AbstractAlphaColorValue{D,T})
AlphaColorValue(convert(colortype(AC), c.c), c.alpha)
for CV in CVAlpha
@eval begin
function convert{D,T}(AC::Type{$CV}, c::AbstractAlphaColorValue{D,T})
AlphaColorValue(convert(colortype($CV), c.c), c.alpha)
end
convert(AC::Type{$CV}, c::ColorValue) = AlphaColorValue(convert(colortype($CV), c))
end
end

convert{C,T}(::Type{AlphaColorValue{C,T}}, c::ColorValue) =
AlphaColorValue{C,T}(convert(C, c), one(T))
function convert(AC::TypeConstructor, c::ColorValue)
AlphaColorValue(convert(colortype(AC), c))
end
convert{C<:ColorValue,D,T}(::Type{C}, c::AlphaColorValue{D, T}) = convert(C, c.c)

convert(::Type{ARGB32}, c::ARGB32) = c
Expand Down

0 comments on commit e880cbf

Please sign in to comment.