mirror of
https://github.com/hyprwm/hyprgraphics.git
synced 2026-05-09 11:48:08 +02:00
png: libpng is straight alpha, but cairo is premult
Some checks failed
Build & Test (Arch) / Arch: Build and Test (gcc) (push) Has been cancelled
Build & Test (Arch) / Arch: Build and Test (clang) (push) Has been cancelled
Build & Test / nix (hyprgraphics) (push) Has been cancelled
Build & Test / nix (hyprgraphics-with-tests) (push) Has been cancelled
Some checks failed
Build & Test (Arch) / Arch: Build and Test (gcc) (push) Has been cancelled
Build & Test (Arch) / Arch: Build and Test (clang) (push) Has been cancelled
Build & Test / nix (hyprgraphics) (push) Has been cancelled
Build & Test / nix (hyprgraphics-with-tests) (push) Has been cancelled
ref #23
This commit is contained in:
parent
a71c0529d1
commit
b841473a0b
1 changed files with 4 additions and 0 deletions
|
|
@ -111,6 +111,10 @@ static std::expected<cairo_surface_t*, std::string> loadPNG(png_structp png, png
|
|||
uint8_t g = rawData[i + 1];
|
||||
uint8_t b = rawData[i + 2];
|
||||
uint8_t a = rawData[i + 3];
|
||||
|
||||
r *= ((float)a) / 255.F;
|
||||
g *= ((float)a) / 255.F;
|
||||
b *= ((float)a) / 255.F;
|
||||
*(uint32_t*)&rawData[i] = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue