From c6dc3f6ed99ee75be391ff43360952370f7cb796 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 12 Oct 2012 14:42:26 +0200 Subject: [PATCH] Suppress anti-aliasing in -monoMode In the color-substitution code, always use bi-level alpha and color. --- draw.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/draw.c b/draw.c index 2da2dd7..193f65c 100644 --- a/draw.c +++ b/draw.c @@ -311,6 +311,11 @@ ScaleOnePiece (int color, int piece) buf[i*stride + j] = c & 0xFF000000; // alpha channel is kept at same opacity buf[i*stride + j] += ((int)(f*(p&0xFF0000)) & 0xFF0000) + ((int)(f*(p&0xFF00)) & 0xFF00) + (int)(f*(p&0xFF)); // add desired fraction of new color if(color) buf[i*stride + j] += r | r << 8 | r << 16; // details on black pieces get their weight added in pure white + if(appData.monoMode) { + if(a < 64) buf[i*stride + j] = 0; // if not opaque enough, totally transparent + else if(2*r < a) buf[i*stride + j] = 0xFF000000; // if not light enough, totally black + else buf[i*stride + j] = 0xFFFFFFFF; // otherwise white + } } cairo_surface_mark_dirty(cs); } -- 1.7.0.4