Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing Gray{T} constructor for colorant #278

Merged
merged 1 commit into from
Jun 13, 2022
Merged

Conversation

johnnychen94
Copy link
Member

fixes #277

@codecov
Copy link

codecov bot commented May 15, 2022

Codecov Report

Merging #278 (033baf4) into master (b8ed378) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #278      +/-   ##
==========================================
+ Coverage   84.04%   84.06%   +0.02%     
==========================================
  Files           8        8              
  Lines         777      778       +1     
==========================================
+ Hits          653      654       +1     
  Misses        124      124              
Impacted Files Coverage Δ
src/types.jl 97.34% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8ed378...033baf4. Read the comment docs.

@@ -515,6 +515,7 @@ function (::Type{C})() where {N, C <: ColorantN{N}}
C(ntuple(_ -> d0, Val(N - 1))..., dx)
end

Gray{T}(c::Colorant) where {T<:Union{Fractional,Bool}} = _new_colorant(Gray{T}, c)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure why, I tried the following but it doesn't work.

(::Type{C})(x ) where {C <: Gray } = _new_colorant(C, x)

@johnnychen94 johnnychen94 merged commit 7676cd2 into master Jun 13, 2022
@johnnychen94 johnnychen94 deleted the jc/gray branch June 13, 2022 20:39
@kimikage
Copy link
Collaborator

kimikage commented Apr 3, 2024

@johnnychen94 I apologize for leaving the development unattended. Thanks for your maintenance, it is much appreciated.

By the way, why is the constructor of Gray{T}(c) needed? It is the job of Colors.jl to convert RGB to Gray.
And I wanted to enhance support for AbstractGray other than Gray a couple of years ago.

@johnnychen94
Copy link
Member Author

johnnychen94 commented Apr 6, 2024

It is the job of Colors.jl to convert RGB to Gray.

I wasn't that clear on this idea until you mentioned this. The intention was to fix some compatibility issues during the transition from 0.11.0 to 0.11.1 (which should be backward compatible).

During the time @kimikage you were unavailable, nobody realized that the current master contains some unexpected breaking changes, and we (actually, Tim) just released them as patch releases, which was incorrect. This PR is a fixup to that. Also, this is why we have a release-0.11 branch to backport compatible bugfixes and patches.

So, if you decide to move the conversions to Colors, you can safely revert this patch commit in the master branch and continue the development of 0.12 until you're ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gray{T}(c::RGB) doesn't work anymore
2 participants