Skip to content

Commit a27f84a

Browse files
author
Affolter Matias
committed
Quanitmat improvement over mix blend func.
1 parent 1a48ede commit a27f84a

File tree

5 files changed

+31
-21
lines changed

5 files changed

+31
-21
lines changed

‎client/chunk_26.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client/chunk_5.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎service-worker.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
2-
var REQUIRED_CACHE = "unless-update-cache-v548-required";
3-
var USEFUL_CACHE = "unless-update-cache-v548-useful";
4-
var STATIC_CACHE = "unless-update-cache-v548-static";
2+
var REQUIRED_CACHE = "unless-update-cache-v549-required";
3+
var USEFUL_CACHE = "unless-update-cache-v549-useful";
4+
var STATIC_CACHE = "unless-update-cache-v549-static";
55
var MAIN_CHILD_CHUNK_REGEX = /chunk_(main_[a-z0-9]+)\.min\.js$/i;
66
var CHILD_CHUNK_REGEX = /chunk_([0-9]+)\.min\.js$/i;
77

‎src/js/components/canvaspixels/utils/ReducePalette.js‎

Lines changed: 22 additions & 8 deletions
Large diffs are not rendered by default.

‎src/js/utils/quantimat/QuantiMat.js‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ QuantiMat.prototype.clusterize = function() {
675675

676676
this.set_all_cluster_indexes();
677677
}
678+
678679
QuantiMat.prototype.process_threshold = function(t) {
679680
"use strict";
680681

@@ -727,15 +728,12 @@ QuantiMat.prototype.process_threshold = function(t) {
727728
color_usage_difference = (first_color_more_used ? color_a_usage / color_b_usage: color_b_usage / color_a_usage) * 255 | 0;
728729
weighted_threshold = (((threshold_255 / 255 + (threshold_255 / 255 * (1 - color_usage_difference/255) * weight_applied_to_color_usage_difference)) / (1 + weight_applied_to_color_usage_difference)) * 255 | 0)>>>0;
729730

730-
if(color_a.manhattan_match_with(color_b, weighted_threshold|0)) {
731+
if(color_a.euclidean_match_with(color_b, weighted_threshold|0)) {
731732

733+
index_merged.add(index_of_color_a);
732734
index_merged.add(index_of_color_b);
733735
accumulator_colors.add(color_b)
734-
if(first_color_more_used) {
735-
color_a.blend_with(color_b, color_usage_difference, false, false);
736-
}else {
737-
color_b.blend_with(color_a, color_usage_difference, false, false);
738-
}
736+
color_a.blend_with(color_b, first_color_more_used ? color_usage_difference: 255 - (color_usage_difference / 255 | 0), false, false);
739737
}
740738
}
741739
}
@@ -745,8 +743,6 @@ QuantiMat.prototype.process_threshold = function(t) {
745743

746744
color_iterator.next().value.set(color_a);
747745
}
748-
749-
index_merged.add(index_of_color_a);
750746
}
751747
}
752748

0 commit comments

Comments
 (0)