Changed the optional 'multiply alpha' boolean argument in love.graphics.setBlendMode to be an enum with constants 'alphamultiply' and 'premultiplied'.

The default value for the second argument of setBlendMode is 'alphamultiply'.
This commit is contained in:
Alex Szpakowski
2015-12-16 14:53:16 -04:00
parent 39127cd1b2
commit 48345bd58c
5 changed files with 61 additions and 21 deletions
+22 -4
View File
@@ -82,6 +82,16 @@ bool Graphics::getConstant(BlendMode in, const char *&out)
return blendModes.find(in, out);
}
bool Graphics::getConstant(const char *in, BlendAlpha &out)
{
return blendAlphaModes.find(in, out);
}
bool Graphics::getConstant(BlendAlpha in, const char *&out)
{
return blendAlphaModes.find(in, out);
}
bool Graphics::getConstant(const char *in, LineStyle &out)
{
return lineStyles.find(in, out);
@@ -172,16 +182,24 @@ StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM> Graphics::drawModes(Graph
StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendModeEntries[] =
{
{ "alpha", BLEND_ALPHA },
{ "add", BLEND_ADD },
{ "alpha", BLEND_ALPHA },
{ "add", BLEND_ADD },
{ "subtract", BLEND_SUBTRACT },
{ "multiply", BLEND_MULTIPLY },
{ "screen", BLEND_SCREEN },
{ "replace", BLEND_REPLACE },
{ "screen", BLEND_SCREEN },
{ "replace", BLEND_REPLACE },
};
StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
StringMap<Graphics::BlendAlpha, Graphics::BLENDALPHA_MAX_ENUM>::Entry Graphics::blendAlphaEntries[] =
{
{ "alphamultiply", BLENDALPHA_MULTIPLY },
{ "premultiplied", BLENDALPHA_PREMULTIPLIED },
};
StringMap<Graphics::BlendAlpha, Graphics::BLENDALPHA_MAX_ENUM> Graphics::blendAlphaModes(Graphics::blendAlphaEntries, sizeof(Graphics::blendAlphaEntries));
StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM>::Entry Graphics::lineStyleEntries[] =
{
{ "smooth", LINE_SMOOTH },