Sha256: 0b1580d2e89debb52df0cdae9e67522a0a928cadd064519ffc764d2e62f0cff4

Contents?: true

Size: 1.69 KB

Versions: 21

Compression:

Stored size: 1.69 KB

Contents

#--
# $Id: clippath.rb,v 1.3 2007/01/20 17:39:48 rmagick Exp $
# Copyright (C) 2007 Timothy P. Hunter
#++
module Magick
    class RVG

        class ClipPath
            include ShapeConstructors
            include UseConstructors
            include TextConstructors
            include Describable
            include Stylable
            include Duplicatable

            # Create a clipping path. Within the block create an outline
            # from one or more paths, basic shapes, text objects, or +use+.
            # Everything drawn within the outline will be displayed.
            # Anything drawn outside the outline will not.
            #
            # If the clipping path contains a +use+, it
            # must directly reference path, basic shape, or text objects.
            #
            # Attach the clipping path to an object with the :clip_path style.
            def initialize(clip_path_units='userSpaceOnUse')
                super()
                if ! ['userSpaceOnUse', 'objectBoundingBox'].include?(clip_path_units)
                    raise ArgumentError, "undefined value for clip path units: #{clip_path_units}"
                end
                @clip_path_units = clip_path_units
                @content = Content.new
                yield(self) if block_given?
            end

            def add_primitives(gc, style)   #:nodoc:
                name = __id__.to_s
                gc.define_clip_path(name) do
                    gc.clip_units(@clip_path_units)
                    @content.each { |element| element.add_primitives(gc) }
                end
                gc.clip_path(name)
            end

        end     # class ClipPath

    end # class RVG
end # module Magick

Version data entries

21 entries across 21 versions & 2 rubygems

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