mirror of https://github.com/Nheko-Reborn/nheko
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
562 B
22 lines
562 B
#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, size_t bytesPerPixel = 3) noexcept;
|
|
|
|
// 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);
|
|
}
|
|
|