Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Patch for missing RVG::Bezier #57

Open
ghost opened this Issue · 1 comment

1 participant

Mikael Muszynski
Deleted user
diff --git a/lib/rvg/embellishable.rb b/lib/rvg/embellishable.rb
index a1613da..c07ae7f 100644
--- a/lib/rvg/embellishable.rb
+++ b/lib/rvg/embellishable.rb
@@ -23,6 +23,22 @@ module Magick

         end     # class Shape

+        class Bezier < Shape
+
+          # Define a bezier curve.
+          def initialize(*points)
+            super()
+            if points.length == 0
+                raise ArgumentError, "no points specified"
+            elsif points.length % 2 != 0
+                raise ArgumentError, "odd number of arguments specified"
+            end
+            @primitive = :bezier
+            @args = points
+          end
+
+        end     # class Bezier
+
         class Circle < Shape

             # Define a circle with radius +r+ and centered at [<tt>cx</tt>, <tt>cy</tt>].
@@ -260,6 +276,13 @@ module Magick
         # Methods that construct basic shapes within a container
         module ShapeConstructors

+            # Draw a bezier curve.
+            def bezier(*points)
+                bezier = Bezier.new(*points)
+                @content << bezier
+                return bezier
+            end
+
             # Draws a circle whose center is [<tt>cx</tt>, <tt>cy</tt>] and radius is +r+.
             def circle(r, cx=0, cy=0)
                 circle = Circle.new(r, cx, cy)
Mikael Muszynski

Submit this patch as a pull request if it is to be reviewed.

Benjamin Fleischer bf4 referenced this issue in gemhome/rmagick
Open

Patch for missing RVG::Bezier #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.