Skip to content

Commit

Permalink
Update combat bounds in Project.toml (#191)
Browse files Browse the repository at this point in the history
* Update Project.toml
* Fix ambiguities, test_broken -> test

---------

Co-authored-by: Tim Holy <[email protected]>
  • Loading branch information
ViralBShah and timholy authored Nov 6, 2024
1 parent 15a168e commit 1d8aa1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ColorVectorSpace"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.10.0"
version = "0.10.1"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand All @@ -11,10 +11,10 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TensorCore = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50"

[compat]
ColorTypes = "0.10, 0.11"
ColorTypes = "0.12"
FixedPointNumbers = "0.8.2"
Requires = "1"
SpecialFunctions = "0.8, 0.9, 0.10, 1, 2.0"
SpecialFunctions = "1, 2"
TensorCore = "0.1"
julia = "1"

Expand Down
5 changes: 5 additions & 0 deletions src/ColorVectorSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ end
(-)(a::TransparentRGB, b::TransparentRGB) = _mapc(rettype(-, a, b), -, a, b)

# New multiplication operators
function ()(x::C, y::C) where C <: AbstractRGB # ambiguity fix
T = acctype(eltype(x), eltype(y))
(T(red(x))*T(red(y)) + T(green(x))*T(green(y)) + T(blue(x))*T(blue(y)))/3
end
function ()(x::AbstractRGB, y::AbstractRGB)
T = acctype(eltype(x), eltype(y))
(T(red(x))*T(red(y)) + T(green(x))*T(green(y)) + T(blue(x))*T(blue(y)))/3
Expand Down Expand Up @@ -418,6 +422,7 @@ Base.zero(a::RGBRGB) = zero(typeof(a))
*(a::RGBRGB, α::Real) = α*a
/(a::RGBRGB, α::Real) = (1/α)*a

(a::C, b::C) where C<:AbstractRGB = invoke(, Tuple{AbstractRGB,AbstractRGB}, a, b) # ambiguity
function (a::AbstractRGB, b::AbstractRGB)
ar, ag, ab = red(a), green(a), blue(a)
br, bg, bb = red(b), green(b), blue(b)
Expand Down
8 changes: 4 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ ColorTypes.comp2(c::RGBA32) = alpha(c)
@test @inferred(convert(Gray{typeof(x)}, x)) === @inferred(convert(Gray, x)) === Gray(x)
@test @inferred(convert(RGB{typeof(x)}, x)) === @inferred(convert(RGB, x)) === RGB(x, x, x)
# These should be fixed by a future release of ColorTypes
@test_broken @inferred(convert(AGray{typeof(x)}, x)) === @inferred(convert(AGray, x)) === AGray(x, 1)
@test_broken @inferred(convert(ARGB{typeof(x)}, x)) === @inferred(convert(ARGB, x)) === ARGB(x, x, x, 1)
@test_broken @inferred(convert(GrayA{typeof(x)}, x)) === @inferred(convert(GrayA, x)) === GrayA(x, 1)
@test_broken @inferred(convert(RGBA{typeof(x)}, x)) === @inferred(convert(RGBA, x)) === RGBA(x, x, x, 1)
@test @inferred(convert(AGray{typeof(x)}, x)) === @inferred(convert(AGray, x)) === AGray(x, 1)
@test @inferred(convert(ARGB{typeof(x)}, x)) === @inferred(convert(ARGB, x)) === ARGB(x, x, x, 1)
@test @inferred(convert(GrayA{typeof(x)}, x)) === @inferred(convert(GrayA, x)) === GrayA(x, 1)
@test @inferred(convert(RGBA{typeof(x)}, x)) === @inferred(convert(RGBA, x)) === RGBA(x, x, x, 1)
end
end

Expand Down

0 comments on commit 1d8aa1c

Please sign in to comment.