支持提取原始笔迹点,与转换笔迹为Logo语言 - #4
Open
4Darmygeometry wants to merge 19 commits into
Open
Conversation
lindexi
reviewed
Jun 15, 2026
lindexi
requested changes
Jun 15, 2026
| /// </para> | ||
| /// | ||
| /// <para> | ||
| /// 公开为 public API 以便调用方在不使用反射的情况下访问笔尖点列, |
Author
There was a problem hiding this comment.
已删除注释:
公开为 public API 以便调用方在不使用反射的情况下访问笔尖点列,
| /// <para><b>坐标系约定</b>:</para> | ||
| /// <list type="bullet"> | ||
| /// <item>屏幕坐标:Y 向下,原点在左上角(与 InkCanvas 画布一致)</item> | ||
| /// <item>Logo 坐标:Y 向上,原点在画布中心(AOTLogoSharp Turtle 默认)</item> |
Author
There was a problem hiding this comment.
我的一个支持AOT的Logo语言绘制库
https://github.com/4Darmygeometry/AOTLogoSharp
| { | ||
| if (strokes == null || strokes.Count == 0) | ||
| { | ||
| return "; (空笔迹:无笔触)\nHOME\n"; |
Author
There was a problem hiding this comment.
上面的会输出Logo语言注释及指令,即
; (空笔迹:无笔触)
HOME
已修改,避免二义性
Member
There was a problem hiding this comment.
@4Darmygeometry 这里暴露另一个问题,那就是混用 \n 和 \r\n 换行符。为什么?因为后面有 StringBuilder 的 AppendLine 方法,在 AppendLine 里面会根据平台决定换行符
| return list; | ||
| } | ||
|
|
||
| private static string ConvertCore( |
| var sb = new StringBuilder(); | ||
|
|
||
| // 调试模式(useAbsoluteCoords=true 或 useRawPoints=true)跳过平滑,原样保留每个点 | ||
| var workPoints = (mode == LogoExportMode.AbsoluteCoordinates || mode == LogoExportMode.RawRelativeAngles) |
| /// 用距离度量会把拐点误删;曲率(夹角)则是纯几何量,对抖动免疫。 | ||
| /// </para> | ||
| /// </summary> | ||
| public static List<RawPoint> CurvatureSimplify( |
| <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> |
Member
There was a problem hiding this comment.
本分支由 4Darmygeometry 维护,公开了 SkiaStroke 的笔尖原始点列 PointList,并内置标准 Logo 语言(PCLogo / MSWLogo / AOTLogoSharp 1.2.1+)转换功能(支持 .logo / .abs.logo / .raw.logo 三种导出形式),完全兼容 AOT/裁剪发布
现在你准备合入主干了哦,这部分记得改哦
Member
|
缓慢阅读代码中 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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+)由海龟回放。