You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Scalar binary RGB operations require the same RGB type for each element,
# otherwise we don't know which to return
color_rettype(::Type{A}, ::Type{B}) where {A<:AbstractRGB,B<:AbstractRGB} =_color_rettype(base_colorant_type(A), base_colorant_type(B))
color_rettype(::Type{A}, ::Type{B}) where {A<:AbstractGray,B<:AbstractGray} =_color_rettype(base_colorant_type(A), base_colorant_type(B))
color_rettype(::Type{A}, ::Type{B}) where {A<:TransparentRGB,B<:TransparentRGB} =_color_rettype(base_colorant_type(A), base_colorant_type(B))
color_rettype(::Type{A}, ::Type{B}) where {A<:TransparentGray,B<:TransparentGray} =_color_rettype(base_colorant_type(A), base_colorant_type(B))
_color_rettype(::Type{C}, ::Type{C}) where {C<:Colorant} = C
The revamp of the color promotion rules is relatively recent (i.e. it was in ColorTypes v0.10.0), but I think there is less ambiguity now. As you know, ColorVectorSpace v0.9 requires ColorTypes v0.10.
julia>RGB24(0.1, 0.2, 0.3) +RGB{Float32}(0.4, 0.5, 0.6)
ERROR: MethodError: no method matching _color_rettype(::Type{RGB24}, ::Type{RGB})
In binary operation with Type{RGB24} and Type{RGB}, the return type is ambiguous
julia>BGR(0.1, 0.2, 0.3) +RGB{N0f8}(0.4, 0.5, 0.6)
ERROR: MethodError: no method matching _color_rettype(::Type{BGR}, ::Type{RGB})
In binary operation with Type{BGR} and Type{RGB}, the return type is ambiguous
julia>Gray24(1) *Gray{N0f8}(1)
ERROR: MethodError: no method matching _color_rettype(::Type{Gray24}, ::Type{Gray})
In binary operation with Type{Gray24} and Type{Gray}, the return type is ambiguous
julia>Gray24(1) ⊙Gray{N0f8}(1)
Gray{N0f8}(1.0)
The
color_rettype
has been around since the initial working commit of ColorVectorSpace, but now, I'm not sure what the point of it is.ColorVectorSpace.jl/src/ColorVectorSpace.jl
Lines 76 to 82 in 85b8759
The revamp of the color promotion rules is relatively recent (i.e. it was in ColorTypes v0.10.0), but I think there is less ambiguity now. As you know, ColorVectorSpace v0.9 requires ColorTypes v0.10.
The text was updated successfully, but these errors were encountered: