1 /* 2 * Copyright 2005, Stephan Aßmus <superstippi@gmx.de>. 3 * Copyright 2008, Andrej Spielmann <andrej.spielmann@seh.ox.ac.uk>. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 * DrawingMode implementing B_OP_SELECT on B_RGBA32. 7 * 8 */ 9 10 #ifndef DRAWING_MODE_SELECT_SUBPIX_H 11 #define DRAWING_MODE_SELECT_SUBPIX_H 12 13 #include "DrawingMode.h" 14 #include "GlobalSubpixelSettings.h" 15 16 // BLEND_SELECT_SUBPIX 17 #define BLEND_SELECT_SUBPIX(d, r, g, b, a1, a2, a3) \ 18 { \ 19 BLEND_SUBPIX(d, r, g, b, a1, a2, a3); \ 20 } 21 22 23 // blend_solid_hspan_select_subpix 24 void 25 blend_solid_hspan_select_subpix(int x, int y, unsigned len, const color_type& c, 26 const uint8* covers, agg_buffer* buffer, const PatternHandler* pattern) 27 { 28 uint8* p = buffer->row_ptr(y) + (x << 2); 29 rgb_color high = pattern->HighColor(); 30 rgb_color low = pattern->LowColor(); 31 rgb_color color; 32 const int subpixelL = gSubpixelOrderingRGB ? 2 : 0; 33 const int subpixelM = 1; 34 const int subpixelR = gSubpixelOrderingRGB ? 0 : 2; 35 do { 36 if (pattern->IsHighColor(x, y)) { 37 if (compare(p, high, low, &color)){ 38 BLEND_SELECT_SUBPIX(p, color.red, color.green, color.blue, 39 covers[subpixelL], covers[subpixelM], covers[subpixelR]); 40 } 41 } 42 covers += 3; 43 p += 4; 44 x++; 45 len -= 3; 46 } while (len); 47 } 48 49 #endif // DRAWING_MODE_SELECT_SUBPIX_H 50 51