翻转 svg 坐标系 [英] flip svg coordinate system

查看:58
本文介绍了翻转 svg 坐标系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法翻转SVG坐标系,使[0,0]在左下角而不是左上角?

Is there a way to flip the SVG coordinate system so that [0,0] is in the lower left instead of the upper left?

推荐答案

我做了很多实验,唯一合乎逻辑的方法如下:

I have done a lot of experimentation, and the only logical method is as follows:

<g transform="translate(0,400)">
<g transform="scale(1,-1)">

其中 400 是图像的高度.这样做的作用是将所有内容向下移动,以便图像的顶部现在是图像的底部,然后缩放操作翻转 Y 坐标,以便现在离开页面/图像的位被翻转回来以填充留下的空间.

Where 400 is the height of the image. What this does it move everything down so that the top of the image is now and the bottom of the image, then the scale operation flips the Y coordinates, so that the bit that is now off the page/image is flipped back up to fill the space left behind.

这篇关于翻转 svg 坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆