Class: Magick::RVG::Pattern

Inherits:
Object
  • Object
show all
Includes:
Duplicatable, ImageConstructors, ShapeConstructors, Stretchable, StructureConstructors, Stylable, TextConstructors, UseConstructors
Defined in:
lib/rvg/paint.rb

Instance Method Summary collapse

Methods included from Stylable

#styles

Methods included from Duplicatable

#deep_copy

Methods included from Stretchable

#viewbox

Methods included from PreserveAspectRatio

#preserve_aspect_ratio

Methods included from ImageConstructors

#image

Methods included from TextConstructors

#text

Methods included from ShapeConstructors

#circle, #ellipse, #line, #path, #polygon, #polyline, #rect

Methods included from UseConstructors

#use

Methods included from StructureConstructors

#g, #rvg

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.

Yields:

  • (_self)

Yield Parameters:



29
30
31
32
33
34
# File 'lib/rvg/paint.rb', line 29

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 Method Details

#add_primitives(gc, style) ⇒ Object

:nodoc:



36
37
38
39
40
41
42
43
# File 'lib/rvg/paint.rb', line 36

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