diff options
Diffstat (limited to 'third_party/blurhash/blurhash.hpp')
-rw-r--r-- | third_party/blurhash/blurhash.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/third_party/blurhash/blurhash.hpp b/third_party/blurhash/blurhash.hpp new file mode 100644 index 00000000..5077f0d5 --- /dev/null +++ b/third_party/blurhash/blurhash.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include <string> +#include <string_view> +#include <vector> + +namespace blurhash { +struct Image +{ + size_t width, height; + std::vector<unsigned char> image; // pixels rgb +}; + +// Decode a blurhash to an image with size width*height +Image +decode(std::string_view blurhash, size_t width, size_t height); + +// Encode an image of rgb pixels (without padding) with size width*height into a blurhash with x*y +// components +std::string +encode(unsigned char *image, size_t width, size_t height, int x, int y); +} |