5#include <BufferStream.h>
14 this->
data = std::move(psFramesData);
15 BufferStreamReadOnly stream{this->
data};
27 :
PSFrames(std::vector<std::byte>{psFramesData.begin(), psFramesData.end()}) {}
30 :
PSFrames(
fs::readFileBuffer(psFramesPath)) {}
53 BufferStreamReadOnly stream{this->
data.data(), this->
data.size()};
55 const std::span palettePixelData{
reinterpret_cast<const ImagePixel::BGR888*
>(palette.data()), 256};
57 std::vector<std::byte> out;
58 out.resize(this->
width * this->
height *
sizeof(ImagePixel::BGR888));
59 BufferStream outStream{out};
60 for (uint32_t i = 0; i < this->
width * this->
height; i++) {
61 outStream << palettePixelData[stream.read<uint8_t>()];
67 static constexpr auto headerSize =
sizeof(uint32_t) * 5 +
sizeof(uint16_t) * 3 +
sizeof(uint8_t);
68 static constexpr auto sampleSize = 19;
73 return 256 *
sizeof(ImagePixel::BGR888) + this->
width * this->
height;
uint32_t getFrameCount() const
uint32_t getFrameOffset(uint32_t frame) const
std::vector< std::byte > data
std::vector< std::byte > getImageDataAsBGR888(uint32_t frame) const
uint16_t getHeight() const
uint16_t getWidth() const
std::vector< std::byte > getImageDataAs(ImageFormat newFormat, uint32_t frame) const
PSFrames(std::vector< std::byte > &&psFramesData)
uint32_t getFramePaletteAndImageSize() const
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.