增加背景颜色选项
This commit is contained in:
@@ -88,6 +88,12 @@ namespace SpineViewer.Exporter
|
|||||||
[Category("[0] 导出"), DisplayName("仅渲染选中"), Description("是否仅导出选中的模型,请在预览画面参数面板进行调整")]
|
[Category("[0] 导出"), DisplayName("仅渲染选中"), Description("是否仅导出选中的模型,请在预览画面参数面板进行调整")]
|
||||||
public bool RenderSelectedOnly { get; }
|
public bool RenderSelectedOnly { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 背景颜色 TODO: 提供颜色编辑
|
||||||
|
/// </summary>
|
||||||
|
[Category("[0] 导出"), DisplayName("背景颜色"), Description("要使用的背景色, 格式为 #RRGGBBAA")]
|
||||||
|
public SFML.Graphics.Color BackgroundColor { get; set; } = SFML.Graphics.Color.Transparent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查参数是否合法并规范化参数值, 否则返回用户错误原因
|
/// 检查参数是否合法并规范化参数值, 否则返回用户错误原因
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace SpineViewer.Exporter
|
|||||||
{
|
{
|
||||||
// tex 必须临时创建, 随用随取, 防止出现跨线程的情况
|
// tex 必须临时创建, 随用随取, 防止出现跨线程的情况
|
||||||
using var tex = GetRenderTexture();
|
using var tex = GetRenderTexture();
|
||||||
tex.Clear(SFML.Graphics.Color.Transparent);
|
tex.Clear(ExportArgs.BackgroundColor);
|
||||||
tex.Draw(spine);
|
tex.Draw(spine);
|
||||||
tex.Display();
|
tex.Display();
|
||||||
return new(tex.Texture.CopyToImage());
|
return new(tex.Texture.CopyToImage());
|
||||||
@@ -94,7 +94,7 @@ namespace SpineViewer.Exporter
|
|||||||
{
|
{
|
||||||
// tex 必须临时创建, 随用随取, 防止出现跨线程的情况
|
// tex 必须临时创建, 随用随取, 防止出现跨线程的情况
|
||||||
using var tex = GetRenderTexture();
|
using var tex = GetRenderTexture();
|
||||||
tex.Clear(SFML.Graphics.Color.Transparent);
|
tex.Clear(ExportArgs.BackgroundColor);
|
||||||
foreach (var spine in spinesToRender) tex.Draw(spine);
|
foreach (var spine in spinesToRender) tex.Draw(spine);
|
||||||
tex.Display();
|
tex.Display();
|
||||||
return new(tex.Texture.CopyToImage());
|
return new(tex.Texture.CopyToImage());
|
||||||
|
|||||||
Reference in New Issue
Block a user