Class: Magick::RVG::ClipPath
- Inherits:
-
Object
- Object
- Magick::RVG::ClipPath
- Includes:
- Describable, Duplicatable, ShapeConstructors, Stylable, TextConstructors, UseConstructors
- Defined in:
- lib/rvg/clippath.rb
Instance Attribute Summary
Attributes included from Describable
Instance Method Summary collapse
-
#add_primitives(gc, style) ⇒ Object
:nodoc:.
-
#initialize(clip_path_units = 'userSpaceOnUse') {|_self| ... } ⇒ ClipPath
constructor
Create a clipping path.
Methods included from Duplicatable
Methods included from Stylable
Methods included from TextConstructors
Methods included from UseConstructors
Methods included from ShapeConstructors
#circle, #ellipse, #line, #path, #polygon, #polyline, #rect
Constructor Details
#initialize(clip_path_units = 'userSpaceOnUse') {|_self| ... } ⇒ ClipPath
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.
24 25 26 27 28 29 30 31 32 |
# File 'lib/rvg/clippath.rb', line 24 def initialize(clip_path_units='userSpaceOnUse') super() unless ['userSpaceOnUse', 'objectBoundingBox'].include?(clip_path_units) fail 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 |
Instance Method Details
#add_primitives(gc, style) ⇒ Object
:nodoc:
34 35 36 37 38 39 40 41 |
# File 'lib/rvg/clippath.rb', line 34 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 |