是否可以在 metapost 中将图片转换为路径?如何操作?

是否可以在 metapost 中将图片转换为路径?如何操作?

我可以通过编程将如下图所示的图片转换为 metapost 中的路径吗?

picture myPicture;

myPicture := image(

fill
(294.660004,411.578003)--(307.644989,411.578003)--(307.644989,407.625000)           --(294.660004,407.625000)--cycle;

pickup pencircle scaled
1.285130bp;
draw (314.710999,409.601990)..controls (314.710999,402.113007) and
(308.640991,396.042999)..(301.152008,396.042999)            ..controls
(293.664001,396.042999) and
(287.593994,402.113007)..(287.593994,409.601990)            ..controls
(287.593994,417.089996) and
(293.664001,423.160004)..(301.152008,423.160004)            ..controls
(308.640991,423.160004) and
(314.710999,417.089996)..(314.710999,409.601990)            --cycle withcolor black

);

我正在寻找类似的东西:

path myPath;
myPath := pictureToPath(myPicture);

答案1

我设法解决了我的问题 - 对整个图像进行一些操作 - 而无需将图像转换为路径:操作現在的圖片

这是一个简单的例子来展示我如何做到的(我的实际使用有点复杂):

picture myPicture;

myPicture := image(

fill (294.660004,411.578003)--(307.644989,411.578003)--(307.644989,407.625000) --(294.660004,407.625000)--cycle;

pickup pencircle scaled 1.285130bp;

draw (314.710999,409.601990)..controls (314.710999,402.113007) and (308.640991,396.042999)..(301.152008,396.042999) ..controls (293.664001,396.042999) and (287.593994,402.113007)..(287.593994,409.601990) ..controls (287.593994,417.089996) and (293.664001,423.160004)..(301.152008,423.160004) ..controls (308.640991,423.160004) and (314.710999,417.089996)..(314.710999,409.601990) --cycle withcolor black

currentpicture := currentpicture shifted 100;

);

相关内容