Skip to content

Commit 9bc27e9

Browse files
authored
Add files via upload
1 parent 97d7a53 commit 9bc27e9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

nQuant.Master/GilbertCurve.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ private void DiffusePixel(int x, int y)
227227
int a_pix = (int)Math.Min(Byte.MaxValue, Math.Max(error[3], 0.0));
228228

229229
Color c2 = Color.FromArgb(a_pix, r_pix, g_pix, b_pix);
230-
if (saliencies != null && dither && !sortedByYDiff && (!m_hasAlpha || Math.Abs(pixel.A - a_pix) < (.5 * margin)))
230+
if (saliencies != null && dither && !sortedByYDiff && (!m_hasAlpha || pixel.A < a_pix))
231231
{
232-
if (palette.Length >= 256 && saliencies[bidx] > .99f)
233-
qPixels[bidx] = ditherable.DitherColorIndex(palette, c2.ToArgb(), bidx);
232+
if ((palette.Length >= 256 && saliencies[bidx] > .99f) || (m_hasAlpha && (pixel.A - a_pix) < (.5 * margin)))
233+
qPixels[bidx] = ditherable.DitherColorIndex(palette, c2.ToArgb(), bidx);
234234
else
235235
qPixels[bidx] = DitherPixel(x, y, c2, beta);
236236
}

0 commit comments

Comments
 (0)