SVG scaling is now supported!
This commit is contained in:
@@ -3,7 +3,7 @@ module Squib
|
||||
|
||||
# Renders a png file at the given location.
|
||||
# See {file:samples/image.rb samples/image.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
|
||||
# Note: scaling not currently supported.
|
||||
# Note: scaling not currently supported for PNGs.
|
||||
#
|
||||
# @param range: the range of cards over which this will be rendered. See {file:API.md#label-Specifying+Ranges Specifying Ranges}
|
||||
# @param file: the . See {file:API.md#Specifying+Files Specifying Files}
|
||||
@@ -17,17 +17,18 @@ module Squib
|
||||
end
|
||||
|
||||
# Renders an entire svg file at the given location. Uses the SVG-specified units and DPI to determine the pixel width and height.
|
||||
# See {file:samples/image.rb samples/image.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
|
||||
# Note: scaling not currently supported.
|
||||
# See {file:samples/load-images.rb samples/load-images.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
|
||||
#
|
||||
# @param range: the range of cards over which this will be rendered. See {file:API.md#label-Specifying+Ranges Specifying Ranges}
|
||||
# @param file: the . See {file:API.md#Specifying+Files Specifying Files}
|
||||
# @param x: the x-coordinate to place
|
||||
# @param y: the y-coordinate to place
|
||||
def svg(range: :all, file: nil, x: 0, y: 0)
|
||||
# @param width: the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document.
|
||||
# @param height: the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document.
|
||||
def svg(range: :all, file: nil, x: 0, y: 0, width: :native, height: :native)
|
||||
range = rangeify(range)
|
||||
file = fileify(file)
|
||||
range.each{ |i| @cards[i].svg(file, x, y) }
|
||||
range.each{ |i| @cards[i].svg(file, x, y, width, height) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user