More documentation for prior methods
parent
0c6b6e4d72
commit
77b7437df0
15
README.md
15
README.md
|
|
@ -20,7 +20,11 @@ end
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Add this line to your application's Gemfile:
|
Install it yourself with:
|
||||||
|
|
||||||
|
$ gem install squib
|
||||||
|
|
||||||
|
If you're using Bundler, add this line to your application's Gemfile:
|
||||||
|
|
||||||
gem 'squib'
|
gem 'squib'
|
||||||
|
|
||||||
|
|
@ -28,11 +32,7 @@ And then execute:
|
||||||
|
|
||||||
$ bundle
|
$ bundle
|
||||||
|
|
||||||
Or install it yourself as:
|
Note: Squib has some native dependencies, such as [Cairo](https://github.com/rcairo/rcairo), [Pango](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Pango%3A%3ALayout), and [Nokogiri](http://nokogiri.org/), which all require DevKit to compile C code. This is usually not painful, but on some setups can cause headaches. For Windows users, I *strongly* recommend using the *non-*64 bit RubyInstaller at http://rubyinstaller.org. For Mac, I recommend using [rvm](https://rvm.io).
|
||||||
|
|
||||||
$ gem install squib
|
|
||||||
|
|
||||||
Note: Squib has some native dependencies, such as [Cairo](https://github.com/rcairo/rcairo), [Pango](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Pango%3A%3ALayout), and [Nokogiri](http://nokogiri.org/), which all require DevKit to compile C code. This is usually not painful, but on some setups can cause headaches. For Windows users, I *strongly* recommend using the *non-*64 bit RubyInstaller at http://rubyinstaller.org/
|
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
|
@ -45,6 +45,7 @@ $ ruby deck.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
The `squib new` command will generate files and folders like this:
|
The `squib new` command will generate files and folders like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
_output
|
_output
|
||||||
gitkeep.txt
|
gitkeep.txt
|
||||||
|
|
@ -80,7 +81,7 @@ end
|
||||||
## Learning Squib's API
|
## Learning Squib's API
|
||||||
|
|
||||||
* The `samples` directory in the [source repository](https://github.com/andymeneely/squib) has lots of examples
|
* The `samples` directory in the [source repository](https://github.com/andymeneely/squib) has lots of examples
|
||||||
* The [API.md]() walks through the various methods and options
|
* The document called API.md walks through the various methods and options that apply to the entire Squib API
|
||||||
* [API Documentation](http://rubydoc.info/gems/squib/) is also kept up-to-date.
|
* [API Documentation](http://rubydoc.info/gems/squib/) is also kept up-to-date.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
# Fills the background with the given color
|
||||||
def background(range: :all, color: :black)
|
#
|
||||||
|
# @param range: the range of cards over which this will be rendered. See {file:API.md#label-Specifying+Ranges Specifying Ranges}
|
||||||
|
# @param color: the color the font will render to. See {file:API.md#label-Specifying+Colors Specifying Colors}
|
||||||
|
# @api public
|
||||||
|
def background(range: :all, color: :white)
|
||||||
range = rangeify(range)
|
range = rangeify(range)
|
||||||
color = colorify(color)
|
color = colorify(color)
|
||||||
range.each { |i| @cards[i].background(color) }
|
range.each { |i| @cards[i].background(color) }
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ module Squib
|
||||||
# @param x: the x-coordinate to place
|
# @param x: the x-coordinate to place
|
||||||
# @param y: the y-coordinate to place
|
# @param y: the y-coordinate to place
|
||||||
# @param alpha: the alpha-transparency percentage used to blend this image
|
# @param alpha: the alpha-transparency percentage used to blend this image
|
||||||
|
# @api public
|
||||||
def png(range: :all, file: nil, x: 0, y: 0, alpha: 1.0)
|
def png(range: :all, file: nil, x: 0, y: 0, alpha: 1.0)
|
||||||
range = rangeify(range)
|
range = rangeify(range)
|
||||||
file = fileify(file)
|
file = fileify(file)
|
||||||
|
|
@ -25,6 +26,7 @@ module Squib
|
||||||
# @param y: the y-coordinate to place
|
# @param y: the y-coordinate to place
|
||||||
# @param width: the pixel width that the image should scale to. 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.
|
# @param width: the pixel width that the image should scale to. 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.
|
||||||
# @param height: the pixel width that the image should scale to. 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.
|
# @param height: the pixel width that the image should scale to. 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.
|
||||||
|
# @api public
|
||||||
def svg(range: :all, file: nil, x: 0, y: 0, width: :native, height: :native)
|
def svg(range: :all, file: nil, x: 0, y: 0, width: :native, height: :native)
|
||||||
range = rangeify(range)
|
range = rangeify(range)
|
||||||
file = fileify(file)
|
file = fileify(file)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,19 @@
|
||||||
module Squib
|
module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
|
# Draw a rounded rectangle
|
||||||
|
#
|
||||||
|
# @param x: the x-coordinate to place
|
||||||
|
# @param y: the y-coordinate to place
|
||||||
|
# @param width: the width of the rectangle.
|
||||||
|
# @param height: the height of the rectangle.
|
||||||
|
# @param x_radius: the radius of the rounded corner horiztonally. Zero is a non-rounded corner.
|
||||||
|
# @param y_radius: the radius of the rounded corner vertically. Zero is a non-rounded corner.
|
||||||
|
# @param radius: when set, overrides both x_radius and y_radius
|
||||||
|
# @param fill_color: the color with which to fill the rectangle
|
||||||
|
# @param stroke_color: the color with which to stroke the outside of the rectangle
|
||||||
|
# @param stroke_width: the width of the outside stroke
|
||||||
|
# @api public
|
||||||
def rect(range: :all, x: 0, y: 0, width: 825, height: 1125, \
|
def rect(range: :all, x: 0, y: 0, width: 825, height: 1125, \
|
||||||
radius: nil, x_radius: 0, y_radius: 0, \
|
radius: nil, x_radius: 0, y_radius: 0, \
|
||||||
fill_color: '#0000', stroke_color: :black, stroke_width: 2.0)
|
fill_color: '#0000', stroke_color: :black, stroke_width: 2.0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue