13 std::vector<uint8_t> pixels;
17inline uint8_t ExpandBits(uint32_t value,
int bits) {
18 const uint32_t max = (1u << bits) - 1;
19 return (uint8_t)((value * 255 + max / 2) / max);
22inline uint32_t CompressBits(uint8_t value,
int bits) {
23 const uint32_t max = (1u << bits) - 1;
24 return (value * max + 127) / 255;
30 std::vector<uint8_t> indices;
31 std::vector<uint8_t> palette;
35bool DecodeImage(
const std::vector<uint8_t>& file, std::vector<RgbaImage>& frames, std::vector<int>* delays,
38bool DecodeIndexedPng(
const std::vector<uint8_t>& file,
IndexedImage& out);
39bool IsGif(
const std::vector<uint8_t>& file);
41std::vector<uint8_t> EncodePng(
const RgbaImage& image);
43std::vector<uint8_t> EncodeGrayPng(
int width,
int height,
const std::vector<uint8_t>& channels,
bool alpha);
44std::vector<uint8_t> EncodeIndexedPng(
const IndexedImage& image);