中间图形转换库

This commit is contained in:
sin365 2025-01-08 18:24:56 +08:00
parent 8b8a055cd1
commit 327570e031
6 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.6.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>G:\Sin365\AxibugEmuOnline\AxibugEmuOnline.GameScreenConvert\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\netstandard2.0\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2025-01-08T10:23:00.0935802Z||;True|2025-01-08T17:56:27.1142682+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@ -0,0 +1,61 @@
namespace AxibugEmuOnline.GameScreenConvert
{
public static class ScreenConvert
{
/// <summary>
/// 转换
/// </summary>
/// <param name="platform">
/// enum RomPlatformType
///{
/// Invalid = 0;
/// Nes = 1;
/// Master_System = 2;
/// Game_Gear = 3;
/// Game_Boy = 4;
/// Game_Boy_Color = 5;
/// Coleco_Vision = 6;
/// SC_3000 = 7;
/// SG_1000 = 8;
/// All = 999;
///}</param>
/// <param name="srcData"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="Quality">品质0~100</param>
/// <param name="JpegData"></param>
/// <returns></returns>
public static bool Convert(int platform, byte[] srcData, out byte[] imageData)
{
IScreenConvert convert = default;
switch (platform)
{
case 1://nes
//
break;
default:
convert = new SampleScreenConvert();
break;
}
return convert.ScreenDataToRGBA32Data(platform, srcData, out imageData);
}
}
public interface IScreenConvert
{
bool ScreenDataToRGBA32Data(int platform, byte[] srcData, out byte[] imageData);
}
public class SampleScreenConvert : IScreenConvert
{
public bool ScreenDataToRGBA32Data(int platform, byte[] srcData, out byte[] imageData)
{
imageData = null;
//TODO 这里加上自己从原始数据中的颜色处理 比如颜色查找表
//System.Span<T> 也是可用的
//统一处理成RGBA32的通道顺序
return imageData != null;
}
}
}

View File

@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugEmuOnline.Server", "A
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualNes.Core", "Core\VirtualNes.Core\VirtualNes.Core.csproj", "{637EB35A-4D1A-41EA-9A7B-459E17E93981}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugEmuOnline.GameScreenConvert", "AxibugEmuOnline.GameScreenConvert\AxibugEmuOnline.GameScreenConvert.csproj", "{A70AD410-E2F2-4792-AEC1-A0DB83392E52}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -27,6 +29,10 @@ Global
{637EB35A-4D1A-41EA-9A7B-459E17E93981}.Debug|Any CPU.Build.0 = Debug|Any CPU
{637EB35A-4D1A-41EA-9A7B-459E17E93981}.Release|Any CPU.ActiveCfg = Release|Any CPU
{637EB35A-4D1A-41EA-9A7B-459E17E93981}.Release|Any CPU.Build.0 = Release|Any CPU
{A70AD410-E2F2-4792-AEC1-A0DB83392E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A70AD410-E2F2-4792-AEC1-A0DB83392E52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A70AD410-E2F2-4792-AEC1-A0DB83392E52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A70AD410-E2F2-4792-AEC1-A0DB83392E52}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE