File indexing completed on 2024-10-06 10:23:48

0001 // SPDX-FileCopyrightText: 2018 Wolt Enterprises
0002 // SPDX-License-Identifier: MIT
0003 
0004 #pragma once
0005 
0006 #include <stdint.h>
0007 
0008 /**
0009  * @brief Returns the pixel array of the result image given the blurhash string.
0010  *
0011  * @param blurhash a string representing the blurhash to be decoded.
0012  * @param width the width of the resulting image.
0013  * @param height the height of the resulting image.
0014  * @param punch the factor to improve the contrast, default = 1.
0015  * @param nChannels the number of channels in the resulting image array, 3 = RGB, 4 = RGBA.
0016  *
0017  * @return A pointer to memory region where pixels are stored in (H, W, C) format.
0018  */
0019 uint8_t *decode(const char *blurhash, int width, int height, int punch, int nChannels);
0020 
0021 /**
0022  * @brief Checks if the Blurhash is valid or not.
0023  *
0024  * @param blurhash a string representing the blurhash.
0025  *
0026  * @return A bool (true if it is a valid blurhash, else false).
0027  */
0028 bool isValidBlurhash(const char *blurhash);