mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Renamed love.graphics.setDefaultImageFilter to love.graphics.setDefaultFilter
This commit is contained in:
@@ -629,12 +629,12 @@ Graphics::BlendMode Graphics::getBlendMode() const
|
|||||||
throw Exception("Unknown blend mode");
|
throw Exception("Unknown blend mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::setDefaultImageFilter(const Image::Filter &f)
|
void Graphics::setDefaultFilter(const Image::Filter &f)
|
||||||
{
|
{
|
||||||
Image::setDefaultFilter(f);
|
Image::setDefaultFilter(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Image::Filter &Graphics::getDefaultImageFilter() const
|
const Image::Filter &Graphics::getDefaultFilter() const
|
||||||
{
|
{
|
||||||
return Image::getDefaultFilter();
|
return Image::getDefaultFilter();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,20 +304,20 @@ public:
|
|||||||
**/
|
**/
|
||||||
void setBlendMode(BlendMode mode);
|
void setBlendMode(BlendMode mode);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current image filter.
|
|
||||||
**/
|
|
||||||
void setDefaultImageFilter(const Image::Filter &f);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current blend mode.
|
* Gets the current blend mode.
|
||||||
**/
|
**/
|
||||||
BlendMode getBlendMode() const;
|
BlendMode getBlendMode() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current image filter.
|
* Sets the default filter for images, canvases, and fonts.
|
||||||
**/
|
**/
|
||||||
const Image::Filter &getDefaultImageFilter() const;
|
void setDefaultFilter(const Image::Filter &f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default filter for images, canvases, and fonts.
|
||||||
|
**/
|
||||||
|
const Image::Filter &getDefaultFilter() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default texture anisotropic filtering level.
|
* Default texture anisotropic filtering level.
|
||||||
@@ -326,7 +326,7 @@ public:
|
|||||||
float getDefaultAnisotropy() const;
|
float getDefaultAnisotropy() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Image mipmap filtermode and sharpness values.
|
* Default Image mipmap filter mode and sharpness values.
|
||||||
**/
|
**/
|
||||||
void setDefaultMipmapFilter(Image::FilterMode filter, float sharpness);
|
void setDefaultMipmapFilter(Image::FilterMode filter, float sharpness);
|
||||||
void getDefaultMipmapFilter(Image::FilterMode *filter, float *sharpness) const;
|
void getDefaultMipmapFilter(Image::FilterMode *filter, float *sharpness) const;
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ int w_newFont(lua_State *L)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Create the font.
|
// Create the font.
|
||||||
font = instance->newFont(rasterizer, instance->getDefaultImageFilter());
|
font = instance->newFont(rasterizer, instance->getDefaultFilter());
|
||||||
}
|
}
|
||||||
catch (love::Exception &e)
|
catch (love::Exception &e)
|
||||||
{
|
{
|
||||||
@@ -426,7 +426,7 @@ int w_newImageFont(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!setFilter)
|
if (!setFilter)
|
||||||
img_filter = instance->getDefaultImageFilter();
|
img_filter = instance->getDefaultFilter();
|
||||||
|
|
||||||
// Create the font.
|
// Create the font.
|
||||||
Font *font = instance->newFont(rasterizer, img_filter);
|
Font *font = instance->newFont(rasterizer, img_filter);
|
||||||
@@ -719,31 +719,6 @@ int w_setBlendMode(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_setDefaultImageFilter(lua_State *L)
|
|
||||||
{
|
|
||||||
Image::FilterMode min;
|
|
||||||
Image::FilterMode mag;
|
|
||||||
|
|
||||||
const char *minstr = luaL_checkstring(L, 1);
|
|
||||||
const char *magstr = luaL_optstring(L, 2, minstr);
|
|
||||||
|
|
||||||
if (!Image::getConstant(minstr, min))
|
|
||||||
return luaL_error(L, "Invalid filter mode: %s", minstr);
|
|
||||||
if (!Image::getConstant(magstr, mag))
|
|
||||||
return luaL_error(L, "Invalid filter mode: %s", magstr);
|
|
||||||
|
|
||||||
Image::Filter f;
|
|
||||||
f.min = min;
|
|
||||||
f.mag = mag;
|
|
||||||
|
|
||||||
instance->setDefaultImageFilter(f);
|
|
||||||
|
|
||||||
float anisotropy = (float) luaL_optnumber(L, 3, 1.0);
|
|
||||||
instance->setDefaultAnisotropy(anisotropy);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_getBlendMode(lua_State *L)
|
int w_getBlendMode(lua_State *L)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -761,9 +736,34 @@ int w_getBlendMode(lua_State *L)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getDefaultImageFilter(lua_State *L)
|
int w_setDefaultFilter(lua_State *L)
|
||||||
{
|
{
|
||||||
const Image::Filter &f = instance->getDefaultImageFilter();
|
Image::FilterMode min;
|
||||||
|
Image::FilterMode mag;
|
||||||
|
|
||||||
|
const char *minstr = luaL_checkstring(L, 1);
|
||||||
|
const char *magstr = luaL_optstring(L, 2, minstr);
|
||||||
|
|
||||||
|
if (!Image::getConstant(minstr, min))
|
||||||
|
return luaL_error(L, "Invalid filter mode: %s", minstr);
|
||||||
|
if (!Image::getConstant(magstr, mag))
|
||||||
|
return luaL_error(L, "Invalid filter mode: %s", magstr);
|
||||||
|
|
||||||
|
Image::Filter f;
|
||||||
|
f.min = min;
|
||||||
|
f.mag = mag;
|
||||||
|
|
||||||
|
instance->setDefaultFilter(f);
|
||||||
|
|
||||||
|
float anisotropy = (float) luaL_optnumber(L, 3, 1.0);
|
||||||
|
instance->setDefaultAnisotropy(anisotropy);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int w_getDefaultFilter(lua_State *L)
|
||||||
|
{
|
||||||
|
const Image::Filter &f = instance->getDefaultFilter();
|
||||||
const char *minstr;
|
const char *minstr;
|
||||||
const char *magstr;
|
const char *magstr;
|
||||||
if (!Image::getConstant(f.min, minstr))
|
if (!Image::getConstant(f.min, minstr))
|
||||||
@@ -1409,9 +1409,9 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getFont", w_getFont },
|
{ "getFont", w_getFont },
|
||||||
|
|
||||||
{ "setBlendMode", w_setBlendMode },
|
{ "setBlendMode", w_setBlendMode },
|
||||||
{ "setDefaultImageFilter", w_setDefaultImageFilter },
|
|
||||||
{ "getBlendMode", w_getBlendMode },
|
{ "getBlendMode", w_getBlendMode },
|
||||||
{ "getDefaultImageFilter", w_getDefaultImageFilter },
|
{ "setDefaultFilter", w_setDefaultFilter },
|
||||||
|
{ "getDefaultFilter", w_getDefaultFilter },
|
||||||
{ "setDefaultMipmapFilter", w_setDefaultMipmapFilter },
|
{ "setDefaultMipmapFilter", w_setDefaultMipmapFilter },
|
||||||
{ "getDefaultMipmapFilter", w_getDefaultMipmapFilter },
|
{ "getDefaultMipmapFilter", w_getDefaultMipmapFilter },
|
||||||
{ "setLineWidth", w_setLineWidth },
|
{ "setLineWidth", w_setLineWidth },
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ int w_getBackgroundColor(lua_State *L);
|
|||||||
int w_setFont(lua_State *L);
|
int w_setFont(lua_State *L);
|
||||||
int w_getFont(lua_State *L);
|
int w_getFont(lua_State *L);
|
||||||
int w_setBlendMode(lua_State *L);
|
int w_setBlendMode(lua_State *L);
|
||||||
int w_setDefaultImageFilter(lua_State *L);
|
|
||||||
int w_getBlendMode(lua_State *L);
|
int w_getBlendMode(lua_State *L);
|
||||||
int w_getDefaultImageFilter(lua_State *L);
|
int w_setDefaultFilter(lua_State *L);
|
||||||
|
int w_getDefaultFilter(lua_State *L);
|
||||||
int w_setDefaultMipmapFilter(lua_State *L);
|
int w_setDefaultMipmapFilter(lua_State *L);
|
||||||
int w_getDefaultMipmapFilter(lua_State *L);
|
int w_getDefaultMipmapFilter(lua_State *L);
|
||||||
int w_setLineWidth(lua_State *L);
|
int w_setLineWidth(lua_State *L);
|
||||||
|
|||||||
Reference in New Issue
Block a user