29 #include <sciplot/Default.hpp>
30 #include <sciplot/Utils.hpp>
31 #include <sciplot/specs/Specs.hpp>
37 template <
typename DerivedSpecs>
75 auto repr() const -> std::
string;
79 std::
string m_fillmode;
82 std::
string m_fillcolor;
85 std::
string m_transparent;
88 std::
string m_density;
91 std::
string m_pattern_number;
94 std::
string m_bordercolor;
97 std::
string m_borderlinewidth;
100 std::
string m_bordershow;
108 template <
typename DerivedSpecs>
113 template <
typename DerivedSpecs>
116 m_fillmode =
"empty";
117 return static_cast<DerivedSpecs&
>(*this);
120 template <
typename DerivedSpecs>
123 m_fillmode =
"solid";
124 return static_cast<DerivedSpecs&
>(*this);
127 template <
typename DerivedSpecs>
130 m_fillmode =
"pattern";
131 m_pattern_number = internal::str(number);
132 return static_cast<DerivedSpecs&
>(*this);
135 template <
typename DerivedSpecs>
138 m_fillcolor =
"fillcolor '" + color +
"'";
139 return static_cast<DerivedSpecs&
>(*this);
142 template <
typename DerivedSpecs>
145 value = std::min<decltype(value)>(std::max<decltype(value)>(0.0, value), 1.0);
146 m_density = internal::str(value);
147 m_fillmode =
"solid";
148 return static_cast<DerivedSpecs&
>(*this);
151 template <
typename DerivedSpecs>
154 m_transparent = active ?
"transparent" :
"";
155 if (m_fillmode.empty())
156 m_fillmode =
"solid";
157 return static_cast<DerivedSpecs&
>(*this);
160 template <
typename DerivedSpecs>
163 m_bordercolor =
"'" + color +
"'";
164 return static_cast<DerivedSpecs&
>(*this);
167 template <
typename DerivedSpecs>
170 m_borderlinewidth = internal::str(value);
171 return static_cast<DerivedSpecs&
>(*this);
174 template <
typename DerivedSpecs>
177 m_bordershow = show ?
"yes" :
"no";
178 return static_cast<DerivedSpecs&
>(*this);
181 template <
typename DerivedSpecs>
187 template <
typename DerivedSpecs>
190 std::string fillstyle;
191 if (m_fillmode ==
"solid")
192 fillstyle =
"fillstyle " + m_transparent +
" solid " + m_density;
193 else if (m_fillmode ==
"pattern")
194 fillstyle =
"fillstyle " + m_transparent +
" pattern " + m_pattern_number;
195 else if (m_fillmode ==
"empty")
196 fillstyle =
"fillstyle empty";
198 std::string borderstyle;
199 if (m_bordershow !=
"")
201 if (m_bordershow ==
"yes")
203 borderstyle =
"border ";
204 borderstyle += gnuplot::optionValueStr(
"linecolor", m_bordercolor);
205 borderstyle += gnuplot::optionValueStr(
"linewidth", m_borderlinewidth);
208 borderstyle =
"noborder";
211 std::stringstream ss;
212 ss << m_fillcolor <<
" " << fillstyle <<
" " << borderstyle;
214 return internal::removeExtraWhitespaces(ss.str());
The class used to attach color or pattern fill options to a type.
Definition: FillSpecsOf.hpp:39
auto borderShow(bool value=true) -> DerivedSpecs &
Set the border of the underlying object to be shown or not.
Definition: FillSpecsOf.hpp:175
auto fillEmpty() -> DerivedSpecs &
Set an empty fill style for the underlying object.
Definition: FillSpecsOf.hpp:114
auto borderLineWidth(int value) -> DerivedSpecs &
Set the border line width of the underlying object.
Definition: FillSpecsOf.hpp:168
FillSpecsOf()
Construct a default FillSpecsOf instance.
Definition: FillSpecsOf.hpp:109
auto fillIntensity(double value) -> DerivedSpecs &
Set the fill color intensity of the underlying object with respect to its border color (a value betwe...
Definition: FillSpecsOf.hpp:143
auto borderLineColor(std::string color) -> DerivedSpecs &
Set the border line color of the underlying object.
Definition: FillSpecsOf.hpp:161
auto fillPattern(int number) -> DerivedSpecs &
Set a pattern fill style for the underlying object.
Definition: FillSpecsOf.hpp:128
auto fillColor(std::string value) -> DerivedSpecs &
Set the color for the solid or pattern fill of the underlying object.
Definition: FillSpecsOf.hpp:136
auto repr() const -> std::string
Convert this FillSpecsOf object into a gnuplot formatted string.
Definition: FillSpecsOf.hpp:188
auto fillSolid() -> DerivedSpecs &
Set a solid fill style for the underlying object.
Definition: FillSpecsOf.hpp:121
The base class for other specs classes (e.g., LineSpecsOf, DrawSpecs, BorderSpecs,...
Definition: Specs.hpp:36
The class used to specify color or pattern fill options.
Definition: FillSpecsOf.hpp:105
auto fillTransparent(bool active=true) -> DerivedSpecs &
Set the fill of the underlying object to be transparent or not.
Definition: FillSpecsOf.hpp:152
auto borderHide() -> DerivedSpecs &
Set the border of the underlying object to be hidden.
Definition: FillSpecsOf.hpp:182