mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
1 parent
5e0da3da28
commit
ee6c9f6a16
82 files changed
+4316
-4310
No files matched your search
+19
-19
@@ -20,13 +20,6 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GeometryPath 保存独立于绘图库的几何路径,不扁平化曲线或舍入坐标
|
||||
// 坐标以左上角为原点,单位为毫米,子路径从Move开始,Close回到当前子路径起点
|
||||
type GeometryPath []GeometrySegment
|
||||
|
||||
// GeometryVerb 表示几何路径指令
|
||||
type GeometryVerb uint8
|
||||
|
||||
const (
|
||||
GeometryMove GeometryVerb = iota
|
||||
GeometryLine
|
||||
@@ -36,6 +29,13 @@ const (
|
||||
GeometryClose
|
||||
)
|
||||
|
||||
// GeometryPath 保存独立于绘图库的几何路径,不扁平化曲线或舍入坐标
|
||||
// 坐标以左上角为原点,单位为毫米,子路径从Move开始,Close回到当前子路径起点
|
||||
type GeometryPath []GeometrySegment
|
||||
|
||||
// GeometryVerb 表示几何路径指令
|
||||
type GeometryVerb uint8
|
||||
|
||||
// GeometrySegment 保存路径端点、贝塞尔控制点或端点式椭圆弧参数
|
||||
// 弧线Rotation单位为度,Sweep为true表示顺时针,Large表示大弧
|
||||
type GeometrySegment struct {
|
||||
@@ -117,6 +117,18 @@ func ParseGeometryPath(data string) (GeometryPath, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SVG 将几何路径编码为SVG路径,不改变曲线或坐标精度
|
||||
// 返回: string SVG路径, error 不支持的路径指令
|
||||
func (p GeometryPath) SVG() (string, error) {
|
||||
return p.encode(true)
|
||||
}
|
||||
|
||||
// OFD 将几何路径编码为OFD紧缩路径
|
||||
// 返回: string 紧缩路径, error 不支持的路径指令
|
||||
func (p GeometryPath) OFD() (string, error) {
|
||||
return p.encode(false)
|
||||
}
|
||||
|
||||
// objectGeometryPath 解析对象路径并由当前几何实现应用页面变换
|
||||
// 入参: geometry 几何后端, object 路径对象
|
||||
// 返回: GeometryPath 页面路径, error 参数或变换错误
|
||||
@@ -156,18 +168,6 @@ func closedGeometry(path GeometryPath) GeometryPath {
|
||||
return result
|
||||
}
|
||||
|
||||
// SVG 将几何路径编码为SVG路径,不改变曲线或坐标精度
|
||||
// 返回: string SVG路径, error 不支持的路径指令
|
||||
func (p GeometryPath) SVG() (string, error) {
|
||||
return p.encode(true)
|
||||
}
|
||||
|
||||
// OFD 将几何路径编码为OFD紧缩路径
|
||||
// 返回: string 紧缩路径, error 不支持的路径指令
|
||||
func (p GeometryPath) OFD() (string, error) {
|
||||
return p.encode(false)
|
||||
}
|
||||
|
||||
// encode 按目标格式写入路径,圆弧标志采用两种格式均支持的0和1
|
||||
// 入参: svg 是否使用SVG指令
|
||||
// 返回: string 路径数据, error 不支持的路径指令
|
||||
|
||||
Reference in new issue
Block a user