diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 16:12:26 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 17:32:33 +0100 |
commit | 15e9d38d36573ba0e1ec6e0cc2768b12ca01bff0 (patch) | |
tree | 5bceab5dfb37941cbc055a978780ed0a777228e5 /plugingui/colour.h | |
parent | df32a5c6a6f8e204a757f68f0a61ea6f4843c569 (diff) |
WIP: Read images as uint8_t instead of float. Convert Colour and all colour related operations to use uint8_t instade of float and finally optimize rendering to render lines instead of single pixels.
Diffstat (limited to 'plugingui/colour.h')
-rw-r--r-- | plugingui/colour.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plugingui/colour.h b/plugingui/colour.h index 3a135fc..0bc8659 100644 --- a/plugingui/colour.h +++ b/plugingui/colour.h @@ -32,7 +32,8 @@ namespace GUI { -class Colour { +class Colour +{ public: Colour(); Colour(float grey, float alpha = 1.0f); @@ -45,13 +46,16 @@ public: bool operator==(const Colour& other) const; bool operator!=(const Colour& other) const; - inline float red() const { return data[0]; } - inline float green() const { return data[1]; } - inline float blue() const { return data[2]; } - inline float alpha() const { return data[3]; } + inline std::uint8_t red() const { return pixel[0]; } + inline std::uint8_t green() const { return pixel[1]; } + inline std::uint8_t blue() const { return pixel[2]; } + inline std::uint8_t alpha() const { return pixel[3]; } + + std::uint8_t* data() { return pixel.data(); } + const std::uint8_t* data() const { return pixel.data(); } private: - std::array<float, 4> data; + std::array<std::uint8_t, 4> pixel{{255, 255, 255, 255}}; }; } // GUI:: |