From 6683d42b636619e02e2bcf98923a2fdbf44bd95b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 May 2015 17:07:13 +0300 Subject: Move functions getColor, getIdByChar from palette to theme and userpalette. --- src/gui/theme.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/gui/theme.h') diff --git a/src/gui/theme.h b/src/gui/theme.h index edbe31a08..5a9a75bb0 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -124,6 +124,31 @@ class Theme final : public Palette, float getMinimumOpacity() const A_WARN_UNUSED { return mMinimumOpacity; } + /** + * Gets the color associated with the type. Sets the alpha channel + * before returning. + * + * @param type the color type requested + * @param alpha alpha channel to use + * + * @return the requested color + */ + inline const Color &getColor(int type, + const int alpha = 255) A_WARN_UNUSED + { + if (type >= static_cast(mColors.size()) || type < 0) + { + logger->log("incorrect color request type: %d from %u", + type, static_cast(mColors.size())); + type = 0; + } + Color* col = &mColors[type].color; + col->a = alpha; + return *col; + } + + int getIdByChar(const signed char c, bool &valid) const A_WARN_UNUSED; + /** * Set the minimum opacity allowed to skins. * Set a negative value to free the minimum allowed. -- cgit v1.2.3-60-g2f50