parent
e18084d963
commit
c9440ec57c
|
|
@ -63,3 +63,14 @@ file
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
This sample `lives here <https://github.com/andymeneely/squib/tree/master/samples/saves>`_.
|
||||||
|
|
||||||
|
.. literalinclude:: ../../samples/saves/_showcase.rb
|
||||||
|
:language: ruby
|
||||||
|
:linenos:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<img src="../saves/showcase_expected.png" class="figure">
|
||||||
|
<img src="../saves/showcase2_expected.png" class="figure">
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,11 @@ module Squib
|
||||||
end
|
end
|
||||||
|
|
||||||
def finish!
|
def finish!
|
||||||
|
begin
|
||||||
@cairo_surface.finish
|
@cairo_surface.finish
|
||||||
|
rescue Cairo::SurfaceFinishedError
|
||||||
|
# do nothin - if it's already finished that's fine
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
########################
|
########################
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ module Squib
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
# @api private
|
# @api private
|
||||||
def trim_rounded(src, trim, radius)
|
def trim_rounded(src, trim, radius)
|
||||||
trim_cc = Cairo::Context.new(Cairo::ImageSurface.new(src.width - 2.0 * trim, src.height - 2.0 * trim))
|
trim_cc = Cairo::Context.new(Cairo::ImageSurface.new(@width - 2.0 * trim, @height - 2.0 * trim))
|
||||||
trim_cc.rounded_rectangle(0, 0, trim_cc.target.width, trim_cc.target.height, radius, radius)
|
trim_cc.rounded_rectangle(0, 0, trim_cc.target.width, trim_cc.target.height, radius, radius)
|
||||||
trim_cc.set_source(src, -1 * trim, -1 * trim)
|
trim_cc.set_source(src, -1 * trim, -1 * trim)
|
||||||
trim_cc.clip
|
trim_cc.clip
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ module Squib
|
||||||
# Most of the time this is in the alpha of the next release.
|
# Most of the time this is in the alpha of the next release.
|
||||||
# e.g. v0.0.5a is on its way to becoming v0.0.5
|
# e.g. v0.0.5a is on its way to becoming v0.0.5
|
||||||
#
|
#
|
||||||
VERSION = '0.12.0a'
|
VERSION = '0.12.0b'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,11 @@ Squib::Deck.new(cards: 2, config: '_backend-config.yml') do
|
||||||
# We can still rasterize whenever we want
|
# We can still rasterize whenever we want
|
||||||
save_png prefix: 'backend_'
|
save_png prefix: 'backend_'
|
||||||
|
|
||||||
|
showcase file: 'showcase.png', fill_color: 'white'
|
||||||
|
|
||||||
# And our PDFs will be vectorized .
|
# And our PDFs will be vectorized .
|
||||||
save_pdf file: 'backend_vectorized.pdf', gap: 5
|
save_pdf file: 'backend_vectorized.pdf', gap: 5
|
||||||
|
|
||||||
# This one is a known issue. Masking an SVG onto an SVG backend is still buggy.
|
# This one is a known issue. Masking an SVG onto an SVG backend is still buggy.
|
||||||
# svg file: 'glass-heart.svg', x: 100, y: 200, width: 100, height: 100, mask: :sangria
|
# svg file: 'glass-heart.svg', x: 100, y: 200, width: 100, height: 100, mask: :sangria
|
||||||
|
|
||||||
# This one is, unfortunately, not possible with svg back ends
|
|
||||||
# Cairo lacks a perspective transform (currently), so we have to
|
|
||||||
# use a striping method, which assumes raster. Fortunately, Cairo
|
|
||||||
# has perspective transforms on its roadmap,
|
|
||||||
# so perhaps this can be done someday with all vectors.
|
|
||||||
#
|
|
||||||
# showcase file: 'showcase.png', fill_color: 'white'
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 177 KiB |
Loading…
Reference in New Issue