RectangleT.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimage - An image/template for new NICE libraries
  4. * See file License for license information.
  5. */
  6. /*****************************************************************************/
  7. #ifndef _RECTANGLET_IMAGE_H
  8. #define _RECTANGLET_IMAGE_H
  9. #include <iostream>
  10. #include <core/image/Drawable.h>
  11. #include <core/image/CoordT.h>
  12. #include <core/image/ColorT.h>
  13. namespace NICE {
  14. /**
  15. * A Drawable rectangle.
  16. */
  17. template<class P>
  18. class RectangleT : public Drawable<P>
  19. {
  20. private:
  21. Coord begin;
  22. Coord end;
  23. protected:
  24. void doDraw(ColorImageT<P> &image, const ColorT<P>& color) const;
  25. void doDraw(ImageT<P> &image, const P& gray) const;
  26. public:
  27. //! Default constructor
  28. inline RectangleT() {}
  29. //! Constructor
  30. /** \param begin begin of the rectangle
  31. * \param end end of the rectangle
  32. */
  33. RectangleT(const Coord &begin, const Coord &end);
  34. //! Constructor
  35. /** \param begin begin of the rectangle
  36. * \param end end of the rectangle
  37. * \param _defaultColor color of the rectangle
  38. */
  39. RectangleT(const Coord &begin, const Coord &end, const ColorT<P>& _defaultColor);
  40. //! Constructor
  41. /** \param x x coord of the begin of the rectangle
  42. * \param y y coord of the begin of the rectangle
  43. * \param width width of the rectangle
  44. * \param height height of the rectangle
  45. */
  46. RectangleT(const int x, const int y, const int width, const int height);
  47. //! Constructor
  48. /** \param x x coord of the begin of the rectangle
  49. * \param y y coord of the begin of the rectangle
  50. * \param width width of the rectangle
  51. * \param height height of the rectangle
  52. * \param _defaultColor color of the rectangle
  53. */
  54. RectangleT(const int x, const int y, const int width, const int height,
  55. const ColorT<P>& _defaultColor);
  56. //! Constructor
  57. /** \param rect rect to draw
  58. */
  59. RectangleT(const Rect& rect);
  60. //! Constructor
  61. /** \param rect rect to draw
  62. * \param _defaultColor color of the rectangle
  63. */
  64. RectangleT(const Rect& rect, const ColorT<P>& _defaultColor);
  65. //! Copy-Constructor
  66. /*! \param arg class to copy
  67. */
  68. RectangleT(const RectangleT<P>& arg);
  69. //! Destructor of LineT
  70. virtual ~RectangleT();
  71. //! Assignment operator
  72. /*! \param ex class to copy
  73. * \return a reference to this class
  74. */
  75. RectangleT<P>& operator=(const RectangleT<P>& ex);
  76. //! Compare operator
  77. /*! \param ex class to compare
  78. * \return true if class content is equal
  79. */
  80. bool operator==(const RectangleT<P>& ex) const;
  81. //! Compare operator
  82. /*! \param ex class to compare
  83. * \return true if class content is not equal
  84. */
  85. bool operator!=(const RectangleT<P>& ex) const;
  86. };
  87. typedef RectangleT<Ipp8u> Rectangle;
  88. } // namespace NICE
  89. //#ifdef __GNUC__
  90. #include "core/image/RectangleT.tcc"
  91. //#endif
  92. #endif /* _RectangleT_IMAGE_H */