1167514Skmacy/* 2167514Skmacy * Copyright 2005, Stephan A��mus <superstippi@gmx.de>. 3189643Sgnn * Copyright 2008, Andrej Spielmann <andrej.spielmann@seh.ox.ac.uk>. 4167514Skmacy * All rights reserved. Distributed under the terms of the MIT License. 5167514Skmacy * 6167514Skmacy * DrawingMode implementing B_OP_INVERT on B_RGBA32. 7167514Skmacy * 8167514Skmacy */ 9167514Skmacy 10167514Skmacy#ifndef DRAWING_MODE_INVERT_SUBPIX_H 11167514Skmacy#define DRAWING_MODE_INVERT_SUBPIX_H 12170076Skmacy 13167514Skmacy#include "DrawingMode.h" 14167514Skmacy#include "GlobalSubpixelSettings.h" 15167514Skmacy 16167514Skmacy// BLEND_INVERT_SUBPIX 17167514Skmacy#define BLEND_INVERT_SUBPIX(d, a1, a2, a3) \ 18167514Skmacy{ \ 19167514Skmacy pixel32 _p; \ 20167514Skmacy _p.data32 = *(uint32*)d; \ 21167514Skmacy BLEND_SUBPIX(d, 255 - _p.data8[2], 255 - _p.data8[1], 255 - _p.data8[0], \ 22167514Skmacy a1, a2, a3); \ 23167514Skmacy (void)_p; \ 24167514Skmacy} 25167514Skmacy 26167514Skmacy 27167514Skmacy// blend_solid_hspan_invert_subpix 28167514Skmacyvoid 29167514Skmacyblend_solid_hspan_invert_subpix(int x, int y, unsigned len, const color_type& c, 30167514Skmacy const uint8* covers, agg_buffer* buffer, const PatternHandler* pattern) 31167514Skmacy{ 32167514Skmacy uint8* p = buffer->row_ptr(y) + (x << 2); 33167514Skmacy const int subpixelL = gSubpixelOrderingRGB ? 2 : 0; 34170076Skmacy const int subpixelM = 1; 35167514Skmacy const int subpixelR = gSubpixelOrderingRGB ? 0 : 2; 36167514Skmacy do { 37170654Skmacy if (pattern->IsHighColor(x, y)) { 38167514Skmacy BLEND_INVERT_SUBPIX(p, covers[subpixelL], covers[subpixelM], 39172096Skmacy covers[subpixelR]); 40185157Sgnn } 41167514Skmacy covers += 3; 42167514Skmacy p += 4; 43167514Skmacy x++; 44167514Skmacy len -= 3; 45167746Skmacy } while (len); 46170654Skmacy} 47180583Skmacy 48167514Skmacy 49167514Skmacy#endif // DRAWING_MODE_INVERT_SUBPIX_H 50170654Skmacy 51167514Skmacy