Sha256: 89e095f6d3c781167df3e334049e668a29dd937b6a8070a6015f02a8bee18f09

Contents?: true

Size: 1.69 KB

Versions: 13

Compression:

Stored size: 1.69 KB

Contents

#--
# $Id: clippath.rb,v 1.5 2009/02/28 23:52:13 rmagick Exp $
# Copyright (C) 2009 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

13 entries across 13 versions & 2 rubygems

Version Path
rmagick-2.13.4 lib/rvg/clippath.rb
rmagick-2.13.3 lib/rvg/clippath.rb
rmagick-2.13.3.rc1 lib/rvg/clippath.rb
rmagick-2.13.2 lib/rvg/clippath.rb
rdp-rmagick-0.0.0 lib/rvg/clippath.rb
rmagick-2.13.1 lib/rvg/clippath.rb
rmagick-2.12.2 lib/rvg/clippath.rb
rmagick-2.12.1 lib/rvg/clippath.rb
rmagick-2.12.0 lib/rvg/clippath.rb
rmagick-2.11.1 lib/rvg/clippath.rb
rmagick-2.10.0 lib/rvg/clippath.rb
rmagick-2.11.0 lib/rvg/clippath.rb
rmagick-2.9.2 lib/rvg/clippath.rb