#include "Image.h"
#include "PngWriter.h"
#include "PngWriterImpl.h"

#include <iostream>

int main()
{
    unsigned width = 200;
    unsigned height = 200;
    unsigned numChannels = 3;
    auto image = Image::Create(width, height);
    image->SetNumChannels(numChannels);

    std::vector<unsigned char> data(image->GetBytesPerRow()*height, 0);
    for(unsigned jdx=0;jdx<height;jdx++)
    {
        const auto heightOffset = jdx*image->GetBytesPerRow();
        for(unsigned idx=0;idx<width*numChannels;idx+=numChannels)
        {
            const auto index = heightOffset + idx;
            data[index] = (idx%2 == 0) ? 255*jdx/(height+1) : 0;
            data[index+1] = 0;
            data[index+2] = 0;
        }
    }
    image->SetData(data);

    PngWriter writer;
    writer.SetPath("test.png");
    writer.Write(image);

    return 0;
}
