1
//----------------------------------------------------------------------------
2
// Anti-Grain Geometry - Version 2.4
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5
// Permission to copy, use, modify, sell and distribute this software
6
// is granted provided this copyright notice appears in all copies.
7
// This software is provided "as is" without express or implied
8
// warranty, and with no claim as to its suitability for any purpose.
10
//----------------------------------------------------------------------------
11
// Contact: mcseem@antigrain.com
12
// mcseemagg@yahoo.com
13
// http://www.antigrain.com
14
//----------------------------------------------------------------------------
16
// Adaptation for high precision colors has been sponsored by
17
// Liberty Technology Systems, Inc., visit http://lib-sys.com
19
// Liberty Technology Systems, Inc. is the provider of
20
// PostScript and PDF technology for software developers.
22
//----------------------------------------------------------------------------
24
#ifndef AGG_PIXFMT_RGB_PACKED_INCLUDED
25
#define AGG_PIXFMT_RGB_PACKED_INCLUDED
28
#include "agg_basics.h"
29
#include "agg_color_rgba.h"
30
#include "agg_rendering_buffer.h"
34
//=========================================================blender_rgb555
37
typedef rgba8 color_type;
38
typedef color_type::value_type value_type;
39
typedef color_type::calc_type calc_type;
40
typedef int16u pixel_type;
42
static AGG_INLINE void blend_pix(pixel_type* p,
43
unsigned cr, unsigned cg, unsigned cb,
48
calc_type r = (rgb >> 7) & 0xF8;
49
calc_type g = (rgb >> 2) & 0xF8;
50
calc_type b = (rgb << 3) & 0xF8;
52
(((((cr - r) * alpha + (r << 8)) >> 1) & 0x7C00) |
53
((((cg - g) * alpha + (g << 8)) >> 6) & 0x03E0) |
54
(((cb - b) * alpha + (b << 8)) >> 11) | 0x8000);
57
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
59
return (pixel_type)(((r & 0xF8) << 7) |
64
static AGG_INLINE color_type make_color(pixel_type p)
66
return color_type((p >> 7) & 0xF8,
73
//=====================================================blender_rgb555_pre
74
struct blender_rgb555_pre
76
typedef rgba8 color_type;
77
typedef color_type::value_type value_type;
78
typedef color_type::calc_type calc_type;
79
typedef int16u pixel_type;
81
static AGG_INLINE void blend_pix(pixel_type* p,
82
unsigned cr, unsigned cg, unsigned cb,
86
alpha = color_type::base_mask - alpha;
88
calc_type r = (rgb >> 7) & 0xF8;
89
calc_type g = (rgb >> 2) & 0xF8;
90
calc_type b = (rgb << 3) & 0xF8;
92
((((r * alpha + cr * cover) >> 1) & 0x7C00) |
93
(((g * alpha + cg * cover) >> 6) & 0x03E0) |
94
((b * alpha + cb * cover) >> 11) | 0x8000);
97
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
99
return (pixel_type)(((r & 0xF8) << 7) |
104
static AGG_INLINE color_type make_color(pixel_type p)
106
return color_type((p >> 7) & 0xF8,
115
//=====================================================blender_rgb555_gamma
116
template<class Gamma> class blender_rgb555_gamma
119
typedef rgba8 color_type;
120
typedef color_type::value_type value_type;
121
typedef color_type::calc_type calc_type;
122
typedef int16u pixel_type;
123
typedef Gamma gamma_type;
125
blender_rgb555_gamma() : m_gamma(0) {}
126
void gamma(const gamma_type& g) { m_gamma = &g; }
128
AGG_INLINE void blend_pix(pixel_type* p,
129
unsigned cr, unsigned cg, unsigned cb,
134
calc_type r = m_gamma->dir((rgb >> 7) & 0xF8);
135
calc_type g = m_gamma->dir((rgb >> 2) & 0xF8);
136
calc_type b = m_gamma->dir((rgb << 3) & 0xF8);
138
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 7) & 0x7C00) |
139
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 2) & 0x03E0) |
140
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3) | 0x8000);
143
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
145
return (pixel_type)(((r & 0xF8) << 7) |
150
static AGG_INLINE color_type make_color(pixel_type p)
152
return color_type((p >> 7) & 0xF8,
158
const Gamma* m_gamma;
165
//=========================================================blender_rgb565
166
struct blender_rgb565
168
typedef rgba8 color_type;
169
typedef color_type::value_type value_type;
170
typedef color_type::calc_type calc_type;
171
typedef int16u pixel_type;
173
static AGG_INLINE void blend_pix(pixel_type* p,
174
unsigned cr, unsigned cg, unsigned cb,
179
calc_type r = (rgb >> 8) & 0xF8;
180
calc_type g = (rgb >> 3) & 0xFC;
181
calc_type b = (rgb << 3) & 0xF8;
183
(((((cr - r) * alpha + (r << 8)) ) & 0xF800) |
184
((((cg - g) * alpha + (g << 8)) >> 5) & 0x07E0) |
185
(((cb - b) * alpha + (b << 8)) >> 11));
188
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
190
return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
193
static AGG_INLINE color_type make_color(pixel_type p)
195
return color_type((p >> 8) & 0xF8,
203
//=====================================================blender_rgb565_pre
204
struct blender_rgb565_pre
206
typedef rgba8 color_type;
207
typedef color_type::value_type value_type;
208
typedef color_type::calc_type calc_type;
209
typedef int16u pixel_type;
211
static AGG_INLINE void blend_pix(pixel_type* p,
212
unsigned cr, unsigned cg, unsigned cb,
216
alpha = color_type::base_mask - alpha;
218
calc_type r = (rgb >> 8) & 0xF8;
219
calc_type g = (rgb >> 3) & 0xFC;
220
calc_type b = (rgb << 3) & 0xF8;
222
((((r * alpha + cr * cover) ) & 0xF800) |
223
(((g * alpha + cg * cover) >> 5 ) & 0x07E0) |
224
((b * alpha + cb * cover) >> 11));
227
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
229
return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
232
static AGG_INLINE color_type make_color(pixel_type p)
234
return color_type((p >> 8) & 0xF8,
242
//=====================================================blender_rgb565_gamma
243
template<class Gamma> class blender_rgb565_gamma
246
typedef rgba8 color_type;
247
typedef color_type::value_type value_type;
248
typedef color_type::calc_type calc_type;
249
typedef int16u pixel_type;
250
typedef Gamma gamma_type;
252
blender_rgb565_gamma() : m_gamma(0) {}
253
void gamma(const gamma_type& g) { m_gamma = &g; }
255
AGG_INLINE void blend_pix(pixel_type* p,
256
unsigned cr, unsigned cg, unsigned cb,
261
calc_type r = m_gamma->dir((rgb >> 8) & 0xF8);
262
calc_type g = m_gamma->dir((rgb >> 3) & 0xFC);
263
calc_type b = m_gamma->dir((rgb << 3) & 0xF8);
265
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 8) & 0xF800) |
266
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 3) & 0x07E0) |
267
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3));
270
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
272
return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
275
static AGG_INLINE color_type make_color(pixel_type p)
277
return color_type((p >> 8) & 0xF8,
283
const Gamma* m_gamma;
288
//=====================================================blender_rgbAAA
289
struct blender_rgbAAA
291
typedef rgba16 color_type;
292
typedef color_type::value_type value_type;
293
typedef color_type::calc_type calc_type;
294
typedef int32u pixel_type;
296
static AGG_INLINE void blend_pix(pixel_type* p,
297
unsigned cr, unsigned cg, unsigned cb,
302
calc_type r = (rgb >> 14) & 0xFFC0;
303
calc_type g = (rgb >> 4) & 0xFFC0;
304
calc_type b = (rgb << 6) & 0xFFC0;
306
(((((cr - r) * alpha + (r << 16)) >> 2) & 0x3FF00000) |
307
((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) |
308
(((cb - b) * alpha + (b << 16)) >> 22) | 0xC0000000);
311
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
313
return (pixel_type)(((r & 0xFFC0) << 14) |
314
((g & 0xFFC0) << 4) |
315
(b >> 6) | 0xC0000000);
318
static AGG_INLINE color_type make_color(pixel_type p)
320
return color_type((p >> 14) & 0xFFC0,
328
//==================================================blender_rgbAAA_pre
329
struct blender_rgbAAA_pre
331
typedef rgba16 color_type;
332
typedef color_type::value_type value_type;
333
typedef color_type::calc_type calc_type;
334
typedef int32u pixel_type;
336
static AGG_INLINE void blend_pix(pixel_type* p,
337
unsigned cr, unsigned cg, unsigned cb,
341
alpha = color_type::base_mask - alpha;
342
cover = (cover + 1) << (color_type::base_shift - 8);
344
calc_type r = (rgb >> 14) & 0xFFC0;
345
calc_type g = (rgb >> 4) & 0xFFC0;
346
calc_type b = (rgb << 6) & 0xFFC0;
348
((((r * alpha + cr * cover) >> 2) & 0x3FF00000) |
349
(((g * alpha + cg * cover) >> 12) & 0x000FFC00) |
350
((b * alpha + cb * cover) >> 22) | 0xC0000000);
353
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
355
return (pixel_type)(((r & 0xFFC0) << 14) |
356
((g & 0xFFC0) << 4) |
357
(b >> 6) | 0xC0000000);
360
static AGG_INLINE color_type make_color(pixel_type p)
362
return color_type((p >> 14) & 0xFFC0,
370
//=================================================blender_rgbAAA_gamma
371
template<class Gamma> class blender_rgbAAA_gamma
374
typedef rgba16 color_type;
375
typedef color_type::value_type value_type;
376
typedef color_type::calc_type calc_type;
377
typedef int32u pixel_type;
378
typedef Gamma gamma_type;
380
blender_rgbAAA_gamma() : m_gamma(0) {}
381
void gamma(const gamma_type& g) { m_gamma = &g; }
383
AGG_INLINE void blend_pix(pixel_type* p,
384
unsigned cr, unsigned cg, unsigned cb,
389
calc_type r = m_gamma->dir((rgb >> 14) & 0xFFC0);
390
calc_type g = m_gamma->dir((rgb >> 4) & 0xFFC0);
391
calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0);
393
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 14) & 0x3FF00000) |
394
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) |
395
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 ) | 0xC0000000);
398
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
400
return (pixel_type)(((r & 0xFFC0) << 14) |
401
((g & 0xFFC0) << 4) |
402
(b >> 6) | 0xC0000000);
405
static AGG_INLINE color_type make_color(pixel_type p)
407
return color_type((p >> 14) & 0xFFC0,
412
const Gamma* m_gamma;
416
//=====================================================blender_bgrAAA
417
struct blender_bgrAAA
419
typedef rgba16 color_type;
420
typedef color_type::value_type value_type;
421
typedef color_type::calc_type calc_type;
422
typedef int32u pixel_type;
424
static AGG_INLINE void blend_pix(pixel_type* p,
425
unsigned cr, unsigned cg, unsigned cb,
430
calc_type b = (bgr >> 14) & 0xFFC0;
431
calc_type g = (bgr >> 4) & 0xFFC0;
432
calc_type r = (bgr << 6) & 0xFFC0;
434
(((((cb - b) * alpha + (b << 16)) >> 2) & 0x3FF00000) |
435
((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) |
436
(((cr - r) * alpha + (r << 16)) >> 22) | 0xC0000000);
439
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
441
return (pixel_type)(((b & 0xFFC0) << 14) |
442
((g & 0xFFC0) << 4) |
443
(r >> 6) | 0xC0000000);
446
static AGG_INLINE color_type make_color(pixel_type p)
448
return color_type((p << 6) & 0xFFC0,
456
//=================================================blender_bgrAAA_pre
457
struct blender_bgrAAA_pre
459
typedef rgba16 color_type;
460
typedef color_type::value_type value_type;
461
typedef color_type::calc_type calc_type;
462
typedef int32u pixel_type;
464
static AGG_INLINE void blend_pix(pixel_type* p,
465
unsigned cr, unsigned cg, unsigned cb,
469
alpha = color_type::base_mask - alpha;
470
cover = (cover + 1) << (color_type::base_shift - 8);
472
calc_type b = (bgr >> 14) & 0xFFC0;
473
calc_type g = (bgr >> 4) & 0xFFC0;
474
calc_type r = (bgr << 6) & 0xFFC0;
476
((((b * alpha + cb * cover) >> 2) & 0x3FF00000) |
477
(((g * alpha + cg * cover) >> 12) & 0x000FFC00) |
478
((r * alpha + cr * cover) >> 22) | 0xC0000000);
481
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
483
return (pixel_type)(((b & 0xFFC0) << 14) |
484
((g & 0xFFC0) << 4) |
485
(r >> 6) | 0xC0000000);
488
static AGG_INLINE color_type make_color(pixel_type p)
490
return color_type((p << 6) & 0xFFC0,
498
//=================================================blender_bgrAAA_gamma
499
template<class Gamma> class blender_bgrAAA_gamma
502
typedef rgba16 color_type;
503
typedef color_type::value_type value_type;
504
typedef color_type::calc_type calc_type;
505
typedef int32u pixel_type;
506
typedef Gamma gamma_type;
508
blender_bgrAAA_gamma() : m_gamma(0) {}
509
void gamma(const gamma_type& g) { m_gamma = &g; }
511
AGG_INLINE void blend_pix(pixel_type* p,
512
unsigned cr, unsigned cg, unsigned cb,
517
calc_type b = m_gamma->dir((bgr >> 14) & 0xFFC0);
518
calc_type g = m_gamma->dir((bgr >> 4) & 0xFFC0);
519
calc_type r = m_gamma->dir((bgr << 6) & 0xFFC0);
521
(((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 14) & 0x3FF00000) |
522
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) |
523
(m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 6 ) | 0xC0000000);
526
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
528
return (pixel_type)(((b & 0xFFC0) << 14) |
529
((g & 0xFFC0) << 4) |
530
(r >> 6) | 0xC0000000);
533
static AGG_INLINE color_type make_color(pixel_type p)
535
return color_type((p << 6) & 0xFFC0,
541
const Gamma* m_gamma;
546
//=====================================================blender_rgbBBA
547
struct blender_rgbBBA
549
typedef rgba16 color_type;
550
typedef color_type::value_type value_type;
551
typedef color_type::calc_type calc_type;
552
typedef int32u pixel_type;
554
static AGG_INLINE void blend_pix(pixel_type* p,
555
unsigned cr, unsigned cg, unsigned cb,
560
calc_type r = (rgb >> 16) & 0xFFE0;
561
calc_type g = (rgb >> 5) & 0xFFE0;
562
calc_type b = (rgb << 6) & 0xFFC0;
564
(((((cr - r) * alpha + (r << 16)) ) & 0xFFE00000) |
565
((((cg - g) * alpha + (g << 16)) >> 11) & 0x001FFC00) |
566
(((cb - b) * alpha + (b << 16)) >> 22));
569
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
571
return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6));
574
static AGG_INLINE color_type make_color(pixel_type p)
576
return color_type((p >> 16) & 0xFFE0,
583
//=================================================blender_rgbBBA_pre
584
struct blender_rgbBBA_pre
586
typedef rgba16 color_type;
587
typedef color_type::value_type value_type;
588
typedef color_type::calc_type calc_type;
589
typedef int32u pixel_type;
591
static AGG_INLINE void blend_pix(pixel_type* p,
592
unsigned cr, unsigned cg, unsigned cb,
596
alpha = color_type::base_mask - alpha;
597
cover = (cover + 1) << (color_type::base_shift - 8);
599
calc_type r = (rgb >> 16) & 0xFFE0;
600
calc_type g = (rgb >> 5) & 0xFFE0;
601
calc_type b = (rgb << 6) & 0xFFC0;
603
((((r * alpha + cr * cover) ) & 0xFFE00000) |
604
(((g * alpha + cg * cover) >> 11) & 0x001FFC00) |
605
((b * alpha + cb * cover) >> 22));
608
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
610
return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6));
613
static AGG_INLINE color_type make_color(pixel_type p)
615
return color_type((p >> 16) & 0xFFE0,
623
//=================================================blender_rgbBBA_gamma
624
template<class Gamma> class blender_rgbBBA_gamma
627
typedef rgba16 color_type;
628
typedef color_type::value_type value_type;
629
typedef color_type::calc_type calc_type;
630
typedef int32u pixel_type;
631
typedef Gamma gamma_type;
633
blender_rgbBBA_gamma() : m_gamma(0) {}
634
void gamma(const gamma_type& g) { m_gamma = &g; }
636
AGG_INLINE void blend_pix(pixel_type* p,
637
unsigned cr, unsigned cg, unsigned cb,
642
calc_type r = m_gamma->dir((rgb >> 16) & 0xFFE0);
643
calc_type g = m_gamma->dir((rgb >> 5) & 0xFFE0);
644
calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0);
646
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 16) & 0xFFE00000) |
647
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 5 ) & 0x001FFC00) |
648
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 ));
651
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
653
return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6));
656
static AGG_INLINE color_type make_color(pixel_type p)
658
return color_type((p >> 16) & 0xFFE0,
664
const Gamma* m_gamma;
668
//=====================================================blender_bgrABB
669
struct blender_bgrABB
671
typedef rgba16 color_type;
672
typedef color_type::value_type value_type;
673
typedef color_type::calc_type calc_type;
674
typedef int32u pixel_type;
676
static AGG_INLINE void blend_pix(pixel_type* p,
677
unsigned cr, unsigned cg, unsigned cb,
682
calc_type b = (bgr >> 16) & 0xFFC0;
683
calc_type g = (bgr >> 6) & 0xFFE0;
684
calc_type r = (bgr << 5) & 0xFFE0;
686
(((((cb - b) * alpha + (b << 16)) ) & 0xFFC00000) |
687
((((cg - g) * alpha + (g << 16)) >> 10) & 0x003FF800) |
688
(((cr - r) * alpha + (r << 16)) >> 21));
691
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
693
return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5));
696
static AGG_INLINE color_type make_color(pixel_type p)
698
return color_type((p << 5) & 0xFFE0,
705
//=================================================blender_bgrABB_pre
706
struct blender_bgrABB_pre
708
typedef rgba16 color_type;
709
typedef color_type::value_type value_type;
710
typedef color_type::calc_type calc_type;
711
typedef int32u pixel_type;
713
static AGG_INLINE void blend_pix(pixel_type* p,
714
unsigned cr, unsigned cg, unsigned cb,
718
alpha = color_type::base_mask - alpha;
719
cover = (cover + 1) << (color_type::base_shift - 8);
721
calc_type b = (bgr >> 16) & 0xFFC0;
722
calc_type g = (bgr >> 6) & 0xFFE0;
723
calc_type r = (bgr << 5) & 0xFFE0;
725
((((b * alpha + cb * cover) ) & 0xFFC00000) |
726
(((g * alpha + cg * cover) >> 10) & 0x003FF800) |
727
((r * alpha + cr * cover) >> 21));
730
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
732
return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5));
735
static AGG_INLINE color_type make_color(pixel_type p)
737
return color_type((p << 5) & 0xFFE0,
745
//=================================================blender_bgrABB_gamma
746
template<class Gamma> class blender_bgrABB_gamma
749
typedef rgba16 color_type;
750
typedef color_type::value_type value_type;
751
typedef color_type::calc_type calc_type;
752
typedef int32u pixel_type;
753
typedef Gamma gamma_type;
755
blender_bgrABB_gamma() : m_gamma(0) {}
756
void gamma(const gamma_type& g) { m_gamma = &g; }
758
AGG_INLINE void blend_pix(pixel_type* p,
759
unsigned cr, unsigned cg, unsigned cb,
764
calc_type b = m_gamma->dir((bgr >> 16) & 0xFFC0);
765
calc_type g = m_gamma->dir((bgr >> 6) & 0xFFE0);
766
calc_type r = m_gamma->dir((bgr << 5) & 0xFFE0);
768
(((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 16) & 0xFFC00000) |
769
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 6 ) & 0x003FF800) |
770
(m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 5 ));
773
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
775
return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5));
778
static AGG_INLINE color_type make_color(pixel_type p)
780
return color_type((p << 5) & 0xFFE0,
786
const Gamma* m_gamma;
791
//===========================================pixfmt_alpha_blend_rgb_packed
792
template<class Blender, class RenBuf> class pixfmt_alpha_blend_rgb_packed
795
typedef RenBuf rbuf_type;
796
typedef typename rbuf_type::row_data row_data;
797
typedef Blender blender_type;
798
typedef typename blender_type::color_type color_type;
799
typedef typename blender_type::pixel_type pixel_type;
800
typedef int order_type; // A fake one
801
typedef typename color_type::value_type value_type;
802
typedef typename color_type::calc_type calc_type;
805
base_shift = color_type::base_shift,
806
base_scale = color_type::base_scale,
807
base_mask = color_type::base_mask,
808
pix_width = sizeof(pixel_type)
812
//--------------------------------------------------------------------
813
AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover)
817
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
818
if(alpha == base_mask)
820
*p = m_blender.make_pix(c.r, c.g, c.b);
824
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover);
830
//--------------------------------------------------------------------
831
explicit pixfmt_alpha_blend_rgb_packed(rbuf_type& rb) : m_rbuf(&rb) {}
832
void attach(rbuf_type& rb) { m_rbuf = &rb; }
834
//--------------------------------------------------------------------
835
template<class PixFmt>
836
bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2)
838
rect_i r(x1, y1, x2, y2);
839
if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1)))
841
int stride = pixf.stride();
842
m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1),
851
Blender& blender() { return m_blender; }
853
//--------------------------------------------------------------------
854
AGG_INLINE unsigned width() const { return m_rbuf->width(); }
855
AGG_INLINE unsigned height() const { return m_rbuf->height(); }
856
AGG_INLINE int stride() const { return m_rbuf->stride(); }
858
//--------------------------------------------------------------------
859
AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); }
860
AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); }
861
AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); }
863
//--------------------------------------------------------------------
864
AGG_INLINE int8u* pix_ptr(int x, int y)
866
return m_rbuf->row_ptr(y) + x * pix_width;
869
AGG_INLINE const int8u* pix_ptr(int x, int y) const
871
return m_rbuf->row_ptr(y) + x * pix_width;
874
//--------------------------------------------------------------------
875
AGG_INLINE void make_pix(int8u* p, const color_type& c)
877
*(pixel_type*)p = m_blender.make_pix(c.r, c.g, c.b);
880
//--------------------------------------------------------------------
881
AGG_INLINE color_type pixel(int x, int y) const
883
return m_blender.make_color(((pixel_type*)m_rbuf->row_ptr(y))[x]);
886
//--------------------------------------------------------------------
887
AGG_INLINE void copy_pixel(int x, int y, const color_type& c)
890
m_rbuf->row_ptr(x, y, 1))[x] =
891
m_blender.make_pix(c.r, c.g, c.b);
894
//--------------------------------------------------------------------
895
AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover)
897
copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y, 1) + x, c, cover);
900
//--------------------------------------------------------------------
901
AGG_INLINE void copy_hline(int x, int y,
905
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
906
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
914
//--------------------------------------------------------------------
915
AGG_INLINE void copy_vline(int x, int y,
919
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
922
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x;
928
//--------------------------------------------------------------------
929
void blend_hline(int x, int y,
936
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
937
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
938
if(alpha == base_mask)
940
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
951
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover);
959
//--------------------------------------------------------------------
960
void blend_vline(int x, int y,
967
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
968
if(alpha == base_mask)
970
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
973
((pixel_type*)m_rbuf->row_ptr(x, y++, 1))[x] = v;
982
(pixel_type*)m_rbuf->row_ptr(x, y++, 1),
983
c.r, c.g, c.b, alpha, cover);
990
//--------------------------------------------------------------------
991
void blend_solid_hspan(int x, int y,
996
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
999
copy_or_blend_pix(p, c, *covers++);
1005
//--------------------------------------------------------------------
1006
void blend_solid_vspan(int x, int y,
1008
const color_type& c,
1009
const int8u* covers)
1013
copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x,
1019
//--------------------------------------------------------------------
1020
void copy_color_hspan(int x, int y,
1022
const color_type* colors)
1024
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
1027
*p++ = m_blender.make_pix(colors->r, colors->g, colors->b);
1033
//--------------------------------------------------------------------
1034
void copy_color_vspan(int x, int y,
1036
const color_type* colors)
1040
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x;
1041
*p = m_blender.make_pix(colors->r, colors->g, colors->b);
1047
//--------------------------------------------------------------------
1048
void blend_color_hspan(int x, int y,
1050
const color_type* colors,
1051
const int8u* covers,
1054
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
1057
copy_or_blend_pix(p++, *colors++, covers ? *covers++ : cover);
1062
//--------------------------------------------------------------------
1063
void blend_color_vspan(int x, int y,
1065
const color_type* colors,
1066
const int8u* covers,
1071
copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x,
1072
*colors++, covers ? *covers++ : cover);
1077
//--------------------------------------------------------------------
1078
template<class RenBuf2>
1079
void copy_from(const RenBuf2& from,
1084
const int8u* p = from.row_ptr(ysrc);
1087
memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width,
1088
p + xsrc * pix_width,
1093
//--------------------------------------------------------------------
1094
template<class SrcPixelFormatRenderer>
1095
void blend_from(const SrcPixelFormatRenderer& from,
1101
typedef typename SrcPixelFormatRenderer::order_type src_order;
1103
const value_type* psrc = (const value_type*)from.row_ptr(ysrc);
1108
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
1111
value_type alpha = psrc[src_order::A];
1114
if(alpha == base_mask && cover == 255)
1116
*pdst = m_blender.make_pix(psrc[src_order::R],
1118
psrc[src_order::B]);
1122
m_blender.blend_pix(pdst,
1137
//--------------------------------------------------------------------
1138
template<class SrcPixelFormatRenderer>
1139
void blend_from_color(const SrcPixelFormatRenderer& from,
1140
const color_type& color,
1146
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
1147
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
1151
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
1155
m_blender.blend_pix(pdst,
1156
color.r, color.g, color.b, color.a,
1165
//--------------------------------------------------------------------
1166
template<class SrcPixelFormatRenderer>
1167
void blend_from_lut(const SrcPixelFormatRenderer& from,
1168
const color_type* color_lut,
1174
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
1175
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
1179
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
1183
const color_type& color = color_lut[*psrc];
1184
m_blender.blend_pix(pdst,
1185
color.r, color.g, color.b, color.a,
1201
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb555, rendering_buffer> pixfmt_rgb555; //----pixfmt_rgb555
1202
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb565, rendering_buffer> pixfmt_rgb565; //----pixfmt_rgb565
1204
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb555_pre, rendering_buffer> pixfmt_rgb555_pre; //----pixfmt_rgb555_pre
1205
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb565_pre, rendering_buffer> pixfmt_rgb565_pre; //----pixfmt_rgb565_pre
1207
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbAAA, rendering_buffer> pixfmt_rgbAAA; //----pixfmt_rgbAAA
1208
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrAAA, rendering_buffer> pixfmt_bgrAAA; //----pixfmt_bgrAAA
1209
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbBBA, rendering_buffer> pixfmt_rgbBBA; //----pixfmt_rgbBBA
1210
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrABB, rendering_buffer> pixfmt_bgrABB; //----pixfmt_bgrABB
1212
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbAAA_pre, rendering_buffer> pixfmt_rgbAAA_pre; //----pixfmt_rgbAAA_pre
1213
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrAAA_pre, rendering_buffer> pixfmt_bgrAAA_pre; //----pixfmt_bgrAAA_pre
1214
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_pre, rendering_buffer> pixfmt_rgbBBA_pre; //----pixfmt_rgbBBA_pre
1215
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrABB_pre, rendering_buffer> pixfmt_bgrABB_pre; //----pixfmt_bgrABB_pre
1218
//-----------------------------------------------------pixfmt_rgb555_gamma
1219
template<class Gamma> class pixfmt_rgb555_gamma :
1220
public pixfmt_alpha_blend_rgb_packed<blender_rgb555_gamma<Gamma>,
1224
pixfmt_rgb555_gamma(rendering_buffer& rb, const Gamma& g) :
1225
pixfmt_alpha_blend_rgb_packed<blender_rgb555_gamma<Gamma>,
1226
rendering_buffer>(rb)
1228
this->blender().gamma(g);
1233
//-----------------------------------------------------pixfmt_rgb565_gamma
1234
template<class Gamma> class pixfmt_rgb565_gamma :
1235
public pixfmt_alpha_blend_rgb_packed<blender_rgb565_gamma<Gamma>, rendering_buffer>
1238
pixfmt_rgb565_gamma(rendering_buffer& rb, const Gamma& g) :
1239
pixfmt_alpha_blend_rgb_packed<blender_rgb565_gamma<Gamma>, rendering_buffer>(rb)
1241
this->blender().gamma(g);
1246
//-----------------------------------------------------pixfmt_rgbAAA_gamma
1247
template<class Gamma> class pixfmt_rgbAAA_gamma :
1248
public pixfmt_alpha_blend_rgb_packed<blender_rgbAAA_gamma<Gamma>,
1252
pixfmt_rgbAAA_gamma(rendering_buffer& rb, const Gamma& g) :
1253
pixfmt_alpha_blend_rgb_packed<blender_rgbAAA_gamma<Gamma>,
1254
rendering_buffer>(rb)
1256
this->blender().gamma(g);
1261
//-----------------------------------------------------pixfmt_bgrAAA_gamma
1262
template<class Gamma> class pixfmt_bgrAAA_gamma :
1263
public pixfmt_alpha_blend_rgb_packed<blender_bgrAAA_gamma<Gamma>,
1267
pixfmt_bgrAAA_gamma(rendering_buffer& rb, const Gamma& g) :
1268
pixfmt_alpha_blend_rgb_packed<blender_bgrAAA_gamma<Gamma>,
1269
rendering_buffer>(rb)
1271
this->blender().gamma(g);
1276
//-----------------------------------------------------pixfmt_rgbBBA_gamma
1277
template<class Gamma> class pixfmt_rgbBBA_gamma :
1278
public pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_gamma<Gamma>,
1282
pixfmt_rgbBBA_gamma(rendering_buffer& rb, const Gamma& g) :
1283
pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_gamma<Gamma>,
1284
rendering_buffer>(rb)
1286
this->blender().gamma(g);
1291
//-----------------------------------------------------pixfmt_bgrABB_gamma
1292
template<class Gamma> class pixfmt_bgrABB_gamma :
1293
public pixfmt_alpha_blend_rgb_packed<blender_bgrABB_gamma<Gamma>,
1297
pixfmt_bgrABB_gamma(rendering_buffer& rb, const Gamma& g) :
1298
pixfmt_alpha_blend_rgb_packed<blender_bgrABB_gamma<Gamma>,
1299
rendering_buffer>(rb)
1301
this->blender().gamma(g);
1
//----------------------------------------------------------------------------
2
// Anti-Grain Geometry - Version 2.4
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5
// Permission to copy, use, modify, sell and distribute this software
6
// is granted provided this copyright notice appears in all copies.
7
// This software is provided "as is" without express or implied
8
// warranty, and with no claim as to its suitability for any purpose.
10
//----------------------------------------------------------------------------
11
// Contact: mcseem@antigrain.com
12
// mcseemagg@yahoo.com
13
// http://www.antigrain.com
14
//----------------------------------------------------------------------------
16
// Adaptation for high precision colors has been sponsored by
17
// Liberty Technology Systems, Inc., visit http://lib-sys.com
19
// Liberty Technology Systems, Inc. is the provider of
20
// PostScript and PDF technology for software developers.
22
//----------------------------------------------------------------------------
24
#ifndef AGG_PIXFMT_RGB_PACKED_INCLUDED
25
#define AGG_PIXFMT_RGB_PACKED_INCLUDED
28
#include "agg_basics.h"
29
#include "agg_color_rgba.h"
30
#include "agg_rendering_buffer.h"
34
//=========================================================blender_rgb555
37
typedef rgba8 color_type;
38
typedef color_type::value_type value_type;
39
typedef color_type::calc_type calc_type;
40
typedef int16u pixel_type;
42
static AGG_INLINE void blend_pix(pixel_type* p,
43
unsigned cr, unsigned cg, unsigned cb,
48
calc_type r = (rgb >> 7) & 0xF8;
49
calc_type g = (rgb >> 2) & 0xF8;
50
calc_type b = (rgb << 3) & 0xF8;
52
(((((cr - r) * alpha + (r << 8)) >> 1) & 0x7C00) |
53
((((cg - g) * alpha + (g << 8)) >> 6) & 0x03E0) |
54
(((cb - b) * alpha + (b << 8)) >> 11) | 0x8000);
57
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
59
return (pixel_type)(((r & 0xF8) << 7) |
64
static AGG_INLINE color_type make_color(pixel_type p)
66
return color_type((p >> 7) & 0xF8,
73
//=====================================================blender_rgb555_pre
74
struct blender_rgb555_pre
76
typedef rgba8 color_type;
77
typedef color_type::value_type value_type;
78
typedef color_type::calc_type calc_type;
79
typedef int16u pixel_type;
81
static AGG_INLINE void blend_pix(pixel_type* p,
82
unsigned cr, unsigned cg, unsigned cb,
86
alpha = color_type::base_mask - alpha;
88
calc_type r = (rgb >> 7) & 0xF8;
89
calc_type g = (rgb >> 2) & 0xF8;
90
calc_type b = (rgb << 3) & 0xF8;
92
((((r * alpha + cr * cover) >> 1) & 0x7C00) |
93
(((g * alpha + cg * cover) >> 6) & 0x03E0) |
94
((b * alpha + cb * cover) >> 11) | 0x8000);
97
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
99
return (pixel_type)(((r & 0xF8) << 7) |
104
static AGG_INLINE color_type make_color(pixel_type p)
106
return color_type((p >> 7) & 0xF8,
115
//=====================================================blender_rgb555_gamma
116
template<class Gamma> class blender_rgb555_gamma
119
typedef rgba8 color_type;
120
typedef color_type::value_type value_type;
121
typedef color_type::calc_type calc_type;
122
typedef int16u pixel_type;
123
typedef Gamma gamma_type;
125
blender_rgb555_gamma() : m_gamma(0) {}
126
void gamma(const gamma_type& g) { m_gamma = &g; }
128
AGG_INLINE void blend_pix(pixel_type* p,
129
unsigned cr, unsigned cg, unsigned cb,
134
calc_type r = m_gamma->dir((rgb >> 7) & 0xF8);
135
calc_type g = m_gamma->dir((rgb >> 2) & 0xF8);
136
calc_type b = m_gamma->dir((rgb << 3) & 0xF8);
138
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 7) & 0x7C00) |
139
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 2) & 0x03E0) |
140
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3) | 0x8000);
143
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
145
return (pixel_type)(((r & 0xF8) << 7) |
150
static AGG_INLINE color_type make_color(pixel_type p)
152
return color_type((p >> 7) & 0xF8,
158
const Gamma* m_gamma;
165
//=========================================================blender_rgb565
166
struct blender_rgb565
168
typedef rgba8 color_type;
169
typedef color_type::value_type value_type;
170
typedef color_type::calc_type calc_type;
171
typedef int16u pixel_type;
173
static AGG_INLINE void blend_pix(pixel_type* p,
174
unsigned cr, unsigned cg, unsigned cb,
179
calc_type r = (rgb >> 8) & 0xF8;
180
calc_type g = (rgb >> 3) & 0xFC;
181
calc_type b = (rgb << 3) & 0xF8;
183
(((((cr - r) * alpha + (r << 8)) ) & 0xF800) |
184
((((cg - g) * alpha + (g << 8)) >> 5) & 0x07E0) |
185
(((cb - b) * alpha + (b << 8)) >> 11));
188
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
190
return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
193
static AGG_INLINE color_type make_color(pixel_type p)
195
return color_type((p >> 8) & 0xF8,
203
//=====================================================blender_rgb565_pre
204
struct blender_rgb565_pre
206
typedef rgba8 color_type;
207
typedef color_type::value_type value_type;
208
typedef color_type::calc_type calc_type;
209
typedef int16u pixel_type;
211
static AGG_INLINE void blend_pix(pixel_type* p,
212
unsigned cr, unsigned cg, unsigned cb,
216
alpha = color_type::base_mask - alpha;
218
calc_type r = (rgb >> 8) & 0xF8;
219
calc_type g = (rgb >> 3) & 0xFC;
220
calc_type b = (rgb << 3) & 0xF8;
222
((((r * alpha + cr * cover) ) & 0xF800) |
223
(((g * alpha + cg * cover) >> 5 ) & 0x07E0) |
224
((b * alpha + cb * cover) >> 11));
227
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
229
return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
232
static AGG_INLINE color_type make_color(pixel_type p)
234
return color_type((p >> 8) & 0xF8,
242
//=====================================================blender_rgb565_gamma
243
template<class Gamma> class blender_rgb565_gamma
246
typedef rgba8 color_type;
247
typedef color_type::value_type value_type;
248
typedef color_type::calc_type calc_type;
249
typedef int16u pixel_type;
250
typedef Gamma gamma_type;
252
blender_rgb565_gamma() : m_gamma(0) {}
253
void gamma(const gamma_type& g) { m_gamma = &g; }
255
AGG_INLINE void blend_pix(pixel_type* p,
256
unsigned cr, unsigned cg, unsigned cb,
261
calc_type r = m_gamma->dir((rgb >> 8) & 0xF8);
262
calc_type g = m_gamma->dir((rgb >> 3) & 0xFC);
263
calc_type b = m_gamma->dir((rgb << 3) & 0xF8);
265
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 8) & 0xF800) |
266
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 3) & 0x07E0) |
267
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3));
270
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
272
return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
275
static AGG_INLINE color_type make_color(pixel_type p)
277
return color_type((p >> 8) & 0xF8,
283
const Gamma* m_gamma;
288
//=====================================================blender_rgbAAA
289
struct blender_rgbAAA
291
typedef rgba16 color_type;
292
typedef color_type::value_type value_type;
293
typedef color_type::calc_type calc_type;
294
typedef int32u pixel_type;
296
static AGG_INLINE void blend_pix(pixel_type* p,
297
unsigned cr, unsigned cg, unsigned cb,
302
calc_type r = (rgb >> 14) & 0xFFC0;
303
calc_type g = (rgb >> 4) & 0xFFC0;
304
calc_type b = (rgb << 6) & 0xFFC0;
306
(((((cr - r) * alpha + (r << 16)) >> 2) & 0x3FF00000) |
307
((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) |
308
(((cb - b) * alpha + (b << 16)) >> 22) | 0xC0000000);
311
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
313
return (pixel_type)(((r & 0xFFC0) << 14) |
314
((g & 0xFFC0) << 4) |
315
(b >> 6) | 0xC0000000);
318
static AGG_INLINE color_type make_color(pixel_type p)
320
return color_type((p >> 14) & 0xFFC0,
328
//==================================================blender_rgbAAA_pre
329
struct blender_rgbAAA_pre
331
typedef rgba16 color_type;
332
typedef color_type::value_type value_type;
333
typedef color_type::calc_type calc_type;
334
typedef int32u pixel_type;
336
static AGG_INLINE void blend_pix(pixel_type* p,
337
unsigned cr, unsigned cg, unsigned cb,
341
alpha = color_type::base_mask - alpha;
342
cover = (cover + 1) << (color_type::base_shift - 8);
344
calc_type r = (rgb >> 14) & 0xFFC0;
345
calc_type g = (rgb >> 4) & 0xFFC0;
346
calc_type b = (rgb << 6) & 0xFFC0;
348
((((r * alpha + cr * cover) >> 2) & 0x3FF00000) |
349
(((g * alpha + cg * cover) >> 12) & 0x000FFC00) |
350
((b * alpha + cb * cover) >> 22) | 0xC0000000);
353
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
355
return (pixel_type)(((r & 0xFFC0) << 14) |
356
((g & 0xFFC0) << 4) |
357
(b >> 6) | 0xC0000000);
360
static AGG_INLINE color_type make_color(pixel_type p)
362
return color_type((p >> 14) & 0xFFC0,
370
//=================================================blender_rgbAAA_gamma
371
template<class Gamma> class blender_rgbAAA_gamma
374
typedef rgba16 color_type;
375
typedef color_type::value_type value_type;
376
typedef color_type::calc_type calc_type;
377
typedef int32u pixel_type;
378
typedef Gamma gamma_type;
380
blender_rgbAAA_gamma() : m_gamma(0) {}
381
void gamma(const gamma_type& g) { m_gamma = &g; }
383
AGG_INLINE void blend_pix(pixel_type* p,
384
unsigned cr, unsigned cg, unsigned cb,
389
calc_type r = m_gamma->dir((rgb >> 14) & 0xFFC0);
390
calc_type g = m_gamma->dir((rgb >> 4) & 0xFFC0);
391
calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0);
393
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 14) & 0x3FF00000) |
394
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) |
395
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 ) | 0xC0000000);
398
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
400
return (pixel_type)(((r & 0xFFC0) << 14) |
401
((g & 0xFFC0) << 4) |
402
(b >> 6) | 0xC0000000);
405
static AGG_INLINE color_type make_color(pixel_type p)
407
return color_type((p >> 14) & 0xFFC0,
412
const Gamma* m_gamma;
416
//=====================================================blender_bgrAAA
417
struct blender_bgrAAA
419
typedef rgba16 color_type;
420
typedef color_type::value_type value_type;
421
typedef color_type::calc_type calc_type;
422
typedef int32u pixel_type;
424
static AGG_INLINE void blend_pix(pixel_type* p,
425
unsigned cr, unsigned cg, unsigned cb,
430
calc_type b = (bgr >> 14) & 0xFFC0;
431
calc_type g = (bgr >> 4) & 0xFFC0;
432
calc_type r = (bgr << 6) & 0xFFC0;
434
(((((cb - b) * alpha + (b << 16)) >> 2) & 0x3FF00000) |
435
((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) |
436
(((cr - r) * alpha + (r << 16)) >> 22) | 0xC0000000);
439
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
441
return (pixel_type)(((b & 0xFFC0) << 14) |
442
((g & 0xFFC0) << 4) |
443
(r >> 6) | 0xC0000000);
446
static AGG_INLINE color_type make_color(pixel_type p)
448
return color_type((p << 6) & 0xFFC0,
456
//=================================================blender_bgrAAA_pre
457
struct blender_bgrAAA_pre
459
typedef rgba16 color_type;
460
typedef color_type::value_type value_type;
461
typedef color_type::calc_type calc_type;
462
typedef int32u pixel_type;
464
static AGG_INLINE void blend_pix(pixel_type* p,
465
unsigned cr, unsigned cg, unsigned cb,
469
alpha = color_type::base_mask - alpha;
470
cover = (cover + 1) << (color_type::base_shift - 8);
472
calc_type b = (bgr >> 14) & 0xFFC0;
473
calc_type g = (bgr >> 4) & 0xFFC0;
474
calc_type r = (bgr << 6) & 0xFFC0;
476
((((b * alpha + cb * cover) >> 2) & 0x3FF00000) |
477
(((g * alpha + cg * cover) >> 12) & 0x000FFC00) |
478
((r * alpha + cr * cover) >> 22) | 0xC0000000);
481
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
483
return (pixel_type)(((b & 0xFFC0) << 14) |
484
((g & 0xFFC0) << 4) |
485
(r >> 6) | 0xC0000000);
488
static AGG_INLINE color_type make_color(pixel_type p)
490
return color_type((p << 6) & 0xFFC0,
498
//=================================================blender_bgrAAA_gamma
499
template<class Gamma> class blender_bgrAAA_gamma
502
typedef rgba16 color_type;
503
typedef color_type::value_type value_type;
504
typedef color_type::calc_type calc_type;
505
typedef int32u pixel_type;
506
typedef Gamma gamma_type;
508
blender_bgrAAA_gamma() : m_gamma(0) {}
509
void gamma(const gamma_type& g) { m_gamma = &g; }
511
AGG_INLINE void blend_pix(pixel_type* p,
512
unsigned cr, unsigned cg, unsigned cb,
517
calc_type b = m_gamma->dir((bgr >> 14) & 0xFFC0);
518
calc_type g = m_gamma->dir((bgr >> 4) & 0xFFC0);
519
calc_type r = m_gamma->dir((bgr << 6) & 0xFFC0);
521
(((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 14) & 0x3FF00000) |
522
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) |
523
(m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 6 ) | 0xC0000000);
526
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
528
return (pixel_type)(((b & 0xFFC0) << 14) |
529
((g & 0xFFC0) << 4) |
530
(r >> 6) | 0xC0000000);
533
static AGG_INLINE color_type make_color(pixel_type p)
535
return color_type((p << 6) & 0xFFC0,
541
const Gamma* m_gamma;
546
//=====================================================blender_rgbBBA
547
struct blender_rgbBBA
549
typedef rgba16 color_type;
550
typedef color_type::value_type value_type;
551
typedef color_type::calc_type calc_type;
552
typedef int32u pixel_type;
554
static AGG_INLINE void blend_pix(pixel_type* p,
555
unsigned cr, unsigned cg, unsigned cb,
560
calc_type r = (rgb >> 16) & 0xFFE0;
561
calc_type g = (rgb >> 5) & 0xFFE0;
562
calc_type b = (rgb << 6) & 0xFFC0;
564
(((((cr - r) * alpha + (r << 16)) ) & 0xFFE00000) |
565
((((cg - g) * alpha + (g << 16)) >> 11) & 0x001FFC00) |
566
(((cb - b) * alpha + (b << 16)) >> 22));
569
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
571
return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6));
574
static AGG_INLINE color_type make_color(pixel_type p)
576
return color_type((p >> 16) & 0xFFE0,
583
//=================================================blender_rgbBBA_pre
584
struct blender_rgbBBA_pre
586
typedef rgba16 color_type;
587
typedef color_type::value_type value_type;
588
typedef color_type::calc_type calc_type;
589
typedef int32u pixel_type;
591
static AGG_INLINE void blend_pix(pixel_type* p,
592
unsigned cr, unsigned cg, unsigned cb,
596
alpha = color_type::base_mask - alpha;
597
cover = (cover + 1) << (color_type::base_shift - 8);
599
calc_type r = (rgb >> 16) & 0xFFE0;
600
calc_type g = (rgb >> 5) & 0xFFE0;
601
calc_type b = (rgb << 6) & 0xFFC0;
603
((((r * alpha + cr * cover) ) & 0xFFE00000) |
604
(((g * alpha + cg * cover) >> 11) & 0x001FFC00) |
605
((b * alpha + cb * cover) >> 22));
608
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
610
return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6));
613
static AGG_INLINE color_type make_color(pixel_type p)
615
return color_type((p >> 16) & 0xFFE0,
623
//=================================================blender_rgbBBA_gamma
624
template<class Gamma> class blender_rgbBBA_gamma
627
typedef rgba16 color_type;
628
typedef color_type::value_type value_type;
629
typedef color_type::calc_type calc_type;
630
typedef int32u pixel_type;
631
typedef Gamma gamma_type;
633
blender_rgbBBA_gamma() : m_gamma(0) {}
634
void gamma(const gamma_type& g) { m_gamma = &g; }
636
AGG_INLINE void blend_pix(pixel_type* p,
637
unsigned cr, unsigned cg, unsigned cb,
642
calc_type r = m_gamma->dir((rgb >> 16) & 0xFFE0);
643
calc_type g = m_gamma->dir((rgb >> 5) & 0xFFE0);
644
calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0);
646
(((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 16) & 0xFFE00000) |
647
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 5 ) & 0x001FFC00) |
648
(m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 ));
651
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
653
return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6));
656
static AGG_INLINE color_type make_color(pixel_type p)
658
return color_type((p >> 16) & 0xFFE0,
664
const Gamma* m_gamma;
668
//=====================================================blender_bgrABB
669
struct blender_bgrABB
671
typedef rgba16 color_type;
672
typedef color_type::value_type value_type;
673
typedef color_type::calc_type calc_type;
674
typedef int32u pixel_type;
676
static AGG_INLINE void blend_pix(pixel_type* p,
677
unsigned cr, unsigned cg, unsigned cb,
682
calc_type b = (bgr >> 16) & 0xFFC0;
683
calc_type g = (bgr >> 6) & 0xFFE0;
684
calc_type r = (bgr << 5) & 0xFFE0;
686
(((((cb - b) * alpha + (b << 16)) ) & 0xFFC00000) |
687
((((cg - g) * alpha + (g << 16)) >> 10) & 0x003FF800) |
688
(((cr - r) * alpha + (r << 16)) >> 21));
691
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
693
return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5));
696
static AGG_INLINE color_type make_color(pixel_type p)
698
return color_type((p << 5) & 0xFFE0,
705
//=================================================blender_bgrABB_pre
706
struct blender_bgrABB_pre
708
typedef rgba16 color_type;
709
typedef color_type::value_type value_type;
710
typedef color_type::calc_type calc_type;
711
typedef int32u pixel_type;
713
static AGG_INLINE void blend_pix(pixel_type* p,
714
unsigned cr, unsigned cg, unsigned cb,
718
alpha = color_type::base_mask - alpha;
719
cover = (cover + 1) << (color_type::base_shift - 8);
721
calc_type b = (bgr >> 16) & 0xFFC0;
722
calc_type g = (bgr >> 6) & 0xFFE0;
723
calc_type r = (bgr << 5) & 0xFFE0;
725
((((b * alpha + cb * cover) ) & 0xFFC00000) |
726
(((g * alpha + cg * cover) >> 10) & 0x003FF800) |
727
((r * alpha + cr * cover) >> 21));
730
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
732
return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5));
735
static AGG_INLINE color_type make_color(pixel_type p)
737
return color_type((p << 5) & 0xFFE0,
745
//=================================================blender_bgrABB_gamma
746
template<class Gamma> class blender_bgrABB_gamma
749
typedef rgba16 color_type;
750
typedef color_type::value_type value_type;
751
typedef color_type::calc_type calc_type;
752
typedef int32u pixel_type;
753
typedef Gamma gamma_type;
755
blender_bgrABB_gamma() : m_gamma(0) {}
756
void gamma(const gamma_type& g) { m_gamma = &g; }
758
AGG_INLINE void blend_pix(pixel_type* p,
759
unsigned cr, unsigned cg, unsigned cb,
764
calc_type b = m_gamma->dir((bgr >> 16) & 0xFFC0);
765
calc_type g = m_gamma->dir((bgr >> 6) & 0xFFE0);
766
calc_type r = m_gamma->dir((bgr << 5) & 0xFFE0);
768
(((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 16) & 0xFFC00000) |
769
((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 6 ) & 0x003FF800) |
770
(m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 5 ));
773
static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b)
775
return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5));
778
static AGG_INLINE color_type make_color(pixel_type p)
780
return color_type((p << 5) & 0xFFE0,
786
const Gamma* m_gamma;
791
//===========================================pixfmt_alpha_blend_rgb_packed
792
template<class Blender, class RenBuf> class pixfmt_alpha_blend_rgb_packed
795
typedef RenBuf rbuf_type;
796
typedef typename rbuf_type::row_data row_data;
797
typedef Blender blender_type;
798
typedef typename blender_type::color_type color_type;
799
typedef typename blender_type::pixel_type pixel_type;
800
typedef int order_type; // A fake one
801
typedef typename color_type::value_type value_type;
802
typedef typename color_type::calc_type calc_type;
805
base_shift = color_type::base_shift,
806
base_scale = color_type::base_scale,
807
base_mask = color_type::base_mask,
808
pix_width = sizeof(pixel_type),
812
//--------------------------------------------------------------------
813
AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover)
817
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
818
if(alpha == base_mask)
820
*p = m_blender.make_pix(c.r, c.g, c.b);
824
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover);
830
//--------------------------------------------------------------------
831
explicit pixfmt_alpha_blend_rgb_packed(rbuf_type& rb) : m_rbuf(&rb) {}
832
void attach(rbuf_type& rb) { m_rbuf = &rb; }
834
//--------------------------------------------------------------------
835
template<class PixFmt>
836
bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2)
838
rect_i r(x1, y1, x2, y2);
839
if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1)))
841
int stride = pixf.stride();
842
m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1),
851
Blender& blender() { return m_blender; }
853
//--------------------------------------------------------------------
854
AGG_INLINE unsigned width() const { return m_rbuf->width(); }
855
AGG_INLINE unsigned height() const { return m_rbuf->height(); }
856
AGG_INLINE int stride() const { return m_rbuf->stride(); }
858
//--------------------------------------------------------------------
859
AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); }
860
AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); }
861
AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); }
863
//--------------------------------------------------------------------
864
AGG_INLINE int8u* pix_ptr(int x, int y)
866
return m_rbuf->row_ptr(y) + x * pix_width;
869
AGG_INLINE const int8u* pix_ptr(int x, int y) const
871
return m_rbuf->row_ptr(y) + x * pix_width;
874
//--------------------------------------------------------------------
875
AGG_INLINE void make_pix(int8u* p, const color_type& c)
877
*(pixel_type*)p = m_blender.make_pix(c.r, c.g, c.b);
880
//--------------------------------------------------------------------
881
AGG_INLINE color_type pixel(int x, int y) const
883
return m_blender.make_color(((pixel_type*)m_rbuf->row_ptr(y))[x]);
886
//--------------------------------------------------------------------
887
AGG_INLINE void copy_pixel(int x, int y, const color_type& c)
890
m_rbuf->row_ptr(x, y, 1))[x] =
891
m_blender.make_pix(c.r, c.g, c.b);
894
//--------------------------------------------------------------------
895
AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover)
897
copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y, 1) + x, c, cover);
900
//--------------------------------------------------------------------
901
AGG_INLINE void copy_hline(int x, int y,
905
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
906
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
914
//--------------------------------------------------------------------
915
AGG_INLINE void copy_vline(int x, int y,
919
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
922
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x;
928
//--------------------------------------------------------------------
929
void blend_hline(int x, int y,
936
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
937
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
938
if(alpha == base_mask)
940
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
951
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover);
959
//--------------------------------------------------------------------
960
void blend_vline(int x, int y,
967
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
968
if(alpha == base_mask)
970
pixel_type v = m_blender.make_pix(c.r, c.g, c.b);
973
((pixel_type*)m_rbuf->row_ptr(x, y++, 1))[x] = v;
982
(pixel_type*)m_rbuf->row_ptr(x, y++, 1),
983
c.r, c.g, c.b, alpha, cover);
990
//--------------------------------------------------------------------
991
void blend_solid_hspan(int x, int y,
996
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
999
copy_or_blend_pix(p, c, *covers++);
1005
//--------------------------------------------------------------------
1006
void blend_solid_vspan(int x, int y,
1008
const color_type& c,
1009
const int8u* covers)
1013
copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x,
1019
//--------------------------------------------------------------------
1020
void copy_color_hspan(int x, int y,
1022
const color_type* colors)
1024
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
1027
*p++ = m_blender.make_pix(colors->r, colors->g, colors->b);
1033
//--------------------------------------------------------------------
1034
void copy_color_vspan(int x, int y,
1036
const color_type* colors)
1040
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x;
1041
*p = m_blender.make_pix(colors->r, colors->g, colors->b);
1047
//--------------------------------------------------------------------
1048
void blend_color_hspan(int x, int y,
1050
const color_type* colors,
1051
const int8u* covers,
1054
pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x;
1057
copy_or_blend_pix(p++, *colors++, covers ? *covers++ : cover);
1062
//--------------------------------------------------------------------
1063
void blend_color_vspan(int x, int y,
1065
const color_type* colors,
1066
const int8u* covers,
1071
copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x,
1072
*colors++, covers ? *covers++ : cover);
1077
//--------------------------------------------------------------------
1078
template<class RenBuf2>
1079
void copy_from(const RenBuf2& from,
1084
const int8u* p = from.row_ptr(ysrc);
1087
memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width,
1088
p + xsrc * pix_width,
1093
//--------------------------------------------------------------------
1094
template<class SrcPixelFormatRenderer>
1095
void blend_from(const SrcPixelFormatRenderer& from,
1101
typedef typename SrcPixelFormatRenderer::order_type src_order;
1103
const value_type* psrc = (const value_type*)from.row_ptr(ysrc);
1108
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
1111
value_type alpha = psrc[src_order::A];
1114
if(alpha == base_mask && cover == 255)
1116
*pdst = m_blender.make_pix(psrc[src_order::R],
1118
psrc[src_order::B]);
1122
m_blender.blend_pix(pdst,
1137
//--------------------------------------------------------------------
1138
template<class SrcPixelFormatRenderer>
1139
void blend_from_color(const SrcPixelFormatRenderer& from,
1140
const color_type& color,
1146
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
1147
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
1150
psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
1152
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
1156
m_blender.blend_pix(pdst,
1157
color.r, color.g, color.b, color.a,
1159
psrc += SrcPixelFormatRenderer::pix_step;
1166
//--------------------------------------------------------------------
1167
template<class SrcPixelFormatRenderer>
1168
void blend_from_lut(const SrcPixelFormatRenderer& from,
1169
const color_type* color_lut,
1175
typedef typename SrcPixelFormatRenderer::value_type src_value_type;
1176
const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc);
1179
psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset;
1181
(pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst;
1185
const color_type& color = color_lut[*psrc];
1186
m_blender.blend_pix(pdst,
1187
color.r, color.g, color.b, color.a,
1189
psrc += SrcPixelFormatRenderer::pix_step;
1203
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb555, rendering_buffer> pixfmt_rgb555; //----pixfmt_rgb555
1204
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb565, rendering_buffer> pixfmt_rgb565; //----pixfmt_rgb565
1206
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb555_pre, rendering_buffer> pixfmt_rgb555_pre; //----pixfmt_rgb555_pre
1207
typedef pixfmt_alpha_blend_rgb_packed<blender_rgb565_pre, rendering_buffer> pixfmt_rgb565_pre; //----pixfmt_rgb565_pre
1209
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbAAA, rendering_buffer> pixfmt_rgbAAA; //----pixfmt_rgbAAA
1210
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrAAA, rendering_buffer> pixfmt_bgrAAA; //----pixfmt_bgrAAA
1211
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbBBA, rendering_buffer> pixfmt_rgbBBA; //----pixfmt_rgbBBA
1212
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrABB, rendering_buffer> pixfmt_bgrABB; //----pixfmt_bgrABB
1214
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbAAA_pre, rendering_buffer> pixfmt_rgbAAA_pre; //----pixfmt_rgbAAA_pre
1215
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrAAA_pre, rendering_buffer> pixfmt_bgrAAA_pre; //----pixfmt_bgrAAA_pre
1216
typedef pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_pre, rendering_buffer> pixfmt_rgbBBA_pre; //----pixfmt_rgbBBA_pre
1217
typedef pixfmt_alpha_blend_rgb_packed<blender_bgrABB_pre, rendering_buffer> pixfmt_bgrABB_pre; //----pixfmt_bgrABB_pre
1220
//-----------------------------------------------------pixfmt_rgb555_gamma
1221
template<class Gamma> class pixfmt_rgb555_gamma :
1222
public pixfmt_alpha_blend_rgb_packed<blender_rgb555_gamma<Gamma>,
1226
pixfmt_rgb555_gamma(rendering_buffer& rb, const Gamma& g) :
1227
pixfmt_alpha_blend_rgb_packed<blender_rgb555_gamma<Gamma>,
1228
rendering_buffer>(rb)
1230
this->blender().gamma(g);
1235
//-----------------------------------------------------pixfmt_rgb565_gamma
1236
template<class Gamma> class pixfmt_rgb565_gamma :
1237
public pixfmt_alpha_blend_rgb_packed<blender_rgb565_gamma<Gamma>, rendering_buffer>
1240
pixfmt_rgb565_gamma(rendering_buffer& rb, const Gamma& g) :
1241
pixfmt_alpha_blend_rgb_packed<blender_rgb565_gamma<Gamma>, rendering_buffer>(rb)
1243
this->blender().gamma(g);
1248
//-----------------------------------------------------pixfmt_rgbAAA_gamma
1249
template<class Gamma> class pixfmt_rgbAAA_gamma :
1250
public pixfmt_alpha_blend_rgb_packed<blender_rgbAAA_gamma<Gamma>,
1254
pixfmt_rgbAAA_gamma(rendering_buffer& rb, const Gamma& g) :
1255
pixfmt_alpha_blend_rgb_packed<blender_rgbAAA_gamma<Gamma>,
1256
rendering_buffer>(rb)
1258
this->blender().gamma(g);
1263
//-----------------------------------------------------pixfmt_bgrAAA_gamma
1264
template<class Gamma> class pixfmt_bgrAAA_gamma :
1265
public pixfmt_alpha_blend_rgb_packed<blender_bgrAAA_gamma<Gamma>,
1269
pixfmt_bgrAAA_gamma(rendering_buffer& rb, const Gamma& g) :
1270
pixfmt_alpha_blend_rgb_packed<blender_bgrAAA_gamma<Gamma>,
1271
rendering_buffer>(rb)
1273
this->blender().gamma(g);
1278
//-----------------------------------------------------pixfmt_rgbBBA_gamma
1279
template<class Gamma> class pixfmt_rgbBBA_gamma :
1280
public pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_gamma<Gamma>,
1284
pixfmt_rgbBBA_gamma(rendering_buffer& rb, const Gamma& g) :
1285
pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_gamma<Gamma>,
1286
rendering_buffer>(rb)
1288
this->blender().gamma(g);
1293
//-----------------------------------------------------pixfmt_bgrABB_gamma
1294
template<class Gamma> class pixfmt_bgrABB_gamma :
1295
public pixfmt_alpha_blend_rgb_packed<blender_bgrABB_gamma<Gamma>,
1299
pixfmt_bgrABB_gamma(rendering_buffer& rb, const Gamma& g) :
1300
pixfmt_alpha_blend_rgb_packed<blender_bgrABB_gamma<Gamma>,
1301
rendering_buffer>(rb)
1303
this->blender().gamma(g);