commit a0d9c67ea9b7f6b088afca631a9f2819b33c0b0c Author: ArgonarioD Date: Fri Jul 29 10:43:47 2022 +0800 init commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a16077 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +**/.idea \ No newline at end of file diff --git a/1st_encode/byte.html b/1st_encode/byte.html new file mode 100644 index 0000000..c4c9783 --- /dev/null +++ b/1st_encode/byte.html @@ -0,0 +1,897 @@ + + + + + 整体结构总览 + + + + + + + + + +

整体结构总览

+
+

注:所有x、y坐标都为有符号整数,实际处理时需要除以1000变回小数

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
图像宽度 width16实际位数+11记为W
图像高度 height16实际位数+11记为H
elements列表长度16标记了该图像上的所有元素原型
> 元素种类 type4
> 元素信息 data详见elements
map列表长度16标记了该图像上所有元素原型在图像中的信息
> 元素id element16
> 坐标 position0
>> x坐标W
>> y坐标H
> 所处层数 level16从0x00FF开始递增,置入底层操作直接移到当前最下
> 附加信息 attached 列表长度8详见map-attached
iterate列表长度16标记该图像中应用迭代函数系统的信息
> 是否为元素组 element-group1若为1,则在elements中寻找组的原始map信息
> 原始元素mapId target16
> 迭代次数 times32
> 迭代操作 operations 列表长度8详见iterate-operations
+

elements

+

type

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
id说明备注
0路径 path起点为(0,0)
1多边形 polygon起点为(0,0)
2圆形 round圆心为(0,0)
3元素组 group
+

data

+

path

+ + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
路径操作 operations 列表长度16
> 操作种类 type4
> 操作信息 data详见path-operations
+
+

path-operations

+
type
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
id说明备注
0直线 line
1三次贝塞尔曲线 curve非列表头时,默认使用平滑曲线
2平滑三次贝塞尔曲线 curve-smooth
3二次贝塞尔曲线 quadratic非列表头时,默认使用平滑曲线
4平滑二次贝塞尔曲线 quadratic-smooth
5圆弧 arc
6封闭图形 zeal用直线连接当前点与起点,封闭该图形,必须为列表尾
+
line
+ + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
目标坐标 target0
> x坐标W
> y坐标H
+
curve
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
目标坐标 target0
> x坐标W
> y坐标H
控制点 control0
> 起点控制点 start0
>> x坐标W
>> y坐标H
> 终点控制点 end0
>> x坐标W
>> y坐标H
+
curve-smooth
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
目标坐标 target0
> x坐标W
> y坐标H
控制点 control0
> x坐标W
> y坐标H
+
quadratic
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
目标坐标 target0
> x坐标W
> y坐标H
控制点 control0
> x坐标W
> y坐标H
+
quadratic-smooth
+ + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
目标坐标 target0
> x坐标W
> y坐标H
+
arc
+
+

circle = true

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
是否为正圆 circle1否则为椭圆
圆心坐标 center0
> x坐标W
> y坐标H
半径 radiusmax(W,H)用无符号整数存小数,结果除100
取线角度 angle17用17位有符号整数存小数,结果除100
+
+

circle = false

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
是否为正圆 circle1否则为椭圆
圆心坐标 center0
> x坐标W
> y坐标H
轴长 axis-length0用无符号整数存小数,结果除100
> x轴max(W,H)
> y轴max(W,H)
取线角度 angle17用17位有符号整数存小数,结果除100
+
+

polygon

+ + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
点坐标 points 列表长度16逆时针排列
> x坐标W
> y坐标H
+

round

+
+

circle = true

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
是否为正圆 circle1否则为椭圆
半径 radiusmax(W,H)用无符号整数存小数,结果除100
取线角度 angle17用17位有符号整数存小数,结果除100
+
+

circle = false

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
是否为正圆 circle1否则为椭圆
轴长 axis-length0用无符号整数存小数,结果除100
> x轴max(W,H)
> y轴max(W,H)
取线角度 angle17用17位有符号整数存小数,结果除100
+

group

+ + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
组成员 members 列表长度16
> 是否是map中元素 of-map1否则为iterate中元素
> 元素id id16
+

map-attached

+

type

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
id说明备注
0旋转 rotate
1缩放 zoom
2翻转 flip无data
3阴影 shadow未实现
4边框 border未实现
+

data

+

rotate

+ + + + + + + + + + + + + + + +
说明位数备注
旋转角度 angle17用17位有符号整数存小数,结果除100
+

zoom

+ + + + + + + + + + + + + + + +
说明位数备注
缩放比例 zoom32单精度浮点数
+

iterate-operations

+

type

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
id说明备注
0移动 move
1旋转 rotate
2缩放 zoom
3翻转 flip无data
+

data

+

move

+ + + + + + + + + + + + + + + + + + + + +
说明位数备注
x轴增量dxW
y轴增量dyH
+

rotate

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
说明位数备注
旋转中心坐标 center0
> x坐标W
> y坐标H
旋转角度 angle17用17位有符号整数存小数,结果除100
+

zoom

+ + + + + + + + + + + + + + + +
说明位数备注
缩放比例 zoom32单精度浮点数
+ + + + + \ No newline at end of file diff --git a/1st_encode/byte.md b/1st_encode/byte.md new file mode 100644 index 0000000..32e729d --- /dev/null +++ b/1st_encode/byte.md @@ -0,0 +1,208 @@ +# 整体结构总览 +> 注:所有x、y坐标都为有符号整数,实际处理时需要除以1000变回小数 + +| 说明 | 位数 | 备注 | +| ------------------------------ | ---- | ---------------------------------------------- | +| 图像宽度 width | 16 | 实际位数+11记为W | +| 图像高度 height | 16 | 实际位数+11记为H | +| elements列表长度 | 16 | 标记了该图像上的所有元素原型 | +| > 元素种类 type | 4 | | +| > 元素信息 data | | 详见[elements](#elements) | +| map列表长度 | 16 | 标记了该图像上所有元素原型在图像中的信息 | +| > 元素id element | 16 | | +| > 坐标 position | 0 | | +| >> x坐标 | W | | +| >> y坐标 | H | | +| > 所处层数 level | 16 | 从0x00FF开始递增,置入底层操作直接移到当前最下 | +| > 附加信息 attached 列表长度 | 8 | 详见[map-attached](#map-attached) | +| iterate列表长度 | 16 | 标记该图像中应用迭代函数系统的信息 | +| > 是否为元素组 element-group | 1 | 若为1,则在elements中寻找组的原始map信息 | +| > 原始元素mapId target | 16 | | +| > 迭代次数 times | 32 | | +| > 迭代操作 operations 列表长度 | 8 | 详见[iterate-operations](#iterate-operations) | + +# elements +## type +| id | 说明 | 备注 | +| --- | -------------- | ----------- | +| 0 | 路径 path | 起点为(0,0) | +| 1 | 多边形 polygon | 起点为(0,0) | +| 2 | 圆形 round | 圆心为(0,0) | +| 3 | 元素组 group | | + +## data +### path +| 说明 | 位数 | 备注 | +| ---------------------------- | ---- | --------------------------------------- | +| 路径操作 operations 列表长度 | 16 | | +| > 操作种类 type | 4 | | +| > 操作信息 data | | 详见[path-operations](#path-operations) | + + +> #### path-operations +> ##### type +> | id | 说明 | 备注 | +> | --- | ----------------------------------- | ------------------------------------------------ | +> | 0 | 直线 line | | +> | 1 | 三次贝塞尔曲线 curve | 非列表头时,默认使用平滑曲线 | +> | 2 | 平滑三次贝塞尔曲线 curve-smooth | | +> | 3 | 二次贝塞尔曲线 quadratic | 非列表头时,默认使用平滑曲线 | +> | 4 | 平滑二次贝塞尔曲线 quadratic-smooth | | +> | 5 | 圆弧 arc | | +> | 6 | 封闭图形 zeal | 用直线连接当前点与起点,封闭该图形,必须为列表尾 | +> +> ##### line +> | 说明 | 位数 | 备注 | +> | --------------- | ---- | ---- | +> | 目标坐标 target | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> +> ##### curve +> | 说明 | 位数 | 备注 | +> | ------------------ | ---- | ---- | +> | 目标坐标 target | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> | 控制点 control | 0 | | +> | > 起点控制点 start | 0 | | +> | >> x坐标 | W | | +> | >> y坐标 | H | | +> | > 终点控制点 end | 0 | | +> | >> x坐标 | W | | +> | >> y坐标 | H | | +> +> ##### curve-smooth +> | 说明 | 位数 | 备注 | +> | --------------- | ---- | ---- | +> | 目标坐标 target | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> | 控制点 control | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> +> ##### quadratic +> | 说明 | 位数 | 备注 | +> | --------------- | ---- | ---- | +> | 目标坐标 target | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> | 控制点 control | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> +> ##### quadratic-smooth +> | 说明 | 位数 | 备注 | +> | --------------- | ---- | ---- | +> | 目标坐标 target | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> +> ##### arc +> > circle = true +> +> | 说明 | 位数 | 备注 | +> | -------------------- | ---------- | --------------------------------- | +> | 是否为正圆 circle | 1 | 否则为椭圆 | +> | 圆心坐标 center | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> | 半径 radius | max(W,H) | 用无符号整数存小数,结果除100 | +> | 取线角度 angle | 17 | 用17位有符号整数存小数,结果除100 | +> +> > circle = false +> +> | 说明 | 位数 | 备注 | +> | -------------------- | ---------- | --------------------------------- | +> | 是否为正圆 circle | 1 | 否则为椭圆 | +> | 圆心坐标 center | 0 | | +> | > x坐标 | W | | +> | > y坐标 | H | | +> | 轴长 axis-length | 0 | 用无符号整数存小数,结果除100 | +> | > x轴 | max(W,H)| | +> | > y轴 | max(W,H) | | +> | 取线角度 angle | 17 | 用17位有符号整数存小数,结果除100 | + +### polygon +| 说明 | 位数 | 备注 | +| ---------------------- | ---- | ---------- | +| 点坐标 points 列表长度 | 16 | 逆时针排列 | +| > x坐标 | W | | +| > y坐标 | H | | + +### round +> circle = true + +| 说明 | 位数 | 备注 | +| ----------------- | -------- | --------------------------------- | +| 是否为正圆 circle | 1 | 否则为椭圆 | +| 半径 radius | max(W,H) | 用无符号整数存小数,结果除100 | +| 取线角度 angle | 17 | 用17位有符号整数存小数,结果除100 | + +> circle = false + +| 说明 | 位数 | 备注 | +| ----------------- | -------- | --------------------------------- | +| 是否为正圆 circle | 1 | 否则为椭圆 | +| 轴长 axis-length | 0 | 用无符号整数存小数,结果除100 | +| > x轴 | max(W,H) | | +| > y轴 | max(W,H) | | +| 取线角度 angle | 17 | 用17位有符号整数存小数,结果除100 | + +### group +| 说明 | 位数 | 备注 | +| ------------------------ | ---- | ------------------- | +| 组成员 members 列表长度 | 16 | | +| > 是否是map中元素 of-map | 1 | 否则为iterate中元素 | +| > 元素id id | 16 | | + +# map-attached +## type +| id | 说明 | 备注 | +| --- | ----------- | ------ | +| 0 | 旋转 rotate | | +| 1 | 缩放 zoom | | +| 2 | 翻转 flip | 无data | +| 3 | 阴影 shadow | 未实现 | +| 4 | 边框 border | 未实现 | + +## data +### rotate +| 说明 | 位数 | 备注 | +| -------------- | ---- | --------------------------------- | +| 旋转角度 angle | 17 | 用17位有符号整数存小数,结果除100 | + +### zoom +| 说明 | 位数 | 备注 | +| ------------- | ---- | ------------ | +| 缩放比例 zoom | 32 | 单精度浮点数 | + +# iterate-operations +## type +| id | 说明 | 备注 | +| --- | ----------- | ------ | +| 0 | 移动 move | | +| 1 | 旋转 rotate | | +| 2 | 缩放 zoom | | +| 3 | 翻转 flip | 无data | + +## data +### move +| 说明 | 位数 | 备注 | +| --------- | ---- | ---- | +| x轴增量dx | W | | +| y轴增量dy | H | | + +### rotate +| 说明 | 位数 | 备注 | +| ------------------- | ---- | --------------------------------- | +| 旋转中心坐标 center | 0 | | +| > x坐标 | W | | +| > y坐标 | H | | +| 旋转角度 angle | 17 | 用17位有符号整数存小数,结果除100 | + +### zoom +| 说明 | 位数 | 备注 | +| ------------- | ---- | ------------ | +| 缩放比例 zoom | 32 | 单精度浮点数 | \ No newline at end of file diff --git a/1st_encode/json.json b/1st_encode/json.json new file mode 100644 index 0000000..51ab978 --- /dev/null +++ b/1st_encode/json.json @@ -0,0 +1,273 @@ +{ + "height": 1080, + "width": 1080, + "elements": [ + { + "type": "path", + "data": { + "operations": [ + { + "type": "line", + "data": { + "target": { + "x": 15, + "y": 20 + } + } + }, + { + "type": "curve", + "data": { + "target": { + "x": 18, + "y": 21 + }, + "control": { + "start": { + "x": 17, + "y": 22 + }, + "end": { + "x": 20, + "y": 23 + } + } + } + }, + { + "type": "curve-smooth", + "data": { + "target": { + "x": 18, + "y": 21 + }, + "control": { + "x": 18, + "y": 21 + } + } + }, + { + "type": "quadratic", + "data": { + "target": { + "x": 18, + "y": 21 + }, + "control": { + "x": 18, + "y": 21 + } + } + }, + { + "type": "quadratic-smooth", + "data": { + "target": { + "x": 18, + "y": 21 + } + } + }, + { + "type": "arc", + "data": { + "circle": true, + "center": { + "x": 18, + "y": 21 + }, + "radius": 5, + "angle": 6000 + } + }, + { + "type": "arc", + "data": { + "circle": false, + "center": { + "x": 18, + "y": 21 + }, + "axis-length": { + "x": 4, + "y": 6 + }, + "angle": 6000 + } + }, + { + "type": "zeal" + } + ] + } + }, + { + "type": "polygon", + "data": { + "points": [ + { + "x": 10, + "y": 20 + }, + { + "x": 10, + "y": 20 + }, + { + "x": 10, + "y": 20 + }, + { + "x": 10, + "y": 20 + }, + { + "x": 10, + "y": 20 + } + ] + } + }, + { + "type": "round", + "data": { + "circle": true, + "radius": 5, + "angle": 6000 + } + }, + { + "type": "round", + "data": { + "circle": false, + "axis-length": { + "x": 4, + "y": 6 + }, + "angle": 6000 + } + }, + { + "type": "group", + "members": [ + { + "of-map": true, + "id": 2 + }, + { + "of-map": false, + "id": 1 + } + ] + } + ], + "map": [ + { + "element": 1, + "position": { + "x": 18, + "y": 21 + }, + "level": 1, + "attached": [ + { + "type": "rotate", + "data": { + "angle": 6000 + } + }, + { + "type": "zoom", + "data": { + "zoom": 1.0 + } + }, + { + "type": "flip" + }, + { + "type": "shadow", + "data": {} + } + ] + }, + { + "element": 2, + "position": { + "x": 18, + "y": 21 + }, + "level": 1, + "attached": [] + } + ], + "iterate": [ + { + "element-group": false, + "target": 2, + "times": 5, + "operations": [ + { + "type": "move", + "data": { + "dx": 5, + "dy": 6 + } + }, + { + "type": "rotate", + "data": { + "center": { + "dx": 0, + "dy": 0 + }, + "dθ": 6000 + } + }, + { + "type": "zoom", + "data": { + "zoom": 1.5 + } + }, + { + "type": "flip" + } + ] + }, + { + "element-group": true, + "target": 5, + "times": 5, + "operations": [ + { + "type": "move", + "data": { + "dx": 5, + "dy": 6 + } + }, + { + "type": "rotate", + "data": { + "center": { + "dx": 0, + "dy": 0 + }, + "dθ": 6000 + } + }, + { + "type": "zoom", + "data": { + "zoom": 1.5 + } + }, + { + "type": "flip" + } + ] + } + ] +} \ No newline at end of file