Skip to content

Commit 844a2f9

Browse files
committed
重构跨平台运行时与图片加载机制,统一抽象
- 移除 LVGLSharp.Darwing,重命名为 LVGLSharp.Drawing,所有相关类型和引用同步调整 - 新增 IImageSource 接口,Image 通过注册工厂实现平台解耦,支持 Windows/Linux 动态加载图片 - 新增 PlatformRuntimeRegistration,统一运行时窗口、图片、鼠标等平台适配注册 - 删除自动生成的 targets/g.cs 运行时注册代码,改为反射注册 - 控件滚动行为优化,默认禁用 LVGL 滚动,部分控件可开启 - Demo 项目布局与图片变换逻辑优化,提升跨平台一致性 - 项目依赖精简,图片相关依赖移至各自 runtime - 清理旧的运行时相关实现与全局 using,提升可维护性与扩展性
1 parent 542ece2 commit 844a2f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+798
-1652
lines changed

LVGLSharp.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LVGLSharp.Forms", "src\LVGL
2121
EndProject
2222
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{34EF8BC5-CA73-4729-8C30-9D6541AAC6BB}"
2323
ProjectSection(SolutionItems) = preProject
24+
.github\copilot-instructions.md = .github\copilot-instructions.md
2425
LICENSE.txt = LICENSE.txt
2526
.github\workflows\nuget-publish.yml = .github\workflows\nuget-publish.yml
2627
README.md = README.md

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- 🚀 **NativeAOT 支持**:支持发布为无依赖的原生可执行文件(已验证 win-x64 / linux-arm)。
1616
- 🌍 **跨平台**:支持 Windows(x86 / x64 / arm64)、Linux(x64 / arm / arm64)。
1717
- 🧩 **内置常用控件**:Button、Label、TextBox、CheckBox、RadioButton、ComboBox、ListBox、ProgressBar、TrackBar、NumericUpDown、PictureBox、Panel、GroupBox、FlowLayoutPanel、TableLayoutPanel、RichTextBox 等。
18-
- 🎨 **自定义绘图类型**:提供 `LVGLSharp.Darwing` 命名空间下的 `Size``Point``Color` 等类型,无需依赖 `System.Drawing`,天然跨平台。
18+
- 🎨 **自定义绘图类型**:提供 `LVGLSharp.Drawing` 命名空间下的 `Size``Point``Color` 等类型,无需依赖 `System.Drawing`,天然跨平台。
1919

2020
---
2121

@@ -102,7 +102,7 @@ dotnet publish -r linux-arm64 -c Release
102102
src/
103103
├── LVGLSharp.WinForms/ # WinForms API 兼容层(核心)
104104
│ ├── Forms/ # 控件实现(Control、Form、Button 等)
105-
│ ├── Darwing/ # 跨平台绘图类型(Size、Point、Color 等)
105+
│ ├── Drawing/ # 跨平台绘图类型(Size、Point、Color 等)
106106
│ └── Runtime/ # 公共运行时注册入口与共享胶水代码
107107
├── LVGLSharp.Core/ # 公共核心库
108108
├── LVGLSharp.Windows/ # Windows 平台运行时

src/Demos/PictureBoxDemo/PictureBoxDemo.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@
1111
</PropertyGroup>
1212
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0-windows'">
1313
<UseWindowsForms>true</UseWindowsForms>
14+
<DefineConstants>$(DefineConstants);PICTUREBOXDEMO_WINFORMS</DefineConstants>
1415
</PropertyGroup>
16+
<ItemGroup>
17+
<Compile Remove="PictureBoxExtensions.cs" />
18+
</ItemGroup>
1519
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-windows'">
20+
<Compile Include="PictureBoxExtensions.cs" />
1621
<Using Include="System.Windows.Forms" />
1722
</ItemGroup>
1823
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
1924
<ProjectReference Include="..\..\LVGLSharp.WinForms\LVGLSharp.Forms.csproj" />
2025
<ProjectReference Include="..\..\LVGLSharp.Windows\LVGLSharp.Runtime.Windows.csproj" />
2126
<ProjectReference Include="..\..\LVGLSharp.Runtime.Linux\LVGLSharp.Runtime.Linux.csproj" />
2227
<Compile Include="..\DemoRuntimeConfiguration.cs" Link="DemoRuntimeConfiguration.cs" />
23-
<Compile Include="..\..\LVGLSharp.Windows\buildTransitive\LVGLSharp.Runtime.Windows.ApplicationExtensions.g.cs" Link="Generated\LVGLSharp.Runtime.Windows.ApplicationExtensions.g.cs" Visible="false" />
24-
<Compile Include="..\..\LVGLSharp.Runtime.Linux\buildTransitive\LVGLSharp.Runtime.Linux.ApplicationExtensions.g.cs" Link="Generated\LVGLSharp.Runtime.Linux.ApplicationExtensions.g.cs" Visible="false" />
2528
<Using Include="LVGLSharp.Forms" />
26-
<Using Include="LVGLSharp.Darwing" />
29+
<Using Include="LVGLSharp.Drawing" />
2730
</ItemGroup>
2831
<ItemGroup>
2932
<ProjectReference Include="..\..\LVGLSharp.Analyzers\LVGLSharp.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />

src/Demos/PictureBoxDemo/PictureBoxExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if NET10_0_OR_GREATER && WINDOWS
21
using System.Drawing;
32
using System.Drawing.Drawing2D;
43
using System.Drawing.Imaging;
@@ -204,4 +203,3 @@ public static void UpdateOriginalImage(this PictureBox pictureBox)
204203
}
205204
}
206205
}
207-
#endif

src/Demos/PictureBoxDemo/frmPictureBoxDemo.Designer.cs

Lines changed: 40 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)