Update WORKSHOP.md

This commit is contained in:
Лu Лinveгa 2019-11-08 11:00:56 -05:00 committed by GitHub
parent 2e8d685f0e
commit 5c3bff3e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
This workshop is designed to go over the **most commonly used functions** with [Ronin](https://github.com/hundredrabbits/Ronin). The list of all available functions and their usage is located [here](https://github.com/hundredrabbits/Ronin/#library). You can also follow along our [video tutorial](https://youtu.be/SgAWGh1s9zg). This workshop is designed to go over the **most commonly used functions** with [Ronin](https://github.com/hundredrabbits/Ronin). The list of all available functions and their usage is located [here](https://github.com/hundredrabbits/Ronin/#library). You can also follow along our [video tutorial](https://youtu.be/SgAWGh1s9zg).
- **Part 1**: [Images](#Images) `(open)`, `(import)`, `(crop)`, `(export)` - **Part 1**: [Images](#Images) `(import)`, `(crop)`, `(export)`
- **Part 2**: [Draw](#Draw) `(stroke)`, `(fill)`, `(gradient)`, `(clear)` - **Part 2**: [Draw](#Draw) `(stroke)`, `(fill)`, `(gradient)`, `(clear)`
- **Part 3**: [Filters](#Filters) `(pixels)`, `(saturation)`, `(convolve)`, `(sharpen)` - **Part 3**: [Filters](#Filters) `(pixels)`, `(saturation)`, `(convolve)`, `(sharpen)`
- **Part 4**: [Events](#Events) `(echo)`, `(on "mouse-down")`, `(on "animate")`, `(on "/a")` - **Part 4**: [Events](#Events) `(echo)`, `(on "mouse-down")`, `(on "animate")`, `(on "/a")`
@ -13,14 +13,6 @@ This workshop is designed to go over the **most commonly used functions** with [
This section will teach the basics of opening, cropping and saving an image file. You can use the `$path` helper to quickly get an image's path into Ronin, by writing `$path` and dragging a file onto the Ronin window. This section will teach the basics of opening, cropping and saving an image file. You can use the `$path` helper to quickly get an image's path into Ronin, by writing `$path` and dragging a file onto the Ronin window.
### Open
To open an image, **and resize the canvas to fit the image size**, type the following text, drag an image file onto the Ronin window and press `cmd+r`:
```lisp
(open $path)
```
### Import ### Import
To import an image onto the current canvas, type the following text, drag an image file onto the Ronin window, trace a shape in the canvas and press `cmd+r`: To import an image onto the current canvas, type the following text, drag an image file onto the Ronin window, trace a shape in the canvas and press `cmd+r`:
@ -150,7 +142,7 @@ This section will cover how to manipulate the pixels of an image.
First let's open an image, ideally one in color, and change every pixel of a selected area at `(rect 100 100 200 200)`: First let's open an image, ideally one in color, and change every pixel of a selected area at `(rect 100 100 200 200)`:
```lisp ```lisp
(open $path) (import $path)
(pixels saturation 10 (pixels saturation 10
(rect 100 100 200 200)) (rect 100 100 200 200))
``` ```
@ -172,7 +164,7 @@ The `(pixels)` function expects a function that returns 4 values(r,g,b,a), and s
In the previous example, we increased the saturation of a region of the image, to desaturate an entire image, you can simply omit the `(rect)` which will select the entire canvas, and set the pixel filter to `saturation` and the value to `0.5`(50% saturation): In the previous example, we increased the saturation of a region of the image, to desaturate an entire image, you can simply omit the `(rect)` which will select the entire canvas, and set the pixel filter to `saturation` and the value to `0.5`(50% saturation):
```lisp ```lisp
(open $path) (import $path)
(pixels saturation 0.5) (pixels saturation 0.5)
``` ```
@ -183,14 +175,14 @@ Effects which use the surrounding pixels, or convolution matrix, are used with t
### sharpen ### sharpen
```lisp ```lisp
(open $path) (import $path)
(convolve (sharpen) $rect) (convolve (sharpen) $rect)
``` ```
Custom convolve kernels can also be created like this: Custom convolve kernels can also be created like this:
```lisp ```lisp
(open $path) (import $path)
(def (blur) (def (blur)
( (
(-1 -1 -1) (-1 -1 -1)