forked from mia/Aegisub
Return a rgba string for coloralpha lua controls
This commit is contained in:
parent
5029b5286f
commit
1dbe7dd5f9
3 changed files with 6 additions and 4 deletions
|
@ -43,7 +43,9 @@ std::string Color::GetSsaFormatted() const {
|
|||
return boost::lexical_cast<std::string>((a << 24) + (b << 16) + (g << 8) + r);
|
||||
}
|
||||
|
||||
std::string Color::GetHexFormatted() const {
|
||||
std::string Color::GetHexFormatted(bool rgba) const {
|
||||
if (rgba)
|
||||
return str(boost::format("#%02X%02X%02X%02X") % (int)r % (int)g % (int)b % (int)a);
|
||||
return str(boost::format("#%02X%02X%02X") % (int)r % (int)g % (int)b);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace agi {
|
|||
std::string GetAssStyleFormatted() const;
|
||||
std::string GetAssOverrideFormatted() const;
|
||||
std::string GetSsaFormatted() const;
|
||||
std::string GetHexFormatted() const;
|
||||
std::string GetHexFormatted(bool rgba=false) const;
|
||||
std::string GetRgbFormatted() const;
|
||||
|
||||
operator std::string() const { return GetRgbFormatted(); }
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace Automation4 {
|
|||
}
|
||||
|
||||
bool CanSerialiseValue() const override { return true; }
|
||||
std::string SerialiseValue() const override { return inline_string_encode(color.GetHexFormatted()); }
|
||||
std::string SerialiseValue() const override { return inline_string_encode(color.GetHexFormatted(alpha)); }
|
||||
void UnserialiseValue(const std::string &serialised) override { color = inline_string_decode(serialised); }
|
||||
|
||||
wxControl *Create(wxWindow *parent) override {
|
||||
|
@ -216,7 +216,7 @@ namespace Automation4 {
|
|||
}
|
||||
|
||||
void LuaReadBack(lua_State *L) override {
|
||||
lua_pushstring(L, color.GetHexFormatted().c_str());
|
||||
lua_pushstring(L, color.GetHexFormatted(alpha).c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue