简体   繁体   English

使用TornadoFX奇怪的SVG失真

[英]Weird SVG distortion with TornadoFX

Having a strange issue while using SVGs in TornadoFX. 在TornadoFX中使用SVG时遇到一个奇怪的问题。 I have a few SVGs strings stored in an enum I'm using as background images in my program. 我在程序中将一些SVG字符串存储在枚举中,用作背景图像。 When I view the exact same SVG path in an online viewer, there is no distortion and it appears correctly: 当我在在线查看器中查看完全相同的SVG路径时,没有任何失真,并且可以正确显示:

愚蠢的地球svg

but when I use the same path in TornadoFX as a svgpath node content, it appears like so: 但是当我在TornadoFX中使用相同的路径作为svgpath节点内容时,它看起来像这样:

愚蠢的地球仪,但扭曲了

Note the strange thinning of the lines in the top and bottom middle sections. 注意顶部和底部中间部分的线变稀。

It's easier to see with the second svg: 使用第二个svg更容易看到:

Online viewer: 在线观看者:

愚蠢的波浪,我不是很好

TornadoFX program: TornadoFX程序:

哑波但失真

I'm not quite sure what could be causing this. 我不太确定是什么原因造成的。 In everything else I view the SVGs in (web, illustrator) they appear fine, but as soon as I load them as a string in a svgpath node, they appear distorted. 在其他所有内容中,我都在(网络,插画家)中查看了SVG,但它们看起来不错,但是一旦我将它们作为字符串加载到svgpath节点中,它们就会出现变形。

I'm initializing them like this: 我正在像这样初始化它们:

class mView : View() {

  override val root = stackpane {
    svgpath("M910.7,329.8a446.43,446.43,0,1,0,35,173.23A443.52,443.52.. etc") {
        addClass(SvgStyle)
    }
//..
}

Any ideas what would be causing this strange distortion? 有什么想法会导致这种奇怪的失真吗? I'm pullin my hair out here. 我在这里拉我的头发。

edit: a fiddle of the curvy SVGs 编辑:弯曲的SVG的小提琴

TornadoFX doesn't affect the SVG rendering in any way, so I can't see any other explanation that this being a bug in the SVG rendering capabilities of JavaFX. TornadoFX不会以任何方式影响SVG渲染,因此我看不到任何其他解释,这是JavaFX的SVG渲染功能中的错误。 Perhaps you're using a path expression not supported by JavaFX? 也许您使用的是JavaFX不支持的路径表达式?

For the sphere, can you try setting the stroke on the SVGPath object as in the following example? 对于球体,是否可以尝试像下面的示例一样在SVGPath对象上设置笔触?

stackpane {
    svgpath("M107 380c40,-101 80,-102 120,-1m-1 -4c39,101 79,102 120,1m-1 4c39,-101 79,-101 120,-1m-1 -2c39,100 79,101 120,1", FillRule.EVEN_ODD) {
        fill = Color.WHITE
        stroke = Color.BLACK
        strokeWidth = 16.0;
    }
}

In the curves part of the question, can you post the full SVG path? 在问题的曲线部分,您可以发布完整的SVG路径吗? I suspect there's something in the path source telling JavaFX to render the thinner segments. 我怀疑路径源中有某些内容告诉JavaFX渲染更细的段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM