#pragma once

#include "Color.h"

#include <memory>
#include <vector>


class Image
{
public:

    Image(unsigned width, unsigned height);
    ~Image();
    static std::unique_ptr<Image> Create(unsigned width, unsigned height);

    unsigned GetBytesPerRow() const;
    unsigned GetWidth() const;
    unsigned GetHeight() const;
    unsigned GetBitDepth() const;
    unsigned GetNumChannels() const;

    void SetPixelValue(unsigned idx, unsigned jdx, const Color& color);

    unsigned char GetByte(unsigned idx, unsigned jdx) const;

    void SetData(const std::vector<unsigned char>& data);
    void SetWidth(unsigned width);
    void SetHeight(unsigned height);
    void SetBitDepth(unsigned bitDepth);
    void SetNumChannels(unsigned numChannels);

private:
    void Initialize();

    unsigned mWidth{1};
    unsigned mHeight{1};
    unsigned mBitDepth{8};
    unsigned mNumChannels{1};
    std::vector<unsigned char> mData;
};

using ImagePtr = std::unique_ptr<Image>;
