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 #ifndef AGG_PIXFMT_TRANSPOSER_INCLUDED
17 #define AGG_PIXFMT_TRANSPOSER_INCLUDED
19 #include "agg_basics.h"
23 //=======================================================pixfmt_transposer
24 template<class PixFmt
> class pixfmt_transposer
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
;
33 //--------------------------------------------------------------------
34 pixfmt_transposer() : m_pixf(0) {}
35 pixfmt_transposer(pixfmt_type
& pixf
) : m_pixf(&pixf
) {}
36 void attach(pixfmt_type
& pixf
) { m_pixf
= &pixf
; }
38 //--------------------------------------------------------------------
39 AGG_INLINE
unsigned width() const { return m_pixf
->height(); }
40 AGG_INLINE
unsigned height() const { return m_pixf
->width(); }
42 //--------------------------------------------------------------------
43 AGG_INLINE color_type
pixel(int x
, int y
) const
45 return m_pixf
->pixel(y
, x
);
48 //--------------------------------------------------------------------
49 AGG_INLINE
void copy_pixel(int x
, int y
, const color_type
& c
)
51 m_pixf
->copy_pixel(y
, x
, c
);
54 //--------------------------------------------------------------------
55 AGG_INLINE
void blend_pixel(int x
, int y
,
59 m_pixf
->blend_pixel(y
, x
, c
, cover
);
62 //--------------------------------------------------------------------
63 AGG_INLINE
void copy_hline(int x
, int y
,
67 m_pixf
->copy_vline(y
, x
, len
, c
);
70 //--------------------------------------------------------------------
71 AGG_INLINE
void copy_vline(int x
, int y
,
75 m_pixf
->copy_hline(y
, x
, len
, c
);
78 //--------------------------------------------------------------------
79 AGG_INLINE
void blend_hline(int x
, int y
,
84 m_pixf
->blend_vline(y
, x
, len
, c
, cover
);
87 //--------------------------------------------------------------------
88 AGG_INLINE
void blend_vline(int x
, int y
,
93 m_pixf
->blend_hline(y
, x
, len
, c
, cover
);
96 //--------------------------------------------------------------------
97 AGG_INLINE
void blend_solid_hspan(int x
, int y
,
102 m_pixf
->blend_solid_vspan(y
, x
, len
, c
, covers
);
105 //--------------------------------------------------------------------
106 AGG_INLINE
void blend_solid_vspan(int x
, int y
,
111 m_pixf
->blend_solid_hspan(y
, x
, len
, c
, covers
);
114 //--------------------------------------------------------------------
115 AGG_INLINE
void copy_color_hspan(int x
, int y
,
117 const color_type
* colors
)
119 m_pixf
->copy_color_vspan(y
, x
, len
, colors
);
122 //--------------------------------------------------------------------
123 AGG_INLINE
void copy_color_vspan(int x
, int y
,
125 const color_type
* colors
)
127 m_pixf
->copy_color_hspan(y
, x
, len
, colors
);
130 //--------------------------------------------------------------------
131 AGG_INLINE
void blend_color_hspan(int x
, int y
,
133 const color_type
* colors
,
137 m_pixf
->blend_color_vspan(y
, x
, len
, colors
, covers
, cover
);
140 //--------------------------------------------------------------------
141 AGG_INLINE
void blend_color_vspan(int x
, int y
,
143 const color_type
* colors
,
147 m_pixf
->blend_color_hspan(y
, x
, len
, colors
, covers
, cover
);