Starting resize support.

This commit is contained in:
James Grogan 2022-11-14 14:57:50 +00:00
parent cea3d2c39f
commit 9ade0e2d4b
26 changed files with 197 additions and 44 deletions

View file

@ -26,22 +26,22 @@ std::unique_ptr<Color> Color::Create(const Color& color)
return std::make_unique<Color>(color);
}
unsigned Color::GetR() const
unsigned Color::getR() const
{
return mR;
}
unsigned Color::GetG() const
unsigned Color::getG() const
{
return mG;
}
unsigned Color::GetB() const
unsigned Color::getB() const
{
return mB;
}
double Color::GetAlpha() const
double Color::getAlpha() const
{
return mAlpha;
}

View file

@ -1,5 +1,8 @@
#pragma once
#include <memory>
#include <vector>
#include <cstdint>
class Color
{
@ -10,10 +13,10 @@ public:
static std::unique_ptr<Color> Create(unsigned r, unsigned g, unsigned b, double a = 1.0);
static std::unique_ptr<Color> Create(const Color& color);
unsigned GetR() const;
unsigned GetG() const;
unsigned GetB() const;
double GetAlpha() const;
unsigned getR() const;
unsigned getG() const;
unsigned getB() const;
double getAlpha() const;
bool operator==(const Color& rhs) const
{
@ -28,6 +31,16 @@ public:
return !operator==(rhs);
}
std::vector<double> getAsVectorDouble() const
{
return {mR/255.0, mG/255.0, mB/255.0, mAlpha/255.0};
}
uint32_t getAsUInt32() const
{
return mB + (mG<<8) + (mR<<16);
}
private:
unsigned mR{0};
unsigned mG{0};