1c8164642SStephan Aßmus /*
2c8164642SStephan Aßmus * Copyright 2005, Stephan Aßmus <superstippi@gmx.de>.
3c8164642SStephan Aßmus * Copyright 2008, Andrej Spielmann <andrej.spielmann@seh.ox.ac.uk>.
4c8164642SStephan Aßmus * All rights reserved. Distributed under the terms of the MIT License.
5c8164642SStephan Aßmus *
6c8164642SStephan Aßmus * DrawingMode implementing B_OP_ALPHA in "Constant Overlay" mode on B_RGBA32.
7c8164642SStephan Aßmus *
8c8164642SStephan Aßmus */
9c8164642SStephan Aßmus
10c8164642SStephan Aßmus #ifndef DRAWING_MODE_ALPHA_CO_SOLID_SUBPIX_H
11c8164642SStephan Aßmus #define DRAWING_MODE_ALPHA_CO_SOLID_SUBPIX_H
12c8164642SStephan Aßmus
13c8164642SStephan Aßmus #include "DrawingModeAlphaCOSUBPIX.h"
14*59e13a3fSStephan Aßmus #include "GlobalSubpixelSettings.h"
15c8164642SStephan Aßmus
16c8164642SStephan Aßmus
17c8164642SStephan Aßmus // blend_solid_hspan_alpha_co_solid_subpix
18c8164642SStephan Aßmus void
blend_solid_hspan_alpha_co_solid_subpix(int x,int y,unsigned len,const color_type & c,const uint8 * covers,agg_buffer * buffer,const PatternHandler * pattern)19c8164642SStephan Aßmus blend_solid_hspan_alpha_co_solid_subpix(int x, int y, unsigned len,
20c8164642SStephan Aßmus const color_type& c, const uint8* covers, agg_buffer* buffer,
21c8164642SStephan Aßmus const PatternHandler* pattern)
22c8164642SStephan Aßmus {
23c8164642SStephan Aßmus uint8* p = buffer->row_ptr(y) + (x << 2);
24c8164642SStephan Aßmus uint8 hAlpha = pattern->HighColor().alpha;
25c8164642SStephan Aßmus uint16 alphaRed;
26c8164642SStephan Aßmus uint16 alphaGreen;
27c8164642SStephan Aßmus uint16 alphaBlue;
28*59e13a3fSStephan Aßmus const int subpixelL = gSubpixelOrderingRGB ? 2 : 0;
29*59e13a3fSStephan Aßmus const int subpixelM = 1;
30*59e13a3fSStephan Aßmus const int subpixelR = gSubpixelOrderingRGB ? 0 : 2;
31c8164642SStephan Aßmus do {
32*59e13a3fSStephan Aßmus alphaRed = hAlpha * covers[subpixelL];
33*59e13a3fSStephan Aßmus alphaGreen = hAlpha * covers[subpixelM];
34*59e13a3fSStephan Aßmus alphaBlue = hAlpha * covers[subpixelR];
35c8164642SStephan Aßmus BLEND_ALPHA_CO_SUBPIX(p, c.r, c.g, c.b,
36c8164642SStephan Aßmus alphaBlue, alphaGreen, alphaRed);
37c8164642SStephan Aßmus covers += 3;
38c8164642SStephan Aßmus p += 4;
39c8164642SStephan Aßmus x++;
40c8164642SStephan Aßmus len -= 3;
41c8164642SStephan Aßmus } while (len);
42c8164642SStephan Aßmus }
43c8164642SStephan Aßmus
44c8164642SStephan Aßmus
45c8164642SStephan Aßmus #endif // DRAWING_MODE_ALPHA_CO_SOLID_SUBPIX_H
46c8164642SStephan Aßmus
47