Add geometry handling.
This commit is contained in:
parent
9c116b1efd
commit
c1389218f2
37 changed files with 294 additions and 278 deletions
|
@ -7,6 +7,23 @@ Image::Image(unsigned width, unsigned height)
|
|||
|
||||
}
|
||||
|
||||
void Image::Initialize()
|
||||
{
|
||||
mData = std::vector<unsigned char>(GetBytesPerRow()*mHeight, 0);
|
||||
}
|
||||
|
||||
void Image::SetPixelValue(unsigned idx, unsigned jdx, const Color& color)
|
||||
{
|
||||
if (mData.empty())
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
mData[jdx*GetBytesPerRow() + idx*3] = static_cast<unsigned char>(color.GetR());
|
||||
mData[jdx*GetBytesPerRow() + idx*3 + 1] = static_cast<unsigned char>(color.GetG());
|
||||
mData[jdx*GetBytesPerRow() + idx*3 + 2] = static_cast<unsigned char>(color.GetB());
|
||||
}
|
||||
|
||||
std::unique_ptr<Image> Image::Create(unsigned width, unsigned height)
|
||||
{
|
||||
return std::make_unique<Image>(width, height);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue