Make UEFI boot-platform build again
[haiku.git] / headers / libs / agg / agg_span_pattern_rgb.h
blob4850508af1e2d7b08719ebd2d53cb7cdb731789f
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 // 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.
21 //
22 //----------------------------------------------------------------------------
25 #ifndef AGG_SPAN_PATTERN_RGB_INCLUDED
26 #define AGG_SPAN_PATTERN_RGB_INCLUDED
28 #include "agg_basics.h"
30 namespace agg
33 //========================================================span_pattern_rgb
34 template<class Source> class span_pattern_rgb
36 public:
37 typedef Source source_type;
38 typedef typename source_type::color_type color_type;
39 typedef typename source_type::order_type order_type;
40 typedef typename color_type::value_type value_type;
41 typedef typename color_type::calc_type calc_type;
43 //--------------------------------------------------------------------
44 span_pattern_rgb() {}
45 span_pattern_rgb(source_type& src,
46 unsigned offset_x, unsigned offset_y) :
47 m_src(&src),
48 m_offset_x(offset_x),
49 m_offset_y(offset_y),
50 m_alpha(color_type::base_mask)
53 //--------------------------------------------------------------------
54 void attach(source_type& v) { m_src = &v; }
55 source_type& source() { return *m_src; }
56 const source_type& source() const { return *m_src; }
58 //--------------------------------------------------------------------
59 void offset_x(unsigned v) { m_offset_x = v; }
60 void offset_y(unsigned v) { m_offset_y = v; }
61 unsigned offset_x() const { return m_offset_x; }
62 unsigned offset_y() const { return m_offset_y; }
63 void alpha(value_type v) { m_alpha = v; }
64 value_type alpha() const { return m_alpha; }
66 //--------------------------------------------------------------------
67 void prepare() {}
68 void generate(color_type* span, int x, int y, unsigned len)
70 x += m_offset_x;
71 y += m_offset_y;
72 const value_type* p = (const value_type*)m_src->span(x, y, len);
75 span->r = p[order_type::R];
76 span->g = p[order_type::G];
77 span->b = p[order_type::B];
78 span->a = m_alpha;
79 p = m_src->next_x();
80 ++span;
82 while(--len);
85 private:
86 source_type* m_src;
87 unsigned m_offset_x;
88 unsigned m_offset_y;
89 value_type m_alpha;
95 #endif