mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show sticker / reaction preview over premium gradient.
This commit is contained in:
parent
7ba997259c
commit
e8933decb1
1 changed files with 23 additions and 12 deletions
|
@ -786,22 +786,33 @@ void Show(
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto fill = QSize(st::boxWideWidth, st::boxWideWidth);
|
const auto fill = QSize(st::boxWideWidth, st::boxWideWidth);
|
||||||
const auto theme = controller->currentChatTheme();
|
const auto stops = Ui::Premium::LimitGradientStops();
|
||||||
const auto color = theme->background().colorForFill;
|
//const auto theme = controller->currentChatTheme();
|
||||||
const auto area = QSize(fill.width(), fill.height() * 2);
|
//const auto color = theme->background().colorForFill;
|
||||||
const auto request = theme->cacheBackgroundRequest(area);
|
//const auto area = QSize(fill.width(), fill.height() * 2);
|
||||||
|
//const auto request = theme->cacheBackgroundRequest(area);
|
||||||
crl::async([=] {
|
crl::async([=] {
|
||||||
using Option = Images::Option;
|
using Option = Images::Option;
|
||||||
auto back = color
|
//auto back = color
|
||||||
? SolidColorImage(area, *color)
|
// ? SolidColorImage(area, *color)
|
||||||
: request.background.waitingForNegativePattern()
|
// : request.background.waitingForNegativePattern()
|
||||||
? SolidColorImage(area, Qt::black)
|
// ? SolidColorImage(area, Qt::black)
|
||||||
: Ui::CacheBackground(request).image;
|
// : Ui::CacheBackground(request).image;
|
||||||
const auto factor = style::DevicePixelRatio();
|
const auto factor = style::DevicePixelRatio();
|
||||||
auto cropped = back.copy(QRect(
|
//auto cropped = back.copy(QRect(
|
||||||
QPoint(0, fill.height() * factor / 2),
|
// QPoint(0, fill.height() * factor / 2),
|
||||||
fill * factor));
|
// fill * factor));
|
||||||
|
//cropped.setDevicePixelRatio(factor);
|
||||||
|
auto cropped = QImage(
|
||||||
|
fill * factor,
|
||||||
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
cropped.setDevicePixelRatio(factor);
|
cropped.setDevicePixelRatio(factor);
|
||||||
|
auto p = QPainter(&cropped);
|
||||||
|
auto gradient = QLinearGradient(0, fill.height(), fill.width(), 0);
|
||||||
|
gradient.setStops(stops);
|
||||||
|
p.fillRect(QRect(QPoint(), fill), gradient);
|
||||||
|
p.end();
|
||||||
|
|
||||||
const auto options = Images::Options()
|
const auto options = Images::Options()
|
||||||
| Option::RoundSkipBottomLeft
|
| Option::RoundSkipBottomLeft
|
||||||
| Option::RoundSkipBottomRight
|
| Option::RoundSkipBottomRight
|
||||||
|
|
Loading…
Add table
Reference in a new issue