agg_vcgen_contour.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_CONTOUR_INCLUDED
  16. #define AGG_VCGEN_CONTOUR_INCLUDED
  17. #include "agg_math_stroke.h"
  18. namespace agg
  19. {
  20. //----------------------------------------------------------vcgen_contour
  21. //
  22. // See Implementation agg_vcgen_contour.cpp
  23. //
  24. class vcgen_contour
  25. {
  26. enum status_e
  27. {
  28. initial,
  29. ready,
  30. outline,
  31. out_vertices,
  32. end_poly,
  33. stop
  34. };
  35. public:
  36. typedef vertex_sequence<vertex_dist, 6> vertex_storage;
  37. typedef pod_bvector<point_d, 6> coord_storage;
  38. vcgen_contour();
  39. void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); }
  40. void line_join(line_join_e lj) { m_stroker.line_join(lj); }
  41. void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); }
  42. line_cap_e line_cap() const { return m_stroker.line_cap(); }
  43. line_join_e line_join() const { return m_stroker.line_join(); }
  44. inner_join_e inner_join() const { return m_stroker.inner_join(); }
  45. void width(double w) { m_stroker.width(m_width = w); }
  46. void miter_limit(double ml) { m_stroker.miter_limit(ml); }
  47. void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); }
  48. void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); }
  49. void approximation_scale(double as) { m_stroker.approximation_scale(as); }
  50. double width() const { return m_width; }
  51. double miter_limit() const { return m_stroker.miter_limit(); }
  52. double inner_miter_limit() const { return m_stroker.inner_miter_limit(); }
  53. double approximation_scale() const { return m_stroker.approximation_scale(); }
  54. void auto_detect_orientation(bool v) { m_auto_detect = v; }
  55. bool auto_detect_orientation() const { return m_auto_detect; }
  56. // Generator interface
  57. void remove_all();
  58. void add_vertex(double x, double y, unsigned cmd);
  59. // Vertex Source Interface
  60. void rewind(unsigned path_id);
  61. unsigned vertex(double* x, double* y);
  62. private:
  63. vcgen_contour(const vcgen_contour&);
  64. const vcgen_contour& operator = (const vcgen_contour&);
  65. math_stroke<coord_storage> m_stroker;
  66. double m_width;
  67. vertex_storage m_src_vertices;
  68. coord_storage m_out_vertices;
  69. status_e m_status;
  70. unsigned m_src_vertex;
  71. unsigned m_out_vertex;
  72. unsigned m_closed;
  73. unsigned m_orientation;
  74. bool m_auto_detect;
  75. };
  76. }
  77. #endif