Class: Magick::RVG::Image
- Inherits:
-
Object
- Object
- Magick::RVG::Image
- Includes:
- Describable, Duplicatable, PreserveAspectRatio, Stylable, Transformable
- Defined in:
- lib/rvg/embellishable.rb
Overview
class Polyline
Instance Attribute Summary
Attributes included from Describable
Instance Method Summary collapse
-
#add_primitives(gc) ⇒ Object
:nodoc:.
-
#initialize(image, width = nil, height = nil, x = 0, y = 0) ⇒ Image
constructor
Composite a raster image in the viewport defined by [x,y] and
width
andheight
.
Methods included from Duplicatable
Methods included from PreserveAspectRatio
Methods included from Transformable
#matrix, #rotate, #scale, #skewX, #skewY, #translate
Methods included from Stylable
Constructor Details
#initialize(image, width = nil, height = nil, x = 0, y = 0) ⇒ Image
Composite a raster image in the viewport defined by [x,y] and width
and height
. Use the RVG::ImageConstructors#image method to create Text objects in a container.
219 220 221 222 223 224 225 226 227 |
# File 'lib/rvg/embellishable.rb', line 219 def initialize(image, width=nil, height=nil, x=0, y=0) super() # run module initializers @image = image.copy # use a copy of the image in case app. re-uses the argument @x, @y, @width, @height = Magick::RVG.convert_to_float(x, y, width || @image.columns, height || @image.rows) if @width < 0 || @height < 0 fail ArgumentError, 'width, height must be >= 0' end init_viewbox end |
Instance Method Details
#add_primitives(gc) ⇒ Object
:nodoc:
229 230 231 232 233 234 235 236 237 |
# File 'lib/rvg/embellishable.rb', line 229 def add_primitives(gc) #:nodoc: # Do not render if width or height is 0 return if @width == 0 || @height == 0 gc.push add_transform_primitives(gc) add_style_primitives(gc) add_composite_primitive(gc) gc.pop end |