filtress/README.md

25 lines
3.4 KiB
Markdown

# filtress
Filtress is an interpreter for the filtress [domain-specific-language](https://en.wikipedia.org/wiki/Domain-specific_language). The interpreter reads an input file (filetype _frs_) and processes the commands to filter/modify an input image. Due to the fact that each _frs_ file is essentially a custom image filter, shell scripts can filter many images with the same _frs_ file in one go. In addition to color filtering, color overlays, and image sampling are also possible.
## The language
The filtress language is pretty basic as far as languages go. All filtress filters/scripts should be contained in a file with the suffix frs (ex. myFilter.frs)
All elements in a filtress script are either a procedure, a variable, an opperator, or an opperand. Opperands are always positive integer values and variables always represent positive integer values as well.
The following opperators are available: +, -, \*, /, %, =. If an opperator is not passed to a procedure before an opperand then = is assumed. As such, you never have to use =, just know that that is what filtress is doing in those cases.
All opperands can be passed as variables rather than as integers directly, with the exception of loops. Loops are started with the keyword (procedure) BEG followed by a number, like so: `BEG 20`. Anything that comes on the following lines is a part of the loop until the keyword _END_. At present, due to the way loops are handled by the parser, this number cannot be filled in by a variable. Many procedures represent a data value and as such can also be used as a variable. For example: `RED +100` increases the value of _RED_ by 100. If instead a person wanted to double red they could do `RED *10` or `RED +RED`. Multivalue procedures such as _COL_ and _LOC_ cannot be used as variables, nor can things that do not represent a specific value, such as _APY or BEG_. Similarly there are two values that cannot be used as procedures, only as variables: _WID_ and _HIG_.
Aside from the above, there are a few things to know. Comments are begun with the _#_ symbol and go until end of line. These will be ignored by the parser. Each statement, consisting of a procedure and, optionally in some cases, an expression and or comment, must be on its own line.
For a more detailed overview of each prcedure and variable please visit the [filtress manual](http://rawtext.club/~sloum). Another good resource to check out is the example\_filters folder of this repo.
## Intallation, Building, Dependencies
Building filtress from source requires the Go compiler. No dependencies beyond the go standard library are required.
## License
This software.source-code is released under the Non-Profit Open Software License 3.0. The basic gist is that you are free to view, modify, and distribute the source code and use the program to your liking, so long as you do not make money doing so and release any modifications under the same terms. There are more details in the **LICENSE** file that accompanies this repository. The license does not cover _frs_ files created by users or the images created with the software.
## Related
Filtress was initially inspired by [interval.rs](https://tildegit.org/diodelass/interval.rs), but filtering images rather than creating audio. Interval is a super cool program that you should definitely check out. A user of both will likely notice some similarities (and likely just as many differences).