14 this->
data = std::move(psFramesData);
15 BufferStreamReadOnly stream{this->
data};
21 for (uint32_t i = 0; i < this->
frameCount; i++) {
22 auto& [width, height, paletteData, imageData] = this->
frames.emplace_back();
24 if (stream.read<uint32_t>() != 65793) {
28 if (
const auto palettePixelCount = stream.read<uint16_t>(); palettePixelCount != 256) {
31 if (
const auto palettePixelBits = stream.read<uint16_t>(); palettePixelBits != 24) {
34 stream.skip(3) >> width >> height;
35 if (
const auto paletteIndexBits = stream.read<uint8_t>(); paletteIndexBits != 8) {
38 if (
const auto decodedPixelBits = stream.read<uint16_t>(); decodedPixelBits != 32) {
42 paletteData = stream.read_span<std::byte>(256 *
sizeof(ImagePixel::BGR888));
43 imageData = stream.read_span<std::byte>(width * height);
101 const auto& [width, height, paletteData, imageData] = this->
frames.at(frame);
102 const std::span palettePixelData{
reinterpret_cast<const ImagePixel::BGR888*
>(paletteData.data()), 256};
104 std::vector<std::byte> out;
105 out.resize(width * height *
sizeof(ImagePixel::BGR888));
106 BufferStream stream{out};
107 for (uint32_t i = 0; i < width * height; i++) {
108 stream << palettePixelData[static_cast<uint8_t>(imageData[i])];
std::vector< std::byte > convertImageDataToFormat(std::span< const std::byte > imageData, ImageFormat oldFormat, ImageFormat newFormat, uint16_t width, uint16_t height, float quality=DEFAULT_COMPRESSED_QUALITY)
Converts an image from one format to another.