MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / build_lut

Method build_lut

dep/agg/include/agg_gradient_lut.h:214–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212 //------------------------------------------------------------------------
213 template <class T, unsigned S>
214 void gradient_lut<T, S>::build_lut()
215 {
216 quick_sort(m_color_profile, offset_less);
217 m_color_profile.cut_at(
218 remove_duplicates(m_color_profile, offset_equal));
219 if (m_color_profile.size() >= 2)
220 {
221 unsigned i;
222 unsigned start = uround(m_color_profile[0].offset * color_lut_size);
223 unsigned end;
224 color_type c = m_color_profile[0].color;
225 for (i = 0; i < start; i++)
226 {
227 m_color_lut[i] = c;
228 }
229 for (i = 1; i < m_color_profile.size(); i++)
230 {
231 end = uround(m_color_profile[i].offset * color_lut_size);
232 interpolator_type ci(m_color_profile[i - 1].color,
233 m_color_profile[i].color,
234 end - start + 1);
235 while (start < end)
236 {
237 m_color_lut[start] = ci.color();
238 ++ci;
239 ++start;
240 }
241 }
242 c = m_color_profile.last().color;
243 for (; end < m_color_lut.size(); end++)
244 {
245 m_color_lut[end] = c;
246 }
247 }
248 }
249}
250
251#endif

Callers

nothing calls this directly

Calls 6

quick_sortFunction · 0.85
remove_duplicatesFunction · 0.85
uroundFunction · 0.85
cut_atMethod · 0.45
sizeMethod · 0.45
colorMethod · 0.45

Tested by

no test coverage detected