init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
30
Telegram/lib_ui/ui/effects/gradient.cpp
Normal file
30
Telegram/lib_ui/ui/effects/gradient.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// This file is part of Desktop App Toolkit,
|
||||
// a set of libraries for developing nice desktop applications.
|
||||
//
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
#include "ui/effects/gradient.h"
|
||||
|
||||
namespace anim {
|
||||
|
||||
QColor gradient_color_at(const QGradientStops &stops, float64 ratio) {
|
||||
for (auto i = 1; i < stops.size(); i++) {
|
||||
const auto currentPoint = stops[i].first;
|
||||
const auto previousPoint = stops[i - 1].first;
|
||||
|
||||
if ((ratio <= currentPoint) && (ratio >= previousPoint)) {
|
||||
return anim::color(
|
||||
stops[i - 1].second,
|
||||
stops[i].second,
|
||||
(ratio - previousPoint) / (currentPoint - previousPoint));
|
||||
}
|
||||
}
|
||||
return QColor();
|
||||
}
|
||||
|
||||
QColor gradient_color_at(const QGradient &gradient, float64 ratio) {
|
||||
return gradient_color_at(gradient.stops(), ratio);
|
||||
}
|
||||
|
||||
} // namespace anim
|
||||
Reference in New Issue
Block a user