Class: Magick::RVG::PathData

### Home Classes Methods

### In Files

- lib/rvg/pathdata.rb

### Parent

Object

### Methods

- ::new
- #arc
- #closepath
- #curveto
- #hlineto
- #lineto
- #moveto
- #quadratic_curveto
- #smooth_curveto
- #smooth_quadratic_curveto
- #to_s
- #vlineto

### Files

- MANIFEST
- Makefile

### Class/Module Index

Quicksearch

- Magick
- Magick::DestroyedImageError
- Magick::Draw
- Magick::Enum
- Magick::FatalImageMagickError
- Magick::Geometry
- Magick::GeometryValue
- Magick::GradientFill
- Magick::HatchFill
- Magick::IPTC
- Magick::IPTC::Application
- Magick::IPTC::Envelope
- Magick::IPTC::ObjectData
- Magick::IPTC::Post_ObjectData_Descriptor
- Magick::IPTC::Pre_ObjectData_Descriptor
- Magick::Image
- Magick::Image::DrawOptions
- Magick::Image::Info
- Magick::Image::PolaroidOptions
- Magick::Image::View
- Magick::Image::View::Pixels
- Magick::Image::View::Rows
- Magick::ImageList
- Magick::ImageList::Montage
- Magick::ImageMagickError
- Magick::OptionalMethodArguments
- Magick::Pixel
- Magick::RVG
- Magick::RVG::Circle
- Magick::RVG::ClipPath
- Magick::RVG::Describable
- Magick::RVG::Duplicatable
- Magick::RVG::Ellipse
- Magick::RVG::Embellishable
- Magick::RVG::Group
- Magick::RVG::Image
- Magick::RVG::ImageConstructors
- Magick::RVG::Line
- Magick::RVG::Path
- Magick::RVG::PathData
- Magick::RVG::Pattern
- Magick::RVG::PolyShape
- Magick::RVG::Polygon
- Magick::RVG::Polyline
- Magick::RVG::PreserveAspectRatio
- Magick::RVG::Rect
- Magick::RVG::ShapeConstructors
- Magick::RVG::Stretchable
- Magick::RVG::StructureConstructors
- Magick::RVG::Stylable
- Magick::RVG::Text
- Magick::RVG::TextBase
- Magick::RVG::TextConstructors
- Magick::RVG::Transformable
- Magick::RVG::Use
- Magick::RVG::UseConstructors
- Magick::RVG::Utility
- Magick::RVG::Utility::DefaultTextStrategy
- Magick::RVG::Utility::GraphicContext
- Magick::RVG::Utility::LRTextStrategy
- Magick::RVG::Utility::RLTextStrategy
- Magick::RVG::Utility::TBTextStrategy
- Magick::RVG::Utility::TextAttributes
- Magick::RVG::Utility::TextStrategy
- Magick::TextureFill
- Object

No matching classes.

# Magick::RVG::PathData

The PathData class provides an object-oriented way to produce an SVG path. Each of the methods corresponds to a path command. Construct a path by calling one or more methods. The path object can be passed as an argument to the RVG::ShapeConstructors#path method.

### Public Class Methods

new() click to toggle source

Construct an empty path

    # File lib/rvg/pathdata.rb, line 28
    def initialize
        @path = ''
    end

### Public Instance Methods

arc(abs, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, x, y) click to toggle source

Add an `arc` command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 123
    def arc(abs, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, x, y)
        @path << sprintf("%s%g,%g %g %d %d %g,%g ", (abs ? 'A' : 'a'), rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, x, y)
    end

closepath(abs=true) click to toggle source

Add a `closepath` command. The `abs` argument is ignored.

    # File lib/rvg/pathdata.rb, line 52
    def closepath(abs=true)
        @path << 'Z'    # ignore `abs'
    end

curveto(abs, x1, y1, x2, y2, x, y, *coords) click to toggle source

Add a `curveto` (cubic Bezier) command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 84
    def curveto(abs, x1, y1, x2, y2, x, y, *coords)
        @path << sprintf("%s%g,%g %g,%g %g,%g ", (abs ? 'C' : 'c'), x1, y1, x2, y2, x, y)
        # "multiple sets of coordinates may be specified to draw a polybezier"
        add_points(6, *coords)
    end

hlineto(abs, x) click to toggle source

Add a `horizontal lineto` command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 69
    def hlineto(abs, x)
        @path << sprintf("%s%g ", (abs ? 'H' : 'h'), x)
    end

lineto(abs, x, y, *coords) click to toggle source

Add a `lineto` command. Any number of x,y coordinate pairs may be specified. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 60
    def lineto(abs, x, y, *coords)
        @path << sprintf("%s%g,%g ", (abs ? 'L' : 'l'), x, y)
        # "a number of coordinate pairs may be specified to draw a polyline"
        add_points(2, *coords)
    end

moveto(abs, x, y, *coords) click to toggle source

Add a `moveto` command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 44
    def moveto(abs, x, y, *coords)
        @path << sprintf("%s%g,%g ", (abs ? 'M' : 'm'), x, y)
        # "subsequent pairs are treated as implicit lineto commands"
        add_points(2, *coords)
    end

quadratic_curveto(abs, x1, y1, x, y, *coords) click to toggle source

Add a `quadratic Bezier curveto` command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 104
    def quadratic_curveto(abs, x1, y1, x, y, *coords)
        @path << sprintf("%s%g,%g %g,%g ", (abs ? 'Q' : 'q'), x1, y1, x, y)
        add_points(4, *coords)
    end

smooth_curveto(abs, x2, y2, x, y, *coords) click to toggle source

Add a `smooth curveto` (cubic Bezier) command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 94
    def smooth_curveto(abs, x2, y2, x, y, *coords)
        @path << sprintf("%s%g,%g %g,%g ", (abs ? 'S' : 's'), x2, y2, x, y)
        # "multiple sets of coordinates may be specified to draw a polybezier"
        add_points(4, *coords)
    end

smooth_quadratic_curveto(abs, x, y, *coords) click to toggle source

Add a `smooth quadratic Bezier curveto` command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 113
    def smooth_quadratic_curveto(abs, x, y, *coords)
        @path << sprintf("%s%g,%g ", (abs ? 'T' : 't'), x, y)
        add_points(2, *coords)
    end

to_s() click to toggle source

Convert the path to its string equivalent.

    # File lib/rvg/pathdata.rb, line 33
    def to_s
        @path
    end

vlineto(abs, y) click to toggle source

Add a `vertical lineto` command. If `abs` is `true` the coordinates are absolute, otherwise the coordinates are relative.

    # File lib/rvg/pathdata.rb, line 76
    def vlineto(abs, y)
        @path << sprintf("%s%g ", (abs ? 'V' : 'v'), y)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.