#include "RasterPainter.h"

#include "DrawingSurface.h"
#include "DrawingContext.h"
#include "Grid.h"

RasterPainter::RasterPainter(DrawingContext* context)
     : AbstractPainter(context)
{
    const auto width = context->getSurface()->getWidth();
    const auto height = context->getSurface()->getHeight();

    mGrid = std::make_unique<Grid<unsigned char> >(Bounds{ 0.0, 0.0, 100.0, 100.0 }, width, height);
}

void RasterPainter::paint()
{
    const auto width = mDrawingContext->getSurface()->getWidth();
    const auto height = mDrawingContext->getSurface()->getHeight();
    mGrid->resetBounds(Bounds{ 0.0, 0.0, static_cast<double>(width), static_cast<double>(height) });

    /*
    for (unsigned idx=0; idx< context->getNumItems(); idx++)
    {
        context->getDrawable(idx)->sample(mGrid.get());
    }

    context->getSurface()->getImage()->setData(mGrid->getValues());
    */
}
