Skip to content

Commit

Permalink
Update reference tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrhill committed Sep 23, 2024
1 parent 4b8c074 commit b76cdfc
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 121 deletions.
3 changes: 2 additions & 1 deletion src/DitherPunk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module DitherPunk

using Base: require_one_based_indexing
using FixedPointNumbers: N0f8, floattype
using ColorTypes: ColorTypes, AbstractGray, Color, Colorant, RGB, Gray, HSV, Lab, XYZ
using ColorTypes: ColorTypes, AbstractGray, Color, Colorant
using ColorTypes: RGB, HSV, Lab, XYZ, Gray, gray
using Colors:
DifferenceMetric,
EuclideanDifferenceMetric,
Expand Down
9 changes: 8 additions & 1 deletion src/colordiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ function _colordiff(a::Colorant, b::Colorant, m::FastEuclideanMetric)
b = convert(RGB{N0f8}, b)
return _colordiff(a, b, m)
end
# avoid method ambiguity
function _colordiff(a::Color, b::Color, m::FastEuclideanMetric)
a = convert(RGB{N0f8}, a)
b = convert(RGB{N0f8}, b)
return _colordiff(a, b, m)
end
# TODO: safe coversion to RGB{N0f8} using clamp01

# TODO: add fast metric for numberic inputs
# TODO: add fast metric for numeric inputs

# Performance can be gained by converting colors to the colorspace `colordiff`
# operates in for a given metric
Expand Down
34 changes: 17 additions & 17 deletions test/references/color/Bayer.txt

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions test/references/color/Bayer_from_gray.txt

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions test/references/color/ClosestColor.txt

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions test/references/color/ClosestColor_from_gray.txt

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions test/references/color/FloydSteinberg.txt

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions test/references/color/FloydSteinberg_clamp_error.txt

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions test/references/color/FloydSteinberg_from_gray.txt

Large diffs are not rendered by default.

0 comments on commit b76cdfc

Please sign in to comment.