Browse Source

samples: un-submodule saves gist

The saves gist is now no longer maintained
dev
Andy Meneely 9 years ago
parent
commit
47292ad0ea
  1. 29
      .gitmodules
  2. 1
      samples/saves
  3. 1
      samples/saves/.gitignore
  4. 23
      samples/saves/_hand.rb
  5. 23
      samples/saves/_portrait_landscape.rb
  6. 18
      samples/saves/_save_pdf.rb
  7. 45
      samples/saves/_saves.rb
  8. 25
      samples/saves/_showcase.rb
  9. BIN
      samples/saves/hand_expected.png
  10. BIN
      samples/saves/hand_pretty_expected.png
  11. BIN
      samples/saves/save-pdf-small_expected.pdf
  12. BIN
      samples/saves/save-pdf_expected.pdf
  13. BIN
      samples/saves/save_png_00_expected.png
  14. BIN
      samples/saves/save_png_trimmed_00_expected.png
  15. BIN
      samples/saves/save_sheet_00_expected.png
  16. BIN
      samples/saves/save_sheet_01_expected.png
  17. BIN
      samples/saves/save_sheet_range_00_expected.png
  18. BIN
      samples/saves/save_sheet_range_01_expected.png
  19. BIN
      samples/saves/save_single_sheet_00_expected.png
  20. BIN
      samples/saves/saves_notrim_01_expected.png
  21. BIN
      samples/saves/showcase2_expected.png
  22. BIN
      samples/saves/showcase_expected.png
  23. BIN
      samples/saves/showcase_individual_00_expected.png
  24. BIN
      samples/saves/showcase_individual_01_expected.png
  25. BIN
      samples/saves/showcase_individual_02_expected.png
  26. BIN
      samples/saves/showcase_individual_03_expected.png
  27. 91
      samples/saves/spanner.svg

29
.gitmodules vendored

@ -1,11 +1,9 @@
[submodule "samples/intro"]
path = samples/intro
url = https://gist.github.com/5026392a419124312cb7.git
path = samples/intro
url = https://gist.github.com/5026392a419124312cb7.git
[submodule "samples/images"]
path = samples/images
url = https://gist.github.com/00ba7eb0aa1d82140503.git
[submodule "samples/text"]
path = samples/text
url = https://gist.github.com/52d7b8e332194946bc69.git
@ -15,22 +13,15 @@
[submodule "samples/build_groups"]
path = samples/build_groups
url = https://gist.github.com/andymeneely/bda48487e3b8c9d15edb
[submodule "samples/backend"]
path = samples/backend
url = https://gist.github.com/7b4a3acd0e758aedf87ba549e2025a11.git
path = samples/backend
url = https://gist.github.com/7b4a3acd0e758aedf87ba549e2025a11.git
[submodule "samples/shapes"]
path = samples/shapes
url = https://gist.github.com/59089c972b8b0e5d7e76598010e69291.git
[submodule "samples/saves"]
path = samples/saves
url = https://gist.github.com/3c60c13b25f525abd037db4055abf35c.git
path = samples/shapes
url = https://gist.github.com/59089c972b8b0e5d7e76598010e69291.git
[submodule "samples/data"]
path = samples/data
url = https://gist.github.com/6f89115805e205c647a779b7b4866151.git
path = samples/data
url = https://gist.github.com/6f89115805e205c647a779b7b4866151.git
[submodule "samples/colors"]
path = samples/colors
url = https://gist.github.com/fac2f4a16a23c2bada126e93d6523971.git
path = samples/colors
url = https://gist.github.com/fac2f4a16a23c2bada126e93d6523971.git

1
samples/saves

@ -1 +0,0 @@
Subproject commit 711ec5a0596a62f6b699a202b7f557d9cd5d20fe

1
samples/saves/.gitignore vendored

@ -0,0 +1 @@
_output/*

23
samples/saves/_hand.rb

@ -0,0 +1,23 @@
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

23
samples/saves/_portrait_landscape.rb

@ -0,0 +1,23 @@
require 'squib'
# For decks with both landscape and portrait orientations,
# we recommend using two separate decks.
# For print-on-demand, we can rotate all of the images in the final step.
# Normal cards
Squib::Deck.new(width: 825, height: 1125) do
background color: '#aaa'
text str: 'This is portrait and trimmed'
save_png prefix: 'portrait_', trim: 10, trim_radius: 15
end
# Money cards are landscape
Squib::Deck.new(width: 1125, height: 825) do
background color: '#aaa'
text str: 'This is landscape and trimmed', x: 15, y: 10
save_png prefix: 'landscape_', rotate: :clockwise, trim: 25, trim_radius: 15
end

18
samples/saves/_save_pdf.rb

@ -0,0 +1,18 @@
require 'squib'
Squib::Deck.new(cards: 8) do
background color: :gray
rect x: 37.5, y: 37.5, width: 750, height: 1050,
x_radius: 37.5, y_radius: 37.5, stroke: 3.0, dash: '4 4'
# Tests for crop marks
save_pdf file: 'crops-default.pdf', crop_marks: true
save_pdf file: 'crops-gapped.pdf', crop_marks: true, trim: 37.5, gap: 20
# Test crop marks with all the bells and whistles
rect x: '0.3in', y: '0.4in', width: '2in', height: '2.5in'
save_pdf file: 'crops-custom.pdf', crop_marks: true, trim: 0, gap: 20,
crop_stroke_dash: '5 5', crop_stroke_color: :red, crop_stroke_width: 4.0,
crop_margin_left: '0.3in', crop_margin_right: '0.45in',
crop_margin_top: '0.4in', crop_margin_bottom: '0.85in'
end

45
samples/saves/_saves.rb

@ -0,0 +1,45 @@
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

25
samples/saves/_showcase.rb

@ -0,0 +1,25 @@
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

BIN
samples/saves/hand_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

BIN
samples/saves/hand_pretty_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
samples/saves/save-pdf-small_expected.pdf

Binary file not shown.

BIN
samples/saves/save-pdf_expected.pdf

Binary file not shown.

BIN
samples/saves/save_png_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
samples/saves/save_png_trimmed_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
samples/saves/save_sheet_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
samples/saves/save_sheet_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
samples/saves/save_sheet_range_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
samples/saves/save_sheet_range_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
samples/saves/save_single_sheet_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

BIN
samples/saves/saves_notrim_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
samples/saves/showcase2_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

BIN
samples/saves/showcase_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 KiB

BIN
samples/saves/showcase_individual_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
samples/saves/showcase_individual_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
samples/saves/showcase_individual_02_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
samples/saves/showcase_individual_03_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

91
samples/saves/spanner.svg

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 128 128"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
width="100%"
height="100%"
sodipodi:docname="spanner.svg">
<metadata
id="metadata18">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs16" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="1002"
id="namedview14"
showgrid="false"
inkscape:zoom="2.8284271"
inkscape:cx="98.928938"
inkscape:cy="62.194589"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g3767"
inkscape:document-units="in"
units="px"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g3767"
transform="matrix(0.24961486,0,0,0.24961486,0.197194,96.049335)">
<rect
ry="67.108368"
y="-378.68747"
x="5.3126979"
height="501.3746"
width="501.3746"
id="backdrop"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10.62539577;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
inkscape:label="#rect3765" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 36.267098,-7.709219 C 16.393265,5.1318032 3.2161811,27.462365 3.2161811,52.884128 c 0,39.825874 32.2852369,72.111092 72.1110909,72.111092 23.870397,0 44.964938,-11.67699 58.089488,-29.545518 -11.26063,7.275808 -24.65607,11.517748 -39.060173,11.517748 -39.825853,0 -72.11109,-32.285221 -72.11109,-72.111095 0,-15.95546 5.248882,-30.6218942 14.021601,-42.565574 z"
id="path3790"
inkscape:connector-curvature="0" />
<g
id="g6"
transform="matrix(18.68858,0,0,18.68858,-3385.6437,-2608.3849)">
<path
style="fill:#ffffff"
inkscape:connector-curvature="0"
id="path8"
d="m 192.2325,129.3203 -10,10 v 5.5625 h 5.375 l 10.0938,-10.0938 -5.4688,-5.4688 z" />
<path
style="fill:#ffffff;stroke:#000000"
inkscape:connector-curvature="0"
id="path10"
d="m 181.7796,141.8591 15.6196,-15.6178 m 3.349,3.3486 -15.8051,15.8032" />
<path
style="fill:#ffffff"
inkscape:connector-curvature="0"
id="path12"
d="m 201.2023,119.7104 c -2.8283,-0.73 -5.9623,-0.004 -8.1759,2.2097 -3.3293,3.3292 -3.3293,8.7358 -2e-5,12.065 3.32928,3.3292 8.7358,3.3292 12.065,0 2.216,-2.216 2.9436,-5.3452 2.2097,-8.1759 l -5.6348,5.6348 -4.8172,-1.2816 -1.2816,-4.8171 5.6348,-5.6348 z" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

Loading…
Cancel
Save