Browse Source

samples: un-submoduling

dev
Andy Meneely 9 years ago
parent
commit
f52446d71b
  1. 1
      samples/autoscale_font
  2. 2
      samples/autoscale_font/.gitignore
  3. 29
      samples/autoscale_font/_autoscale_font.rb
  4. BIN
      samples/autoscale_font/card_00_expected.png
  5. 1
      samples/backend
  6. 1
      samples/backend/.gitignore
  7. 5
      samples/backend/_backend-config.yml
  8. 33
      samples/backend/_backend.rb
  9. BIN
      samples/backend/backend_00_expected.png
  10. BIN
      samples/backend/backend_01_expected.png
  11. BIN
      samples/backend/backend_vectorized_expected.pdf
  12. 84
      samples/backend/backend_vectors_00_expected.svg
  13. 84
      samples/backend/backend_vectors_01_expected.svg
  14. BIN
      samples/backend/shiny-purse.png
  15. 91
      samples/backend/spanner.svg
  16. 1
      samples/colors
  17. 1
      samples/colors/.gitignore
  18. 37
      samples/colors/_colors.rb
  19. 34
      samples/colors/_gradients.rb
  20. BIN
      samples/colors/color_constants_00_expected.png
  21. BIN
      samples/colors/colors_00_expected.png
  22. BIN
      samples/colors/gradient_00_expected.png
  23. 1
      samples/data
  24. 1
      samples/data/.gitignore
  25. 33
      samples/data/_csv.rb
  26. 55
      samples/data/_excel.rb
  27. BIN
      samples/data/explode_quantities.xlsx
  28. 3
      samples/data/quantity_explosion.csv
  29. 3
      samples/data/sample.csv
  30. BIN
      samples/data/sample.xlsx
  31. BIN
      samples/data/sample_csv_00_expected.png
  32. BIN
      samples/data/sample_csv_01_expected.png
  33. BIN
      samples/data/sample_csv_qty_00_expected.png
  34. BIN
      samples/data/sample_excel_00_expected.png
  35. BIN
      samples/data/sample_excel_01_expected.png
  36. BIN
      samples/data/sample_excel_02_expected.png
  37. BIN
      samples/data/sample_excel_resources_00_expected.png
  38. BIN
      samples/data/sample_excel_resources_01_expected.png
  39. BIN
      samples/data/sample_xlsx_qty_00_expected.png
  40. 1
      samples/images
  41. 7
      samples/images/.gitignore
  42. 104
      samples/images/_images.rb
  43. BIN
      samples/images/_images_00_expected.png
  44. 99
      samples/images/_more_load_images.rb
  45. BIN
      samples/images/ball.png
  46. 52
      samples/images/glass-heart.svg
  47. BIN
      samples/images/grit.png
  48. 85
      samples/images/offset.svg
  49. 1
      samples/images/robot-golem.svg
  50. BIN
      samples/images/shiny-purse.png
  51. 91
      samples/images/spanner.svg
  52. BIN
      samples/images/sprites.png
  53. BIN
      samples/images/with-alpha.png
  54. 1
      samples/intro
  55. 2
      samples/intro/.gitignore
  56. 9
      samples/intro/01_hello.rb
  57. 15
      samples/intro/02_options.rb
  58. 12
      samples/intro/03_layout.rb
  59. 16
      samples/intro/04_arrays.rb
  60. 15
      samples/intro/05_excel.rb
  61. 1
      samples/intro/auto-repair.svg
  62. 1
      samples/intro/crawling.svg
  63. BIN
      samples/intro/data.xlsx
  64. 1
      samples/intro/humans.svg
  65. 1
      samples/intro/ninja-mask.svg
  66. BIN
      samples/intro/part1_00_expected.png
  67. BIN
      samples/intro/part2_00_expected.png
  68. BIN
      samples/intro/part3_00_expected.png
  69. 34
      samples/intro/part3_layout.yml
  70. BIN
      samples/intro/part4_00_expected.png
  71. BIN
      samples/intro/part4_01_expected.png
  72. BIN
      samples/intro/part5_00_expected.png
  73. BIN
      samples/intro/part5_01_expected.png
  74. BIN
      samples/intro/part5_02_expected.png
  75. BIN
      samples/intro/part5_03_expected.png
  76. BIN
      samples/intro/part5_hand_expected.png
  77. BIN
      samples/intro/part5_showcase_expected.png
  78. 1
      samples/intro/pirate-skull.svg
  79. 1
      samples/intro/robot-golem.svg
  80. 1
      samples/shapes
  81. 1
      samples/shapes/.gitignore
  82. 54
      samples/shapes/_draw_shapes.rb
  83. BIN
      samples/shapes/shape_00_expected.png
  84. 1
      samples/text
  85. 2
      samples/text/.gitignore
  86. 1
      samples/text/README.md
  87. 47
      samples/text/_text.rb
  88. BIN
      samples/text/_text_00_expected.png
  89. 2
      samples/text/config.yml

1
samples/autoscale_font

@ -1 +0,0 @@
Subproject commit 1f197bf1d46e0f8f1af30fdd9d3d058f4fe584a1

2
samples/autoscale_font/.gitignore vendored

@ -0,0 +1,2 @@
*.png
!card_00_expected.png

29
samples/autoscale_font/_autoscale_font.rb

@ -0,0 +1,29 @@
require 'squib'
# Here's an example of being able to scale a font
# based on the length of individual string.
# Handy for making minor font scales to fill text boxes.
def autoscale(str_array)
str_array.map do | str |
case str.length
when 0..15
32
when 16..20
18
else
12
end
end
end
Squib::Deck.new(width: 300, height: 100, cards: 3) do
background color: :white
rect
title = ['Short & Big',
'Medium Length & Size',
'Super duper long string here, therefore a smaller font.']
text str: title, font: 'Arial', font_size: autoscale(title),
x: 10, y:10, align: :center, width: 280, ellipsize: false, hint: :red
save_sheet dir: '.', columns: 3
end

BIN
samples/autoscale_font/card_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

1
samples/backend

@ -1 +0,0 @@
Subproject commit f1f939a86662dc8a6dd6c86da752b0bb1a9a59e9

1
samples/backend/.gitignore vendored

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

5
samples/backend/_backend-config.yml

@ -0,0 +1,5 @@
# To configure for using SVG as our backend, we need to set this option
# This will create a series of SVG files that get updated with Squib command
backend: svg
# They are auto-saved with this background
prefix: backend_vectors_

33
samples/backend/_backend.rb

@ -0,0 +1,33 @@
require 'squib'
# Our SVGs are auto-saved after each step using the configuration parameters
Squib::Deck.new(cards: 2, config: '_backend-config.yml') do
# These are all supported by the SVG backend
background color: :gray
text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 72', align: :center
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
circle x: 100, y: 400, radius: 25
triangle x1: 100, y1: 425, x2: 125, y2: 475, x3: 75, y3: 475
line x1: 100, y1: 620, x2: 720, y2: 620, stroke_width: 15.0
svg file: 'spanner.svg', x: 100, y: 75
png file: 'shiny-purse.png', x: 250, y: 75 # raster can still be used too
png file: 'shiny-purse.png', x: 250, y: 250, mask: :red # still renders as raster
# We can still rasterize whenever we want
save_png prefix: 'backend_'
# And our PDFs will be vectorized .
save_pdf file: 'backend_vectorized.pdf', gap: 5
# 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
# 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

BIN
samples/backend/backend_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
samples/backend/backend_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
samples/backend/backend_vectorized_expected.pdf

Binary file not shown.

84
samples/backend/backend_vectors_00_expected.svg

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="825pt" height="1125pt" viewBox="0 0 825 1125" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-0">
<path style="stroke:none;" d="M 12 0 L 12 -72 L 84 -72 L 84 0 Z M 18 -6 L 78 -6 L 78 -66 L 18 -66 Z M 18 -6 "/>
</symbol>
<symbol overflow="visible" id="glyph0-1">
<path style="stroke:none;" d="M 66 0 L 48 0 L 48 -31 L 25 -31 L 25 0 L 7 0 L 7 -70 L 25 -70 L 25 -44 L 48 -44 L 48 -70 L 66 -70 Z M 66 0 "/>
</symbol>
<symbol overflow="visible" id="glyph0-2">
<path style="stroke:none;" d="M 33.109375 1 C 23.066406 0.996094 15.371094 -1.390625 10.023438 -6.164063 C 4.671875 -10.9375 1.996094 -17.742188 2 -26.578125 C 1.996094 -35.210938 4.496094 -42.105469 9.492188 -47.265625 C 14.484375 -52.417969 21.464844 -54.996094 30.4375 -55 C 38.589844 -54.996094 44.722656 -52.828125 48.835938 -48.5 C 52.941406 -44.164063 54.996094 -37.960938 55 -29.890625 L 55 -24 L 18 -24 C 18.15625 -21.507813 18.683594 -19.425781 19.585938 -17.757813 C 20.484375 -16.082031 21.675781 -14.75 23.15625 -13.765625 C 24.601563 -12.78125 26.289063 -12.078125 28.21875 -11.648438 C 30.144531 -11.214844 32.246094 -10.996094 34.53125 -11 C 36.484375 -10.996094 38.414063 -11.207031 40.3125 -11.625 C 42.207031 -12.039063 43.941406 -12.589844 45.515625 -13.28125 C 46.898438 -13.863281 48.175781 -14.496094 49.351563 -15.179688 C 50.519531 -15.859375 51.476563 -16.464844 52.21875 -17 L 54 -17 L 54 -3.375 C 52.644531 -2.84375 51.402344 -2.351563 50.28125 -1.898438 C 49.152344 -1.445313 47.617188 -0.984375 45.671875 -0.515625 C 43.867188 -0.0390625 42.011719 0.332031 40.101563 0.601563 C 38.1875 0.863281 35.855469 0.996094 33.109375 1 Z M 39 -34 C 38.894531 -37.582031 38.039063 -40.3125 36.4375 -42.1875 C 34.832031 -44.0625 32.367188 -45 29.046875 -45 C 25.65625 -45 23.011719 -44.015625 21.109375 -42.046875 C 19.199219 -40.078125 18.148438 -37.394531 17.953125 -34 Z M 39 -34 "/>
</symbol>
<symbol overflow="visible" id="glyph0-3">
<path style="stroke:none;" d="M 22 0 L 6 0 L 6 -73 L 22 -73 Z M 22 0 "/>
</symbol>
<symbol overflow="visible" id="glyph0-4">
<path style="stroke:none;" d="M 57 -26.46875 C 57 -17.640625 54.605469 -10.691406 49.820313 -5.617188 C 45.03125 -0.539063 38.257813 1.996094 29.5 2 C 20.808594 1.996094 14.054688 -0.539063 9.234375 -5.617188 C 4.410156 -10.691406 1.996094 -17.640625 2 -26.46875 C 1.996094 -35.390625 4.410156 -42.378906 9.234375 -47.429688 C 14.054688 -52.472656 20.808594 -54.996094 29.5 -55 C 38.226563 -54.996094 44.992188 -52.457031 49.796875 -47.382813 C 54.597656 -42.300781 57 -35.328125 57 -26.46875 Z M 40 -26.375 C 39.996094 -29.558594 39.734375 -32.214844 39.21875 -34.335938 C 38.695313 -36.453125 37.972656 -38.148438 37.046875 -39.421875 C 36.066406 -40.753906 34.960938 -41.683594 33.726563 -42.210938 C 32.492188 -42.734375 31.082031 -42.996094 29.5 -43 C 28.007813 -42.996094 26.660156 -42.765625 25.460938 -42.304688 C 24.253906 -41.839844 23.148438 -40.957031 22.140625 -39.65625 C 21.179688 -38.414063 20.417969 -36.710938 19.851563 -34.546875 C 19.28125 -32.378906 18.996094 -29.652344 19 -26.375 C 18.996094 -23.101563 19.265625 -20.453125 19.804688 -18.429688 C 20.339844 -16.398438 21.035156 -14.78125 21.890625 -13.578125 C 22.785156 -12.335938 23.894531 -11.429688 25.226563 -10.859375 C 26.550781 -10.28125 28.023438 -9.996094 29.640625 -10 C 30.972656 -9.996094 32.328125 -10.28125 33.703125 -10.859375 C 35.078125 -11.429688 36.175781 -12.289063 37 -13.4375 C 37.988281 -14.796875 38.734375 -16.445313 39.242188 -18.375 C 39.742188 -20.300781 39.996094 -22.964844 40 -26.375 Z M 40 -26.375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-5">
<path style="stroke:none;" d="M 26 -18 L 9.84375 18 L 0 18 L 9.09375 -18 Z M 26 -18 "/>
</symbol>
<symbol overflow="visible" id="glyph0-6">
<path style="stroke:none;" d=""/>
</symbol>
<symbol overflow="visible" id="glyph0-7">
<path style="stroke:none;" d="M 84 -53 L 68.8125 0 L 51.578125 0 L 42.453125 -34.265625 L 33.28125 0 L 16.046875 0 L 1 -53 L 17.625 -53 L 26.015625 -17.9375 L 35.875 -53 L 50.1875 -53 L 59.5 -17.9375 L 67.359375 -53 Z M 84 -53 "/>
</symbol>
<symbol overflow="visible" id="glyph0-8">
<path style="stroke:none;" d="M 42 -38 L 40.5625 -38 C 39.902344 -38.328125 38.945313 -38.578125 37.695313 -38.75 C 36.4375 -38.914063 35.050781 -39 33.53125 -39 C 31.714844 -39 29.8125 -38.742188 27.820313 -38.226563 C 25.824219 -37.710938 23.882813 -37.097656 22 -36.390625 L 22 0 L 6 0 L 6 -53 L 22 -53 L 22 -45.234375 C 22.789063 -45.921875 23.886719 -46.789063 25.289063 -47.84375 C 26.6875 -48.890625 27.964844 -49.730469 29.125 -50.359375 C 30.382813 -51.085938 31.847656 -51.707031 33.515625 -52.226563 C 35.179688 -52.738281 36.75 -52.996094 38.234375 -53 C 38.792969 -52.996094 39.421875 -52.980469 40.117188 -52.953125 C 40.808594 -52.917969 41.4375 -52.878906 42 -52.828125 Z M 42 -38 "/>
</symbol>
<symbol overflow="visible" id="glyph0-9">
<path style="stroke:none;" d="M 54 0 L 38 0 L 38 -5.484375 C 36.914063 -4.609375 35.679688 -3.671875 34.289063 -2.671875 C 32.898438 -1.671875 31.675781 -0.921875 30.625 -0.421875 C 29.277344 0.328125 27.949219 0.917969 26.640625 1.351563 C 25.324219 1.78125 23.757813 1.996094 21.9375 2 C 15.800781 1.996094 10.941406 -0.550781 7.367188 -5.648438 C 3.785156 -10.746094 1.996094 -17.558594 2 -26.09375 C 1.996094 -30.796875 2.605469 -34.882813 3.820313 -38.351563 C 5.03125 -41.8125 6.710938 -44.832031 8.859375 -47.40625 C 10.804688 -49.738281 13.167969 -51.585938 15.953125 -52.953125 C 18.730469 -54.3125 21.667969 -54.996094 24.765625 -55 C 27.574219 -54.996094 29.882813 -54.707031 31.695313 -54.132813 C 33.5 -53.550781 35.601563 -52.652344 38 -51.4375 L 38 -73 L 54 -73 Z M 38 -14.3125 L 38 -41.515625 C 37.164063 -41.9375 36.070313 -42.292969 34.71875 -42.578125 C 33.359375 -42.855469 32.199219 -42.996094 31.234375 -43 C 27.167969 -42.996094 24.113281 -41.546875 22.070313 -38.65625 C 20.019531 -35.757813 18.996094 -31.707031 19 -26.5 C 18.996094 -21.039063 19.8125 -17.089844 21.445313 -14.65625 C 23.074219 -12.214844 25.707031 -10.996094 29.34375 -11 C 30.820313 -10.996094 32.316406 -11.292969 33.835938 -11.890625 C 35.347656 -12.480469 36.734375 -13.289063 38 -14.3125 Z M 38 -14.3125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-10">
<path style="stroke:none;" d="M 25 -70 L 23.140625 -20 L 8.859375 -20 L 7 -70 Z M 25 0 L 7 0 L 7 -12 L 25 -12 Z M 25 0 "/>
</symbol>
</g>
<clipPath id="clip1">
<path d="M 100 82 L 218 82 L 218 203 L 100 203 Z M 100 82 "/>
</clipPath>
<image id="image8" width="128" height="128" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAQAAABpN6lAAAAAAmJLR0QAxtiKRLcAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfeCAwPOiprCHMUAAAM90lEQVR42uVda3RVxRX+EiLhFRACYrQEjBheN0VABQlgKiDlbVCqxQd0UaiiRRHBroWg1UVVFGm6LGhXrNJSwSoiWhQDKBKCouIDEiERoiGoaJSXEkFDvv7gcnPOvWfmzMyZG2O7Z2Wtm3P27Nl7n3ns2bNnJoHwhzIUYlto56N7s6tQjRNoyJCCdkgv6nZDn+KByFTAT6CP6MuwisX4aUIIuQnX+qmBwlSE8bMlr38yafzsIslrweNKTMz9XxD+VJqYW6mjgHykGBTSrEGrIIX5qgq4MWRWxNwGrgLwxpCCAkY8YUp+OHc1+KYw4gkfBeRsNifemmSeQb4N9aqCnM0SBZh//ZPpOMlfauaZTPKuH7EWWGj7dWkjSbKtRo4kUjuP3b7A0fMHJ3w/SbJCI8fysAIKlbDTrakgP1oBlUYDX3S6PCzOckX83qyDMb7YV3GKxUGx0q0AO2bPmRFxrlfC3+dQwFEf3FSSo62aRg4FFMEW2TrI8MWdRTf8RYpdRvISqz1BUZ0C7Nn8b0TEOeCD2ZKxcI4QexFJ8nzLc4SwAkphj+gihzjrpZhrPRSwQ4A7wFdBZqkURCKwzOIE9E3H78G4XYg3GMM8p6+TPJ4m49XwryOWp8vLTk6HQxZ12jHqm/YS4B2kN9SykaRZJVmuASESVhuAuxskyWNM9sC5j2JYFoU72/HOvklUCisGkDO9GyXQuzEYaZSDs6vr5npjXwH5SNwWstuu3oj6vxcejHqy2ofCC47fWxy/j8fBabYt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KTJNst8ALF+xMTdKlL6eWC18FNBRcBDPl5bFj1yxYe+SlSdcguQahc8v8sxxt5Xdiu5U5JwL2blmZ5NyPE+FQPxvpcd5pFkU33XNjq2LlupW5f0uXespUMBI6dkAQ6yJH3PRkp2rtk7BKgXcfxrsD8q0poB8L3dA0MvWmkecmSrYjXgiRgGpcTB1vA1ggT8k2HV7Jw9LKlfGn6S8vGY3Ca/bI4JduDiW5AE21sjhnNN/UU/iSy9cDFYLbmONZiU+x6GAfj/C1xe4BE37gsd4nnaeU2dVraz3ti/1iZpdu3u6EVNHSZJN4i68xrW7J+2C+rp4eTTJaXEvRfPiZYYN5Pq5evvRONOXX739f3/5eoLKylgZCrEttPPRvdlVqMaJBi10CtohvajbDX2KB/rdOw8A+C/P9iz7dYa7BgAAAABJRU5ErkJggg=="/>
<filter id="alpha" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
<feColorMatrix type="matrix" in="SourceGraphic" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="mask0">
<g filter="url(#alpha)">
<use xlink:href="#image8" transform="matrix(1,0,0,1,250,250)"/>
</g>
</mask>
</defs>
<g id="surface1">
<rect x="0" y="0" width="825" height="1125" style="fill:rgb(50.196078%,50.196078%,50.196078%);fill-opacity:1;stroke:none;"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="106" y="596"/>
<use xlink:href="#glyph0-2" x="179" y="596"/>
<use xlink:href="#glyph0-3" x="236" y="596"/>
<use xlink:href="#glyph0-3" x="265" y="596"/>
<use xlink:href="#glyph0-4" x="294" y="596"/>
<use xlink:href="#glyph0-5" x="353" y="596"/>
<use xlink:href="#glyph0-6" x="383" y="596"/>
<use xlink:href="#glyph0-7" x="411" y="596"/>
<use xlink:href="#glyph0-4" x="496" y="596"/>
<use xlink:href="#glyph0-8" x="555" y="596"/>
<use xlink:href="#glyph0-3" x="597" y="596"/>
<use xlink:href="#glyph0-9" x="626" y="596"/>
<use xlink:href="#glyph0-10" x="686" y="596"/>
</g>
<path style="fill:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 76 38 L 750 38 C 769 38 788 57 788 76 L 788 1050 C 788 1069 769 1088 750 1088 L 76 1088 C 57 1088 38 1069 38 1050 L 38 76 C 38 57 57 38 76 38 Z M 76 38 "/>
<path style="fill:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 125 400 C 125 413.808594 113.808594 425 100 425 C 86.191406 425 75 413.808594 75 400 C 75 386.191406 86.191406 375 100 375 C 113.808594 375 125 386.191406 125 400 "/>
<path style="fill:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 100 425 L 125 475 L 75 475 Z M 100 425 "/>
<path style="fill:none;stroke-width:15;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 100 620 L 720 620 "/>
<path style="fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;stroke-width:10.625396;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 72.416536 -378.68698 L 439.575917 -378.68698 C 476.648655 -378.68698 506.694943 -348.640692 506.694943 -311.583603 L 506.694943 55.575778 C 506.694943 92.648516 476.648655 122.694804 439.575917 122.694804 L 72.416536 122.694804 C 35.359447 122.694804 5.313159 92.648516 5.313159 55.575778 L 5.313159 -311.583603 C 5.313159 -348.640692 35.359447 -378.68698 72.416536 -378.68698 Z M 72.416536 -378.68698 " transform="matrix(0.249615,0,0,0.249615,100.197194,171.049335)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 109.25 169.125 C 104.289063 172.332031 101 177.90625 101 184.25 C 101 194.191406 109.058594 202.25 119 202.25 C 124.957031 202.25 130.222656 199.335938 133.5 194.875 C 130.6875 196.691406 127.34375 197.75 123.75 197.75 C 113.808594 197.75 105.75 189.691406 105.75 179.75 C 105.75 175.765625 107.058594 172.105469 109.25 169.125 Z M 109.25 169.125 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 151.84375 123.230469 L 105.195313 169.878906 L 105.195313 195.828125 L 130.269531 195.828125 L 177.355469 148.742188 Z M 151.84375 123.230469 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 103.082031 181.722656 L 175.945313 108.867188 M 191.570313 124.488281 L 117.839844 198.207031 "/>
<g clip-path="url(#clip1)" clip-rule="nonzero">
<path style="fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 181.779507 141.859042 L 197.398822 126.241402 M 200.74827 129.590013 L 184.943061 145.39271 " transform="matrix(4.664947,0,0,4.664947,-744.909784,-480.042297)"/>
</g>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 193.6875 78.402344 C 180.496094 74.996094 165.875 78.382813 155.546875 88.707031 C 140.015625 104.238281 140.015625 129.460938 155.546875 144.992188 C 171.078125 160.523438 196.300781 160.523438 211.832031 144.992188 C 222.167969 134.652344 225.5625 120.054688 222.140625 106.851563 L 195.851563 133.136719 L 173.378906 127.160156 L 167.402344 104.6875 Z M 193.6875 78.402344 "/>
<use xlink:href="#image8" transform="matrix(1,0,0,1,250,75)"/>
<rect x="0" y="0" width="825" height="1125" style="fill:rgb(100%,0%,0%);fill-opacity:1;stroke:none;" mask="url(#mask0)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

84
samples/backend/backend_vectors_01_expected.svg

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="825pt" height="1125pt" viewBox="0 0 825 1125" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-0">
<path style="stroke:none;" d="M 12 0 L 12 -72 L 84 -72 L 84 0 Z M 18 -6 L 78 -6 L 78 -66 L 18 -66 Z M 18 -6 "/>
</symbol>
<symbol overflow="visible" id="glyph0-1">
<path style="stroke:none;" d="M 66 0 L 48 0 L 48 -31 L 25 -31 L 25 0 L 7 0 L 7 -70 L 25 -70 L 25 -44 L 48 -44 L 48 -70 L 66 -70 Z M 66 0 "/>
</symbol>
<symbol overflow="visible" id="glyph0-2">
<path style="stroke:none;" d="M 33.109375 1 C 23.066406 0.996094 15.371094 -1.390625 10.023438 -6.164063 C 4.671875 -10.9375 1.996094 -17.742188 2 -26.578125 C 1.996094 -35.210938 4.496094 -42.105469 9.492188 -47.265625 C 14.484375 -52.417969 21.464844 -54.996094 30.4375 -55 C 38.589844 -54.996094 44.722656 -52.828125 48.835938 -48.5 C 52.941406 -44.164063 54.996094 -37.960938 55 -29.890625 L 55 -24 L 18 -24 C 18.15625 -21.507813 18.683594 -19.425781 19.585938 -17.757813 C 20.484375 -16.082031 21.675781 -14.75 23.15625 -13.765625 C 24.601563 -12.78125 26.289063 -12.078125 28.21875 -11.648438 C 30.144531 -11.214844 32.246094 -10.996094 34.53125 -11 C 36.484375 -10.996094 38.414063 -11.207031 40.3125 -11.625 C 42.207031 -12.039063 43.941406 -12.589844 45.515625 -13.28125 C 46.898438 -13.863281 48.175781 -14.496094 49.351563 -15.179688 C 50.519531 -15.859375 51.476563 -16.464844 52.21875 -17 L 54 -17 L 54 -3.375 C 52.644531 -2.84375 51.402344 -2.351563 50.28125 -1.898438 C 49.152344 -1.445313 47.617188 -0.984375 45.671875 -0.515625 C 43.867188 -0.0390625 42.011719 0.332031 40.101563 0.601563 C 38.1875 0.863281 35.855469 0.996094 33.109375 1 Z M 39 -34 C 38.894531 -37.582031 38.039063 -40.3125 36.4375 -42.1875 C 34.832031 -44.0625 32.367188 -45 29.046875 -45 C 25.65625 -45 23.011719 -44.015625 21.109375 -42.046875 C 19.199219 -40.078125 18.148438 -37.394531 17.953125 -34 Z M 39 -34 "/>
</symbol>
<symbol overflow="visible" id="glyph0-3">
<path style="stroke:none;" d="M 22 0 L 6 0 L 6 -73 L 22 -73 Z M 22 0 "/>
</symbol>
<symbol overflow="visible" id="glyph0-4">
<path style="stroke:none;" d="M 57 -26.46875 C 57 -17.640625 54.605469 -10.691406 49.820313 -5.617188 C 45.03125 -0.539063 38.257813 1.996094 29.5 2 C 20.808594 1.996094 14.054688 -0.539063 9.234375 -5.617188 C 4.410156 -10.691406 1.996094 -17.640625 2 -26.46875 C 1.996094 -35.390625 4.410156 -42.378906 9.234375 -47.429688 C 14.054688 -52.472656 20.808594 -54.996094 29.5 -55 C 38.226563 -54.996094 44.992188 -52.457031 49.796875 -47.382813 C 54.597656 -42.300781 57 -35.328125 57 -26.46875 Z M 40 -26.375 C 39.996094 -29.558594 39.734375 -32.214844 39.21875 -34.335938 C 38.695313 -36.453125 37.972656 -38.148438 37.046875 -39.421875 C 36.066406 -40.753906 34.960938 -41.683594 33.726563 -42.210938 C 32.492188 -42.734375 31.082031 -42.996094 29.5 -43 C 28.007813 -42.996094 26.660156 -42.765625 25.460938 -42.304688 C 24.253906 -41.839844 23.148438 -40.957031 22.140625 -39.65625 C 21.179688 -38.414063 20.417969 -36.710938 19.851563 -34.546875 C 19.28125 -32.378906 18.996094 -29.652344 19 -26.375 C 18.996094 -23.101563 19.265625 -20.453125 19.804688 -18.429688 C 20.339844 -16.398438 21.035156 -14.78125 21.890625 -13.578125 C 22.785156 -12.335938 23.894531 -11.429688 25.226563 -10.859375 C 26.550781 -10.28125 28.023438 -9.996094 29.640625 -10 C 30.972656 -9.996094 32.328125 -10.28125 33.703125 -10.859375 C 35.078125 -11.429688 36.175781 -12.289063 37 -13.4375 C 37.988281 -14.796875 38.734375 -16.445313 39.242188 -18.375 C 39.742188 -20.300781 39.996094 -22.964844 40 -26.375 Z M 40 -26.375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-5">
<path style="stroke:none;" d="M 26 -18 L 9.84375 18 L 0 18 L 9.09375 -18 Z M 26 -18 "/>
</symbol>
<symbol overflow="visible" id="glyph0-6">
<path style="stroke:none;" d=""/>
</symbol>
<symbol overflow="visible" id="glyph0-7">
<path style="stroke:none;" d="M 84 -53 L 68.8125 0 L 51.578125 0 L 42.453125 -34.265625 L 33.28125 0 L 16.046875 0 L 1 -53 L 17.625 -53 L 26.015625 -17.9375 L 35.875 -53 L 50.1875 -53 L 59.5 -17.9375 L 67.359375 -53 Z M 84 -53 "/>
</symbol>
<symbol overflow="visible" id="glyph0-8">
<path style="stroke:none;" d="M 42 -38 L 40.5625 -38 C 39.902344 -38.328125 38.945313 -38.578125 37.695313 -38.75 C 36.4375 -38.914063 35.050781 -39 33.53125 -39 C 31.714844 -39 29.8125 -38.742188 27.820313 -38.226563 C 25.824219 -37.710938 23.882813 -37.097656 22 -36.390625 L 22 0 L 6 0 L 6 -53 L 22 -53 L 22 -45.234375 C 22.789063 -45.921875 23.886719 -46.789063 25.289063 -47.84375 C 26.6875 -48.890625 27.964844 -49.730469 29.125 -50.359375 C 30.382813 -51.085938 31.847656 -51.707031 33.515625 -52.226563 C 35.179688 -52.738281 36.75 -52.996094 38.234375 -53 C 38.792969 -52.996094 39.421875 -52.980469 40.117188 -52.953125 C 40.808594 -52.917969 41.4375 -52.878906 42 -52.828125 Z M 42 -38 "/>
</symbol>
<symbol overflow="visible" id="glyph0-9">
<path style="stroke:none;" d="M 54 0 L 38 0 L 38 -5.484375 C 36.914063 -4.609375 35.679688 -3.671875 34.289063 -2.671875 C 32.898438 -1.671875 31.675781 -0.921875 30.625 -0.421875 C 29.277344 0.328125 27.949219 0.917969 26.640625 1.351563 C 25.324219 1.78125 23.757813 1.996094 21.9375 2 C 15.800781 1.996094 10.941406 -0.550781 7.367188 -5.648438 C 3.785156 -10.746094 1.996094 -17.558594 2 -26.09375 C 1.996094 -30.796875 2.605469 -34.882813 3.820313 -38.351563 C 5.03125 -41.8125 6.710938 -44.832031 8.859375 -47.40625 C 10.804688 -49.738281 13.167969 -51.585938 15.953125 -52.953125 C 18.730469 -54.3125 21.667969 -54.996094 24.765625 -55 C 27.574219 -54.996094 29.882813 -54.707031 31.695313 -54.132813 C 33.5 -53.550781 35.601563 -52.652344 38 -51.4375 L 38 -73 L 54 -73 Z M 38 -14.3125 L 38 -41.515625 C 37.164063 -41.9375 36.070313 -42.292969 34.71875 -42.578125 C 33.359375 -42.855469 32.199219 -42.996094 31.234375 -43 C 27.167969 -42.996094 24.113281 -41.546875 22.070313 -38.65625 C 20.019531 -35.757813 18.996094 -31.707031 19 -26.5 C 18.996094 -21.039063 19.8125 -17.089844 21.445313 -14.65625 C 23.074219 -12.214844 25.707031 -10.996094 29.34375 -11 C 30.820313 -10.996094 32.316406 -11.292969 33.835938 -11.890625 C 35.347656 -12.480469 36.734375 -13.289063 38 -14.3125 Z M 38 -14.3125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-10">
<path style="stroke:none;" d="M 25 -70 L 23.140625 -20 L 8.859375 -20 L 7 -70 Z M 25 0 L 7 0 L 7 -12 L 25 -12 Z M 25 0 "/>
</symbol>
</g>
<clipPath id="clip1">
<path d="M 100 82 L 218 82 L 218 203 L 100 203 Z M 100 82 "/>
</clipPath>
<image id="image8" width="128" height="128" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAQAAABpN6lAAAAAAmJLR0QAxtiKRLcAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfeCAwPOiprCHMUAAAM90lEQVR42uVda3RVxRX+EiLhFRACYrQEjBheN0VABQlgKiDlbVCqxQd0UaiiRRHBroWg1UVVFGm6LGhXrNJSwSoiWhQDKBKCouIDEiER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Ow8A+C/P9iz7dYa7BgAAAABJRU5ErkJggg=="/>
<filter id="alpha" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
<feColorMatrix type="matrix" in="SourceGraphic" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="mask0">
<g filter="url(#alpha)">
<use xlink:href="#image8" transform="matrix(1,0,0,1,250,250)"/>
</g>
</mask>
</defs>
<g id="surface4">
<rect x="0" y="0" width="825" height="1125" style="fill:rgb(50.196078%,50.196078%,50.196078%);fill-opacity:1;stroke:none;"/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="106" y="596"/>
<use xlink:href="#glyph0-2" x="179" y="596"/>
<use xlink:href="#glyph0-3" x="236" y="596"/>
<use xlink:href="#glyph0-3" x="265" y="596"/>
<use xlink:href="#glyph0-4" x="294" y="596"/>
<use xlink:href="#glyph0-5" x="353" y="596"/>
<use xlink:href="#glyph0-6" x="383" y="596"/>
<use xlink:href="#glyph0-7" x="411" y="596"/>
<use xlink:href="#glyph0-4" x="496" y="596"/>
<use xlink:href="#glyph0-8" x="555" y="596"/>
<use xlink:href="#glyph0-3" x="597" y="596"/>
<use xlink:href="#glyph0-9" x="626" y="596"/>
<use xlink:href="#glyph0-10" x="686" y="596"/>
</g>
<path style="fill:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 76 38 L 750 38 C 769 38 788 57 788 76 L 788 1050 C 788 1069 769 1088 750 1088 L 76 1088 C 57 1088 38 1069 38 1050 L 38 76 C 38 57 57 38 76 38 Z M 76 38 "/>
<path style="fill:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 125 400 C 125 413.808594 113.808594 425 100 425 C 86.191406 425 75 413.808594 75 400 C 75 386.191406 86.191406 375 100 375 C 113.808594 375 125 386.191406 125 400 "/>
<path style="fill:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 100 425 L 125 475 L 75 475 Z M 100 425 "/>
<path style="fill:none;stroke-width:15;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 100 620 L 720 620 "/>
<path style="fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;stroke-width:10.625396;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 72.416536 -378.68698 L 439.575917 -378.68698 C 476.648655 -378.68698 506.694943 -348.640692 506.694943 -311.583603 L 506.694943 55.575778 C 506.694943 92.648516 476.648655 122.694804 439.575917 122.694804 L 72.416536 122.694804 C 35.359447 122.694804 5.313159 92.648516 5.313159 55.575778 L 5.313159 -311.583603 C 5.313159 -348.640692 35.359447 -378.68698 72.416536 -378.68698 Z M 72.416536 -378.68698 " transform="matrix(0.249615,0,0,0.249615,100.197194,171.049335)"/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 109.25 169.125 C 104.289063 172.332031 101 177.90625 101 184.25 C 101 194.191406 109.058594 202.25 119 202.25 C 124.957031 202.25 130.222656 199.335938 133.5 194.875 C 130.6875 196.691406 127.34375 197.75 123.75 197.75 C 113.808594 197.75 105.75 189.691406 105.75 179.75 C 105.75 175.765625 107.058594 172.105469 109.25 169.125 Z M 109.25 169.125 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 151.84375 123.230469 L 105.195313 169.878906 L 105.195313 195.828125 L 130.269531 195.828125 L 177.355469 148.742188 Z M 151.84375 123.230469 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 103.082031 181.722656 L 175.945313 108.867188 M 191.570313 124.488281 L 117.839844 198.207031 "/>
<g clip-path="url(#clip1)" clip-rule="nonzero">
<path style="fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 181.779507 141.859042 L 197.398822 126.241402 M 200.74827 129.590013 L 184.943061 145.39271 " transform="matrix(4.664947,0,0,4.664947,-744.909784,-480.042297)"/>
</g>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 193.6875 78.402344 C 180.496094 74.996094 165.875 78.382813 155.546875 88.707031 C 140.015625 104.238281 140.015625 129.460938 155.546875 144.992188 C 171.078125 160.523438 196.300781 160.523438 211.832031 144.992188 C 222.167969 134.652344 225.5625 120.054688 222.140625 106.851563 L 195.851563 133.136719 L 173.378906 127.160156 L 167.402344 104.6875 Z M 193.6875 78.402344 "/>
<use xlink:href="#image8" transform="matrix(1,0,0,1,250,75)"/>
<rect x="0" y="0" width="825" height="1125" style="fill:rgb(100%,0%,0%);fill-opacity:1;stroke:none;" mask="url(#mask0)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

BIN
samples/backend/shiny-purse.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

91
samples/backend/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

1
samples/colors

@ -1 +0,0 @@
Subproject commit bdfebb34afcf710fdd9fa3127e6bbf9ad541905a

1
samples/colors/.gitignore vendored

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

37
samples/colors/_colors.rb

@ -0,0 +1,37 @@
require 'squib'
Squib::Deck.new(width: 825, height: 1125, cards: 1) do
background color: :white
y = 0
text color: '#f00', str: '3-hex', x: 50, y: y += 50
text color: '#f00', str: '3-hex (alpha)', x: 50, y: y += 50
text color: '#ff0000', str: '6-hex', x: 50, y: y += 50
text color: '#ff000099', str: '8-hex(alpha)', x: 50, y: y += 50
text color: '#ffff00000000', str: '12-hex', x: 50, y: y += 50
text color: '#ffff000000009999', str: '12-hex (alpha)', x: 50, y: y += 50
text color: :burnt_orange, str: 'Symbols of constants too', x: 50, y: y += 50
text color: '(0,0)(400,0) blue@0.0 red@1.0', str: 'Linear gradients!', x: 50, y: y += 50
text color: '(200,500,10)(200,500,100) blue@0.0 red@1.0', str: 'Radial gradients!', x: 50, y: y += 50
# see gradients.rb sample for more on gradients
save_png prefix: 'colors_'
end
# This script generates a table of the built-in constants
Squib::Deck.new(width: 3000, height: 1500) do
colors = (Cairo::Color.constants - %i(HEX_RE Base RGB CMYK HSV X11))
colors.sort_by! {|c| Cairo::Color.parse(c).to_s}
x, y, w, h = 0, 0, 300, 50
colors.each_with_index do |color, i|
rect x: x, y: y, width: w, height: h, fill_color: color
text str: color.to_s, x: x + 5, y: y + 13, font: 'Sans Bold 16',
color: (Cairo::Color.parse(color).to_hsv.v > 0.9) ? '#000' : '#fff'
y += h
if y > @height
x += w
y = 0
end
end
save_png prefix: 'color_constants_'
end

34
samples/colors/_gradients.rb

@ -0,0 +1,34 @@
require 'squib'
Squib::Deck.new do
# Just about anywhere Squib takes in a color it can also take in a gradient too
# The x-y coordinates on the card itself,
# and then color stops are defined between 0 and 1
background color: '(0,0)(0,1125) #ccc@0.0 #111@1.0'
line stroke_color: '(0,0)(825,0) #111@1.0 #ccc@0.0',
x1: 0, y1: 600, x2: 825, y2: 600,
stroke_width: 15
# Radial gradients look like this
circle fill_color: '(425,400,2)(425,400,120) #ccc@0.0 #111@1.0',
x: 415, y: 415, radius: 100, stroke_color: '#0000'
triangle fill_color: '(650,400,2)(650,400,120) #ccc@0.0 #111@1.0',
stroke_color: '#0000',
x1: 650, y1: 360,
x2: 550, y2: 500,
x3: 750, y3: 500
# Gradients are also good for beveling effects:
rect fill_color: '(0,200)(0,600) #111@0.0 #ccc@1.0',
x: 30, y: 350, width: 150, height: 150,
radius: 15, stroke_color: '#0000'
rect fill_color: '(0,200)(0,600) #111@1.0 #ccc@0.0',
x: 40, y: 360, width: 130, height: 130,
radius: 15, stroke_color: '#0000'
# Alpha transparency can be used too
text str: 'Hello, world!', x: 75, y: 700, font: 'Sans Bold 72',
color: '(0,0)(825,0) #000f@0.0 #0000@1.0'
save_png prefix: 'gradient_'
end

BIN
samples/colors/color_constants_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

BIN
samples/colors/colors_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
samples/colors/gradient_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

1
samples/data

@ -1 +0,0 @@
Subproject commit d9d087ebf415698bb81605c042b4b7e84bcdcb52

1
samples/data/.gitignore vendored

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

33
samples/data/_csv.rb

@ -0,0 +1,33 @@
require 'squib'
Squib::Deck.new(cards: 2) do
background color: :white
# Outputs a hash of arrays with the header names as keys
data = csv file: 'sample.csv'
text str: data['Type'], x: 250, y: 55, font: 'Arial 54'
text str: data['Level'], x: 65, y: 65, font: 'Arial 72'
save format: :png, prefix: 'sample_csv_'
# You can also specify the sheet, starting at 0
data = xlsx file: 'sample.xlsx', sheet: 2
end
# CSV is also a Squib-module-level function, so this also works:
data = Squib.csv file: 'quantity_explosion.csv' # 2 rows...
num_cards = data['Name'].size # ...but 4 cards!
Squib::Deck.new(cards: num_cards) do
background color: :white
rect # card border
text str: data['Name'], font: 'Arial 54'
save_sheet prefix: 'sample_csv_qty_', columns: 4
end
# Additionally, CSV supports inline data specifically
data = Squib.csv data: <<-EOCSV
Name,Cost
Knight,3
Orc,1
EOCSV

55
samples/data/_excel.rb

@ -0,0 +1,55 @@
require 'squib'
Squib::Deck.new(cards: 3) do
background color: :white
# Reads the first sheet by default (sheet 0)
# Outputs a hash of arrays with the header names as keys
data = xlsx file: 'sample.xlsx'
text str: data['Name'], x: 250, y: 55, font: 'Arial 54'
text str: data['Level'], x: 65, y: 65, font: 'Arial 72'
text str: data['Description'], x: 65, y: 600, font: 'Arial 36'
save format: :png, prefix: 'sample_excel_' # save to individual pngs
end
# xlsx is also a Squib-module-level function, so this also works:
data = Squib.xlsx file: 'explode_quantities.xlsx' # 2 rows...
num_cards = data['Name'].size # ...but 4 cards!
Squib::Deck.new(cards: num_cards) do
background color: :white
rect # card border
text str: data['Name'], font: 'Arial 54'
save_sheet prefix: 'sample_xlsx_qty_', columns: 4
end
# Here's another example, a bit more realistic. Here's what's going on:
# * We call xlsx from Squib directly - BEFORE Squib::Deck creation. This
# allows us to infer the number of cards based on the size of the "Name"
# field
# * We make use of quantity explosion. Fields named "Qty" or "Quantity"
# (any capitalization), or any other in the "qty_header" get expanded by the
# number given
# * We also make sure that trailing and leading whitespace is stripped
# from each value. This is the default behavior in Squib, but the options
# are here just to make sure.
resource_data = Squib.xlsx(file: 'sample.xlsx', sheet: 2, strip: true) do |header, value|
case header
when 'Cost'
"$#{value}k" # e.g. "3" becomes "$3k"
else
value # always return the original value if you didn't do anything to it
end
end
Squib::Deck.new(cards: resource_data['Name'].size) do
background color: :white
rect width: :deck, height: :deck
text str: resource_data['Name'], align: :center, width: :deck, hint: 'red'
text str: resource_data['Cost'], align: :right, width: :deck, hint: 'red'
save_sheet prefix: 'sample_excel_resources_' # save to a whole sheet
end

BIN
samples/data/explode_quantities.xlsx

Binary file not shown.

3
samples/data/quantity_explosion.csv

@ -0,0 +1,3 @@
Name,Qty
Basilisk,3
High Templar,1
1 Name Qty
2 Basilisk 3
3 High Templar 1

3
samples/data/sample.csv

@ -0,0 +1,3 @@
Type,"Level"
Thief,1
Mastermind,2
1 Type Level
2 Thief 1
3 Mastermind 2

BIN
samples/data/sample.xlsx

Binary file not shown.

BIN
samples/data/sample_csv_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
samples/data/sample_csv_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
samples/data/sample_csv_qty_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
samples/data/sample_excel_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
samples/data/sample_excel_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
samples/data/sample_excel_02_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
samples/data/sample_excel_resources_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
samples/data/sample_excel_resources_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
samples/data/sample_xlsx_qty_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1
samples/images

@ -1 +0,0 @@
Subproject commit 8f892ecb3b2d6442466a0a1996fdcbc110f31b16

7
samples/images/.gitignore vendored

@ -0,0 +1,7 @@
*.png
!ball.png
!grit.png
!sprites.png
!with-alpha.png
!_images_00_expected.png
!shiny-purse.png

104
samples/images/_images.rb

@ -0,0 +1,104 @@
require 'squib'
require 'squib/sample_helpers'
Squib::Deck.new(width: 1000, height: 3000) do
draw_graph_paper width, height
sample "This a PNG.\nNo scaling is done by default." do |x, y|
png file: 'angler-fish.png', x: x, y: y
end
sample 'PNGs can be upscaled, but they will emit an antialias warning (unless you turn it off in the config.yml)' do |x,y|
png file: 'angler-fish.png', x: x, y: y, width: 150, height: 150
end
sample 'SVGs can be loaded from a file (left) or from straight XML (right). They can also be scaled to any size.' do |x,y|
svg file: 'robot-golem.svg', x: x, y: y, width: 100, height: 100
svg data: File.read('robot-golem.svg'), width: 100, height: 100,
x: x + 200, y: y
end
sample 'PNG and SVG can be auto-scaled by one side and setting the other to :scale' do |x,y|
svg file: 'robot-golem.svg', x: x, y: y, width: 50, height: :scale
svg file: 'robot-golem.svg', x: x + 50, y: y, width: :scale, height: 50
png file: 'angler-fish.png', x: x + 200, y: y, width: 50, height: :scale
png file: 'angler-fish.png', x: x + 250, y: y, width: :scale, height: 50
end
sample 'PNGs can be cropped. To work from sprite sheets, you can set crop coordinates to PNG images. Rounded corners supported too.' do |x,y|
png file: 'sprites.png', x: x - 50, y: y - 50 # entire sprite sheet
rect x: x - 50, y: y - 50, width: 100, height: 100, # draw the crop line
radius: 15, dash: '3 3', stroke_color: 'red', stroke_width: 3
text str: '➜', font: 'Sans Bold 36', x: x + 150, y: y - 35
png file: 'sprites.png', x: x + 200, y: y - 50, # just the robot golem image
crop_x: 0, crop_y: 0, crop_corner_radius: 15,
crop_width: 100, crop_height: 100
png file: 'sprites.png', x: x - 50, y: y + 50 # entire sprite sheet again
rect x: x + 14, y: y + 50, width: 65, height: 65, # highlight the crop
radius: 25, dash: '3 3', stroke_color: 'red', stroke_width: 3
text str: '➜', font: 'Sans Bold 36', x: x + 150, y: y + 50
png file: 'sprites.png', x: x + 225, y: y + 50, # just the drakkar ship image, rotated
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
crop_width: 64, crop_height: 64, angle: Math::PI / 6
end
sample 'SVGs can be cropped too.' do |x,y|
svg file: 'robot-golem.svg', x: x, y: y, width: 100, height: 100,
crop_x: 40, crop_y: 0, crop_width: 50, crop_height: 50
end
sample 'Images can be flipped about their center.' do |x,y|
png file: 'angler-fish.png', x: x, y: y, flip_vertical: true, flip_horizontal: true
svg file: 'robot-golem.svg', x: x + 200, y: y, width: 100, height: 100,
flip_horizontal: true
end
sample 'SVG can be limited to rendering to a single object if the SVG ID is set. If you look in this SVG file, the black backdrop has ID #backdrop.' do |x,y|
svg file: 'robot-golem.svg', id: 'backdrop', x: x, y: y, width: 100, height: 100
end
sample "The SVG force_id option allows use of an ID only when specified, and render nothing if empty. Useful for multiple icons in one SVG file.\nThis should show nothing." do |x,y|
svg file: 'robot-golem.svg', x: x, y: y,
force_id: true, id: '' # <-- the important parts
end
sample 'NOTE! If you render a single object in an SVG, its placement is still relative to the SVG document.' do |x,y|
svg file: 'offset.svg', x: x, y: y
rect x: x, y: y, width: 100, height: 100, dash: '3 1', stroke_color: 'red', stroke_width: 3
svg file: 'offset.svg', id: 'thing', x: x + 200, y: y, width: 100, height: 100
rect x: x + 200, y: y, width: 100, height: 100, dash: '3 1', stroke_color: 'red', stroke_width: 3
end
sample 'PNGs can be blended onto each other with 15 different blending operators. Alpha transparency supported too. See http://cairographics.org/operators' do |x,y|
png file: 'ball.png', x: x, y: y
png file: 'grit.png', x: x + 20, y: y + 20, blend: :color_burn, alpha: 0.75
end
sample 'Rotation is around the upper-left corner of the image. Unit is radians.' do |x,y|
rect x: x, y: y, width: 100, height: 100, stroke_width: 3, dash: '3 3', stroke_color: :red
png x: x, y: y, width: 100, height: 100, angle: Math::PI / 4, file: 'angler-fish.png'
rect x: x + 250, y: y, width: 100, height: 100, stroke_width: 3, dash: '3 3', stroke_color: :red
svg x: x + 250, y: y, width: 100, height: 100, file: 'robot-golem.svg',
angle: Math::PI / 2 - 0.2
end
sample 'SVGs and PNGs can be used as masks for colors instead of being directly rendered.' do |x,y|
svg mask: '#00ff00', file: 'glass-heart.svg', x: x - 50, y: y - 50, width: 200, height: 200
svg mask: '(0,0)(500,0) #eee@0.0 #111@1.0', file: 'glass-heart.svg', x: x + 150, y: y - 50, width: 200, height: 200
end
sample 'PNG masks are based on the alpha channel. Gradient coordinates are relative to the card.' do |x,y|
png file: 'with-alpha.png', x: x - 50, y: y
png file: 'with-alpha.png', mask: :magenta, x: x + 50, y: y
mask = "(#{x+150+75}, #{y+75}, 0)(#{x+150+75}, #{y+75}, 100) #f00@0.0 #000@1.0"
png file: 'with-alpha.png', mask: mask, x: x + 150, y: y, width: 150, height: :scale
end
save_png prefix: '_images_', dir: '.'
end

BIN
samples/images/_images_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

99
samples/images/_more_load_images.rb

@ -0,0 +1,99 @@
require 'squib'
Squib::Deck.new(width: 825, height: 1125, cards: 1, config: 'load_images_config.yml') do
background color: '#0b7c8e'
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
png file: 'shiny-purse.png', x: 620, y: 75 # no scaling is done by default
svg file: 'spanner.svg', x: 620, y: 218
# Can be scaled if width and height are set
svg file: 'spanner.svg', x: 50, y: 50, width: 250, height: 250
png file: 'shiny-purse.png', x: 305, y: 50, width: 250, height: 250
# ...but PNGs will warn if it's an upscale, unless you disable them in config.yml
# Can be scaled using just width or height, if one of them is set to :scale
svg file: 'spanner.svg', x: 200, y: 350, width: 35, height: :scale
svg file: 'spanner.svg', x: 200, y: 390, width: :scale, height: 35
png file: 'shiny-purse.png', x: 240, y: 350, width: 35, height: :scale
png file: 'shiny-purse.png', x: 240, y: 390, width: :scale, height: 35
# You can also crop the loaded images, so you can work from a sprite sheet
png file: 'sprites.png', x: 300, y: 350 # entire sprite sheet
png file: 'sprites.png', x: 300, y: 425, # just the robot golem image
crop_x: 0, crop_y: 0, crop_corner_radius: 10,
crop_width: 64, crop_height: 64
png file: 'sprites.png', x: 400, y: 425, # just the drakkar ship image
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
crop_width: 64, crop_height: 64
png file: 'sprites.png', x: 500, y: 415, # just the drakkar ship image, rotated
crop_x: 64, crop_y: 0, crop_corner_x_radius: 25, crop_corner_y_radius: 25,
crop_width: 64, crop_height: 64, angle: Math::PI / 6
# Cropping also works on SVGs too
svg file: 'spanner.svg', x: 300, y: 500, width: 64, height: 64,
crop_x: 32, crop_y: 32, crop_width: 32, crop_height:32
# We can flip our images too
png file: 'sprites.png', x: 300, y: 535, flip_vertical: true, flip_horizontal: true
svg file: 'spanner.svg', x: 300, y: 615, width: 64, height: 64,
flip_vertical: true, flip_horizontal: true
# We can also limit our rendering to a single object, if the SVG ID is set
svg file: 'spanner.svg', id: '#backdrop', x: 50, y: 350, width: 75, height: 75
# Squib prepends a #-sign if one is not specified
svg file: 'spanner.svg', id: 'backdrop', x: 50, y: 450, width: 125, height: 125
# We can also load SVGs as a string of XML
svg data: File.read('spanner.svg'), x: 50, y: 600, width: 75, height: 75
# The svg data field works nicely with modifying the SVG XML on-the-fly.
# To run this one, do `gem install game_icons` and uncomment the following
#
# require 'game_icons'
# svg data: GameIcons.get('angler-fish').recolor(fg: '#ccc', bg: '#333').string,
# x: 150, y: 600, width: 75, height: 75
#
# More examples at https://github.com/andymeneely/game_icons
# (or `gem install game_icons`) to get & manipulate art from game-icons.net
# Nokogiri (already included in Squib) is also great for XML manipulation.
# WARNING! If you choose to use the SVG ID, the x-y coordinates are still
# relative to the SVG page. See this example in an SVG editor
svg file: 'offset.svg', id: 'thing', x: 0, y: 0, width: 600, height: 600
# Over 15 different blending operators are supported.
# See http://cairographics.org/operators
# Alpha transparency too
png file: 'ball.png', x: 50, y: 700
png file: 'grit.png', x: 70, y: 750, blend: :color_burn, alpha: 0.75
# Images can be rotated around their upper-left corner
png file: 'shiny-purse.png', x: 300, y: 700, angle: 0.0 # default (no rotate)
png file: 'shiny-purse.png', x: 300, y: 800, angle: Math::PI / 4
svg file: 'spanner.svg', x: 300, y: 900, angle: Math::PI / 2 - 0.1
# Images can also be used as masks instead of being directly painted.
# This is particularly useful for switching directly over to black-and-white for printing
# Or, if you want the same image to be used but with different colors/gradients
svg mask: '#00ff00',
file: 'glass-heart.svg',
x: 500, y: 600, width: 200, height: 200
svg mask: '(0,0)(0,500) #ccc@0.0 #333@1.0',
file: 'glass-heart.svg',
x: 500, y: 800, width: 200, height: 200
# Masks are based on the alpha channel, so this is just a magenta square
png mask: :magenta, file: 'shiny-purse.png',
x: 650, y: 950
# Note that this method does nothing, even though it would normally fill up
# the card. force_id: true looks to the id field to be non-empty to render.
# This is useful if you have multiple different icons in one SVG file,
# but sometimes want to use none.
# e.g. id: [:attack, :defend, nil]
svg file: 'spanner.svg', width: :deck, height: :deck,
force_id: true, id: '' # <-- the important part
save prefix: 'load_images_', format: :png
end

BIN
samples/images/ball.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

52
samples/images/glass-heart.svg

@ -0,0 +1,52 @@
<?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 512 512"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="glass-heart.svg">
<metadata
id="metadata22">
<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="defs20" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1018"
id="namedview18"
showgrid="false"
inkscape:zoom="1.3037281"
inkscape:cx="399.78879"
inkscape:cy="267.43808"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<path
style="fill:#000000;stroke:#000000;stroke-width:18.68857956;stroke-opacity:1;fill-opacity:1"
d="M 371.24414 28.179688 C 329.86691 28.096623 287.41274 51.03218 261.00391 102.875 C 196.11155 -14.027671 24.628137 13.619783 29.029297 157.66016 C 33.157605 292.77111 183.5304 347.1093 261.00391 481.30078 C 338.40266 347.24199 496.61198 301.41271 492.29492 157.66016 C 489.89034 77.591144 431.71855 28.301089 371.24414 28.179688 z M 358.9082 49.480469 C 372.3905 49.61861 388.76091 53.818062 405.73047 62.265625 C 444.51802 81.57434 471.74936 115.76108 466.55273 138.62305 C 461.3561 161.48501 425.69966 164.36536 386.91211 145.05664 C 348.12455 125.74793 320.89517 91.56314 326.0918 68.701172 C 329.0149 55.841315 341.57382 49.302858 358.9082 49.480469 z M 148.91016 49.492188 C 159.88856 49.603754 173.21708 52.996781 187.03516 59.820312 C 218.61934 75.416956 240.79389 103.02923 236.5625 121.49609 C 232.3311 139.96294 203.29706 142.29 171.71289 126.69336 C 140.12871 111.09671 117.95416 83.482482 122.18555 65.015625 C 124.56571 54.628018 134.79506 49.348745 148.91016 49.492188 z M 263.11719 179.0332 C 373.07132 179.0332 462.20703 196.90249 462.20703 218.94727 C 462.20703 223.81036 457.86399 228.46946 449.92188 232.7793 C 411.40329 313.40731 320.36729 360.01624 263.00195 457.04297 C 206.07092 360.7538 119.55662 313.16333 78.189453 235.61133 C 84.123672 237.57886 90.694402 239.43942 97.783203 241.1875 C 76.471815 234.83175 64.027344 227.18135 64.027344 218.94727 C 64.027344 196.90249 153.16306 179.0332 263.11719 179.0332 z M 97.783203 241.1875 C 133.52789 251.84773 194.23275 258.86328 263.11719 258.86328 C 348.81534 258.86328 421.8618 248.00627 449.92188 232.7793 C 450.10835 232.38896 450.30232 232.00327 450.48633 231.61133 C 365.1295 267.11537 188.10527 263.46067 97.783203 241.1875 z "
id="path10" />
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
samples/images/grit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

85
samples/images/offset.svg

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
width="100"
height="100"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="offset.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="6.1011724"
inkscape:cx="73.572884"
inkscape:cy="47.134619"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="988"
inkscape:window-x="1432"
inkscape:window-y="109"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(5.1573995,-950.1002)">
<circle
style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.12493663px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="thing"
inkscape:label="thing"
cx="86.79924"
cy="1041.9883"
r="7.4213605" />
<circle
style="opacity:1;fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4142"
cx="17.988642"
cy="973.59332"
r="20.5236" />
<circle
cy="1004.2076"
cx="45.866539"
id="circle4144"
style="opacity:1;fill:#666666;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
r="17.274031" />
<circle
r="12.228644"
style="opacity:1;fill:#333333;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle4146"
cx="69.554207"
cy="1027.0402" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

1
samples/images/robot-golem.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#010101" d="M0 0h512v512H0z" id="backdrop"></path><path fill="#fdfdfd" d="M256.688 18.406c-29.86 0-54.44 21.716-58.875 50.282H315.53c-4.428-28.566-28.983-50.282-58.842-50.282zm-104.313 9.282L81.75 99.094c26.37 25.22 50.43 39.66 69.438 45.53 20.595 6.364 34.156 3.076 41.53-4.468 2.482-2.538 4.475-5.84 5.813-9.875-12.5-13.88-20.124-32.236-20.124-52.31 0-5.28.527-10.45 1.53-15.44-7.117-10.973-16.213-22.668-27.56-34.843zm208.594 0c-11.35 12.174-20.452 23.87-27.564 34.843 1.004 4.99 1.53 10.16 1.53 15.44.002 20.074-7.63 38.43-20.123 52.31 1.334 4.036 3.33 7.338 5.812 9.876 7.374 7.544 20.935 10.832 41.53 4.47 19.01-5.873 43.068-20.313 69.44-45.532l-70.626-71.406zM197.843 87.374c4.008 25.464 24.02 45.487 49.5 49.47v-49.47h-49.5zm68.187 0v49.47c25.476-3.983 45.466-24.006 49.47-49.47h-49.47zm-52.655 55.72c-1.93 3.73-4.352 7.127-7.28 10.124-7.01 7.17-16.34 11.444-27.157 12.843 17.245 30.84 47.478 45.278 77.718 45.187 30.135-.09 60.314-14.62 77.594-45.188-10.75-1.42-20.024-5.706-27-12.843-2.926-2.994-5.323-6.4-7.25-10.126-12.413 8.293-27.313 13.156-43.313 13.156-16 0-30.893-4.863-43.312-13.156zm-105.72.905c-11.884 8.09-22.142 17.595-30.03 28.47 5.18 1.992 10.066 5.204 14.47 9.374.287.273.557.562.843.844 7.992-10.844 19.192-20.188 33-28.188-5.933-2.94-12.04-6.43-18.282-10.5zm297.814.156c-6.274 4.077-12.418 7.563-18.376 10.5 13.946 8.04 25.26 17.42 33.312 28.28.26-.258.518-.527.78-.78 4.39-4.208 9.27-7.476 14.44-9.53-7.928-10.863-18.222-20.373-30.157-28.47zM65.405 188.844c-4.14.03-8.71 1.797-13.937 6.812-5.23 5.016-10.76 13.247-15.595 24.78-9.03 21.54-15.567 54.52-16.406 98.19h91.75c-.836-44.038-7.38-77.138-16.407-98.626-4.833-11.502-10.363-19.67-15.563-24.594-5.2-4.924-9.704-6.592-13.844-6.562zm382.656 0c-4.14.03-8.71 1.797-13.937 6.812-5.228 5.016-10.758 13.247-15.594 24.78-9.03 21.54-15.566 54.52-16.405 98.19h91.75c-.835-44.038-7.38-77.138-16.406-98.626-4.833-11.502-10.364-19.67-15.564-24.594-5.2-4.924-9.703-6.592-13.844-6.562zm-164.5 37.53c-8.798 2.334-17.828 3.536-26.875 3.564-9.09.027-18.16-1.13-27-3.438-5.288 5.608-8.437 12.862-8.437 20.656 0 17.25 15.35 31.844 35.438 31.844 20.087 0 35.437-14.593 35.437-31.844 0-7.854-3.2-15.155-8.563-20.78zm-76 41.94c-20.808 10.54-39.378 28.066-52.937 52.248 5.276 2.285 10.287 5.71 15 10.188 12.49-23.23 29.974-38.884 49.25-47.5-4.683-4.264-8.518-9.31-11.313-14.938zm98.157.248c-2.83 5.618-6.727 10.63-11.44 14.875 19.213 8.67 36.67 24.287 49.19 47.282.062-.06.123-.13.186-.19 4.588-4.308 9.586-7.692 14.844-9.967-13.558-23.972-32.056-41.42-52.78-52zm-166.595 67.375c-5.454-.038-11.282 2.203-17.688 8.22-6.405 6.016-13.017 15.817-18.812 29.5-7.377 17.416-13.346 41.16-16.72 70.937 8.495-4.2 17.876-6.245 27.19-6.22 14.79.043 29.66 5.315 40.968 16.032 9.487 8.993 16.182 21.848 18.093 37.563h23.25c-.856-52.36-8.71-91.89-19.656-117.783-11.6-27.438-25.718-38.173-36.625-38.25zm234.97 0c-5.455-.038-11.252 2.203-17.658 8.22-6.405 6.016-13.048 15.817-18.843 29.5-10.943 25.835-18.774 65.513-19.625 118.312h23.217c1.898-15.826 8.58-28.72 18.094-37.72 11.325-10.712 26.243-15.917 41.033-15.875 9.298.026 18.658 2.098 27.125 6.313-3.368-29.494-9.328-53.09-16.688-70.5-11.6-27.44-25.75-38.174-36.656-38.25zm-336.126 1.375c-1.03 3.895-1.02 8.08.186 12.22 3.82 13.102 19.167 21.597 34.532 17.812 15.24-3.754 23.346-17.03 19.75-30.03l-54.47-.002zm382.655 0c-1.028 3.895-1.02 8.08.188 12.22 3.818 13.102 19.166 21.597 34.53 17.812 15.24-3.754 23.347-17.03 19.75-30.03l-54.468-.002zM113.03 457.063c-10.365-.03-20.612 3.615-28.155 10.75-5.935 5.615-10.374 13.43-12.03 24.157h80.436c-1.664-10.603-6.128-18.377-12.06-24-7.56-7.167-17.823-10.878-28.19-10.908zm287.22 0c-10.366-.03-20.582 3.615-28.125 10.75-5.935 5.615-10.405 13.43-12.063 24.157H440.5c-1.665-10.603-6.13-18.377-12.063-24-7.56-7.167-17.82-10.878-28.187-10.908z"></path></svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
samples/images/shiny-purse.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

91
samples/images/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

BIN
samples/images/sprites.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
samples/images/with-alpha.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

1
samples/intro

@ -1 +0,0 @@
Subproject commit 62bfa4cd6cc011363de6fec34a8575656f07e5f7

2
samples/intro/.gitignore vendored

@ -0,0 +1,2 @@
*.png
!part*_expected.png

9
samples/intro/01_hello.rb

@ -0,0 +1,9 @@
require 'squib'
Squib::Deck.new cards: 1 do
background color: 'pink'
rect
text str: 'Draw two cards.'
save_png prefix: 'part1_', dir: '.'
end

15
samples/intro/02_options.rb

@ -0,0 +1,15 @@
require 'squib'
Squib::Deck.new cards: 1 do
background color: '#252322'
rect fill_color: '#0B3736',
x: 38, y: 38, width: 750, height: 1050, radius: 38
text str: 'Robot Golem', font: 'True Crimes, Sans 72',
align: :center, x: 75, width: :deck, color: '#DFDFE1', y: 90
svg file: 'auto-repair.svg', x: 75, y: 75, width: 100, height: :scale
svg file: 'robot-golem.svg', x: 75, y: 300, width: 675, height: :scale
text str: 'Draw two cards', font: 'Serif 36',
align: :center, width: :deck, color: '#DFDFE1', y: 1000
save_png prefix: 'part2_', dir: '.'
end

12
samples/intro/03_layout.rb

@ -0,0 +1,12 @@
require 'squib'
Squib::Deck.new cards: 1, layout: 'part3_layout.yml' do
background color: '#252322'
rect layout: 'backdrop'
text str: 'Robot Golem', layout: 'title'
svg layout: 'drone'
svg file: 'robot-golem.svg', layout: 'art'
text str: 'Draw two cards.', layout: 'power'
save_png prefix: 'part3_', dir: '.'
end

16
samples/intro/04_arrays.rb

@ -0,0 +1,16 @@
require 'squib'
Squib::Deck.new cards: 2, layout: 'part3_layout.yml' do
background color: '#252322'
rect layout: 'backdrop'
text str: ['Robot Golem', 'Ninja'],
layout: 'title'
svg layout: ['drone', 'human']
svg file: ['robot-golem.svg','ninja-mask.svg'],
layout: 'art'
text str: ['Draw two cards',
'Use the power of another player'],
layout: 'power'
save_png prefix: 'part4_', dir: '.'
end

15
samples/intro/05_excel.rb

@ -0,0 +1,15 @@
require 'squib'
Squib::Deck.new cards: 4, layout: 'part3_layout.yml' do
background color: '#252322'
rect layout: 'backdrop'
data = xlsx file: 'data.xlsx'
text str: data['name'], layout: 'title'
svg layout: data['class']
svg file: data['art'], layout: 'art'
text str: data['power'], layout: 'power'
save_png prefix: 'part5_', dir: '.'
hand file: 'part5_hand.png', dir: '.', trim_radius: 38
showcase file: 'part5_showcase.png', dir: '.'
end

1
samples/intro/auto-repair.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path fill="#DFDFE1" d="M241.406 21l-15.22 34.75c-7.864.478-15.703 1.472-23.467 2.97l-23.282-30.064-25.094 8.532-.125 38.25c-10.63 5.464-20.817 12.07-30.44 19.78L88.313 79.25 70.156 98.563 88.312 133c-5.852 8.346-10.925 17.072-15.218 26.094l-38.938 1.062-7.906 25.28 31.438 23.158c-1.505 9.38-2.24 18.858-2.282 28.344L20.5 254.625l3.656 26.25 38.313 7.5c2.284 7.982 5.107 15.826 8.5 23.5L45.72 343.22l14.093 22.436 39.25-9.187c2.47 2.895 5.037 5.757 7.718 8.53 5.643 5.835 11.565 11.206 17.72 16.125l-7.625 39.313 22.938 13.25 29.968-26.094c8.606 3.462 17.435 6.23 26.407 8.312l9.782 38.406 26.405 2.157 15.875-36.22c10.97-.66 21.904-2.3 32.656-4.938l25.22 29.22 24.593-9.844-.72-14.813-57.406-43.53c-16.712 4.225-34.042 5.356-51.063 3.436-31.754-3.58-62.27-17.92-86.218-42.686-54.738-56.614-53.173-146.67 3.438-201.406 27.42-26.513 62.69-39.963 98-40.344 37.59-.406 75.214 13.996 103.438 43.187 45.935 47.512 52.196 118.985 19.562 173.095l31.97 24.25c3.997-6.28 7.594-12.75 10.75-19.375l38.655-1.063 7.906-25.28-31.217-23c1.513-9.457 2.262-19.035 2.28-28.594l34.688-17.625-3.655-26.25-38.28-7.5c-3.196-10.993-7.444-21.762-12.75-32.125l22.81-31.594-15.25-21.657-37.56 10.906c-.472-.5-.93-1.007-1.408-1.5-5.998-6.205-12.33-11.89-18.937-17.064l7.188-37.125L334 43.78l-28.5 24.814c-9.226-3.713-18.702-6.603-28.313-8.75l-9.343-36.688L241.406 21zM183.25 174.5c-10.344.118-20.597 2.658-30 7.28l45.22 34.314c13.676 10.376 17.555 30.095 7.06 43.937-10.498 13.85-30.656 15.932-44.53 5.408l-45.188-34.282c-4.627 24.793 4.135 51.063 25.594 67.344 19.245 14.597 43.944 17.33 65.22 9.688l4.78-1.72 4.03 3.063 135.19 102.564 4.03 3.062-.344 5.063c-1.637 22.55 7.59 45.61 26.844 60.217 21.46 16.28 49.145 17.63 71.78 6.5l-45.186-34.28c-13.874-10.526-17.282-30.506-6.78-44.344 10.5-13.84 30.537-15.405 44.217-5.032l45.188 34.283c4.616-24.784-4.11-51.067-25.563-67.344-19.313-14.658-43.817-17.562-64.968-10.033l-4.75 1.688-4.03-3.063-135.19-102.562-4.03-3.063.344-5.03c1.55-22.387-7.85-45.194-27.157-59.845-12.544-9.516-27.222-13.978-41.78-13.812zm43.563 90.25l163.875 124.344L379.406 404 215.5 279.625l11.313-14.875z"></path></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

1
samples/intro/crawling.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path d="M384.932 45.57c-3.286.244-7.88 2.403-15.094 14.546-5.056 15.957-.322 25.086 5.06 38.496l2.307 5.744-55.96 51.87c4.376 8.594 7.407 18.226 8.78 28.44l80.254-80.214c-4.114-10.653-8.672-18.525-12.147-27.168-3.263-8.116-4.76-17.495-2.795-28.32-4.347-2.066-8.086-3.564-10.406-3.393zm-119.604 91.15c-25.092.105-47.134 26.142-46.957 60.414.178 34.27 22.487 60.12 47.58 60.013 25.092-.105 47.133-26.14 46.956-60.412-.177-34.272-22.485-60.12-47.578-60.015zm190.053 84.296c-5.97-.085-11.825.86-16.946 2.87-10.125 15.2-8.244 19.567-11.067 36.418l-.71 4.25-3.758 2.11c-21.674 12.172-42.448 22.542-62.93 39.315l-3.632 2.974-4.516-1.275s-12.793-3.613-25.804-7.423c-6.506-1.905-13.063-3.858-18.168-5.455-2.553-.8-4.73-1.505-6.45-2.106-.86-.3-1.59-.567-2.318-.867-.363-.15-.72-.302-1.197-.544-.47-.238-.912-.218-2.463-1.732l-.096.1-12.922-17.024c-5.195 1.613-10.67 2.493-16.36 2.517-21.26.09-39.657-11.704-51.53-29.73-56.886 37.057-116.74 79.386-150.313 123.28l8.283 24.558 55.025-15.826 20.713 46.717c42.768-26.075 84.4-51.742 116.833-74.634-6.47-2-12.324-4.36-17.36-7.163l8.754-15.726c9.89 5.505 29.343 10.33 51.204 12.707 20.935 2.277 44.212 2.546 64.754.84 24.303-20.896 54.028-46.405 72.838-65.997 1.26-7.008 3.54-13.69 7.895-19.768l.44-.617.538-.533c3.732-3.7 8.657-6.304 13.737-6.272 5.08.032 9.018 2.307 11.968 4.506 2.687 2.002 4.914 4.12 6.993 6.09l8.677-13.134c-3.495-8.958-11.785-16.096-22.45-20.12-5.596-2.11-11.687-3.225-17.66-3.31zM36.79 381.1l-2.56 17.82c-.555-.08-.808-.126-1.085-.173.112.03.233.054.32.092.617.265 1.608.72 2.838 1.303 2.46 1.168 5.905 2.864 9.95 4.89 3.966 1.987 8.656 4.375 13.52 6.86L51.57 387.58c-2.886-1.436-5.518-2.733-7.546-3.696-1.338-.635-2.458-1.152-3.418-1.567-.96-.415-.327-.715-3.817-1.217zm68.374 21.485l-40.7 11.707.026.014-15.095 13.234c-4.943-2.555-9.69-4.996-13.698-7.024-3.356-1.698-6.226-3.125-8.427-4.18-1.1-.53-2.026-.962-2.84-1.318-.815-.356-.077-.615-3.537-1.125L18.27 431.7c-.503-.074-.715-.114-.996-.162.475.21 1.24.56 2.21 1.025 1.987.953 4.79 2.35 8.086 4.016 2.155 1.09 4.764 2.433 7.272 3.72L20.78 452.628l11.867 13.535 19.37-16.982c16.705 8.704 32.9 17.262 32.9 17.262l8.413-15.912s-12.692-6.693-26.802-14.07l15.158-13.29c18.2 9.415 34.89 18.137 34.89 18.137l8.352-15.947s-13.362-6.973-28.71-14.93zm-87.89 28.953l-.053-.025c-.395-.173-1.407-.226.054.025z" fill="#DFDFE1"></path></svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
samples/intro/data.xlsx

Binary file not shown.

1
samples/intro/humans.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path fill-rule="evenodd" fill="#DFDFE1" d="M164.594 21.625c-.537.012-1.068.028-1.563.094-29.656 3.852-52.56 35.847-52.56 74.75 0 21.55 7.307 41.193 18.686 54.905-61.678 11.594-66.563 115.158-66.562 188.063h43.218l11.094 152.437h63.063L168.905 340.03h21.47l11.343 152.158h108.686l10.03-152.157h21.627l-9.907 151.845h63.063l10.53-152.438h40.28c0-73.107 1.407-178.78-65.967-189.218 10.89-13.646 18.093-32.734 18.093-53.75 0-41.496-26.52-74.75-59-74.75-2.03 0-4.43-.263-6.406 0-9.4 1.22-17.562 5.455-25.125 11.686 16.388 13.303 27.468 36.433 27.47 63.063 0 21.016-7.236 40.104-18.126 53.75 67.373 10.438 66 116.11 66 189.218h-21.94c.008-73.086 1.29-178.215-65.905-188.625 10.89-13.647 17.906-32.61 17.906-53.625 0-41.497-26.457-75-58.936-75-2.03 0-4.117-.262-6.094 0-29.657 3.85-52.813 36.095-52.813 75 0 21.547 7.373 40.788 18.75 54.5-61.514 11.563-66.318 114.874-66.343 187.75H126.25c-.002-72.905 4.322-176.47 66-188.063-11.38-13.712-18.687-33.356-18.688-54.906 0-26.575 11.138-49.632 27.438-63.064-9.148-7.425-19.896-11.687-31.53-11.687-1.525 0-3.267-.132-4.876-.095z"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

1
samples/intro/ninja-mask.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path fill="#DFDFE1" d="M255.063 21c-46.697 0-88.406 27.674-117.844 70.656-29.44 42.982-47.25 101.566-47.25 166.094 0 64.527 17.81 123.112 47.25 166.094 29.437 42.982 71.146 70.656 117.843 70.656 46.696 0 88.405-27.674 117.843-70.656 29.44-42.982 47.25-101.567 47.25-166.094 0-64.528-17.81-123.112-47.25-166.094C343.468 48.674 301.76 21 255.062 21zM396.28 200.344c3.365 18.28 5.19 37.527 5.19 57.406 0 18.535-1.594 36.522-4.533 53.688-37.91 12.904-87.436 20.812-141.656 20.812-54.45 0-104.125-8.235-142.186-21.313-2.884-17.014-4.438-34.833-4.438-53.187 0-19.868 1.827-39.103 5.188-57.375 37.903 14.565 87.35 23.25 141.47 23.25 54.136 0 103.183-8.707 140.967-23.28zM177.157 241c-15.137-.162-30.97 3.458-47.375 10.313 14.562 51.423 87.08 42.483 102.157 10.156-17.004-13.822-35.318-20.262-54.78-20.47zm155.75 0c-19.462.208-37.808 6.648-54.812 20.47 15.078 32.326 87.596 41.266 102.156-10.158-16.405-6.854-32.206-10.474-47.344-10.312z"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
samples/intro/part1_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
samples/intro/part2_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
samples/intro/part3_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

34
samples/intro/part3_layout.yml

@ -0,0 +1,34 @@
backdrop:
fill_color: '#0B3736'
x: 38
y: 38
radius: 38
width: 750
height: 1050
title:
font: 'True Crimes, Sans 72'
align: center
color: '#DFDFE1'
x: 75
y: 90
width: 825
drone:
file: auto-repair.svg
x: 75
y: 75
width: 100
height: 100
human:
extends: drone
file: humans.svg
art:
x: 75
y: 300
width: 675
height: 675
power:
font: 'Serif 36'
align: center
width: 825
color: '#DFDFE1'
y: 1000

BIN
samples/intro/part4_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
samples/intro/part4_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
samples/intro/part5_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
samples/intro/part5_01_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
samples/intro/part5_02_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
samples/intro/part5_03_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
samples/intro/part5_hand_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

BIN
samples/intro/part5_showcase_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

1
samples/intro/pirate-skull.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path fill="#DFDFE1" d="M255.95 19.2c-58.685 0-101.737 17.664-132.97 45.68 48.263 68.21 113.714 107.422 171.94 118.15 32.58 6 62.737 3.08 86.443-8.014 23.35-10.928 40.7-29.45 49.282-56.862-5.45-10.763-11.76-20.916-18.997-30.29-31.994-41.443-81.43-68.663-155.7-68.663zM109.587 78.298c-3.422 3.823-6.677 7.784-9.764 11.875-30.746 40.752-44.657 94.833-45.63 147.937 58.72 26.42 90.817 62.647 101.806 101.417 30.31 19.97 69.622 29.4 108.22 27.975 33.805-1.247 66.84-10.815 92.688-27.922 10.205-38.25 42.34-73.28 100.81-101.193-.54-33.675-5.868-66.638-16.704-96.28-10.685 20.984-27.018 36.954-46.848 47.395 5.5 17.523 2.04 35.76-6.05 50.85-8.78 16.38-22.906 29.666-39.145 36.173-16.24 6.508-35.77 5.343-50.11-8.22-13.924-13.172-22.515-35.957-24.258-70.71-58.037-15.36-118.86-55.217-165.014-119.298zm41.916 97.803c5.71 20.964 31.71 36.888 63.072 36.888 6.97 0 13.348-.932 19.635-2.38.038.598 0 1.183 0 1.785 0 24.497-23.654 44.62-52.956 44.62-29.302 0-52.96-20.125-52.96-44.62 0-15.31 9.09-28.315 23.208-36.29l.002-.003zm108.422 74.107c14.6 29.094 23.808 58.187 31.467 87.28-20.978-7.523-41.956-6.637-62.936 0 5.666-29.093 17.082-58.186 31.47-87.28zm93.416 113.254c-9.875 5.25-20.36 9.583-31.248 13.017v44.47c13.1-4.626 25.368-10.682 36.3-18.12-3.742-13.045-5.556-26.223-5.052-39.366zm-193.162.224c.912 13.586-.507 27.122-3.846 40.312 10.74 7.033 22.603 12.742 35.156 17.123v-44.5c-10.862-3.4-21.366-7.702-31.31-12.936zm143.226 17.71c-12.18 2.616-24.69 4.192-37.27 4.723v45.545c12.66-.585 25.197-2.337 37.27-5.217v-45.052zM364.852 421c-28.772 18.386-64.12 28.102-99.942 29.424-40.16 1.482-81.158-7.587-114.527-28.06-4.88 12.362-11.358 24.27-19.074 35.445 22.273 21.468 70.715 35.49 121.31 36.042 50.88.553 103.302-12.087 132.718-36.016-8.24-11.97-15.18-24.302-20.486-36.836z"></path></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

1
samples/intro/robot-golem.svg

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path fill="#DFDFE1" d="M256.688 18.406c-29.86 0-54.44 21.716-58.875 50.282H315.53c-4.428-28.566-28.983-50.282-58.842-50.282zm-104.313 9.282L81.75 99.094c26.37 25.22 50.43 39.66 69.438 45.53 20.595 6.364 34.156 3.076 41.53-4.468 2.482-2.538 4.475-5.84 5.813-9.875-12.5-13.88-20.124-32.236-20.124-52.31 0-5.28.527-10.45 1.53-15.44-7.117-10.973-16.213-22.668-27.56-34.843zm208.594 0c-11.35 12.174-20.452 23.87-27.564 34.843 1.004 4.99 1.53 10.16 1.53 15.44.002 20.074-7.63 38.43-20.123 52.31 1.334 4.036 3.33 7.338 5.812 9.876 7.374 7.544 20.935 10.832 41.53 4.47 19.01-5.873 43.068-20.313 69.44-45.532l-70.626-71.406zM197.843 87.374c4.008 25.464 24.02 45.487 49.5 49.47v-49.47h-49.5zm68.187 0v49.47c25.476-3.983 45.466-24.006 49.47-49.47h-49.47zm-52.655 55.72c-1.93 3.73-4.352 7.127-7.28 10.124-7.01 7.17-16.34 11.444-27.157 12.843 17.245 30.84 47.478 45.278 77.718 45.187 30.135-.09 60.314-14.62 77.594-45.188-10.75-1.42-20.024-5.706-27-12.843-2.926-2.994-5.323-6.4-7.25-10.126-12.413 8.293-27.313 13.156-43.313 13.156-16 0-30.893-4.863-43.312-13.156zm-105.72.905c-11.884 8.09-22.142 17.595-30.03 28.47 5.18 1.992 10.066 5.204 14.47 9.374.287.273.557.562.843.844 7.992-10.844 19.192-20.188 33-28.188-5.933-2.94-12.04-6.43-18.282-10.5zm297.814.156c-6.274 4.077-12.418 7.563-18.376 10.5 13.946 8.04 25.26 17.42 33.312 28.28.26-.258.518-.527.78-.78 4.39-4.208 9.27-7.476 14.44-9.53-7.928-10.863-18.222-20.373-30.157-28.47zM65.405 188.844c-4.14.03-8.71 1.797-13.937 6.812-5.23 5.016-10.76 13.247-15.595 24.78-9.03 21.54-15.567 54.52-16.406 98.19h91.75c-.836-44.038-7.38-77.138-16.407-98.626-4.833-11.502-10.363-19.67-15.563-24.594-5.2-4.924-9.704-6.592-13.844-6.562zm382.656 0c-4.14.03-8.71 1.797-13.937 6.812-5.228 5.016-10.758 13.247-15.594 24.78-9.03 21.54-15.566 54.52-16.405 98.19h91.75c-.835-44.038-7.38-77.138-16.406-98.626-4.833-11.502-10.364-19.67-15.564-24.594-5.2-4.924-9.703-6.592-13.844-6.562zm-164.5 37.53c-8.798 2.334-17.828 3.536-26.875 3.564-9.09.027-18.16-1.13-27-3.438-5.288 5.608-8.437 12.862-8.437 20.656 0 17.25 15.35 31.844 35.438 31.844 20.087 0 35.437-14.593 35.437-31.844 0-7.854-3.2-15.155-8.563-20.78zm-76 41.94c-20.808 10.54-39.378 28.066-52.937 52.248 5.276 2.285 10.287 5.71 15 10.188 12.49-23.23 29.974-38.884 49.25-47.5-4.683-4.264-8.518-9.31-11.313-14.938zm98.157.248c-2.83 5.618-6.727 10.63-11.44 14.875 19.213 8.67 36.67 24.287 49.19 47.282.062-.06.123-.13.186-.19 4.588-4.308 9.586-7.692 14.844-9.967-13.558-23.972-32.056-41.42-52.78-52zm-166.595 67.375c-5.454-.038-11.282 2.203-17.688 8.22-6.405 6.016-13.017 15.817-18.812 29.5-7.377 17.416-13.346 41.16-16.72 70.937 8.495-4.2 17.876-6.245 27.19-6.22 14.79.043 29.66 5.315 40.968 16.032 9.487 8.993 16.182 21.848 18.093 37.563h23.25c-.856-52.36-8.71-91.89-19.656-117.783-11.6-27.438-25.718-38.173-36.625-38.25zm234.97 0c-5.455-.038-11.252 2.203-17.658 8.22-6.405 6.016-13.048 15.817-18.843 29.5-10.943 25.835-18.774 65.513-19.625 118.312h23.217c1.898-15.826 8.58-28.72 18.094-37.72 11.325-10.712 26.243-15.917 41.033-15.875 9.298.026 18.658 2.098 27.125 6.313-3.368-29.494-9.328-53.09-16.688-70.5-11.6-27.44-25.75-38.174-36.656-38.25zm-336.126 1.375c-1.03 3.895-1.02 8.08.186 12.22 3.82 13.102 19.167 21.597 34.532 17.812 15.24-3.754 23.346-17.03 19.75-30.03l-54.47-.002zm382.655 0c-1.028 3.895-1.02 8.08.188 12.22 3.818 13.102 19.166 21.597 34.53 17.812 15.24-3.754 23.347-17.03 19.75-30.03l-54.468-.002zM113.03 457.063c-10.365-.03-20.612 3.615-28.155 10.75-5.935 5.615-10.374 13.43-12.03 24.157h80.436c-1.664-10.603-6.128-18.377-12.06-24-7.56-7.167-17.823-10.878-28.19-10.908zm287.22 0c-10.366-.03-20.582 3.615-28.125 10.75-5.935 5.615-10.405 13.43-12.063 24.157H440.5c-1.665-10.603-6.13-18.377-12.063-24-7.56-7.167-17.82-10.878-28.187-10.908z"></path></svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

1
samples/shapes

@ -1 +0,0 @@
Subproject commit 0097971b5926b6571dbf2d3b4a3363d7cb196382

1
samples/shapes/.gitignore vendored

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

54
samples/shapes/_draw_shapes.rb

@ -0,0 +1,54 @@
require 'squib'
Squib::Deck.new do
background color: :white
grid x: 10, y: 10, width: 50, height: 50, stroke_color: '#0066FF', stroke_width: 1.5, angle: 0.1
grid x: 10, y: 10, width: 200, height: 200, stroke_color: '#0066FF', stroke_width: 3, angle: 0.1
rect x: 305, y: 105, width: 200, height: 50, dash: '4 2'
rect x: 300, y: 300, width: 400, height: 400,
fill_color: :blue, stroke_color: :red, stroke_width: 50.0,
join: 'bevel'
rect x: 550, y: 105, width: 100, height: 100,
stroke_width: 5, stroke_color: :orange, angle: -0.2
ellipse x: 675, y: 105, width: 65, height: 100,
stroke_width: 5, stroke_color: :orange, angle: -0.2
circle x: 600, y: 600, radius: 75,
fill_color: :gray, stroke_color: :green, stroke_width: 8.0
triangle x1: 50, y1: 50,
x2: 150, y2: 150,
x3: 75, y3: 250,
fill_color: :gray, stroke_color: :green, stroke_width: 3.0
line x1: 50, y1: 550,
x2: 150, y2: 650,
stroke_width: 25.0
curve x1: 50, y1: 850, cx1: 150, cy1: 700,
x2: 625, y2: 900, cx2: 150, cy2: 700,
stroke_width: 12.0, stroke_color: :cyan,
fill_color: :burgundy, cap: 'round'
ellipse x: 50, y: 925, width: 200, height: 100,
stroke_width: 5.0, stroke_color: :cyan,
fill_color: :burgundy
star x: 300, y: 1000, n: 5, inner_radius: 15, outer_radius: 40,
fill_color: :cyan, stroke_color: :burgundy, stroke_width: 5
# default draw is fill-then-stroke. Can be changed to stroke-then-fill
star x: 375, y: 1000, n: 5, inner_radius: 15, outer_radius: 40,
fill_color: :cyan, stroke_color: :burgundy,
stroke_width: 5, stroke_strategy: :stroke_first
polygon x: 500, y: 1000, n: 5, radius: 25, angle: Math::PI / 2,
fill_color: :cyan, stroke_color: :burgundy, stroke_width: 2
save_png prefix: 'shape_'
end

BIN
samples/shapes/shape_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

1
samples/text

@ -1 +0,0 @@
Subproject commit 1a380a6bd209aadfffa134099b17388f5f31cd07

2
samples/text/.gitignore vendored

@ -0,0 +1,2 @@
*.png
!_text_00_expected.png

1
samples/text/README.md

@ -0,0 +1 @@
Using the `text` method in Squib

47
samples/text/_text.rb

@ -0,0 +1,47 @@
require 'squib'
require 'squib/sample_helpers'
Squib::Deck.new(width: 1000, height: 1250) do
draw_graph_paper width, height
sample 'Font strings are quite expressive. Specify family, modifiers, then size. Font names with spaces in them should end with a comma to help with parsing.' do |x, y|
text font: 'Arial bold italic 32', str: 'Bold and italic!', x: x, y: y - 50
text font: 'Arial weight=300 32', str: 'Light bold!', x: x, y: y
text font: 'Times New Roman, 32', str: 'Times New Roman', x: x, y: y + 50
text font: 'NoSuchFont,Arial 32', str: 'Arial Backup', x: x, y: y + 100
end
sample 'Specify width and height to see a text box. Also: set "hint" to see the extents of your text box' do |x, y|
text str: 'This has fixed width and height.', x: x, y: y,
hint: :red, width: 300, height: 100, font: 'Serif bold 24'
end
sample 'If you specify the width only, the text will ellipsize.' do |x, y|
text str: 'The meaning of life is 42', x: x - 50, y: y,
hint: :red, width: 350, font: 'Serif bold 22'
end
sample 'If you specify the width only, and turn off ellipsize, the height will auto-stretch.' do |x, y|
text str: 'This has fixed width, but not fixed height.', x: x, y: y,
hint: :red, width: 300, ellipsize: false, font: 'Serif bold 24'
end
sample 'The text method returns the ink extents of each card\'s rendered text. So you can custom-fit a shape around it.' do |x, y|
['Auto fit!', 'Auto fit!!!!' ].each.with_index do |str, i|
text_y = y + i * 50
extents = text str: str, x: x, y: text_y, font: 'Sans Bold 24'
# Extents come back as an array of hashes, which can get split out like this
text_width = extents[0][:width]
text_height = extents[0][:height]
rect x: x, y: text_y, width: text_width, height: text_height, radius: 10,
stroke_color: :purple, stroke_width: 3
end
end
sample 'Text can be rotated about the upper-left corner of the text box. Unit is in radians.' do |x, y|
text str: 'Rotated', hint: :red, x: x, y: y, angle: Math::PI / 6
end
save_png prefix: '_text_', dir: '.'
end

BIN
samples/text/_text_00_expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

2
samples/text/config.yml

@ -0,0 +1,2 @@
# Turn off warnings about ellipsization for this example
warn_ellipsize: false
Loading…
Cancel
Save