btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / libs / agg / agg_pixfmt_transposer.h
blob723da7bb8ab8e64c7c2f6e6cdd17d9fdd795361c
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: 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"
21 namespace agg
23 //=======================================================pixfmt_transposer
24 template<class PixFmt> class pixfmt_transposer
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;
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,
56 const color_type& c,
57 int8u cover)
59 m_pixf->blend_pixel(y, x, c, cover);
62 //--------------------------------------------------------------------
63 AGG_INLINE void copy_hline(int x, int y,
64 unsigned len,
65 const color_type& c)
67 m_pixf->copy_vline(y, x, len, c);
70 //--------------------------------------------------------------------
71 AGG_INLINE void copy_vline(int x, int y,
72 unsigned len,
73 const color_type& c)
75 m_pixf->copy_hline(y, x, len, c);
78 //--------------------------------------------------------------------
79 AGG_INLINE void blend_hline(int x, int y,
80 unsigned len,
81 const color_type& c,
82 int8u cover)
84 m_pixf->blend_vline(y, x, len, c, cover);
87 //--------------------------------------------------------------------
88 AGG_INLINE void blend_vline(int x, int y,
89 unsigned len,
90 const color_type& c,
91 int8u cover)
93 m_pixf->blend_hline(y, x, len, c, cover);
96 //--------------------------------------------------------------------
97 AGG_INLINE void blend_solid_hspan(int x, int y,
98 unsigned len,
99 const color_type& c,
100 const int8u* covers)
102 m_pixf->blend_solid_vspan(y, x, len, c, covers);
105 //--------------------------------------------------------------------
106 AGG_INLINE void blend_solid_vspan(int x, int y,
107 unsigned len,
108 const color_type& c,
109 const int8u* covers)
111 m_pixf->blend_solid_hspan(y, x, len, c, covers);
114 //--------------------------------------------------------------------
115 AGG_INLINE void copy_color_hspan(int x, int y,
116 unsigned len,
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,
124 unsigned len,
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,
132 unsigned len,
133 const color_type* colors,
134 const int8u* covers,
135 int8u cover)
137 m_pixf->blend_color_vspan(y, x, len, colors, covers, cover);
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)
147 m_pixf->blend_color_hspan(y, x, len, colors, covers, cover);
150 private:
151 pixfmt_type* m_pixf;
155 #endif