16 #include "agg_renderer_outline_aa.h" 22 void line_profile_aa::width(
double w)
26 if(w < m_smoother_width) w += w;
27 else w += m_smoother_width;
31 w -= m_smoother_width;
32 double s = m_smoother_width;
43 line_profile_aa::value_type* line_profile_aa::profile(
double w)
45 m_subpixel_width = uround(w * subpixel_scale);
46 unsigned size = m_subpixel_width + subpixel_scale * 6;
47 if(size > m_profile.size())
49 m_profile.resize(size);
56 void line_profile_aa::set(
double center_width,
double smoother_width)
58 double base_val = 1.0;
59 if(center_width == 0.0) center_width = 1.0 / subpixel_scale;
60 if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale;
62 double width = center_width + smoother_width;
63 if(width < m_min_width)
65 double k = width / m_min_width;
71 value_type* ch = profile(center_width + smoother_width);
73 unsigned subpixel_center_width = unsigned(center_width * subpixel_scale);
74 unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale);
76 value_type* ch_center = ch + subpixel_scale*2;
77 value_type* ch_smoother = ch_center + subpixel_center_width;
81 unsigned val = m_gamma[unsigned(base_val * aa_mask)];
83 for(i = 0; i < subpixel_center_width; i++)
85 *ch++ = (value_type)val;
88 for(i = 0; i < subpixel_smoother_width; i++)
91 m_gamma[unsigned((base_val -
93 (
double(i) / subpixel_smoother_width)) * aa_mask)];
96 unsigned n_smoother = profile_size() -
97 subpixel_smoother_width -
98 subpixel_center_width -
102 for(i = 0; i < n_smoother; i++)
104 *ch_smoother++ = (value_type)val;
108 for(i = 0; i < subpixel_scale*2; i++)
110 *--ch = *ch_center++;