squib 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.gitmodules +22 -0
- data/.travis.yml +4 -5
- data/CHANGELOG.md +23 -0
- data/CONTRIBUTING.md +40 -0
- data/README.md +25 -553
- data/RELEASE TODO.md +2 -2
- data/Rakefile +6 -64
- data/appveyor.yml +0 -4
- data/benchmarks/antialias_best.rb +2 -2
- data/benchmarks/antialias_fast.rb +2 -2
- data/benchmarks/{backend-memory.rb → backend_memory.rb} +2 -2
- data/benchmarks/{backend-svg.rb → backend_svg.rb} +2 -2
- data/benchmarks/tons_of_png.rb +1 -1
- data/benchmarks/tons_of_svg.rb +1 -1
- data/benchmarks/tons_of_text.rb +1 -1
- data/docs/Makefile +216 -0
- data/docs/_static/css/squibdocs.css +18 -0
- data/docs/args/draw.rst +36 -0
- data/docs/args/expansion.rst +3 -0
- data/docs/args/layout.rst +6 -0
- data/docs/args/output_dir.rst +6 -0
- data/docs/args/range.rst +6 -0
- data/docs/args/transform.rst +51 -0
- data/docs/args/trim.rst +11 -0
- data/docs/args/wh.rst +12 -0
- data/docs/args/xy.rst +12 -0
- data/docs/arrays.rst +77 -0
- data/docs/backends.rst +20 -0
- data/docs/bleed.rst +13 -0
- data/docs/build_groups.rst +47 -0
- data/docs/colors.rst +64 -0
- data/docs/conf.py +287 -0
- data/docs/config.rst +117 -0
- data/docs/data.rst +22 -0
- data/docs/dsl/background.rst +20 -0
- data/docs/dsl/build.rst +32 -0
- data/docs/dsl/build_groups.rst +23 -0
- data/docs/dsl/circle.rst +27 -0
- data/docs/dsl/cm.rst +19 -0
- data/docs/dsl/csv.rst +62 -0
- data/docs/dsl/curve.rst +63 -0
- data/docs/dsl/deck.rst +45 -0
- data/docs/dsl/disable_build.rst +28 -0
- data/docs/dsl/ellipse.rst +17 -0
- data/docs/dsl/enable_build.rst +25 -0
- data/docs/dsl/grid.rst +31 -0
- data/docs/dsl/hand.rst +40 -0
- data/docs/dsl/hint.rst +15 -0
- data/docs/dsl/inches.rst +19 -0
- data/docs/dsl/index.rst +9 -0
- data/docs/dsl/line.rst +52 -0
- data/docs/dsl/png.rst +49 -0
- data/docs/dsl/polygon.rst +28 -0
- data/docs/dsl/rect.rst +18 -0
- data/docs/dsl/save.rst +23 -0
- data/docs/dsl/save_pdf.rst +48 -0
- data/docs/dsl/save_png.rst +46 -0
- data/docs/dsl/save_sheet.rst +55 -0
- data/docs/dsl/showcase.rst +65 -0
- data/docs/dsl/star.rst +35 -0
- data/docs/dsl/svg.rst +119 -0
- data/docs/dsl/text.rst +294 -0
- data/docs/dsl/triangle.rst +38 -0
- data/docs/dsl/use_layout.rst +16 -0
- data/docs/dsl/xlsx.rst +50 -0
- data/docs/guides/game_icons.rst +2 -0
- data/docs/guides/getting-started/index.rst +5 -0
- data/docs/guides/getting-started/part_0_learning_ruby.rst +145 -0
- data/docs/guides/getting-started/part_1_zero_to_game.rst +216 -0
- data/docs/guides/getting-started/part_2_iconography.rst +152 -0
- data/docs/guides/getting-started/part_3_workflows.rst +4 -0
- data/docs/guides/git.rst +13 -0
- data/docs/guides/hello_world.rst +6 -0
- data/docs/help.rst +157 -0
- data/docs/index.rst +35 -0
- data/docs/install.rst +66 -0
- data/docs/layouts.rst +235 -0
- data/docs/learning.rst +10 -0
- data/docs/make.bat +263 -0
- data/docs/parameters.rst +26 -0
- data/docs/server.bat +1 -0
- data/docs/text_feature.rst +86 -0
- data/docs/units.rst +6 -0
- data/lib/squib.rb +4 -4
- data/lib/squib/api/background.rb +5 -10
- data/lib/squib/api/data.rb +30 -54
- data/lib/squib/api/groups.rb +47 -0
- data/lib/squib/api/image.rb +8 -67
- data/lib/squib/api/save.rb +15 -105
- data/lib/squib/api/settings.rb +8 -22
- data/lib/squib/api/shapes.rb +15 -185
- data/lib/squib/api/text.rb +9 -49
- data/lib/squib/api/text_embed.rb +12 -12
- data/lib/squib/api/units.rb +3 -17
- data/lib/squib/args/arg_loader.rb +6 -6
- data/lib/squib/args/box.rb +2 -2
- data/lib/squib/args/card_range.rb +1 -1
- data/lib/squib/args/color_validator.rb +2 -2
- data/lib/squib/args/coords.rb +2 -2
- data/lib/squib/args/csv_opts.rb +25 -0
- data/lib/squib/args/dir_validator.rb +1 -1
- data/lib/squib/args/draw.rb +2 -2
- data/lib/squib/args/embed_adjust.rb +1 -1
- data/lib/squib/args/embed_key.rb +1 -1
- data/lib/squib/args/hand_special.rb +37 -37
- data/lib/squib/args/import.rb +2 -2
- data/lib/squib/args/input_file.rb +1 -1
- data/lib/squib/args/paint.rb +3 -3
- data/lib/squib/args/paragraph.rb +2 -2
- data/lib/squib/args/save_batch.rb +2 -2
- data/lib/squib/args/scale_box.rb +1 -1
- data/lib/squib/args/sheet.rb +3 -3
- data/lib/squib/args/showcase_special.rb +2 -2
- data/lib/squib/args/svg_special.rb +1 -1
- data/lib/squib/args/transform.rb +2 -2
- data/lib/squib/args/typographer.rb +5 -4
- data/lib/squib/args/unit_conversion.rb +4 -4
- data/lib/squib/card.rb +8 -8
- data/lib/squib/conf.rb +5 -5
- data/lib/squib/deck.rb +20 -18
- data/lib/squib/graphics/cairo_context_wrapper.rb +3 -3
- data/lib/squib/graphics/gradient_regex.rb +1 -1
- data/lib/squib/graphics/hand.rb +2 -2
- data/lib/squib/graphics/save_doc.rb +9 -8
- data/lib/squib/graphics/save_images.rb +24 -11
- data/lib/squib/graphics/shapes.rb +16 -17
- data/lib/squib/graphics/showcase.rb +9 -9
- data/lib/squib/graphics/text.rb +21 -21
- data/lib/squib/layout_parser.rb +9 -9
- data/lib/squib/layouts/economy.yml +85 -85
- data/lib/squib/layouts/fantasy.yml +101 -101
- data/lib/squib/layouts/hand.yml +62 -62
- data/lib/squib/layouts/playing-card.yml +35 -35
- data/lib/squib/layouts/tuck_box.yml +45 -45
- data/lib/squib/sample_helpers.rb +1 -1
- data/lib/squib/version.rb +1 -1
- data/samples/{backend.rb → backend/_backend.rb} +2 -2
- data/samples/basic.rb +3 -3
- data/samples/bug134.rb +14 -0
- data/samples/build_groups/build_groups.rb +36 -0
- data/samples/cairo_access.rb +12 -1
- data/samples/{colors.rb → colors/_colors.rb} +12 -12
- data/samples/{gradients.rb → colors/_gradients.rb} +1 -1
- data/samples/config_text_markup.rb +2 -2
- data/samples/custom-config.yml +5 -5
- data/samples/custom_config.rb +18 -18
- data/samples/{csv_import.rb → data/_csv.rb} +8 -1
- data/samples/{excel.rb → data/_excel.rb} +3 -3
- data/samples/embed_text.rb +21 -0
- data/samples/hello_world.rb +1 -1
- data/samples/{load_images.rb → images/_more_load_images.rb} +2 -2
- data/samples/layouts.rb +11 -1
- data/samples/layouts_builtin.rb +51 -51
- data/samples/offset.svg +71 -71
- data/samples/ranges.rb +7 -7
- data/samples/{hand.rb → saves/_hand.rb} +1 -2
- data/samples/{portrait-landscape.rb → saves/_portrait_landscape.rb} +4 -4
- data/samples/{saves.rb → saves/_saves.rb} +0 -0
- data/samples/{showcase.rb → saves/_showcase.rb} +2 -2
- data/samples/{draw_shapes.rb → shapes/_draw_shapes.rb} +1 -1
- data/samples/text/_text.rb +4 -3
- data/samples/text_options.rb +6 -6
- data/samples/unicode.rb +1 -1
- data/spec/api/api_data_spec.rb +59 -4
- data/spec/api/api_settings_spec.rb +1 -1
- data/spec/args/box_spec.rb +7 -7
- data/spec/args/draw_spec.rb +19 -19
- data/spec/args/embed_key_spec.rb +13 -13
- data/spec/args/input_file_spec.rb +2 -2
- data/spec/args/paint_spec.rb +5 -5
- data/spec/args/paragraph_spec.rb +28 -28
- data/spec/args/range_spec.rb +1 -1
- data/spec/args/save_batch_spec.rb +10 -10
- data/spec/args/scale_box_spec.rb +9 -9
- data/spec/args/sheet_spec.rb +8 -8
- data/spec/args/showcase_special_spec.rb +15 -15
- data/spec/args/transform_spec.rb +4 -4
- data/spec/args/typographer_spec.rb +11 -11
- data/spec/args/unit_conversion_spec.rb +2 -2
- data/spec/card_spec.rb +1 -1
- data/spec/commands/new_spec.rb +1 -1
- data/spec/data/csv/custom_opts.csv +2 -0
- data/spec/data/csv/newline.csv +3 -0
- data/spec/data/csv/qty.csv +2 -2
- data/spec/data/csv/qty_named.csv +2 -2
- data/spec/data/csv/with_spaces.csv +2 -2
- data/spec/data/csv/yield.csv +3 -0
- data/spec/data/samples/{autoscale_font.rb.txt → autoscale_font/_autoscale_font.rb.txt} +55 -18
- data/spec/data/samples/cairo_access.rb.txt +24 -0
- data/spec/data/samples/{gradients.rb.txt → colors/_gradients.rb.txt} +0 -0
- data/spec/data/samples/config_text_markup.rb.txt +72 -72
- data/spec/data/samples/custom_config.rb.txt +1 -0
- data/spec/data/samples/{csv_import.rb.txt → data/_csv.rb.txt} +0 -0
- data/spec/data/samples/{excel.rb.txt → data/_excel.rb.txt} +0 -0
- data/spec/data/samples/embed_text.rb.txt +79 -0
- data/spec/data/samples/hello_world.rb.txt +36 -36
- data/spec/data/samples/{load_images.rb.txt → images/_more_load_images.rb.txt} +4 -4
- data/spec/data/samples/{hand.rb.txt → saves/_hand.rb.txt} +0 -0
- data/spec/data/samples/{portrait-landscape.rb.txt → saves/_portrait_landscape.rb.txt} +11 -7
- data/spec/data/samples/{save_pdf.rb.txt → saves/_save_pdf.rb.txt} +0 -0
- data/spec/data/samples/{saves.rb.txt → saves/_saves.rb.txt} +3 -4
- data/spec/data/samples/{showcase.rb.txt → saves/_showcase.rb.txt} +0 -0
- data/spec/data/samples/{draw_shapes.rb.txt → shapes/_draw_shapes.rb.txt} +0 -0
- data/spec/data/samples/text_options.rb.txt +1125 -1125
- data/spec/graphics/cairo_context_wrapper_spec.rb +10 -10
- data/spec/graphics/graphics_save_doc_spec.rb +11 -5
- data/spec/layout_parser_spec.rb +21 -9
- data/spec/logger_spec.rb +2 -2
- data/spec/samples/run_samples_spec.rb +1 -1
- data/spec/samples/samples_regression_spec.rb +16 -18
- data/spec/samples/sanity.rb +9 -9
- data/spec/sanity/.gitignore +1 -0
- data/spec/sanity/sanity.html.erb +42 -0
- data/spec/sanity/sanity_test.rb +42 -0
- data/spec/sanity/tests.yml +12 -0
- data/spec/spec_helper.rb +22 -20
- data/squib.gemspec +3 -4
- metadata +143 -81
- data/.rspec +0 -1
- data/.yardopts +0 -10
- data/samples/autoscale_font.rb +0 -27
- data/samples/backend-config.yml +0 -5
- data/samples/color_shortcuts.rb +0 -6
- data/samples/explode_quantities.xlsx +0 -0
- data/samples/quantity_explosion.csv +0 -3
- data/samples/sample.csv +0 -3
- data/samples/sample.xlsx +0 -0
- data/squib.sublime-project +0 -42
@@ -0,0 +1,28 @@
|
|
1
|
+
disable_build
|
2
|
+
=============
|
3
|
+
|
4
|
+
Disable the given build group for the rest of the build. Thus, code within the corresponding :doc:`/dsl/group` block will not be executed. See :doc:`/build_groups` for ways to use this effectively.
|
5
|
+
|
6
|
+
|
7
|
+
Required Arguments
|
8
|
+
------------------
|
9
|
+
|
10
|
+
build_group_name
|
11
|
+
default: ``:all``
|
12
|
+
the name of the group to disable. Convention is to use a Ruby symbol.
|
13
|
+
|
14
|
+
.. note::
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
Examples
|
19
|
+
--------
|
20
|
+
|
21
|
+
Can be used to disable a group (even if it's enabled via command line)::
|
22
|
+
|
23
|
+
Squib::Deck.new do
|
24
|
+
disable_build :pnp
|
25
|
+
build :pnp do
|
26
|
+
save_pdf
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ellipse
|
2
|
+
-------
|
3
|
+
|
4
|
+
Draw an ellipse at the given coordinates. An ellipse is an oval that is defined by a bounding rectangle. To draw a circle, see :doc:`circle`.
|
5
|
+
|
6
|
+
Options
|
7
|
+
^^^^^^^
|
8
|
+
.. include:: /args/expansion.rst
|
9
|
+
|
10
|
+
.. include:: /args/xy.rst
|
11
|
+
.. include:: /args/wh.rst
|
12
|
+
.. include:: /args/draw.rst
|
13
|
+
.. include:: /args/range.rst
|
14
|
+
.. include:: /args/layout.rst
|
15
|
+
|
16
|
+
Examples
|
17
|
+
^^^^^^^^
|
@@ -0,0 +1,25 @@
|
|
1
|
+
enable_build
|
2
|
+
============
|
3
|
+
|
4
|
+
Enable the given build group for the rest of the build. Thus, code within the corresponding :doc:`/dsl/group` block will be executed. See :doc:`/build_groups` for ways to use this effectively.
|
5
|
+
|
6
|
+
|
7
|
+
Required Arguments
|
8
|
+
------------------
|
9
|
+
|
10
|
+
build_group_name
|
11
|
+
the name of the group to enable. Convention is to use a Ruby symbol.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
Examples
|
16
|
+
--------
|
17
|
+
|
18
|
+
Can be used to disable a group (even if it's enabled via command line)::
|
19
|
+
|
20
|
+
Squib::Deck.new do
|
21
|
+
disable_build :pnp
|
22
|
+
build :pnp do
|
23
|
+
save_pdf
|
24
|
+
end
|
25
|
+
end
|
data/docs/dsl/grid.rst
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
grid
|
2
|
+
----
|
3
|
+
|
4
|
+
Draw an unlimited square grid of lines on the deck, starting with x,y and extending off the end of the deck.
|
5
|
+
|
6
|
+
|
7
|
+
Options
|
8
|
+
^^^^^^^
|
9
|
+
.. include:: /args/expansion.rst
|
10
|
+
|
11
|
+
.. include:: /args/xy.rst
|
12
|
+
|
13
|
+
|
14
|
+
width
|
15
|
+
default: ``:deck`` (the width of the deck)
|
16
|
+
|
17
|
+
the spacing between vertical gridlines. Supports :doc:`/units`.
|
18
|
+
|
19
|
+
|
20
|
+
height
|
21
|
+
default: ``:deck`` (the height of the deck)
|
22
|
+
|
23
|
+
the spacing between horizontal gridlines. Supports :doc:`/units`.
|
24
|
+
|
25
|
+
|
26
|
+
.. include:: /args/draw.rst
|
27
|
+
.. include:: /args/range.rst
|
28
|
+
.. include:: /args/layout.rst
|
29
|
+
|
30
|
+
Examples
|
31
|
+
^^^^^^^^
|
data/docs/dsl/hand.rst
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
hand
|
2
|
+
====
|
3
|
+
|
4
|
+
Renders a range of cards fanned out as if in a hand. Saves as PNG regardless of back end.
|
5
|
+
|
6
|
+
Options
|
7
|
+
-------
|
8
|
+
|
9
|
+
radius
|
10
|
+
default: ``:auto``
|
11
|
+
|
12
|
+
The distance from the bottom of each card to the center of the fan. If set to ``:auto``, then it is computed as 30% of the card's height. Why 30%? Because it looks good that way. Reasons.
|
13
|
+
|
14
|
+
angle_range
|
15
|
+
default: ``((Math::PI / -4.0)..(Math::PI / 2))``
|
16
|
+
|
17
|
+
The overall width of the fan, in radians. Angle of zero is a vertical card. Further negative angles widen the fan counter-clockwise and positive angles widen the fan clockwise.
|
18
|
+
|
19
|
+
margin
|
20
|
+
default: ``75``
|
21
|
+
|
22
|
+
the margin around the entire image. Supports :doc:`/units`.
|
23
|
+
|
24
|
+
fill_color
|
25
|
+
default: ``:white``
|
26
|
+
|
27
|
+
Backdrop color. See :doc:`/colors`.
|
28
|
+
|
29
|
+
.. include:: /args/trim.rst
|
30
|
+
|
31
|
+
file
|
32
|
+
default: ``'hand.png'``
|
33
|
+
|
34
|
+
The file to save relative to the current directory. Will overwrite without warning.
|
35
|
+
|
36
|
+
.. include:: /args/output_dir.rst
|
37
|
+
.. include:: /args/range.rst
|
38
|
+
|
39
|
+
Examples
|
40
|
+
--------
|
data/docs/dsl/hint.rst
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
hint
|
2
|
+
====
|
3
|
+
|
4
|
+
Toggle text hints globally. A text hint is a 1-pixel line drawn around the extents of a text box. They are intended to be temporary guides.
|
5
|
+
|
6
|
+
Options
|
7
|
+
-------
|
8
|
+
|
9
|
+
text
|
10
|
+
default: ``:off``
|
11
|
+
|
12
|
+
The color of the text hint. See :doc:`/colors` To turn off use ``:off`` or ``nil``.
|
13
|
+
|
14
|
+
Examples
|
15
|
+
--------
|
data/docs/dsl/inches.rst
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
inches
|
2
|
+
------
|
3
|
+
|
4
|
+
Given inches, returns the number of pixels according to the deck's DPI.
|
5
|
+
|
6
|
+
Parameters
|
7
|
+
^^^^^^^^^^
|
8
|
+
|
9
|
+
n
|
10
|
+
the number of inches
|
11
|
+
|
12
|
+
|
13
|
+
Examples
|
14
|
+
^^^^^^^^
|
15
|
+
|
16
|
+
.. code-block:: ruby
|
17
|
+
|
18
|
+
inches(2.5) # 750 (for default Deck::dpi of 300)
|
19
|
+
inches(2.5) + inches(0.5) # 900 (for default Deck::dpi of 300)
|
data/docs/dsl/index.rst
ADDED
data/docs/dsl/line.rst
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
line
|
2
|
+
----
|
3
|
+
|
4
|
+
Draw a line from x1,y1 to x2,y2.
|
5
|
+
|
6
|
+
Options
|
7
|
+
^^^^^^^
|
8
|
+
.. include:: /args/expansion.rst
|
9
|
+
|
10
|
+
x1
|
11
|
+
default: ``0``
|
12
|
+
|
13
|
+
the x-coordinate to place. Supports :doc:`/units/`
|
14
|
+
|
15
|
+
|
16
|
+
y1
|
17
|
+
default: ``0``
|
18
|
+
|
19
|
+
the y-coordinate to place. Supports :doc:`/units/`
|
20
|
+
|
21
|
+
|
22
|
+
x2
|
23
|
+
default: ``50``
|
24
|
+
|
25
|
+
the x-coordinate to place. Supports :doc:`/units/`
|
26
|
+
|
27
|
+
|
28
|
+
y2
|
29
|
+
default: ``50``
|
30
|
+
|
31
|
+
the y-coordinate to place. Supports :doc:`/units/`
|
32
|
+
|
33
|
+
|
34
|
+
x3
|
35
|
+
default: ``0``
|
36
|
+
|
37
|
+
the x-coordinate to place. Supports :doc:`/units/`
|
38
|
+
|
39
|
+
|
40
|
+
y3
|
41
|
+
default: ``50``
|
42
|
+
|
43
|
+
the y-coordinate to place. Supports :doc:`/units/`
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
.. include:: /args/draw.rst
|
48
|
+
.. include:: /args/range.rst
|
49
|
+
.. include:: /args/layout.rst
|
50
|
+
|
51
|
+
Examples
|
52
|
+
^^^^^^^^
|
data/docs/dsl/png.rst
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
png
|
2
|
+
===
|
3
|
+
|
4
|
+
Renders PNG images.
|
5
|
+
|
6
|
+
Options
|
7
|
+
-------
|
8
|
+
.. include:: /args/expansion.rst
|
9
|
+
|
10
|
+
file
|
11
|
+
default: ``''`` (empty string)
|
12
|
+
|
13
|
+
file(s) to read in. As in :doc:`/arrays`, if this a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done for that card.
|
14
|
+
|
15
|
+
.. include:: /args/xy.rst
|
16
|
+
|
17
|
+
width
|
18
|
+
default: ``:native``
|
19
|
+
|
20
|
+
the pixel width that the image should scale to. Supports :doc:`/units`. When set to ``:native``, uses the DPI and units of the loaded SVG document. Using ``:deck`` will scale to the deck width. Using ``:scale`` will use the ``height`` to scale and keep native the aspect ratio. Scaling PNGs is not recommended for professional-looking cards, and up-scaling a PNG will throw a warning in the console (see :doc:`/config`).
|
21
|
+
|
22
|
+
height
|
23
|
+
default: ``:native``
|
24
|
+
|
25
|
+
the pixel height that the image should scale to. Supports :doc:`/units`. When set to ``:native``, uses the DPI and units of the loaded SVG document. Using ``:deck`` will scale to the deck height. Using ``:scale`` will use the ``width`` to scale and keep native the aspect ratio. Scaling PNGs is not recommended for professional-looking cards, and up-scaling a PNG will throw a warning in the console (see :doc:`/config`).
|
26
|
+
|
27
|
+
alpha
|
28
|
+
default: 1.0
|
29
|
+
|
30
|
+
the alpha-transparency percentage used to blend this image. Must be between ``0.0`` and ``1.0``
|
31
|
+
|
32
|
+
blend
|
33
|
+
default: ``:none``
|
34
|
+
|
35
|
+
the composite blend operator used when applying this image. See Blend Modes at http://cairographics.org/operators.
|
36
|
+
The possibilties include :none, :multiply, :screen, :overlay, :darken, :lighten, :color_dodge, :color_burn, :hard_light, :soft_light, :difference, :exclusion, :hsl_hue, :hsl_saturation, :hsl_color, :hsl_luminosity. String versions of these options are accepted too.
|
37
|
+
|
38
|
+
mask
|
39
|
+
default: ``nil``
|
40
|
+
|
41
|
+
Accepts a color (see :doc:`/colors`). If specified, the image will be used as a mask for the given color/gradient. Transparent pixels are ignored, opaque pixels are the given color. Note: the origin for gradient coordinates is at the given x,y, not at 0,0 as it is most other places.
|
42
|
+
|
43
|
+
.. include:: /args/transform.rst
|
44
|
+
|
45
|
+
.. include:: /args/range.rst
|
46
|
+
.. include:: /args/layout.rst
|
47
|
+
|
48
|
+
Examples
|
49
|
+
--------
|
@@ -0,0 +1,28 @@
|
|
1
|
+
polygon
|
2
|
+
-------
|
3
|
+
|
4
|
+
Draw an n-sided regular polygon, centered at x,y.
|
5
|
+
|
6
|
+
Options
|
7
|
+
^^^^^^^
|
8
|
+
.. include:: /args/expansion.rst
|
9
|
+
|
10
|
+
.. include:: /args/xy.rst
|
11
|
+
|
12
|
+
radius
|
13
|
+
default: 0
|
14
|
+
|
15
|
+
the distance from the center of the star to the inner circle of its points. Supports :doc:`/units`.
|
16
|
+
|
17
|
+
angle
|
18
|
+
default: 0
|
19
|
+
|
20
|
+
the angle at which to rotate the star
|
21
|
+
|
22
|
+
|
23
|
+
.. include:: /args/draw.rst
|
24
|
+
.. include:: /args/range.rst
|
25
|
+
.. include:: /args/layout.rst
|
26
|
+
|
27
|
+
Examples
|
28
|
+
^^^^^^^^
|
data/docs/dsl/rect.rst
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
rect
|
2
|
+
----
|
3
|
+
|
4
|
+
Draw a rounded rectangle
|
5
|
+
|
6
|
+
Options
|
7
|
+
^^^^^^^
|
8
|
+
.. include:: /args/expansion.rst
|
9
|
+
|
10
|
+
.. include:: /args/xy.rst
|
11
|
+
.. include:: /args/wh.rst
|
12
|
+
.. include:: /args/draw.rst
|
13
|
+
.. include:: /args/range.rst
|
14
|
+
.. include:: /args/layout.rst
|
15
|
+
|
16
|
+
|
17
|
+
Examples
|
18
|
+
^^^^^^^^
|
data/docs/dsl/save.rst
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
save
|
2
|
+
====
|
3
|
+
|
4
|
+
Saves the given range of cards to either PNG or PDF. Wrapper method for other save methods.
|
5
|
+
|
6
|
+
Options
|
7
|
+
-------
|
8
|
+
|
9
|
+
This method delegates everything to :doc:`save_png` or :doc:`save_pdf` using the ``format`` option. All other options are passed along.
|
10
|
+
|
11
|
+
format
|
12
|
+
default: ``[]`` (do nothing)
|
13
|
+
|
14
|
+
Use ``:png`` to save as a PNG, and ``:pdf`` to save as PDF. To save to both at once, use ``[:png, :pdf]``
|
15
|
+
|
16
|
+
Examples
|
17
|
+
--------
|
18
|
+
|
19
|
+
::
|
20
|
+
|
21
|
+
save format: :png, prefix: 'front_' # same as: save_png prefix: 'front_'
|
22
|
+
save format: :pdf, prefix: 'cards_' # same as: save_pdf prefix: 'cards_'
|
23
|
+
save format: [:png, :pdf] # same as: save_png; save_pdf
|
@@ -0,0 +1,48 @@
|
|
1
|
+
save_pdf
|
2
|
+
========
|
3
|
+
|
4
|
+
Lays out the cards in range on a sheet and renders a PDF
|
5
|
+
|
6
|
+
Options
|
7
|
+
-------
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
file
|
12
|
+
default: ``'output.pdf'``
|
13
|
+
|
14
|
+
the name of the PDF file to save. Will be overwritten without warning.
|
15
|
+
|
16
|
+
dir
|
17
|
+
default: ``_output``
|
18
|
+
|
19
|
+
the directory to save to. Created if it doesn't exist.
|
20
|
+
|
21
|
+
width
|
22
|
+
default: ``3300``
|
23
|
+
|
24
|
+
the height of the page in pixels. Default is 11in * 300dpi. Supports :doc:`/units`.
|
25
|
+
|
26
|
+
height
|
27
|
+
default: ``2550``
|
28
|
+
|
29
|
+
the height of the page in pixels. Default is 8.5in * 300dpi. Supports :doc:`/units`.
|
30
|
+
|
31
|
+
margin
|
32
|
+
default: ``75``
|
33
|
+
|
34
|
+
the margin around the outside of the page. Supports :doc:`/units`.
|
35
|
+
|
36
|
+
gap
|
37
|
+
default: ``0``
|
38
|
+
|
39
|
+
the space in pixels between the cards. Supports :doc:`/units`.
|
40
|
+
|
41
|
+
trim
|
42
|
+
default: ``0``
|
43
|
+
|
44
|
+
the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play). Supports :doc:`/units`.
|
45
|
+
|
46
|
+
|
47
|
+
Examples
|
48
|
+
--------
|
@@ -0,0 +1,46 @@
|
|
1
|
+
save_png
|
2
|
+
========
|
3
|
+
|
4
|
+
Saves the given range of cards to a PNG
|
5
|
+
|
6
|
+
Options
|
7
|
+
-------
|
8
|
+
|
9
|
+
|
10
|
+
range
|
11
|
+
default ``:all``
|
12
|
+
|
13
|
+
the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
14
|
+
|
15
|
+
dir
|
16
|
+
default: ``'_output'``
|
17
|
+
|
18
|
+
the directory for the output to be sent to. Will be created if it doesn't exist.
|
19
|
+
|
20
|
+
prefix
|
21
|
+
default ``'card_'``
|
22
|
+
|
23
|
+
the prefix of the file name to be printed.
|
24
|
+
|
25
|
+
count_format
|
26
|
+
default: ``'%02d'``
|
27
|
+
|
28
|
+
the format string used for formatting the card count (e.g. padding zeros). Uses a Ruby format string (see the Ruby doc for ``Kernel::sprintf`` for specifics)
|
29
|
+
|
30
|
+
rotate
|
31
|
+
default: ``false``
|
32
|
+
|
33
|
+
If ``true``, the saved cards will be rotated 90 degrees clockwise. Or, rotate by the number of radians. Intended to rendering landscape instead of portrait. Possible values: ``true``, ``false``, ``:clockwise``, ``:counterclockwise``
|
34
|
+
|
35
|
+
trim
|
36
|
+
default: ``0``
|
37
|
+
|
38
|
+
the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play). Supports :doc:`/units`.
|
39
|
+
|
40
|
+
trim_radius
|
41
|
+
default: ``0``
|
42
|
+
|
43
|
+
the rounded rectangle radius around the card to trim before saving.
|
44
|
+
|
45
|
+
Examples
|
46
|
+
--------
|