agg_vcgen_stroke.h 3.5 KB

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