Skip to content

Commit 1d8aa1c

Browse files
ViralBShahtimholy
andauthored
Update combat bounds in Project.toml (#191)
* Update Project.toml * Fix ambiguities, test_broken -> test --------- Co-authored-by: Tim Holy <[email protected]>
1 parent 15a168e commit 1d8aa1c

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ColorVectorSpace"
22
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
3-
version = "0.10.0"
3+
version = "0.10.1"
44

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

1313
[compat]
14-
ColorTypes = "0.10, 0.11"
14+
ColorTypes = "0.12"
1515
FixedPointNumbers = "0.8.2"
1616
Requires = "1"
17-
SpecialFunctions = "0.8, 0.9, 0.10, 1, 2.0"
17+
SpecialFunctions = "1, 2"
1818
TensorCore = "0.1"
1919
julia = "1"
2020

src/ColorVectorSpace.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ end
275275
(-)(a::TransparentRGB, b::TransparentRGB) = _mapc(rettype(-, a, b), -, a, b)
276276

277277
# New multiplication operators
278+
function ()(x::C, y::C) where C <: AbstractRGB # ambiguity fix
279+
T = acctype(eltype(x), eltype(y))
280+
(T(red(x))*T(red(y)) + T(green(x))*T(green(y)) + T(blue(x))*T(blue(y)))/3
281+
end
278282
function ()(x::AbstractRGB, y::AbstractRGB)
279283
T = acctype(eltype(x), eltype(y))
280284
(T(red(x))*T(red(y)) + T(green(x))*T(green(y)) + T(blue(x))*T(blue(y)))/3
@@ -418,6 +422,7 @@ Base.zero(a::RGBRGB) = zero(typeof(a))
418422
*(a::RGBRGB, α::Real) = α*a
419423
/(a::RGBRGB, α::Real) = (1/α)*a
420424

425+
(a::C, b::C) where C<:AbstractRGB = invoke(, Tuple{AbstractRGB,AbstractRGB}, a, b) # ambiguity
421426
function (a::AbstractRGB, b::AbstractRGB)
422427
ar, ag, ab = red(a), green(a), blue(a)
423428
br, bg, bb = red(b), green(b), blue(b)

test/runtests.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ ColorTypes.comp2(c::RGBA32) = alpha(c)
8282
@test @inferred(convert(Gray{typeof(x)}, x)) === @inferred(convert(Gray, x)) === Gray(x)
8383
@test @inferred(convert(RGB{typeof(x)}, x)) === @inferred(convert(RGB, x)) === RGB(x, x, x)
8484
# These should be fixed by a future release of ColorTypes
85-
@test_broken @inferred(convert(AGray{typeof(x)}, x)) === @inferred(convert(AGray, x)) === AGray(x, 1)
86-
@test_broken @inferred(convert(ARGB{typeof(x)}, x)) === @inferred(convert(ARGB, x)) === ARGB(x, x, x, 1)
87-
@test_broken @inferred(convert(GrayA{typeof(x)}, x)) === @inferred(convert(GrayA, x)) === GrayA(x, 1)
88-
@test_broken @inferred(convert(RGBA{typeof(x)}, x)) === @inferred(convert(RGBA, x)) === RGBA(x, x, x, 1)
85+
@test @inferred(convert(AGray{typeof(x)}, x)) === @inferred(convert(AGray, x)) === AGray(x, 1)
86+
@test @inferred(convert(ARGB{typeof(x)}, x)) === @inferred(convert(ARGB, x)) === ARGB(x, x, x, 1)
87+
@test @inferred(convert(GrayA{typeof(x)}, x)) === @inferred(convert(GrayA, x)) === GrayA(x, 1)
88+
@test @inferred(convert(RGBA{typeof(x)}, x)) === @inferred(convert(RGBA, x)) === RGBA(x, x, x, 1)
8989
end
9090
end
9191

0 commit comments

Comments
 (0)