mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 20:03:12 +00:00
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
/*
|
|
This file is part of Telegram Desktop,
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
For license and copyright information please follow this link:
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
*/
|
|
#include "dialogs/ui/dialogs_pill.h"
|
|
|
|
#include "ui/painter.h"
|
|
|
|
#include "styles/style_dialogs.h"
|
|
|
|
namespace Dialogs {
|
|
|
|
void PaintPillTopSheen(QPainter &p, const QRect &pill, int radius) {
|
|
if (pill.isEmpty() || st::dialogsBg->c.lightness() >= 128) {
|
|
return;
|
|
}
|
|
auto top = QColor(255, 255, 255, 40);
|
|
auto mid = QColor(255, 255, 255, 0);
|
|
auto bottom = QColor(255, 255, 255, 20);
|
|
auto grad = QLinearGradient(0, pill.top(), 0, pill.bottom());
|
|
grad.setColorAt(0., top);
|
|
grad.setColorAt(0.5, mid);
|
|
grad.setColorAt(1., bottom);
|
|
p.setPen(QPen(QBrush(grad), st::lineWidth));
|
|
p.setBrush(Qt::NoBrush);
|
|
const auto half = 0.5 * st::lineWidth;
|
|
const auto stroke = QRectF(pill).adjusted(half, half, -half, -half);
|
|
p.drawRoundedRect(stroke, radius - half, radius - half);
|
|
}
|
|
|
|
} // namespace Dialogs
|