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
data/lib/squib/layouts/hand.yml
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
# A layout designed for a card to be held in your hand.
|
2
|
-
# * Bonuses align along the left-hand side.
|
3
|
-
# * Title along the top.
|
4
|
-
# * Middle area for artwork,
|
5
|
-
# * Room for a text description
|
6
|
-
# * And some theme-based text (which I like call the "snark")
|
7
|
-
# Along the lines of Race for the Galaxy or 7 Wonders
|
8
|
-
# Based on TheGameCrafter.com's Poker Card, which is 825x1125
|
9
|
-
# Sample usage is found in samples/layouts.rb
|
10
|
-
title:
|
11
|
-
x: 275
|
12
|
-
y: 75
|
13
|
-
width: 475
|
14
|
-
height: 125
|
15
|
-
art:
|
16
|
-
x: 275
|
17
|
-
y: 225
|
18
|
-
width: 475
|
19
|
-
height: 475
|
20
|
-
description:
|
21
|
-
x: 275
|
22
|
-
y: 725
|
23
|
-
width: 475
|
24
|
-
height: 200
|
25
|
-
snark:
|
26
|
-
x: 275
|
27
|
-
y: 950
|
28
|
-
width: 475
|
29
|
-
height: 100
|
30
|
-
bonus1:
|
31
|
-
x: 75
|
32
|
-
y: 75
|
33
|
-
width: 175
|
34
|
-
height: 175
|
35
|
-
bonus2:
|
36
|
-
extends: bonus1
|
37
|
-
y: += 198
|
38
|
-
bonus3:
|
39
|
-
extends: bonus2
|
40
|
-
y: += 198
|
41
|
-
bonus4:
|
42
|
-
extends: bonus3
|
43
|
-
y: += 198
|
44
|
-
bonus5:
|
45
|
-
extends: bonus4
|
46
|
-
y: += 198
|
47
|
-
|
48
|
-
# The "cut line", without rounded corners
|
49
|
-
cut:
|
50
|
-
x: 37.5
|
51
|
-
y: 37.5
|
52
|
-
width: 750
|
53
|
-
height: 1050
|
54
|
-
|
55
|
-
# The "safe zone" as defined by TheGameCrafter poker cards
|
56
|
-
safe:
|
57
|
-
x: 75
|
58
|
-
y: 75
|
59
|
-
width: 675
|
60
|
-
height: 975
|
61
|
-
radius: 16
|
62
|
-
dash: 3 3
|
1
|
+
# A layout designed for a card to be held in your hand.
|
2
|
+
# * Bonuses align along the left-hand side.
|
3
|
+
# * Title along the top.
|
4
|
+
# * Middle area for artwork,
|
5
|
+
# * Room for a text description
|
6
|
+
# * And some theme-based text (which I like call the "snark")
|
7
|
+
# Along the lines of Race for the Galaxy or 7 Wonders
|
8
|
+
# Based on TheGameCrafter.com's Poker Card, which is 825x1125
|
9
|
+
# Sample usage is found in samples/layouts.rb
|
10
|
+
title:
|
11
|
+
x: 275
|
12
|
+
y: 75
|
13
|
+
width: 475
|
14
|
+
height: 125
|
15
|
+
art:
|
16
|
+
x: 275
|
17
|
+
y: 225
|
18
|
+
width: 475
|
19
|
+
height: 475
|
20
|
+
description:
|
21
|
+
x: 275
|
22
|
+
y: 725
|
23
|
+
width: 475
|
24
|
+
height: 200
|
25
|
+
snark:
|
26
|
+
x: 275
|
27
|
+
y: 950
|
28
|
+
width: 475
|
29
|
+
height: 100
|
30
|
+
bonus1:
|
31
|
+
x: 75
|
32
|
+
y: 75
|
33
|
+
width: 175
|
34
|
+
height: 175
|
35
|
+
bonus2:
|
36
|
+
extends: bonus1
|
37
|
+
y: += 198
|
38
|
+
bonus3:
|
39
|
+
extends: bonus2
|
40
|
+
y: += 198
|
41
|
+
bonus4:
|
42
|
+
extends: bonus3
|
43
|
+
y: += 198
|
44
|
+
bonus5:
|
45
|
+
extends: bonus4
|
46
|
+
y: += 198
|
47
|
+
|
48
|
+
# The "cut line", without rounded corners
|
49
|
+
cut:
|
50
|
+
x: 37.5
|
51
|
+
y: 37.5
|
52
|
+
width: 750
|
53
|
+
height: 1050
|
54
|
+
|
55
|
+
# The "safe zone" as defined by TheGameCrafter poker cards
|
56
|
+
safe:
|
57
|
+
x: 75
|
58
|
+
y: 75
|
59
|
+
width: 675
|
60
|
+
height: 975
|
61
|
+
radius: 16
|
62
|
+
dash: 3 3
|
@@ -1,35 +1,35 @@
|
|
1
|
-
# A basic playing card layout with bonuses in the upper-left and lower-right.
|
2
|
-
# The lower-right angle is rotated for text.
|
3
|
-
bonus_ul:
|
4
|
-
x: 75
|
5
|
-
y: 75
|
6
|
-
width: 200
|
7
|
-
height: 200
|
8
|
-
bonus_lr:
|
9
|
-
extends: bonus_ul
|
10
|
-
x: 750
|
11
|
-
y: 1050
|
12
|
-
angle: 3.14159
|
13
|
-
art:
|
14
|
-
x: 150
|
15
|
-
y: 275
|
16
|
-
width: 525
|
17
|
-
height: 575
|
18
|
-
valign: middle
|
19
|
-
align: center
|
20
|
-
|
21
|
-
# The "cut line", without rounded corners
|
22
|
-
cut:
|
23
|
-
x: 37.5
|
24
|
-
y: 37.5
|
25
|
-
width: 750
|
26
|
-
height: 1050
|
27
|
-
|
28
|
-
# The "safe zone" as defined by TheGameCrafter poker cards
|
29
|
-
safe:
|
30
|
-
x: 75
|
31
|
-
y: 75
|
32
|
-
width: 675
|
33
|
-
height: 975
|
34
|
-
radius: 16
|
35
|
-
dash: 3 3
|
1
|
+
# A basic playing card layout with bonuses in the upper-left and lower-right.
|
2
|
+
# The lower-right angle is rotated for text.
|
3
|
+
bonus_ul:
|
4
|
+
x: 75
|
5
|
+
y: 75
|
6
|
+
width: 200
|
7
|
+
height: 200
|
8
|
+
bonus_lr:
|
9
|
+
extends: bonus_ul
|
10
|
+
x: 750
|
11
|
+
y: 1050
|
12
|
+
angle: 3.14159
|
13
|
+
art:
|
14
|
+
x: 150
|
15
|
+
y: 275
|
16
|
+
width: 525
|
17
|
+
height: 575
|
18
|
+
valign: middle
|
19
|
+
align: center
|
20
|
+
|
21
|
+
# The "cut line", without rounded corners
|
22
|
+
cut:
|
23
|
+
x: 37.5
|
24
|
+
y: 37.5
|
25
|
+
width: 750
|
26
|
+
height: 1050
|
27
|
+
|
28
|
+
# The "safe zone" as defined by TheGameCrafter poker cards
|
29
|
+
safe:
|
30
|
+
x: 75
|
31
|
+
y: 75
|
32
|
+
width: 675
|
33
|
+
height: 975
|
34
|
+
radius: 16
|
35
|
+
dash: 3 3
|
@@ -1,46 +1,46 @@
|
|
1
|
-
## Rectangles correspond to the "safe zones" as defined by TheGameCrafter for tuck boxes 2325x1950 pixels
|
2
|
-
top_rect:
|
3
|
-
x: 313
|
4
|
-
y: 198
|
5
|
-
width: 688
|
6
|
-
height: 167
|
7
|
-
|
8
|
-
bottom_rect:
|
9
|
-
x: 313
|
10
|
-
y: 1526
|
11
|
-
width: 688
|
12
|
-
height: 167
|
13
|
-
|
14
|
-
right_rect:
|
15
|
-
x: 77
|
16
|
-
y: 466
|
17
|
-
width: 164
|
18
|
-
height: 988
|
19
|
-
|
20
|
-
left_rect:
|
21
|
-
x: 1080
|
22
|
-
y: 466
|
23
|
-
width: 164
|
24
|
-
height: 988
|
25
|
-
|
26
|
-
back_rect:
|
27
|
-
x: 313
|
28
|
-
y: 466
|
29
|
-
width: 688
|
30
|
-
height: 989
|
31
|
-
|
32
|
-
front_rect:
|
33
|
-
x: 1322
|
34
|
-
y: 466
|
35
|
-
width: 688
|
36
|
-
height: 989
|
37
|
-
|
38
|
-
front_curve:
|
39
|
-
x1: 1550
|
40
|
-
y1: 466
|
41
|
-
x2: 1765
|
42
|
-
y2: 466
|
43
|
-
cx1: 1575
|
44
|
-
cy1: 565
|
45
|
-
cx2: 1740
|
1
|
+
## Rectangles correspond to the "safe zones" as defined by TheGameCrafter for tuck boxes 2325x1950 pixels
|
2
|
+
top_rect:
|
3
|
+
x: 313
|
4
|
+
y: 198
|
5
|
+
width: 688
|
6
|
+
height: 167
|
7
|
+
|
8
|
+
bottom_rect:
|
9
|
+
x: 313
|
10
|
+
y: 1526
|
11
|
+
width: 688
|
12
|
+
height: 167
|
13
|
+
|
14
|
+
right_rect:
|
15
|
+
x: 77
|
16
|
+
y: 466
|
17
|
+
width: 164
|
18
|
+
height: 988
|
19
|
+
|
20
|
+
left_rect:
|
21
|
+
x: 1080
|
22
|
+
y: 466
|
23
|
+
width: 164
|
24
|
+
height: 988
|
25
|
+
|
26
|
+
back_rect:
|
27
|
+
x: 313
|
28
|
+
y: 466
|
29
|
+
width: 688
|
30
|
+
height: 989
|
31
|
+
|
32
|
+
front_rect:
|
33
|
+
x: 1322
|
34
|
+
y: 466
|
35
|
+
width: 688
|
36
|
+
height: 989
|
37
|
+
|
38
|
+
front_curve:
|
39
|
+
x1: 1550
|
40
|
+
y1: 466
|
41
|
+
x2: 1765
|
42
|
+
y2: 466
|
43
|
+
cx1: 1575
|
44
|
+
cy1: 565
|
45
|
+
cx2: 1740
|
46
46
|
cy2: 565
|
data/lib/squib/sample_helpers.rb
CHANGED
data/lib/squib/version.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'squib'
|
2
2
|
|
3
3
|
# Our SVGs are auto-saved after each step using the configuration parameters
|
4
|
-
Squib::Deck.new(cards: 2, config: '
|
4
|
+
Squib::Deck.new(cards: 2, config: '_backend-config.yml') do
|
5
5
|
|
6
6
|
# These are all supported by the SVG backend
|
7
7
|
background color: :gray
|
8
|
-
text str:
|
8
|
+
text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 72', align: :center
|
9
9
|
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
|
10
10
|
circle x: 100, y: 400, radius: 25
|
11
11
|
triangle x1: 100, y1: 425, x2: 125, y2: 475, x3: 75, y3: 475
|
data/samples/basic.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'squib'
|
2
2
|
|
3
|
-
data = {'name' => ['Thief', 'Grifter', 'Mastermind'],
|
4
|
-
'level' => [1,2,3]}
|
3
|
+
data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
|
4
|
+
'level' => [1, 2, 3] }
|
5
5
|
|
6
6
|
Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
7
7
|
background color: :white
|
@@ -12,7 +12,7 @@ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
|
|
12
12
|
text str: data['level'], x: 75, y: 85, width: 128,
|
13
13
|
font: 'Arial 72', align: :center
|
14
14
|
|
15
|
-
png range: [0,2], file: 'shiny-purse.png', x: 620, y: 75
|
15
|
+
png range: [0, 2], file: 'shiny-purse.png', x: 620, y: 75
|
16
16
|
svg range: 1..2, file: 'spanner.svg', x: 620, y: 218
|
17
17
|
|
18
18
|
save prefix: 'basic_', format: :png
|
data/samples/bug134.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'squib'
|
2
|
+
require 'game_icons'
|
3
|
+
|
4
|
+
Squib::Deck.new(cards: 1) do
|
5
|
+
rect
|
6
|
+
text str: 'foo', x: 275, y: 75, width: 500, height: 500, valign: :middle, hint: :blue
|
7
|
+
text(str: '(heart)(heart2)',
|
8
|
+
x: 75, y: 75, width: 500, height: 500,
|
9
|
+
valign: :middle, hint: :red) do |embed|
|
10
|
+
embed.svg key: '(heart)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
|
11
|
+
embed.svg key: '(heart2)', width: 50, height: 50, data: GameIcons.get('glass-heart').string
|
12
|
+
end
|
13
|
+
save_png prefix: 'bug_134_'
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'squib'
|
2
|
+
|
3
|
+
Squib::Deck.new(width: 75, height: 75, cards: 2) do
|
4
|
+
# puts "Groups enabled by environment: #{groups.to_a}"
|
5
|
+
|
6
|
+
text str: ['A', 'B']
|
7
|
+
|
8
|
+
build :print_n_play do
|
9
|
+
rect
|
10
|
+
save_sheet dir: '.', prefix: 'build_groups_bw_'
|
11
|
+
end
|
12
|
+
|
13
|
+
build :color do
|
14
|
+
rect stroke_color: :red, dash: '5 5'
|
15
|
+
save_png dir: '.', prefix: 'build_groups_color_'
|
16
|
+
end
|
17
|
+
|
18
|
+
build :test do
|
19
|
+
save_png range: 0, dir: '.', prefix: 'build_groups_'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
# Here's how you can run this on the command line:
|
25
|
+
#
|
26
|
+
# --- OSX/Linux (bash or similar shells) ---
|
27
|
+
# $ ruby build_groups.rb
|
28
|
+
# $ SQUIB_BUILD=color ruby build_groups.rb
|
29
|
+
# $ SQUIB_BUILD=print_n_play,test ruby build_groups.rb
|
30
|
+
#
|
31
|
+
# --- Windows CMD ---
|
32
|
+
# $ ruby build_groups.rb
|
33
|
+
# $ set SQUIB_BUILD=color && ruby build_groups.rb
|
34
|
+
# $ set SQUIB_BUILD=print_n_play,test && ruby build_groups.rb
|
35
|
+
#
|
36
|
+
# Or, better yet... use a Rakefile like the one provided in this gist!
|
data/samples/cairo_access.rb
CHANGED
@@ -24,5 +24,16 @@ Squib::Deck.new(cards: 2) do
|
|
24
24
|
cairo_context.fill
|
25
25
|
end
|
26
26
|
|
27
|
+
# Or modify the coordinate system for all (most?) future calls
|
28
|
+
# Could be handy for a dynamic bleed
|
29
|
+
each do |card|
|
30
|
+
# note how this does NOT use save/restore.
|
31
|
+
# again... this "feature" lives in the Land of Undefined Behavior
|
32
|
+
card.cairo_context.translate(500, 500)
|
33
|
+
end
|
34
|
+
rect x: 0, y: 0, # actually 500, 500
|
35
|
+
width: 50, height: 50, fill_color: :red
|
36
|
+
|
37
|
+
|
27
38
|
save_png prefix: 'cairo_access_'
|
28
|
-
end
|
39
|
+
end
|
@@ -4,15 +4,15 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
|
4
4
|
background color: :white
|
5
5
|
|
6
6
|
y = 0
|
7
|
-
text color: '#f00', str: '3-hex', x: 50, y: y+=50
|
8
|
-
text color: '#f00', str: '3-hex (alpha)', x: 50, y: y+=50
|
9
|
-
text color: '#ff0000', str: '6-hex', x: 50, y: y+=50
|
10
|
-
text color: '#ff000099', str: '8-hex(alpha)', x: 50, y: y+=50
|
11
|
-
text color: '#ffff00000000', str: '12-hex', x: 50, y: y+=50
|
12
|
-
text color: '#ffff000000009999', str: '12-hex (alpha)', x: 50, y: y+=50
|
13
|
-
text color: :burnt_orange, str: 'Symbols of constants too', x: 50, y: y+=50
|
14
|
-
text color: '(0,0)(400,0) blue@0.0 red@1.0', str: 'Linear gradients!', x: 50, y: y+=50
|
15
|
-
text color: '(200,500,10)(200,500,100) blue@0.0 red@1.0', str: 'Radial gradients!', x: 50, y: y+=50
|
7
|
+
text color: '#f00', str: '3-hex', x: 50, y: y += 50
|
8
|
+
text color: '#f00', str: '3-hex (alpha)', x: 50, y: y += 50
|
9
|
+
text color: '#ff0000', str: '6-hex', x: 50, y: y += 50
|
10
|
+
text color: '#ff000099', str: '8-hex(alpha)', x: 50, y: y += 50
|
11
|
+
text color: '#ffff00000000', str: '12-hex', x: 50, y: y += 50
|
12
|
+
text color: '#ffff000000009999', str: '12-hex (alpha)', x: 50, y: y += 50
|
13
|
+
text color: :burnt_orange, str: 'Symbols of constants too', x: 50, y: y += 50
|
14
|
+
text color: '(0,0)(400,0) blue@0.0 red@1.0', str: 'Linear gradients!', x: 50, y: y += 50
|
15
|
+
text color: '(200,500,10)(200,500,100) blue@0.0 red@1.0', str: 'Radial gradients!', x: 50, y: y += 50
|
16
16
|
# see gradients.rb sample for more on gradients
|
17
17
|
|
18
18
|
save_png prefix: 'colors_'
|
@@ -22,11 +22,11 @@ end
|
|
22
22
|
Squib::Deck.new(width: 3000, height: 1500) do
|
23
23
|
colors = (Cairo::Color.constants - %i(HEX_RE Base RGB CMYK HSV X11))
|
24
24
|
colors.sort_by! {|c| Cairo::Color.parse(c).to_s}
|
25
|
-
x,y,w,h = 0,0,300,50
|
25
|
+
x, y, w, h = 0, 0, 300, 50
|
26
26
|
colors.each_with_index do |color, i|
|
27
27
|
rect x: x, y: y, width: w, height: h, fill_color: color
|
28
|
-
text str: color.to_s, x: x + 5, y: y+13, font: 'Sans Bold 16',
|
29
|
-
color: (Cairo::Color.parse(color).to_hsv.v > 0.9) ? '#000': '#fff'
|
28
|
+
text str: color.to_s, x: x + 5, y: y + 13, font: 'Sans Bold 16',
|
29
|
+
color: (Cairo::Color.parse(color).to_hsv.v > 0.9) ? '#000' : '#fff'
|
30
30
|
y += h
|
31
31
|
if y > @height
|
32
32
|
x += w
|