Class: XRVG::Style
Overview
render.add( Circle[], Style[ :stroke, Color.red ] )
Instance Method Summary collapse
-
#fillopacity ⇒ Object
attribute :strokeopacity, 1.0.
- #strokeopacity ⇒ Object
- #svgfill ⇒ Object
- #svgline ⇒ Object
- #svgstroke ⇒ Object
Instance Method Details
#fillopacity ⇒ Object
attribute :strokeopacity, 1.0
30 31 32 33 34 35 |
# File 'lib/style.rb', line 30 def fillopacity() if @fill.is_a? Color return @fill.a end return 1.0 end |
#strokeopacity ⇒ Object
37 38 39 40 41 42 |
# File 'lib/style.rb', line 37 def strokeopacity() if @stroke.is_a? Color return @stroke.a end return 1.0 end |
#svgfill ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/style.rb', line 45 def svgfill if fill.is_a? Color return fill.svg elsif fill.is_a? Gradient return "%fillgradient%" else return fill end end |
#svgline ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/style.rb', line 65 def svgline template = 'style="opacity:%opacity%;fill:%fill%;fill-opacity:%fillopacity%;stroke:%stroke%;stroke-width:%strokewidth%;stroke-opacity:%strokeopacity%"' return template.subreplace( {"%opacity%" => 1.0, "%fill%" => svgfill, "%fillopacity%" => fillopacity, "%stroke%" => svgstroke, "%strokewidth%" => strokewidth, "%strokeopacity%" => strokeopacity} ) end |