Allow strictly blurring images with alpha.
This commit is contained in:
parent
95dd2c8465
commit
2e63c6103e
2 changed files with 3 additions and 3 deletions
|
|
@ -506,7 +506,7 @@ ReadResult Read(ReadArgs &&args) {
|
||||||
: Option::None);
|
: Option::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Blur(QImage &&image) {
|
QImage Blur(QImage &&image, bool ignoreAlpha) {
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
return std::move(image);
|
return std::move(image);
|
||||||
}
|
}
|
||||||
|
|
@ -532,7 +532,7 @@ QImage Blur(QImage &&image) {
|
||||||
if (radius >= 16 || div >= w || div >= h || stride > w * 4) {
|
if (radius >= 16 || div >= w || div >= h || stride > w * 4) {
|
||||||
return std::move(image);
|
return std::move(image);
|
||||||
}
|
}
|
||||||
const auto withalpha = image.hasAlphaChannel();
|
const auto withalpha = !ignoreAlpha && image.hasAlphaChannel();
|
||||||
if (withalpha) {
|
if (withalpha) {
|
||||||
auto smaller = QImage(image.size(), image.format());
|
auto smaller = QImage(image.size(), image.format());
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ inline constexpr auto is_flag_type(Option) { return true; };
|
||||||
ImageRoundRadius radius,
|
ImageRoundRadius radius,
|
||||||
RectParts corners = RectPart::AllCorners);
|
RectParts corners = RectPart::AllCorners);
|
||||||
|
|
||||||
[[nodiscard]] QImage Blur(QImage &&image);
|
[[nodiscard]] QImage Blur(QImage &&image, bool ignoreAlpha = false);
|
||||||
[[nodiscard]] QImage Round(
|
[[nodiscard]] QImage Round(
|
||||||
QImage &&image,
|
QImage &&image,
|
||||||
ImageRoundRadius radius,
|
ImageRoundRadius radius,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue