Skip to content

Commit

Permalink
Update GilbertCurve.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan committed May 13, 2024
1 parent 5a8b7e8 commit cb281c5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void ditherPixel(int x, int y) {
lookup[offset] = ditherable.nearestColorIndex(palette, c2, bidx) + 1;
qPixels[bidx] = palette[lookup[offset] - 1];

if(saliencies != null && CIELABConvertor.Y_Diff(pixel, c2) > palette.length - margin) {
if(saliencies != null && CIELABConvertor.Y_Diff(pixel, c2) > Math.max(1, palette.length - margin)) {
final float strength = 1 / 3f;
c2 = BlueNoise.diffuse(pixel, palette[qPixels[bidx]], 1 / saliencies[bidx], strength, x, y);
qPixels[bidx] = palette[ditherable.nearestColorIndex(palette, c2, bidx)];
Expand Down

0 comments on commit cb281c5

Please sign in to comment.