1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 03:56:26 +02:00

Added setting for minimal colors

Fixes #162
This commit is contained in:
kkapsner 2017-12-11 12:47:43 +01:00
parent e128cba84a
commit 096db123d7
7 changed files with 70 additions and 2 deletions

View file

@ -79,10 +79,16 @@
var l = desc.length;
var ignoredColors = {};
var statistic;
if (prefs("ignoreFrequentColors")){
var statistic = colorStatistics.compute(source);
statistic = colorStatistics.compute(source);
ignoredColors = statistic.getMaxColors(prefs("ignoreFrequentColors"));
}
if (prefs("minColors")){
if (!colorStatistics.hasMoreColors(source, prefs("minColors"), statistic)){
return original;
}
}
var rng = randomSupply.getPixelRng(l, window, ignoredColors);
var fakeAlphaChannel = prefs("fakeAlphaChannel");