mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Moved the AColor type to a gfx/ header, so other code can use it.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@847 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -11,34 +11,6 @@
|
||||
#include <render/symbol/viewer.hpp>
|
||||
#include <gfx/gfx.hpp>
|
||||
#include <util/error.hpp>
|
||||
#include <script/value.hpp> // for some strange reason the profile build needs this :(
|
||||
|
||||
// ----------------------------------------------------------------------------- : Color
|
||||
|
||||
template <> void GetDefaultMember::handle(const AColor& col) {
|
||||
handle((const Color&)col);
|
||||
}
|
||||
template <> void Reader::handle(AColor& col) {
|
||||
UInt r,g,b,a;
|
||||
String v = getValue();
|
||||
if (wxSscanf(v.c_str(),_("rgb(%u,%u,%u)"),&r,&g,&b)) {
|
||||
col.Set(r,g,b);
|
||||
col.alpha = 255;
|
||||
} else if (wxSscanf(v.c_str(),_("rgba(%u,%u,%u,%u)"),&r,&g,&b,&a)) {
|
||||
col.Set(r,g,b);
|
||||
col.alpha = a;
|
||||
} else {
|
||||
col = Color(v);
|
||||
if (!col.Ok()) col = *wxBLACK;
|
||||
}
|
||||
}
|
||||
template <> void Writer::handle(const AColor& col) {
|
||||
if (col.alpha == 255) {
|
||||
handle(String::Format(_("rgb(%u,%u,%u)"), col.Red(), col.Green(), col.Blue()));
|
||||
} else {
|
||||
handle(String::Format(_("rgba(%u,%u,%u,%u)"), col.Red(), col.Green(), col.Blue(), col.alpha));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Symbol filtering
|
||||
|
||||
|
||||
@@ -11,21 +11,11 @@
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/reflect.hpp>
|
||||
#include <gfx/color.hpp>
|
||||
|
||||
DECLARE_POINTER_TYPE(Symbol);
|
||||
class SymbolFilter;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Color
|
||||
|
||||
/// Color with alpha channel
|
||||
class AColor : public Color {
|
||||
public:
|
||||
Byte alpha; ///< The alpha value, in the range [0..255]
|
||||
inline AColor() : alpha(0) {}
|
||||
inline AColor(Byte r, Byte g, Byte b, Byte a = 255) : Color(r,g,b), alpha(a) {}
|
||||
inline AColor(const Color& color, Byte a = 255) : Color(color), alpha(a) {}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Symbol filtering
|
||||
|
||||
/// Filter a symbol-image.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <render/text/element.hpp>
|
||||
#include <util/tagged_string.hpp>
|
||||
#include <data/field/text.hpp>
|
||||
#include <gfx/color.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(TextElementP);
|
||||
DECLARE_POINTER_TYPE(FontTextElement);
|
||||
|
||||
Reference in New Issue
Block a user