Remove default arguments from `LuaPictureBox.*`

This commit is contained in:
YoshiRulz 2024-08-25 16:54:23 +10:00
parent 1fc443640a
commit e5e055b7a4
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 59 additions and 20 deletions

View File

@ -82,7 +82,13 @@ namespace BizHawk.Client.EmuHawk
boxBackground.DrawBezier(GetPen(TableHelper.ParseColor(color)), pointsArr[0], pointsArr[1], pointsArr[2], pointsArr[3]);
}
public void DrawBox(int x, int y, int x2, int y2, [LuaColorParam] object line = null, [LuaColorParam] object background = null)
public void DrawBox(
int x,
int y,
int x2,
int y2,
[LuaColorParam] object line,
[LuaColorParam] object background)
{
if (x < x2)
{
@ -115,7 +121,13 @@ namespace BizHawk.Client.EmuHawk
}
}
public void DrawEllipse(int x, int y, int width, int height, [LuaColorParam] object line = null, [LuaColorParam] object background = null)
public void DrawEllipse(
int x,
int y,
int width,
int height,
[LuaColorParam] object line,
[LuaColorParam] object background)
{
var bg = TableHelper.SafeParseColor(background) ?? _defaultBackground;
var boxBackground = Graphics.FromImage(Image);
@ -129,7 +141,7 @@ namespace BizHawk.Client.EmuHawk
boxBackground.DrawEllipse(GetPen(TableHelper.SafeParseColor(line) ?? _defaultForeground), x, y, width, height);
}
public void DrawIcon(string path, int x, int y, int? width = null, int? height = null)
public void DrawIcon(string path, int x, int y, int? width, int? height)
{
Icon icon;
if (width.HasValue && height.HasValue)
@ -145,7 +157,7 @@ namespace BizHawk.Client.EmuHawk
boxBackground.DrawIcon(icon, x, y);
}
public void DrawImage(string path, int x, int y, int? width = null, int? height = null, bool cache = true)
public void DrawImage(string path, int x, int y, int? width, int? height, bool cache)
{
if (!_imageCache.TryGetValue(path, out var img))
{
@ -170,7 +182,16 @@ namespace BizHawk.Client.EmuHawk
_imageCache.Clear();
}
public void DrawImageRegion(string path, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int destX, int destY, int? destWidth = null, int? destHeight = null)
public void DrawImageRegion(
string path,
int sourceX,
int sourceY,
int sourceWidth,
int sourceHeight,
int destX,
int destY,
int? destWidth,
int? destHeight)
{
var img = _imageCache.GetValueOrPut(path, Image.FromFile);
var destRect = new Rectangle(destX, destY, destWidth ?? sourceWidth, destHeight ?? sourceHeight);
@ -179,20 +200,27 @@ namespace BizHawk.Client.EmuHawk
boxBackground.DrawImage(img, destRect, sourceX, sourceY, sourceWidth, sourceHeight, GraphicsUnit.Pixel);
}
public void DrawLine(int x1, int y1, int x2, int y2, [LuaColorParam] object color = null)
public void DrawLine(int x1, int y1, int x2, int y2, [LuaColorParam] object color)
{
var boxBackground = Graphics.FromImage(Image);
boxBackground.DrawLine(GetPen(TableHelper.SafeParseColor(color) ?? _defaultForeground), x1, y1, x2, y2);
}
public void DrawAxis(int x, int y, int size, [LuaColorParam] object color = null)
public void DrawAxis(int x, int y, int size, [LuaColorParam] object color)
{
var color1 = TableHelper.SafeParseColor(color);
DrawLine(x + size, y, x - size, y, color1);
DrawLine(x, y + size, x, y - size, color1);
}
public void DrawArc(int x, int y, int width, int height, int startAngle, int sweepAngle, [LuaColorParam] object line = null)
public void DrawArc(
int x,
int y,
int width,
int height,
int startAngle,
int sweepAngle,
[LuaColorParam] object line)
{
var boxBackground = Graphics.FromImage(Image);
boxBackground.DrawArc(GetPen(TableHelper.SafeParseColor(line) ?? _defaultForeground), x, y, width, height, startAngle, sweepAngle);
@ -205,8 +233,8 @@ namespace BizHawk.Client.EmuHawk
int height,
int startAngle,
int sweepAngle,
[LuaColorParam] object line = null,
[LuaColorParam] object background = null)
[LuaColorParam] object line,
[LuaColorParam] object background)
{
var bg = TableHelper.SafeParseColor(background) ?? _defaultBackground;
var boxBackground = Graphics.FromImage(Image);
@ -220,13 +248,18 @@ namespace BizHawk.Client.EmuHawk
boxBackground.DrawPie(GetPen(TableHelper.SafeParseColor(line) ?? _defaultForeground), x + 1, y + 1, width - 1, height - 1, startAngle, sweepAngle);
}
public void DrawPixel(int x, int y, [LuaColorParam] object color = null)
public void DrawPixel(int x, int y, [LuaColorParam] object color)
{
var boxBackground = Graphics.FromImage(Image);
boxBackground.DrawLine(GetPen(TableHelper.SafeParseColor(color) ?? _defaultForeground), x, y, x + 0.1F, y);
}
public void DrawPolygon(LuaTable points, int? x = null, int? y = null, [LuaColorParam] object line = null, [LuaColorParam] object background = null)
public void DrawPolygon(
LuaTable points,
int? x,
int? y,
[LuaColorParam] object line,
[LuaColorParam] object background)
{
var pointsList = TableHelper.EnumerateValues<LuaTable>(points)
.Select(table => TableHelper.EnumerateValues<long>(table).ToList()).ToList();
@ -248,7 +281,13 @@ namespace BizHawk.Client.EmuHawk
}
}
public void DrawRectangle(int x, int y, int width, int height, [LuaColorParam] object line = null, [LuaColorParam] object background = null)
public void DrawRectangle(
int x,
int y,
int width,
int height,
[LuaColorParam] object line,
[LuaColorParam] object background)
{
var bg = TableHelper.SafeParseColor(background) ?? _defaultBackground;
var boxBackground = Graphics.FromImage(Image);
@ -265,13 +304,13 @@ namespace BizHawk.Client.EmuHawk
int x,
int y,
string message,
[LuaColorParam] object foreColor = null,
[LuaColorParam] object backColor = null,
int? fontSize = null,
string fontFamily = null,
string fontStyle = null,
string horizAlign = null,
string vertAlign = null)
[LuaColorParam] object foreColor,
[LuaColorParam] object backColor,
int? fontSize,
string fontFamily,
string fontStyle,
string horizAlign,
string vertAlign)
{
var family = FontFamily.GenericMonospace;
if (fontFamily != null)