diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/blurhash/blurhash.cpp | 5 | ||||
-rw-r--r-- | third_party/blurhash/blurhash.hpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/third_party/blurhash/blurhash.cpp b/third_party/blurhash/blurhash.cpp index 0ff6cb74..cd0a18a4 100644 --- a/third_party/blurhash/blurhash.cpp +++ b/third_party/blurhash/blurhash.cpp @@ -251,7 +251,7 @@ multiplyBasisFunction(Components components, int width, int height, unsigned cha namespace blurhash { Image -decode(std::string_view blurhash, size_t width, size_t height) +decode(std::string_view blurhash, size_t width, size_t height, size_t bytesPerPixel) { Image i{}; @@ -295,6 +295,9 @@ decode(std::string_view blurhash, size_t width, size_t height) i.image.push_back(static_cast<unsigned char>(linearToSrgb(c.r))); i.image.push_back(static_cast<unsigned char>(linearToSrgb(c.g))); i.image.push_back(static_cast<unsigned char>(linearToSrgb(c.b))); + + for (size_t p = 3; p < bytesPerPixel; p++) + i.image.push_back(255); } } diff --git a/third_party/blurhash/blurhash.hpp b/third_party/blurhash/blurhash.hpp index 5077f0d5..e01b9b3f 100644 --- a/third_party/blurhash/blurhash.hpp +++ b/third_party/blurhash/blurhash.hpp @@ -13,7 +13,7 @@ struct Image // Decode a blurhash to an image with size width*height Image -decode(std::string_view blurhash, size_t width, size_t height); +decode(std::string_view blurhash, size_t width, size_t height, size_t bytesPerPixel = 3); // Encode an image of rgb pixels (without padding) with size width*height into a blurhash with x*y // components |