diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 16:12:26 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-03-07 19:22:34 +0100 |
commit | a65278c7bc9c0dbca8a74db09fd0aebf1c26ef28 (patch) | |
tree | f6137641afd154dca1c45480137e9b56afb1a7d6 /plugingui/colour.h | |
parent | 450e39c5b02ace3c50d116e4cba825ff695c8665 (diff) |
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:: |