Class: Magick::RVG::Pattern
- Inherits:
-
Object
- Object
- Magick::RVG::Pattern
- Includes:
- Duplicatable, ImageConstructors, ShapeConstructors, Stretchable, StructureConstructors, Stylable, TextConstructors, UseConstructors
- Defined in:
- lib/rvg/paint.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Return upper-left corner, width, height of viewport in user coordinates.
-
#width ⇒ Object
readonly
Return upper-left corner, width, height of viewport in user coordinates.
-
#x ⇒ Object
readonly
Return upper-left corner, width, height of viewport in user coordinates.
-
#y ⇒ Object
readonly
Return upper-left corner, width, height of viewport in user coordinates.
Instance Method Summary collapse
-
#add_primitives(gc, style) ⇒ Object
:nodoc:.
-
#initialize(width = 0, height = 0, x = 0, y = 0) {|_self| ... } ⇒ Pattern
constructor
Create a pattern that can be used with the :fill or :stroke styles.
Methods included from Stylable
Methods included from Duplicatable
Methods included from Stretchable
Methods included from PreserveAspectRatio
Methods included from ImageConstructors
Methods included from TextConstructors
Methods included from ShapeConstructors
#circle, #ellipse, #line, #path, #polygon, #polyline, #rect
Methods included from UseConstructors
Methods included from StructureConstructors
Constructor Details
#initialize(width = 0, height = 0, x = 0, y = 0) {|_self| ... } ⇒ Pattern
Create a pattern that can be used with the :fill or :stroke styles. The width
and height
arguments define the viewport. The pattern will be repeated at x+m*width
and y+n*height
offsets.
Define the pattern in the block. The pattern can be composed of shapes (rectangle, circles, etc.), text, raster images and container objects. You can include graphic objects by referring to them with #use.
33 34 35 36 37 38 |
# File 'lib/rvg/paint.rb', line 33 def initialize(width = 0, height = 0, x = 0, y = 0) super() @width, @height, @x, @y = Magick::RVG.convert_to_float(width, height, x, y) @content = Content.new yield(self) if block_given? end |
Instance Attribute Details
#height ⇒ Object (readonly)
Return upper-left corner, width, height of viewport in user coordinates. Usually these are the values specified when the Pattern object is created, but they can be changed by a call to the viewbox method.
22 23 24 |
# File 'lib/rvg/paint.rb', line 22 def height @height end |
#width ⇒ Object (readonly)
Return upper-left corner, width, height of viewport in user coordinates. Usually these are the values specified when the Pattern object is created, but they can be changed by a call to the viewbox method.
22 23 24 |
# File 'lib/rvg/paint.rb', line 22 def width @width end |
#x ⇒ Object (readonly)
Return upper-left corner, width, height of viewport in user coordinates. Usually these are the values specified when the Pattern object is created, but they can be changed by a call to the viewbox method.
22 23 24 |
# File 'lib/rvg/paint.rb', line 22 def x @x end |
#y ⇒ Object (readonly)
Return upper-left corner, width, height of viewport in user coordinates. Usually these are the values specified when the Pattern object is created, but they can be changed by a call to the viewbox method.
22 23 24 |
# File 'lib/rvg/paint.rb', line 22 def y @y end |
Instance Method Details
#add_primitives(gc, style) ⇒ Object
:nodoc:
40 41 42 43 44 45 46 47 |
# File 'lib/rvg/paint.rb', line 40 def add_primitives(gc, style) #:nodoc: name = __id__.to_s gc.pattern(name, @x, @y, @width, @height) do add_viewbox_primitives(@width, @height, gc) @content.each { |element| element.add_primitives(gc) } end gc.__send__(style, name) end |