| Module | Magick::RVG::Stylable |
| In: |
lib/rvg/stylable.rb
|
This module is mixed into classes that can have styles.
This method can be used with any RVG, Group, Use, Text, or shape object. The argument is a hash. The style names are the hash keys. The style names and values are:
# File lib/rvg/stylable.rb, line 107
107: def styles(styles)
108: @styles.set(styles)
109: yield(self) if block_given?
110: self
111: end
For each style that has a value, add a style primitive to the gc. Use splat to splat out Array arguments such as stroke_dasharray.
# File lib/rvg/stylable.rb, line 62
62: def add_style_primitives(gc)
63: @styles.each_value do |style, value|
64: if value.respond_to? :add_primitives
65: value.add_primitives(gc, style)
66: else
67: gc.__send__(style, *value)
68: end
69: end
70: end