Added path generation example

This commit is contained in:
Devine Lu Linvega 2019-08-01 09:05:50 +09:00
parent 127ed76537
commit 215911cc41

View File

@ -55,19 +55,23 @@ To export the resulting image, type the following text, drag an image file onto
(export $path) (export $path)
``` ```
For example, a version of that same code with file paths, might look something like the following, notice how the `(rect)` is omitted, if a `(rect)` is not present, the entire canvas size will be exported: For example, a version of that same code with file paths, might look something like the following:
```lisp ```lisp
(import "~/Desktop/photo.jpg") (import "~/Desktop/photo.jpg")
(export "~/Desktop/export.png") (export "~/Desktop/export.png")
``` ```
If you are working on from a saved `.lisp` file, you can also export directly into the working directory with: You could also **generate the export path from the import path**, like this:
```lisp ```lisp
(export (def import-path $path)
(def export-path
(concat (concat
(dirpath) "/" "hello.jpg")) (dirpath import-path) "/"
(filename import-path) "-export.jpg"))
(import import-path) ; "~/Desktop/photo.jpg"
(export export-path) ; "~/Desktop/photo-export.jpg"
``` ```
## Draw ## Draw