Clean image types
This commit is contained in:
parent
e7683cd94e
commit
c6d03f16d0
18 changed files with 169 additions and 107 deletions
|
@ -1,43 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
#include "Color.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class Color;
|
||||
|
||||
template<typename T>
|
||||
class Image
|
||||
{
|
||||
public:
|
||||
|
||||
Image(unsigned width, unsigned height);
|
||||
~Image();
|
||||
static std::unique_ptr<Image> Create(unsigned width, unsigned height);
|
||||
static std::unique_ptr<Image<T> > Create(unsigned width, unsigned height);
|
||||
|
||||
unsigned GetBytesPerRow() const;
|
||||
unsigned GetWidth() const;
|
||||
unsigned GetHeight() const;
|
||||
unsigned GetBitDepth() const;
|
||||
unsigned GetNumChannels() const;
|
||||
unsigned getBytesPerRow() const;
|
||||
unsigned getWidth() const;
|
||||
unsigned getHeight() const;
|
||||
unsigned getBitDepth() const;
|
||||
unsigned getNumChannels() const;
|
||||
|
||||
void SetPixelValue(unsigned idx, unsigned jdx, const Color& color);
|
||||
void setPixelValue(unsigned idx, unsigned jdx, const Color& color);
|
||||
|
||||
unsigned char GetByte(unsigned idx, unsigned jdx) const;
|
||||
T 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);
|
||||
void setData(const std::vector<T>& data);
|
||||
void setWidth(unsigned width);
|
||||
void setHeight(unsigned height);
|
||||
void setBitDepth(unsigned bitDepth);
|
||||
void setNumChannels(unsigned numChannels);
|
||||
|
||||
private:
|
||||
void Initialize();
|
||||
void initialize();
|
||||
|
||||
unsigned mWidth{1};
|
||||
unsigned mHeight{1};
|
||||
unsigned mBitDepth{8};
|
||||
unsigned mNumChannels{1};
|
||||
std::vector<unsigned char> mData;
|
||||
std::vector<T> mData;
|
||||
};
|
||||
|
||||
using ImagePtr = std::unique_ptr<Image>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue