1 /* -*- mode: c++ -*- */
4 * @author Sebastien Fourey <http://www.greyc.ensicaen.fr/~seb>
7 * @brief Shapes inline methods
10 * \@copyright This File is part of the Board library which is
11 * licensed under the terms of the GNU Lesser General Public Licence.
12 * See the LICENCE file for further details.
17 Shape::Shape( DGtal::Color pen,
24 : _depth( depthValue ),
27 _lineWidth( lineWidth ),
34 Dot::Dot( double x, double y,
40 lineWidth, SolidStyle, RoundCap, MiterJoin, depthValue ),
45 Line::Line( double x1, double y1, double x2, double y2,
48 const LineStyle style,
52 : Shape( color, DGtal::Color::None, lineWidth, style, cap, join, depthValue ),
53 _x1( x1 ), _y1( y1 ), _x2( x2 ), _y2( y2 )
59 Arrow::Arrow( double x1, double y1, double x2, double y2,
63 const LineStyle style,
67 : Line( x1, y1, x2, y2, pen, lineWidth, style, cap, join, depthValue )
69 Shape::_fillColor = fill;
72 Polyline::Polyline( const std::vector<Point> & points,
77 const LineStyle lineStyle,
81 : Shape( pen, fill, lineWidth, lineStyle, cap, join, depthValue ),
82 _path( points, closed )
86 Polyline::Polyline( const Path & path,
90 const LineStyle lineStyle,
94 : Shape( pen, fill, lineWidth, lineStyle, cap, join, depthValue ),
99 Polyline::Polyline( bool closed,
103 const LineStyle lineStyle,
107 : Shape( pen, fill, lineWidth, lineStyle, cap, join, depthValue ),
112 Rectangle::Rectangle( double xLeft,
119 const LineStyle style,
123 : Polyline( std::vector<Point>(), true, pen, fill,
124 lineWidth, style, cap, join, depthValue )
126 _path << Point( xLeft, yTop );
127 _path << Point( xLeft + rectWidth, yTop );
128 _path << Point( xLeft + rectWidth, yTop - rectHeight );
129 _path << Point( xLeft, yTop - rectHeight );
132 Rectangle::Rectangle( const Rect & rect,
136 const LineStyle style,
140 : Polyline( std::vector<Point>(), true, pen, fill, lineWidth, style, cap, join, depthValue ) {
141 _path << Point( rect.left, rect.top );
142 _path << Point( rect.left + rect.width, rect.top );
143 _path << Point( rect.left + rect.width, rect.top - rect.height );
144 _path << Point( rect.left, rect.top - rect.height );
149 Image::Image( double x0, double y0, double aWidth, double aHeight,
150 std::string fileName, int depthValue, double alpha )
151 : Rectangle(x0, y0, aWidth, aHeight, DGtal::Color::None, DGtal::Color::None, 0.0, SolidStyle, RoundCap, MiterJoin, depthValue ),
152 _x0(x0), _y0(y0), _width(aWidth), _height(aHeight), _filename(fileName), _alpha (alpha)
158 } // namespace LibBoard