Skip to content

支持提取原始笔迹点,与转换笔迹为Logo语言 - #4

Open
4Darmygeometry wants to merge 19 commits into
dotnet-campus:mainfrom
4Darmygeometry:main
Open

支持提取原始笔迹点,与转换笔迹为Logo语言#4
4Darmygeometry wants to merge 19 commits into
dotnet-campus:mainfrom
4Darmygeometry:main

Conversation

@4Darmygeometry

Copy link
Copy Markdown

1.将SkiaStroke.PointList Public化:
SkiaStroke.Path 是 Skia 渲染用的外轮廓多边形,看起来像线段,实际上是围绕中心线的封闭多边形,
直接连 Path.Points 会画出空心、变形的笔迹。
真实的、按书写时间排序的笔尖点列保存在 SkiaStroke.PointList(IReadOnlyList)。
本属性返回的是按书写顺序的笔尖点列,与 InkCanvas 的画布坐标系一致,可直接用于 Logo 语言转换、SVG 路径、笔画分析等需要"中间过程点列"
2.添加书写笔迹转换为Logo语言:
内置 DotNetCampus.Inking.LogoExport.InkToLogoConverter 静态类,以及 InkCanvas.ToLogoSource(...) 扩展方法。
输出的是标准 Logo 源码,可直接交给任何 Logo 解释器(PCLogo、MSWLogo、
AOTLogoSharp 1.2.1+)由海龟回放。

@CLAassistant

CLAassistant commented Jun 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@lindexi lindexi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢贡献,有些问题需要改一下

/// </para>
///
/// <para>
/// 公开为 public API 以便调用方在不使用反射的情况下访问笔尖点列,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个注释请干掉吧

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除注释:
公开为 public API 以便调用方在不使用反射的情况下访问笔尖点列,

/// <para><b>坐标系约定</b>:</para>
/// <list type="bullet">
/// <item>屏幕坐标:Y 向下,原点在左上角(与 InkCanvas 画布一致)</item>
/// <item>Logo 坐标:Y 向上,原点在画布中心(AOTLogoSharp Turtle 默认)</item>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 AOTLogoSharp 是哪来的呢?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的一个支持AOT的Logo语言绘制库
https://github.com/4Darmygeometry/AOTLogoSharp

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除括号内容,改为中立化描述

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4Darmygeometry 也好将你的库的地址贴上去呀

Comment thread src/DotNetCampus.AvaloniaInkCanvas/LogoExport/InkToLogoConverter.cs Outdated
{
if (strokes == null || strokes.Count == 0)
{
return "; (空笔迹:无笔触)\nHOME\n";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个返回值不应该吧?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面的会输出Logo语言注释及指令,即
; (空笔迹:无笔触)
HOME
已修改,避免二义性

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4Darmygeometry 这里暴露另一个问题,那就是混用 \n\r\n 换行符。为什么?因为后面有 StringBuilder 的 AppendLine 方法,在 AppendLine 里面会根据平台决定换行符

Comment thread src/DotNetCampus.AvaloniaInkCanvas/LogoExport/InkToLogoConverter.cs
return list;
}

private static string ConvertCore(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参数数量太多了哦

var sb = new StringBuilder();

// 调试模式(useAbsoluteCoords=true 或 useRawPoints=true)跳过平滑,原样保留每个点
var workPoints = (mode == LogoExportMode.AbsoluteCoordinates || mode == LogoExportMode.RawRelativeAngles)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句代码太长了,逻辑太多了,能否拆分呢?

/// 用距离度量会把拐点误删;曲率(夹角)则是纯几何量,对抖动免疫。
/// </para>
/// </summary>
public static List<RawPoint> CurvatureSimplify(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉格式化有点问题

Comment thread Directory.Build.props Outdated
<Company>dotnet campus(.NET 职业技术学院)</Company>
<Authors>dotnet-campus</Authors>
<Copyright>Copyright © 2023-$(ThisYear) dotnet campus, All Rights Reserved.</Copyright>
<Description>DotNetCampus.AvaloniaInkCanvas 是基于 Skia 的 Avalonia 笔迹画布;本分支由 4Darmygeometry 维护,公开了 SkiaStroke 的笔尖原始点列 PointList,并内置标准 Logo 语言(PCLogo / MSWLogo / AOTLogoSharp 1.2.1+)转换功能(支持 .logo / .abs.logo / .raw.logo 三种导出形式),完全兼容 AOT/裁剪发布。</Description>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本分支由 4Darmygeometry 维护,公开了 SkiaStroke 的笔尖原始点列 PointList,并内置标准 Logo 语言(PCLogo / MSWLogo / AOTLogoSharp 1.2.1+)转换功能(支持 .logo / .abs.logo / .raw.logo 三种导出形式),完全兼容 AOT/裁剪发布

现在你准备合入主干了哦,这部分记得改哦

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已回退

4Darmygeometry and others added 8 commits June 16, 2026 00:22
Co-authored-by: lindexi <lindexi@users.noreply.github.com>
分号既是Logo语言注释开始,又是C#语法结束
删除Logo语言输出注释,利于阅读减少二义性
@lindexi

lindexi commented Jul 13, 2026

Copy link
Copy Markdown
Member

缓慢阅读代码中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants