diff options
author | Neil <nyamatongwe@gmail.com> | 2024-03-14 10:23:18 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2024-03-14 10:23:18 +1100 |
commit | 7b318c5156ae8b4c9a014717416ceaab7cf2aade (patch) | |
tree | d3b9921857bdece9304da784c1ea3cd17a918a46 /src/Geometry.h | |
parent | afd1e8e565a5d80b622b283a217681981f066495 (diff) | |
download | scintilla-mirror-7b318c5156ae8b4c9a014717416ceaab7cf2aade.tar.gz |
Add ColourRGBA::Grey constructing method to simplify use of grey-scale colours.
Use symbolic constants for colour components, fixing 'magic number' warnings.
Diffstat (limited to 'src/Geometry.h')
-rw-r--r-- | src/Geometry.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Geometry.h b/src/Geometry.h index a9daa5516..d02a25bbb 100644 --- a/src/Geometry.h +++ b/src/Geometry.h @@ -182,7 +182,7 @@ public: constexpr explicit ColourRGBA(int co_ = 0) noexcept : co(co_) { } - constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha= maximumByte) noexcept : + constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=maximumByte) noexcept : ColourRGBA(red | (green << 8) | (blue << 16) | (alpha << 24)) { } @@ -194,6 +194,10 @@ public: return ColourRGBA(co_ | (maximumByte << 24)); } + static constexpr ColourRGBA Grey(unsigned int grey, unsigned int alpha=maximumByte) noexcept { + return ColourRGBA(grey, grey, grey, alpha); + } + static constexpr ColourRGBA FromIpRGB(intptr_t co_) noexcept { const int rgb = co_ & rgbMask; return ColourRGBA(rgb | (maximumByte << 24)); |