### Home Classes Methods

### In Files

- lib/rvg/stretchable.rb

### Methods

- ::new
- #viewbox

### Included Modules

- Magick::RVG::PreserveAspectRatio

### 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::Stretchable

The methods in this module describe the user-coordinate space. RVG and Pattern objects are stretchable.

### Public Class Methods

new(*args, &block) click to toggle source

    # File lib/rvg/stretchable.rb, line 124
    def initialize(*args, &block)
        super()
        @vbx_x, @vbx_y, @vbx_width, @vbx_height = nil
        @meet_or_slice = 'meet'
        @align = nil
    end

### Public Instance Methods

viewbox(x, y, width, height) click to toggle source

Describe a user coordinate system to be imposed on the viewbox. The arguments must be numbers and the `width` and `height` arguments must be positive.

    # File lib/rvg/stretchable.rb, line 137
    def viewbox(x, y, width, height)
        begin
            @vbx_x = Float(x)
            @vbx_y = Float(y)
            @vbx_width = Float(width)
            @vbx_height = Float(height)
        rescue ArgumentError
            raise ArgumentError, "arguments must be convertable to float (got #{x.class}, #{y.class}, #{width.class}, #{height.class})"
        end
        raise(ArgumentError, "viewbox width must be > 0 (#{width} given)") unless width >= 0
        raise(ArgumentError, "viewbox height must be > 0 (#{height} given)") unless height >= 0

        # return the user-coordinate space attributes if defined
        class << self
          if not defined? @redefined then
            @redefined = true
            define_method(:x) { @vbx_x }
            define_method(:y) { @vbx_y }
            define_method(:width) { @vbx_width}
            define_method(:height) { @vbx_height }
          end
        end

        yield(self) if block_given?
        self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.