Add gradient_color_at(QGradientStops, ratio).
This commit is contained in:
parent
851444a172
commit
74224fe06e
2 changed files with 9 additions and 3 deletions
|
|
@ -8,9 +8,7 @@
|
||||||
|
|
||||||
namespace anim {
|
namespace anim {
|
||||||
|
|
||||||
QColor gradient_color_at(const QGradient &gradient, float64 ratio) {
|
QColor gradient_color_at(const QGradientStops & stops, float64 ratio) {
|
||||||
const auto &stops = gradient.stops();
|
|
||||||
|
|
||||||
for (auto i = 1; i < stops.size(); i++) {
|
for (auto i = 1; i < stops.size(); i++) {
|
||||||
const auto currentPoint = stops[i].first;
|
const auto currentPoint = stops[i].first;
|
||||||
const auto previousPoint = stops[i - 1].first;
|
const auto previousPoint = stops[i - 1].first;
|
||||||
|
|
@ -25,4 +23,8 @@ QColor gradient_color_at(const QGradient &gradient, float64 ratio) {
|
||||||
return QColor();
|
return QColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor gradient_color_at(const QGradient &gradient, float64 ratio) {
|
||||||
|
return gradient_color_at(gradient.stops(), ratio);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace anim
|
} // namespace anim
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
namespace anim {
|
namespace anim {
|
||||||
|
|
||||||
|
[[nodiscard]] QColor gradient_color_at(
|
||||||
|
const QGradientStops &stops,
|
||||||
|
float64 ratio);
|
||||||
|
|
||||||
[[nodiscard]] QColor gradient_color_at(
|
[[nodiscard]] QColor gradient_color_at(
|
||||||
const QGradient &gradient,
|
const QGradient &gradient,
|
||||||
float64 ratio);
|
float64 ratio);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue