Creating new files for readthedocs port

dev
Andy Meneely 2016-01-24 00:55:23 -05:00
parent dcf838b500
commit fa10c82ee8
28 changed files with 99 additions and 32 deletions

28
docs/colors.rst Normal file
View File

@ -0,0 +1,28 @@
Specifying Colors & Gradients
=============================
Colors can be specified in a wide variety of ways, mostly in a hex-string. Take a look at the examples from `samples/colors.rb`, found [here](https://github.com/andymeneely/squib/tree/master/samples/colors.rb)
{include:file:samples/colors.rb}
Under the hood, Squib uses the `rcairo` [color parser](https://github.com/rcairo/rcairo/blob/master/lib/cairo/color.rb) to accept a variety of color specifications, along with over [300 pre-defined constants](https://github.com/rcairo/rcairo/blob/master/lib/cairo/colors.rb). The above sample will generate a table of such constants.
Additionally, in most places where colors are allowed, you may also supply a string that defines a gradient. Squib supports two flavors of gradients: linear and radial. Gradients are specified by supplying some xy coordinates, which are relative to the card (not the command). Each stop must be between 0.0 and 1.0, and you can supply as many as you like. Colors can be specified as above (in any of the hex notations or built-in constant). If you add two (or more) colors at the same stop, then the gradient keeps the colors in the in order specified and treats it like sharp transition.
The format for gradient strings look like this:
Linear:
```
(x1,y1)(x2,y2) color1@stop1 color2@stop2
```
The xy coordinates define the angle of the gradient.
Radial:
```
(x1,y1,radius1)(x2,y2,radius2) color1@stop1 color2@stop2
```
The coordinates specify an inner circle first, then an outer circle.
Check out the following sample from `samples/gradients.rb`, found [here](https://github.com/andymeneely/squib/tree/master/samples/colors.rb)
{include:file:samples/gradients.rb}

2
docs/dsl/circle.rst Normal file
View File

@ -0,0 +1,2 @@
circle
------

2
docs/dsl/cm.rst Normal file
View File

@ -0,0 +1,2 @@
cm
--

2
docs/dsl/csv.rst Normal file
View File

@ -0,0 +1,2 @@
csv
---

2
docs/dsl/curve.rst Normal file
View File

@ -0,0 +1,2 @@
curve
-----

2
docs/dsl/ellipse.rst Normal file
View File

@ -0,0 +1,2 @@
ellipse
-------

2
docs/dsl/grid.rst Normal file
View File

@ -0,0 +1,2 @@
grid
----

2
docs/dsl/hand.rst Normal file
View File

@ -0,0 +1,2 @@
hand
----

2
docs/dsl/hint.rst Normal file
View File

@ -0,0 +1,2 @@
hint
----

2
docs/dsl/inches.rst Normal file
View File

@ -0,0 +1,2 @@
inches
------

View File

@ -5,33 +5,4 @@ DSL Reference
:maxdepth: 1
:glob:
*
background
circle
cm
csv
curve
ellipse
grid
hand
hint
inches
initialize
line
png
png
polygon
rect
save
save_pdf
save_png
save_sheet
set
showcase
star
stroke_outline
svg
text
triangle
xlsx
/dsl/*

2
docs/dsl/line.rst Normal file
View File

@ -0,0 +1,2 @@
line
----

2
docs/dsl/png.rst Normal file
View File

@ -0,0 +1,2 @@
png
---

2
docs/dsl/polygon.rst Normal file
View File

@ -0,0 +1,2 @@
polygon
-------

2
docs/dsl/rect.rst Normal file
View File

@ -0,0 +1,2 @@
rect
----

2
docs/dsl/save.rst Normal file
View File

@ -0,0 +1,2 @@
save
----

2
docs/dsl/save_pdf.rst Normal file
View File

@ -0,0 +1,2 @@
save_pdf
--------

2
docs/dsl/save_png.rst Normal file
View File

@ -0,0 +1,2 @@
save_png
--------

2
docs/dsl/save_sheet.rst Normal file
View File

@ -0,0 +1,2 @@
save_sheet
----------

2
docs/dsl/set.rst Normal file
View File

@ -0,0 +1,2 @@
set
---

2
docs/dsl/showcase.rst Normal file
View File

@ -0,0 +1,2 @@
showcase
--------

2
docs/dsl/star.rst Normal file
View File

@ -0,0 +1,2 @@
star
----

2
docs/dsl/svg.rst Normal file
View File

@ -0,0 +1,2 @@
svg
---

2
docs/dsl/triangle.rst Normal file
View File

@ -0,0 +1,2 @@
triangle
--------

2
docs/dsl/xlsx.rst Normal file
View File

@ -0,0 +1,2 @@
xlsx
----

View File

@ -8,9 +8,12 @@ Contents:
:maxdepth: 1
:glob:
dsl/index.rst
units
learning
parameters
range
units
colors
dsl/index.rst
Indices and tables
==================

2
docs/learning.rst Normal file
View File

@ -0,0 +1,2 @@
Learning Squib
--------------

17
docs/parameters.rst Normal file
View File

@ -0,0 +1,17 @@
Parameters are Options
======================
Squib is all about sane defaults and shorthand specification. Arguments to DSL methods are almost always using hashes, which look a lot like [Ruby 2.0's named parameters](http://www.ruby-doc.org/core-2.0.0/doc/syntax/calling_methods_rdoc.html#label-Keyword+Arguments). This means you can specify your parameters in any order you please. All parameters are optional.
For example `x` and `y` default to 0 (i.e. the upper-left corner of the card). Any parameter that is specified in the command overrides any Squib defaults, `config.yml` settings, or layout rules.
Note: you MUST use named parameters rather than positional parameters. For example: ``save :png`` will lead to an error like this::
C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/api/save.rb:12:in `save': wrong number of arguments (2 for 0..1) (ArgumentError)
from deck.rb:22:in `block in <main>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/deck.rb:60:in `instance_eval'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/deck.rb:60:in `initialize'
from deck.rb:18:in `new'
from deck.rb:18:in `<main>'
Instead, you must name the parameters: `save format: :png`