Pergunta

I'm dealing with JavaFX 2.2 (JDK 7u7) and SVG files (once again ;D). I need to map SVG content to FX objects.

My problem is now, that I have e.g. a <rec> (Rectangle) defined in my SVG file. The according CSS style defines:

  • fill-opacity:0

and

  • stroke-opacity:1

As far as I know, I can only set the opacity for a complete node, there is no difference between stroke and fill opacity.

I haven't found a proper entry in the CSS reference guide, too.

Once again, do I just miss something or am I simply limited right now? Any hints how I could solve my delicate problem?

Any help is appreciated as every time :)

Foi útil?

Solução

Set -fx-fill and -fx-stroke attributes to RGB + Alpha paint specs.

Searching in the CSS reference guide you referenced will provide the syntax.

For example, the following style class sets fill opacity to .5 and stroke opacity to completely opaque.

 .rectangle {
   -fx-fill: rgba(0,255,0,0.5);
   -fx-stroke: rgba(255,0,0,1);
 }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top