| 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: [email protected] |
| 12 |
// [email protected] |
| 13 |
// http://www.antigrain.com |
| 14 |
//---------------------------------------------------------------------------- |
| 15 |
|
| 16 |
#ifndef AGG_SPAN_CONVERTER_INCLUDED |
| 17 |
#define AGG_SPAN_CONVERTER_INCLUDED |
| 18 |
|
| 19 |
#include "agg_basics.h" |
| 20 |
|
| 21 |
namespace agg |
| 22 |
{ |
| 23 |
//----------------------------------------------------------span_converter |
| 24 |
template<class SpanGenerator, class SpanConverter> class span_converter |
| 25 |
{ |
| 26 |
public: |
| 27 |
typedef typename SpanGenerator::color_type color_type; |
| 28 |
|
| 29 |
span_converter(SpanGenerator& span_gen, SpanConverter& span_cnv) : |
| 30 |
m_span_gen(&span_gen), m_span_cnv(&span_cnv) {} |
| 31 |
|
| 32 |
void attach_generator(SpanGenerator& span_gen) { m_span_gen = &span_gen; } |
| 33 |
void attach_converter(SpanConverter& span_cnv) { m_span_cnv = &span_cnv; } |
| 34 |
|
| 35 |
//-------------------------------------------------------------------- |
| 36 |
void prepare() |
| 37 |
{ |
| 38 |
m_span_gen->prepare(); |
| 39 |
m_span_cnv->prepare(); |
| 40 |
} |
| 41 |
|
| 42 |
//-------------------------------------------------------------------- |
| 43 |
void generate(color_type* span, int x, int y, unsigned len) |
| 44 |
{ |
| 45 |
m_span_gen->generate(span, x, y, len); |
| 46 |
m_span_cnv->generate(span, x, y, len); |
| 47 |
} |
| 48 |
|
| 49 |
private: |
| 50 |
SpanGenerator* m_span_gen; |
| 51 |
SpanConverter* m_span_cnv; |
| 52 |
}; |
| 53 |
|
| 54 |
} |
| 55 |
|
| 56 |
#endif |