From: H.G. Muller Date: Fri, 12 Oct 2012 12:42:26 +0000 (+0200) Subject: Suppress anti-aliasing in -monoMode X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=c6dc3f6ed99ee75be391ff43360952370f7cb796 Suppress anti-aliasing in -monoMode In the color-substitution code, always use bi-level alpha and color. --- 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); }