Module: Magick::RVG::PreserveAspectRatio

### Home Classes Methods

### In Files

- lib/rvg/stretchable.rb

### Methods

- #preserve_aspect_ratio

### Files

- 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::SolidFill
- Magick::TextureFill
- Object

No matching classes.

# Magick::RVG::PreserveAspectRatio

### Public Instance Methods

preserve_aspect_ratio(align, meet_or_slice='meet') click to toggle source

Specifies how the image within a viewport should be scaled.

`align`

  a combination of 'xMin', 'xMid', or 'xMax', followed by 'YMin', 'YMid', or 'YMax'

`meet_or_slice`

  one of 'meet' or 'slice'

    # File lib/rvg/stretchable.rb, line 17
    def preserve_aspect_ratio(align, meet_or_slice='meet')
        @align = align.to_s
        if @align != 'none'
            m = /\A(xMin|xMid|xMax)(YMin|YMid|YMax)\z/.match(@align)
            raise(ArgumentError, "unknown alignment specifier: #{@align}") unless m
        end

        if meet_or_slice
            meet_or_slice = meet_or_slice.to_s.downcase
            if meet_or_slice == 'meet' || meet_or_slice == 'slice'
                @meet_or_slice = meet_or_slice
            else
                raise(ArgumentError, "specifier must be `meet' or `slice' (got #{meet_or_slice})")
            end
        end
        yield(self) if block_given?
        self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.