Skip to content

Multiplication between RGB types seems to be missing #119

@a-r-n-o-l-d

Description

@a-r-n-o-l-d
julia> RGB{Float64}(1, 1, 1) * RGB{Float64}(1, 1, 1)
ERROR: MethodError: no method matching *(::RGB{Float64}, ::RGB{Float64})
Closest candidates are:
  *(::Any, ::Any, ::Any, ::Any...) at operators.jl:529
  *(::Real, ::AbstractRGB) at /home/afertin/.julia/packages/ColorVectorSpace/wI546/src/ColorVectorSpace.jl:123
  *(::AbstractRGB, ::Real) at /home/afertin/.julia/packages/ColorVectorSpace/wI546/src/ColorVectorSpace.jl:147
  ...
Stacktrace:
 [1] top-level scope at none:0

If I add:

import Base.*, ColorVectorSpace.color_rettype, ColorVectorSpace.multype
(*)(a::AbstractRGB{S}, b::AbstractRGB{T}) where {S,T} = color_rettype(a,b){multype(S,T)}(red(a)*red(b), green(a)*green(b), blue(a)*blue(b))

therefore, I can multiply two RGB images.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions