26 #ifndef BOARD_SHAPE_WITH_STYLE_H
27 #define BOARD_SHAPE_WITH_STYLE_H
50 inline ShapeWithStyle(
Color penColor,
Color fillColor,
double lineWidth, LineStyle style,
const LineCap cap,
const LineJoin join);
71 const std::string &
name()
const;
75 inline const Color & penColor()
const;
79 inline const Color & fillColor()
const;
83 inline double lineWidth()
const;
87 inline LineStyle lineStyle()
const;
91 inline LineCap lineCap()
const;
95 inline LineJoin lineJoin()
const;
99 inline Style style()
const;
113 inline bool filled()
const;
116 static const std::string _name;
117 static bool _lineWidthScaling;
120 inline void updateLineWidth(
double s);
134 : _style{penColor, fillColor, lineWidth, lineStyle, lineCap, lineJoin}
143 const Color & ShapeWithStyle::penColor()
const
145 return _style.penColor;
148 ShapeWithStyle & ShapeWithStyle::setPenColor(
const Color & color)
150 _style.penColor = color;
154 const Color & ShapeWithStyle::fillColor()
const
156 return _style.fillColor;
159 ShapeWithStyle & ShapeWithStyle::setFillColor(
const Color & color)
161 _style.fillColor = color;
165 double ShapeWithStyle::lineWidth()
const
167 return _style.lineWidth;
170 ShapeWithStyle & ShapeWithStyle::setLineWidth(
double width)
172 _style.lineWidth = width;
176 LineStyle ShapeWithStyle::lineStyle()
const
178 return _style.lineStyle;
181 ShapeWithStyle & ShapeWithStyle::setLineStyle(LineStyle style)
183 _style.lineStyle = style;
187 LineCap ShapeWithStyle::lineCap()
const
189 return _style.lineCap;
192 ShapeWithStyle & ShapeWithStyle::setLineCap(LineCap cap)
194 _style.lineCap = cap;
198 LineJoin ShapeWithStyle::lineJoin()
const
200 return _style.lineJoin;
203 ShapeWithStyle & ShapeWithStyle::setLineJoin(LineJoin join)
205 _style.lineJoin = join;
209 ShapeWithStyle & ShapeWithStyle::setStyle(
const Style & style)
215 Style ShapeWithStyle::style()
const
222 return fillColor() != Color::Null;
225 void ShapeWithStyle::updateLineWidth(
double s)
227 if (_lineWidthScaling) {
228 _style.lineWidth *= s;