Browse Source

Creating new files for readthedocs port

dev
Andy Meneely 10 years ago
parent
commit
fa10c82ee8
  1. 28
      docs/colors.rst
  2. 2
      docs/dsl/circle.rst
  3. 2
      docs/dsl/cm.rst
  4. 2
      docs/dsl/csv.rst
  5. 2
      docs/dsl/curve.rst
  6. 2
      docs/dsl/ellipse.rst
  7. 2
      docs/dsl/grid.rst
  8. 2
      docs/dsl/hand.rst
  9. 2
      docs/dsl/hint.rst
  10. 2
      docs/dsl/inches.rst
  11. 31
      docs/dsl/index.rst
  12. 2
      docs/dsl/line.rst
  13. 2
      docs/dsl/png.rst
  14. 2
      docs/dsl/polygon.rst
  15. 2
      docs/dsl/rect.rst
  16. 2
      docs/dsl/save.rst
  17. 2
      docs/dsl/save_pdf.rst
  18. 2
      docs/dsl/save_png.rst
  19. 2
      docs/dsl/save_sheet.rst
  20. 2
      docs/dsl/set.rst
  21. 2
      docs/dsl/showcase.rst
  22. 2
      docs/dsl/star.rst
  23. 2
      docs/dsl/svg.rst
  24. 2
      docs/dsl/triangle.rst
  25. 2
      docs/dsl/xlsx.rst
  26. 7
      docs/index.rst
  27. 2
      docs/learning.rst
  28. 17
      docs/parameters.rst

28
docs/colors.rst

@ -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

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

2
docs/dsl/cm.rst

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

2
docs/dsl/csv.rst

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

2
docs/dsl/curve.rst

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

2
docs/dsl/ellipse.rst

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

2
docs/dsl/grid.rst

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

2
docs/dsl/hand.rst

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

2
docs/dsl/hint.rst

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

2
docs/dsl/inches.rst

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

31
docs/dsl/index.rst

@ -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

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

2
docs/dsl/png.rst

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

2
docs/dsl/polygon.rst

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

2
docs/dsl/rect.rst

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

2
docs/dsl/save.rst

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

2
docs/dsl/save_pdf.rst

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

2
docs/dsl/save_png.rst

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

2
docs/dsl/save_sheet.rst

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

2
docs/dsl/set.rst

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

2
docs/dsl/showcase.rst

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

2
docs/dsl/star.rst

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

2
docs/dsl/svg.rst

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

2
docs/dsl/triangle.rst

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

2
docs/dsl/xlsx.rst

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

7
docs/index.rst

@ -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

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

17
docs/parameters.rst

@ -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`
Loading…
Cancel
Save