5#include <BufferStream.h>
13 this->
data = std::move(psFramesData);
14 BufferStreamReadOnly stream{this->
data};
26 :
PSFrames(std::vector<std::byte>{psFramesData.begin(), psFramesData.end()}) {}
29 :
PSFrames(
fs::readFileBuffer(psFramesPath)) {}
52 BufferStreamReadOnly stream{this->
data.data(), this->
data.size()};
54 const std::span palettePixelData{
reinterpret_cast<const ImagePixel::BGR888*
>(palette.data()), 256};
56 std::vector<std::byte> out;
58 BufferStream outStream{out};
59 for (uint32_t i = 0; i < this->
width * this->
height; i++) {
60 outStream << palettePixelData[stream.read<uint8_t>()];
66 static constexpr auto headerSize =
sizeof(uint32_t) * 5 +
sizeof(uint16_t) * 3 +
sizeof(uint8_t);
67 static constexpr auto sampleSize = 19;
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.