#include "ImageBitStream.h"

#include "AbstractGrid.h"

ImageBitStream::ImageBitStream(Image* image)
    :   BitStream(),
        mImage(image)
{

}

bool ImageBitStream::isFinished() const
{
    return mByteOffset == static_cast<int>(mImage->getGrid()->getDataSize());
}

std::vector<unsigned char> ImageBitStream::peekNextNBytes(unsigned) const
{
    return {};
}

std::optional<unsigned char> ImageBitStream::readNextByte()
{
    mByteOffset++;

    if (isFinished() )
    {
        return std::nullopt;
    }
    //const auto val = mImage->getData()->getAsUnsignedChar(mByteOffset);
    //return val;
    return {};
}

void ImageBitStream::writeByte(unsigned char, bool )
{
    mByteOffset++;

    if (isFinished() )
    {
        return;
    }
    //mImage->getData()->setDataItem(mByteOffset, data);
}

