stuff-from-scratch/src/image/ImageBitStream.cpp

37 lines
612 B
C++
Raw Normal View History

2022-11-23 15:41:33 +00:00
#include "ImageBitStream.h"
ImageBitStream::ImageBitStream(Image<unsigned char>* image)
: BitStream(),
mImage(image)
{
}
bool ImageBitStream::isFinished() const
{
2022-11-24 16:15:41 +00:00
return mByteOffset == mImage->getDataRef().size();
2022-11-23 15:41:33 +00:00
}
std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned n) const
{
return {};
}
std::optional<unsigned char> ImageBitStream::readNextByte()
{
2022-11-24 16:15:41 +00:00
mByteOffset++;
if (isFinished() )
{
return std::nullopt;
}
const auto val = mImage->getDataRef()[mByteOffset];
return val;
2022-11-23 15:41:33 +00:00
}
void ImageBitStream::writeByte(unsigned char data)
{
}