Add complement migrated from Images.jl#144
Conversation
Co-Authored-by: Ioannis Valasakis <code@wizofe.uk>
Codecov Report
@@ Coverage Diff @@
## master #144 +/- ##
==========================================
+ Coverage 97.12% 97.15% +0.02%
==========================================
Files 2 2
Lines 209 211 +2
==========================================
+ Hits 203 205 +2
Misses 6 6
Continue to review full report at Codecov.
|
To clarify for other readers, it works if you load ColorVectorSpace but the method is among several that needs to migrate to ColorTypes. |
No, it does not work. ColorVectorSpace hasn't supported it for a long time. ColorTypes only supports julia> complement(Gray24(0.2))
ERROR: MethodError: no method matching one(::Type{Gray24}) |
julia> using ColorTypes
julia> c = oneunit(Gray{Float32})
Gray{Float32}(1.0f0)
julia> oneunit(c)
ERROR: MethodError: no method matching one(::Gray{Float32})
Closest candidates are:
one(::Union{Type{T}, T}) where T<:AbstractString at strings/basic.jl:262
one(::Union{Type{P}, P}) where P<:Dates.Period at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.7/Dates/src/periods.jl:54
one(::LinearAlgebra.UniformScaling{T}) where T at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/uniformscaling.jl:132
...
Stacktrace:
[1] oneunit(x::Gray{Float32})
@ Base ./number.jl:318
[2] top-level scope
@ REPL[3]:1
julia> using ColorVectorSpace
julia> oneunit(c)
Gray{Float32}(1.0f0) |
|
That is true, but it is also misleading. What is important is not the difference between instance and type, but between In any case, I don't think it is necessary to add new seeds of depreation now. |
|
Well, not quite true. Probably 99% of people use Gray rather than, e.g., Gray24. |
| @test_broken complement(Gray24(0.2)) === Gray24(0.8) | ||
| @test_broken complement(AGray32(0.2, 0.7)) === AGray32(0.8, 0.7) |
There was a problem hiding this comment.
Also, oneunit(::AbstractGray) has been missing. This may be fixed in ColorTypes v0.11.
`complement` is such a basic operation that we moved to lower-level package ColorVectorSpace in PR JuliaGraphics/ColorVectorSpace.jl#144 This requires ColorVectorSpace v0.9.2. Since we indirectly get CVS via ImageCore, we need to set a compatible ImageCore version that requires CVS >= v0.9.2. For this reason, this commit sets ImageCore compatibility to v0.9.3 so that we get CVS at least v0.9.7
`complement` is such a basic operation that we moved to lower-level package ColorVectorSpace in PR JuliaGraphics/ColorVectorSpace.jl#144 This requires ColorVectorSpace v0.9.2. Since we indirectly get CVS via ImageCore, we need to set a compatible ImageCore version that requires CVS >= v0.9.2. For this reason, this commit sets ImageCore compatibility to v0.9.3 so that we get CVS at least v0.9.7
This is the part of PR #125 about
complement. (cf. JuliaImages/Images.jl#698, JuliaImages/Images.jl#879)The differences from the original are as follows:
complement(as suggested in Bug/move std to cvs #125 (comment)).Images.jl does not yet support ColorVectorSpace v0.9, so it is possible to include this in v0.9, but I don't think that would be a good idea.
Also,
oneunit(::AbstractGray)has been missing. 😕 This may be fixed in ColorTypes v0.11.cc: @wizofe