agg_rounded_rect.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. //
  16. // Rounded rectangle vertex generator
  17. //
  18. //----------------------------------------------------------------------------
  19. #ifndef AGG_ROUNDED_RECT_INCLUDED
  20. #define AGG_ROUNDED_RECT_INCLUDED
  21. #include "agg_basics.h"
  22. #include "agg_arc.h"
  23. namespace agg
  24. {
  25. //------------------------------------------------------------rounded_rect
  26. //
  27. // See Implemantation agg_rounded_rect.cpp
  28. //
  29. class rounded_rect
  30. {
  31. public:
  32. rounded_rect() {}
  33. rounded_rect(double x1, double y1, double x2, double y2, double r);
  34. void rect(double x1, double y1, double x2, double y2);
  35. void radius(double r);
  36. void radius(double rx, double ry);
  37. void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top);
  38. void radius(double rx1, double ry1, double rx2, double ry2,
  39. double rx3, double ry3, double rx4, double ry4);
  40. void normalize_radius();
  41. void approximation_scale(double s) { m_arc.approximation_scale(s); }
  42. double approximation_scale() const { return m_arc.approximation_scale(); }
  43. void rewind(unsigned);
  44. unsigned vertex(double* x, double* y);
  45. private:
  46. double m_x1;
  47. double m_y1;
  48. double m_x2;
  49. double m_y2;
  50. double m_rx1;
  51. double m_ry1;
  52. double m_rx2;
  53. double m_ry2;
  54. double m_rx3;
  55. double m_ry3;
  56. double m_rx4;
  57. double m_ry4;
  58. unsigned m_status;
  59. arc m_arc;
  60. };
  61. }
  62. #endif