OLD | NEW |
1 | 1 |
2 //---------------------------------------------------------------------------- | 2 //---------------------------------------------------------------------------- |
3 // Anti-Grain Geometry - Version 2.3 | 3 // Anti-Grain Geometry - Version 2.3 |
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) | 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) |
5 // | 5 // |
6 // Permission to copy, use, modify, sell and distribute this software | 6 // Permission to copy, use, modify, sell and distribute this software |
7 // is granted provided this copyright notice appears in all copies. | 7 // is granted provided this copyright notice appears in all copies. |
8 // This software is provided "as is" without express or implied | 8 // This software is provided "as is" without express or implied |
9 // warranty, and with no claim as to its suitability for any purpose. | 9 // warranty, and with no claim as to its suitability for any purpose. |
10 // | 10 // |
(...skipping 10 matching lines...) Expand all Loading... |
21 // PostScript and PDF technology for software developers. | 21 // PostScript and PDF technology for software developers. |
22 // | 22 // |
23 //---------------------------------------------------------------------------- | 23 //---------------------------------------------------------------------------- |
24 #ifndef AGG_PIXFMT_GRAY_INCLUDED | 24 #ifndef AGG_PIXFMT_GRAY_INCLUDED |
25 #define AGG_PIXFMT_GRAY_INCLUDED | 25 #define AGG_PIXFMT_GRAY_INCLUDED |
26 #include "agg_basics.h" | 26 #include "agg_basics.h" |
27 #include "agg_color_gray.h" | 27 #include "agg_color_gray.h" |
28 #include "agg_rendering_buffer.h" | 28 #include "agg_rendering_buffer.h" |
29 namespace agg | 29 namespace agg |
30 { | 30 { |
31 template<class ColorT> struct blender_gray : public CFX_Object { | 31 template<class ColorT> struct blender_gray { |
32 typedef ColorT color_type; | 32 typedef ColorT color_type; |
33 typedef typename color_type::value_type value_type; | 33 typedef typename color_type::value_type value_type; |
34 typedef typename color_type::calc_type calc_type; | 34 typedef typename color_type::calc_type calc_type; |
35 enum base_scale_e { base_shift = color_type::base_shift }; | 35 enum base_scale_e { base_shift = color_type::base_shift }; |
36 static AGG_INLINE void blend_pix(value_type* p, unsigned cv, | 36 static AGG_INLINE void blend_pix(value_type* p, unsigned cv, |
37 unsigned alpha, unsigned cover = 0) | 37 unsigned alpha, unsigned cover = 0) |
38 { | 38 { |
39 *p = (value_type)((((cv - calc_type(*p)) * alpha) + (calc_type(*p) << ba
se_shift)) >> base_shift); | 39 *p = (value_type)((((cv - calc_type(*p)) * alpha) + (calc_type(*p) << ba
se_shift)) >> base_shift); |
40 } | 40 } |
41 }; | 41 }; |
42 template<class Blender, unsigned Step = 1, unsigned Offset = 0> | 42 template<class Blender, unsigned Step = 1, unsigned Offset = 0> |
43 class pixel_formats_gray : public CFX_Object | 43 class pixel_formats_gray |
44 { | 44 { |
45 public: | 45 public: |
46 typedef rendering_buffer::row_data row_data; | 46 typedef rendering_buffer::row_data row_data; |
47 typedef rendering_buffer::span_data span_data; | 47 typedef rendering_buffer::span_data span_data; |
48 typedef typename Blender::color_type color_type; | 48 typedef typename Blender::color_type color_type; |
49 typedef typename color_type::value_type value_type; | 49 typedef typename color_type::value_type value_type; |
50 typedef typename color_type::calc_type calc_type; | 50 typedef typename color_type::calc_type calc_type; |
51 enum base_scale_e { | 51 enum base_scale_e { |
52 base_shift = color_type::base_shift, | 52 base_shift = color_type::base_shift, |
53 base_size = color_type::base_size, | 53 base_size = color_type::base_size, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } while(--len); | 168 } while(--len); |
169 } | 169 } |
170 } | 170 } |
171 private: | 171 private: |
172 rendering_buffer* m_rbuf; | 172 rendering_buffer* m_rbuf; |
173 }; | 173 }; |
174 typedef blender_gray<gray8> blender_gray8; | 174 typedef blender_gray<gray8> blender_gray8; |
175 typedef pixel_formats_gray<blender_gray8, 1, 0> pixfmt_gray8; | 175 typedef pixel_formats_gray<blender_gray8, 1, 0> pixfmt_gray8; |
176 } | 176 } |
177 #endif | 177 #endif |
OLD | NEW |