samples: gistify saves
parent
e3bd7c9503
commit
bd5e6c92f6
|
|
@ -25,5 +25,5 @@
|
|||
url = https://gist.github.com/59089c972b8b0e5d7e76598010e69291.git
|
||||
|
||||
[submodule "samples/saves"]
|
||||
path = samples/save
|
||||
path = samples/saves
|
||||
url = https://gist.github.com/3c60c13b25f525abd037db4055abf35c.git
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
require 'squib'
|
||||
|
||||
Squib::Deck.new(cards: 8, layout: 'playing-card.yml') do
|
||||
background color: :cyan
|
||||
rect x: 37, y: 37, width: 750, height: 1050, fill_color: :black, radius: 25
|
||||
rect x: 75, y: 75, width: 675, height: 975, fill_color: :white, radius: 20
|
||||
text str: ('A'..'Z').to_a, layout: :bonus_ul, font: 'Sans bold 100'
|
||||
|
||||
# Defaults are sensible
|
||||
hand # saves to _output/hand.png
|
||||
|
||||
# Here's a prettier version:
|
||||
# - Each card is trimmed with rounded corners
|
||||
# - Zero radius means cards rotate about the bottom of the card
|
||||
# - Cards are shown in reverse order
|
||||
hand trim: 37.5, trim_radius: 25,
|
||||
radius: 0,
|
||||
range: 7.downto(0),
|
||||
file: 'hand_pretty.png'
|
||||
|
||||
# Tip: you can have the top card be on the left by reversing the range
|
||||
# angle_range: (Math::PI / 4)..(Math::PI / -4)
|
||||
end
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit fae188e6b132a6282a205281dcb029165f777558
|
||||
Subproject commit b657866fccb82865697118c7ac6379928cbd6c8f
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
require 'squib'
|
||||
|
||||
# This sample demonstrates how to use the various save methods
|
||||
|
||||
Squib::Deck.new(width: 825, height: 1125, cards: 16) do
|
||||
background color: :gray
|
||||
rect x: 38, y: 38, width: 750, height: 1050,
|
||||
x_radius: 38, y_radius: 38, stroke: 3.0, dash: '4 4'
|
||||
|
||||
text str: (1..16).to_a, x: 220, y: 78, font: 'Arial 54'
|
||||
|
||||
# Here's what a regular save_png looks like for just the first card
|
||||
save_png range: 0, prefix: 'save_png_'
|
||||
|
||||
# save_png supports trim and trim_radius
|
||||
save_png trim: 30, trim_radius: 38,
|
||||
range: 0, prefix: 'save_png_trimmed_'
|
||||
|
||||
# Place on multiple pages over the PDF, with bleed beeing trimmed off
|
||||
save_pdf file: 'save-pdf.pdf', margin: 75, gap: 5, trim: 37
|
||||
|
||||
# PDFs also support arbitrary paper sizes, in pixels or any other supported units
|
||||
save_pdf file: 'save-pdf-small.pdf',
|
||||
width: '7in', height: '5in',
|
||||
range: 0..1
|
||||
|
||||
# Note that our PNGs still are not trimmed even though the pdf ones were
|
||||
save_png range: 1, prefix: 'saves_notrim_'
|
||||
|
||||
# We can also save our PNGs into a single sheet,
|
||||
# rows are calculated based on cols and number of cards
|
||||
save_sheet prefix: 'save_single_sheet_',
|
||||
columns: 2, margin: 75, gap: 5, trim: 37
|
||||
|
||||
# Or multiple sheets if rows are also specified
|
||||
save_sheet prefix: 'save_sheet_',
|
||||
columns: 4, rows: 2,
|
||||
margin: 75, gap: 5, trim: 37
|
||||
|
||||
# Sheets support ranges too
|
||||
save_sheet prefix: 'save_sheet_range_',
|
||||
range: 0..5,
|
||||
columns: 2, rows: 2,
|
||||
margin: 75, gap: 5, trim: 37
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
require 'squib'
|
||||
|
||||
# Showcases are a neat way to show off your cards in a modern way, using a
|
||||
# reflection and a persepctive effect to make them look 3D
|
||||
Squib::Deck.new(cards: 4) do
|
||||
background color: '#CE534D'
|
||||
rect fill_color: '#DED4B9', x: 78, y: 78,
|
||||
width: '2.25in', height: '3.25in', radius: 32
|
||||
text str: %w(Grifter Thief Thug Kingpin),
|
||||
font: 'Helvetica,Sans weight=800 120',
|
||||
x: 78, y: 78, width: '2.25in', align: :center
|
||||
svg file: 'spanner.svg', x: (825 - 500) / 2, y: 500, width: 500, height: 500
|
||||
|
||||
# Defaults are pretty sensible.
|
||||
showcase file: 'showcase.png'
|
||||
|
||||
# Here's a more complete example.
|
||||
# Tons of ways to tweak it if you like - check the docs.
|
||||
showcase trim: 32, trim_radius: 32, margin: 100, face: :right,
|
||||
scale: 0.85, offset: 0.95, fill_color: :black,
|
||||
reflect_offset: 25, reflect_strength: 0.1, reflect_percent: 0.4,
|
||||
file: 'showcase2.png'
|
||||
|
||||
save_png prefix: 'showcase_individual_' # to show that they're not trimmed
|
||||
end
|
||||
|
|
@ -38,7 +38,8 @@ describe 'Squib samples' do
|
|||
# These are samples that don't really need a regression log
|
||||
# colors.rb
|
||||
# unicode.rb
|
||||
%w( autoscale_font/_autoscale_font.rb
|
||||
%w(
|
||||
autoscale_font/_autoscale_font.rb
|
||||
basic.rb
|
||||
cairo_access.rb
|
||||
csv_import.rb
|
||||
|
|
@ -48,13 +49,13 @@ describe 'Squib samples' do
|
|||
embed_text.rb
|
||||
excel.rb
|
||||
gradients.rb
|
||||
hand.rb
|
||||
saves/_hand.rb
|
||||
hello_world.rb
|
||||
images/_more_load_images.rb
|
||||
portrait-landscape.rb
|
||||
ranges.rb
|
||||
saves.rb
|
||||
showcase.rb
|
||||
saves/_saves.rb
|
||||
saves/_showcase.rb
|
||||
text_options.rb
|
||||
tgc_proofs.rb
|
||||
units.rb
|
||||
|
|
|
|||
Loading…
Reference in New Issue