-
Notifications
You must be signed in to change notification settings - Fork 20
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
Redesign color arithmetic #131
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many ddls at the end of the semester, haven't got the time to read the source codes. I just made some documentation suggestions here.
This notably defines 3 multiplication operators for RGB colors. It also un-defines `abs2`, because how that should work is a bit ambiguous. Finally, it defines a new `varmult` function, which allows one to compute variance using a specific multiplication operator. There are some compatibility definitions for current releases of ColorTypes. Co-authored-by: Johnny Chen <[email protected]>
4e24dad
to
08dbd9e
Compare
Codecov Report
@@ Coverage Diff @@
## master #131 +/- ##
===========================================
+ Coverage 78.86% 97.58% +18.71%
===========================================
Files 2 2
Lines 194 207 +13
===========================================
+ Hits 153 202 +49
+ Misses 41 5 -36
Continue to review full report at Codecov.
|
A single test depends on Colors, otherwise this package is now independent of Colors.
I *hate* that phrase...
I've made this work with current releases; except for the I am leaning towards calling this 0.9, rather than 1.0, and see how things work for a few months. |
That was a long delay! Good to have this finally done. |
eps(::Type{Gray{T}}) where {T} = Gray(eps(T)) | ||
|
||
for f in (:trunc, :floor, :round, :ceil) | ||
@eval $f(::Type{T}, g::Gray) where {T<:Integer} = Gray{T}($f(T, gray(g))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be an over-loose type annotation to me, since we don't really have Gray{<:Integer}
types except for Bool
.
Making it
$f(::Type{T}, g::Gray) where {T<:Integer} = $f(T, gray(g)))
is more reasonable if we consider that T
specifies the output type for such usages.
cref: JuliaGraphics/ColorTypes.jl#123 (comment)
cc: @myrddin89
This notably defines 3 multiplication operators for RGB colors. It also un-defines
abs2
, because how that should work is a bit ambiguous. Finally, it defines a newvarmult
function, which allows one to compute variance using a specific multiplication operator.Fixes #126. Requires the following:
floattype(Rational)
and require <:AbstractFloat for fallback JuliaMath/FixedPointNumbers.jl#177