| 1 |
//---------------------------------------------------------------------------- |
| 2 |
// Anti-Grain Geometry - Version 2.4 |
| 3 |
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) |
| 4 |
// |
| 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. |
| 9 |
// |
| 10 |
//---------------------------------------------------------------------------- |
| 11 |
// Contact: [email protected] |
| 12 |
// [email protected] |
| 13 |
// http://www.antigrain.com |
| 14 |
//---------------------------------------------------------------------------- |
| 15 |
|
| 16 |
#ifndef AGG_PIXFMT_TRANSPOSER_INCLUDED |
| 17 |
#define AGG_PIXFMT_TRANSPOSER_INCLUDED |
| 18 |
|
| 19 |
#include "agg_basics.h" |
| 20 |
|
| 21 |
namespace agg |
| 22 |
{ |
| 23 |
//=======================================================pixfmt_transposer |
| 24 |
template<class PixFmt> class pixfmt_transposer |
| 25 |
{ |
| 26 |
public: |
| 27 |
typedef PixFmt pixfmt_type; |
| 28 |
typedef typename pixfmt_type::color_type color_type; |
| 29 |
typedef typename pixfmt_type::row_data row_data; |
| 30 |
typedef typename color_type::value_type value_type; |
| 31 |
typedef typename color_type::calc_type calc_type; |
| 32 |
|
| 33 |
//-------------------------------------------------------------------- |
| 34 |
pixfmt_transposer() : m_pixf(0) {} |
| 35 |
explicit pixfmt_transposer(pixfmt_type& pixf) : m_pixf(&pixf) {} |
| 36 |
void attach(pixfmt_type& pixf) { m_pixf = &pixf; } |
| 37 |
|
| 38 |
//-------------------------------------------------------------------- |
| 39 |
AGG_INLINE unsigned width() const { return m_pixf->height(); } |
| 40 |
AGG_INLINE unsigned height() const { return m_pixf->width(); } |
| 41 |
|
| 42 |
//-------------------------------------------------------------------- |
| 43 |
AGG_INLINE color_type pixel(int x, int y) const |
| 44 |
{ |
| 45 |
return m_pixf->pixel(y, x); |
| 46 |
} |
| 47 |
|
| 48 |
//-------------------------------------------------------------------- |
| 49 |
AGG_INLINE void copy_pixel(int x, int y, const color_type& c) |
| 50 |
{ |
| 51 |
m_pixf->copy_pixel(y, x, c); |
| 52 |
} |
| 53 |
|
| 54 |
//-------------------------------------------------------------------- |
| 55 |
AGG_INLINE void blend_pixel(int x, int y, |
| 56 |
const color_type& c, |
| 57 |
int8u cover) |
| 58 |
{ |
| 59 |
m_pixf->blend_pixel(y, x, c, cover); |
| 60 |
} |
| 61 |
|
| 62 |
//-------------------------------------------------------------------- |
| 63 |
AGG_INLINE void copy_hline(int x, int y, |
| 64 |
unsigned len, |
| 65 |
const color_type& c) |
| 66 |
{ |
| 67 |
m_pixf->copy_vline(y, x, len, c); |
| 68 |
} |
| 69 |
|
| 70 |
//-------------------------------------------------------------------- |
| 71 |
AGG_INLINE void copy_vline(int x, int y, |
| 72 |
unsigned len, |
| 73 |
const color_type& c) |
| 74 |
{ |
| 75 |
m_pixf->copy_hline(y, x, len, c); |
| 76 |
} |
| 77 |
|
| 78 |
//-------------------------------------------------------------------- |
| 79 |
AGG_INLINE void blend_hline(int x, int y, |
| 80 |
unsigned len, |
| 81 |
const color_type& c, |
| 82 |
int8u cover) |
| 83 |
{ |
| 84 |
m_pixf->blend_vline(y, x, len, c, cover); |
| 85 |
} |
| 86 |
|
| 87 |
//-------------------------------------------------------------------- |
| 88 |
AGG_INLINE void blend_vline(int x, int y, |
| 89 |
unsigned len, |
| 90 |
const color_type& c, |
| 91 |
int8u cover) |
| 92 |
{ |
| 93 |
m_pixf->blend_hline(y, x, len, c, cover); |
| 94 |
} |
| 95 |
|
| 96 |
//-------------------------------------------------------------------- |
| 97 |
AGG_INLINE void blend_solid_hspan(int x, int y, |
| 98 |
unsigned len, |
| 99 |
const color_type& c, |
| 100 |
const int8u* covers) |
| 101 |
{ |
| 102 |
m_pixf->blend_solid_vspan(y, x, len, c, covers); |
| 103 |
} |
| 104 |
|
| 105 |
//-------------------------------------------------------------------- |
| 106 |
AGG_INLINE void blend_solid_vspan(int x, int y, |
| 107 |
unsigned len, |
| 108 |
const color_type& c, |
| 109 |
const int8u* covers) |
| 110 |
{ |
| 111 |
m_pixf->blend_solid_hspan(y, x, len, c, covers); |
| 112 |
} |
| 113 |
|
| 114 |
//-------------------------------------------------------------------- |
| 115 |
AGG_INLINE void copy_color_hspan(int x, int y, |
| 116 |
unsigned len, |
| 117 |
const color_type* colors) |
| 118 |
{ |
| 119 |
m_pixf->copy_color_vspan(y, x, len, colors); |
| 120 |
} |
| 121 |
|
| 122 |
//-------------------------------------------------------------------- |
| 123 |
AGG_INLINE void copy_color_vspan(int x, int y, |
| 124 |
unsigned len, |
| 125 |
const color_type* colors) |
| 126 |
{ |
| 127 |
m_pixf->copy_color_hspan(y, x, len, colors); |
| 128 |
} |
| 129 |
|
| 130 |
//-------------------------------------------------------------------- |
| 131 |
AGG_INLINE void blend_color_hspan(int x, int y, |
| 132 |
unsigned len, |
| 133 |
const color_type* colors, |
| 134 |
const int8u* covers, |
| 135 |
int8u cover) |
| 136 |
{ |
| 137 |
m_pixf->blend_color_vspan(y, x, len, colors, covers, cover); |
| 138 |
} |
| 139 |
|
| 140 |
//-------------------------------------------------------------------- |
| 141 |
AGG_INLINE void blend_color_vspan(int x, int y, |
| 142 |
unsigned len, |
| 143 |
const color_type* colors, |
| 144 |
const int8u* covers, |
| 145 |
int8u cover) |
| 146 |
{ |
| 147 |
m_pixf->blend_color_hspan(y, x, len, colors, covers, cover); |
| 148 |
} |
| 149 |
|
| 150 |
private: |
| 151 |
pixfmt_type* m_pixf; |
| 152 |
}; |
| 153 |
} |
| 154 |
|
| 155 |
#endif |
| 156 |
|
| 157 |
|