| 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_VCGEN_STROKE_INCLUDED |
| 17 |
#define AGG_VCGEN_STROKE_INCLUDED |
| 18 |
|
| 19 |
#include "agg_math_stroke.h" |
| 20 |
|
| 21 |
|
| 22 |
namespace agg |
| 23 |
{ |
| 24 |
|
| 25 |
//============================================================vcgen_stroke |
| 26 |
// |
| 27 |
// See Implementation agg_vcgen_stroke.cpp |
| 28 |
// Stroke generator |
| 29 |
// |
| 30 |
//------------------------------------------------------------------------ |
| 31 |
class vcgen_stroke |
| 32 |
{ |
| 33 |
enum status_e |
| 34 |
{ |
| 35 |
initial, |
| 36 |
ready, |
| 37 |
cap1, |
| 38 |
cap2, |
| 39 |
outline1, |
| 40 |
close_first, |
| 41 |
outline2, |
| 42 |
out_vertices, |
| 43 |
end_poly1, |
| 44 |
end_poly2, |
| 45 |
stop |
| 46 |
}; |
| 47 |
|
| 48 |
public: |
| 49 |
typedef vertex_sequence<vertex_dist, 6> vertex_storage; |
| 50 |
typedef pod_bvector<point_d, 6> coord_storage; |
| 51 |
|
| 52 |
vcgen_stroke(); |
| 53 |
|
| 54 |
void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } |
| 55 |
void line_join(line_join_e lj) { m_stroker.line_join(lj); } |
| 56 |
void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } |
| 57 |
|
| 58 |
line_cap_e line_cap() const { return m_stroker.line_cap(); } |
| 59 |
line_join_e line_join() const { return m_stroker.line_join(); } |
| 60 |
inner_join_e inner_join() const { return m_stroker.inner_join(); } |
| 61 |
|
| 62 |
void width(double w) { m_stroker.width(w); } |
| 63 |
void miter_limit(double ml) { m_stroker.miter_limit(ml); } |
| 64 |
void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } |
| 65 |
void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } |
| 66 |
void approximation_scale(double as) { m_stroker.approximation_scale(as); } |
| 67 |
|
| 68 |
double width() const { return m_stroker.width(); } |
| 69 |
double miter_limit() const { return m_stroker.miter_limit(); } |
| 70 |
double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } |
| 71 |
double approximation_scale() const { return m_stroker.approximation_scale(); } |
| 72 |
|
| 73 |
void shorten(double s) { m_shorten = s; } |
| 74 |
double shorten() const { return m_shorten; } |
| 75 |
|
| 76 |
// Vertex Generator Interface |
| 77 |
void remove_all(); |
| 78 |
void add_vertex(double x, double y, unsigned cmd); |
| 79 |
|
| 80 |
// Vertex Source Interface |
| 81 |
void rewind(unsigned path_id); |
| 82 |
unsigned vertex(double* x, double* y); |
| 83 |
|
| 84 |
private: |
| 85 |
vcgen_stroke(const vcgen_stroke&); |
| 86 |
const vcgen_stroke& operator = (const vcgen_stroke&); |
| 87 |
|
| 88 |
math_stroke<coord_storage> m_stroker; |
| 89 |
vertex_storage m_src_vertices; |
| 90 |
coord_storage m_out_vertices; |
| 91 |
double m_shorten; |
| 92 |
unsigned m_closed; |
| 93 |
status_e m_status; |
| 94 |
status_e m_prev_status; |
| 95 |
unsigned m_src_vertex; |
| 96 |
unsigned m_out_vertex; |
| 97 |
}; |
| 98 |
|
| 99 |
|
| 100 |
} |
| 101 |
|
| 102 |
#endif |