Sha256: 98d9efc6303dc1f6c802f61bc298d4ede1d8888f0404e8805b6c626a64437c01

Contents?: true

Size: 1.73 KB

Versions: 21

Compression:

Stored size: 1.73 KB

Contents

#--
# $Id: paint.rb,v 1.4 2007/01/20 17:39:49 rmagick Exp $
# Copyright (C) 2007 Timothy P. Hunter
#++
# Defines paint server classes.
# Eventually this will include gradients.

module Magick
    class RVG

        class Pattern
            include StructureConstructors
            include UseConstructors
            include ShapeConstructors
            include TextConstructors
            include ImageConstructors
            include Stretchable
            include Duplicatable
            include Stylable

            # 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 <tt>x+m*width</tt> and <tt>y+n*height</tt>
            # 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.
            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

            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

        end     # class Pattern

    end # class RVG
end # module Magick

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
rmagick-1.15.1 lib/rvg/paint.rb
rmagick-1.15.10 lib/rvg/paint.rb
rmagick-1.15.0 lib/rvg/paint.rb
rmagick-1.15.13 lib/rvg/paint.rb
rmagick-1.15.12 lib/rvg/paint.rb
rmagick-1.15.11 lib/rvg/paint.rb
rmagick-1.15.3 lib/rvg/paint.rb
rmagick-1.15.2 lib/rvg/paint.rb
rmagick-1.15.4 lib/rvg/paint.rb
rmagick-1.15.6 lib/rvg/paint.rb
rmagick-1.15.5 lib/rvg/paint.rb
rmagick-1.15.7 lib/rvg/paint.rb
rmagick-1.15.8 lib/rvg/paint.rb
rmagick-1.15.9 lib/rvg/paint.rb
rmagick-2.2.2 lib/rvg/paint.rb
rmagick-2.2.0 lib/rvg/paint.rb
rmagick-2.0.0 lib/rvg/paint.rb
rmagick-2.1.0 lib/rvg/paint.rb
rmagick4j-0.3.3-java lib/rvg/paint.rb
rmagick4j-0.3.4-java lib/rvg/paint.rb