Browse Source

docs: port more saves, other revisions

dev
Andy Meneely 10 years ago
parent
commit
26091974cb
  1. 4
      docs/dsl/polygon.rst
  2. 46
      docs/dsl/save_pdf.rst
  3. 44
      docs/dsl/save_png.rst
  4. 55
      docs/dsl/save_sheet.rst
  5. 119
      docs/dsl/svg.rst
  6. 2
      docs/dsl/xlsx.rst

4
docs/dsl/polygon.rst

@ -1,5 +1,5 @@
star polygon
---- -------
Draw an n-sided regular polygon, centered at x,y. Draw an n-sided regular polygon, centered at x,y.

46
docs/dsl/save_pdf.rst

@ -1,2 +1,48 @@
save_pdf save_pdf
========
Lays out the cards in range on a sheet and renders a PDF
Options
-------
file
default: ``'output.pdf'``
the name of the PDF file to save. Will be overwritten without warning.
dir
default: ``_output``
the directory to save to. Created if it doesn't exist.
width
default: ``3300``
the height of the page in pixels. Default is 11in * 300dpi. Supports :doc:`/units`.
height
default: ``2550``
the height of the page in pixels. Default is 8.5in * 300dpi. Supports :doc:`/units`.
margin
default: ``75``
the margin around the outside of the page. Supports :doc:`/units`.
gap
default: ``0``
the space in pixels between the cards. Supports :doc:`/units`.
trim
default: ``0``
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`.
Examples
-------- --------

44
docs/dsl/save_png.rst

@ -1,2 +1,46 @@
save_png save_png
========
Saves the given range of cards to a PNG
Options
-------
range
default ``:all``
the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
dir
default: ``'_output'``
the directory for the output to be sent to. Will be created if it doesn't exist.
prefix
default ``'card_'``
the prefix of the file name to be printed.
count_format
default: ``'%02d'``
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)
rotate
default: ``false``
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``
trim
default: ``0``
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`.
trim_radius
default: ``0``
the rounded rectangle radius around the card to trim before saving.
Examples
-------- --------

55
docs/dsl/save_sheet.rst

@ -1,2 +1,55 @@
save_sheet save_sheet
---------- ==========
Lays out the cards in range and renders a stitched PNG sheet
Options
-------
range
default: ``:all``
the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
columns
default: ``5``
the number of columns in the grid. Must be an integer
rows
default: ``:infinite``
the number of rows in the grid. When set to :infinite, the sheet scales to the rows needed. If there are more cards than rows*columns, new sheets are started.
prefix
default: ``card_``
the prefix of the file name(s)
count_format
default: ``'%02d'``
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)
dir
default: ``'_output'``
the directory to save to. Created if it doesn't exist.
margin
default: ``0``
the margin around the outside of the sheet. Supports :doc:`/units`.
gap
default ``0``
the space in pixels between the cards. Supports :doc:`/units`.
trim
default ``0``
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`.
Examples
--------

119
docs/dsl/svg.rst

@ -1,2 +1,119 @@
svg svg
--- ===
Renders an entire svg file at the given location. Uses the SVG-specified units and DPI to determine the pixel width and height. If neither data nor file are specified for a given card, this method does nothing.
.. note::
Note: if alpha transparency is desired, set that in the SVG.
Options
-------
.. include:: /args/expansion.rst
file
default: ``''`` (empty string)
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.
.. include:: /args/xy.rst
range
default: ``all``
the range of cards over which this will be rendered. See :doc:`/arrays`
data
default: ``nil``
render from an SVG XML string. Overrides ``file`` if both are specified (a warning is shown).
id
default: ``nil``
if set, then only render the SVG element with the given id. Prefix '#' is optional. Note: the x-y coordinates are still relative to the SVG document's page.
force_id
default: ``false``
if set to ``true``, then this svg will not be rendered at all if the id is empty or nil. If not set, the entire SVG is rendered. Useful for putting multple icons in a single SVG file.
width
default: ``native``
the pixel width that the image should scale to. Setting this to ``:deck`` will scale to the deck height. ``:scale`` will use the width to scale and keep native the aspect ratio. SVG scaling is done with vectors, so the scaling should be smooth. When set to ``:native``, uses the DPI and units of the loaded SVG document.
height
default: ``:native``
the pixel width that the image should scale to. ``:deck`` will scale to the deck height. ``:scale`` will use the width to scale and keep native the aspect ratio. SVG scaling is done with vectors, so the scaling should be smooth. When set to ``:native``, uses the DPI and units of the loaded SVG document.
blend
default: ``:none``
the composite blend operator used when applying this image. See Blend Modes at http://cairographics.org/operators.
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.
angle
default: ``0``
rotation of the image in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky.
mask
default: ``nil``
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.
crop_x
default: ``0``
rop the loaded image at this x coordinate. Supports :doc:`/units`
crop_y
default: ``0``
rop the loaded image at this y coordinate. Supports :doc:`/units`
crop_corner_radius
default: ``0``
Radius for rounded corners, both x and y. When set, overrides crop_corner_x_radius and crop_corner_y_radius. Supports :doc:`/units`
crop_corner_x_radius
default: ``0``
x radius for rounded corners of cropped image. Supports :doc:`/units`
crop_corner_y_radius
default: ``0``
y radius for rounded corners of cropped image. Supports :doc:`/units`
crop_width
default: ``0``
width of the cropped image. Supports :doc:`/units`
crop_height
default: ``0``
ive): Height of the cropped image. Supports :doc:`/units`
flip_horiztonal
default: ``false``
Flip this image about its center horizontally (i.e. left becomes right and vice versa).
flip_vertical
default: ``false``
Flip this image about its center verticall (i.e. top becomes bottom and vice versa).
.. include:: /args/range.rst
.. include:: /args/layout.rst
Examples
--------

2
docs/dsl/xlsx.rst

@ -3,7 +3,7 @@ xlsx
Pulls ExcelX data from .xlsx files into a hash of arrays keyed by the headers. First row is assumed to be the header row. Pulls ExcelX data from .xlsx files into a hash of arrays keyed by the headers. First row is assumed to be the header row.
The ``csv`` method is a member of ``Squib::Deck``, but it is also available outside of the Deck DSL with ``Squib.csv()``. This allows a construction like:: The ``xlsx`` method is a member of ``Squib::Deck``, but it is also available outside of the Deck DSL with ``Squib.xlsx()``. This allows a construction like::
data = Squib.xlsx file: 'data.xlsx' data = Squib.xlsx file: 'data.xlsx'
Squib::Deck.new(cards: data['name'].size) do Squib::Deck.new(cards: data['name'].size) do

Loading…
Cancel
Save