Adds a better readme and changes project folder structure for examples

master
sloumdrone 4 years ago
parent d2f325b432
commit 4c5537c0e0

@ -1,2 +1,20 @@
# 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 \*100_ 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 examplei\_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).

@ -0,0 +1,83 @@
# This filter demonstrates ways to use existing pixel data by setting the color via the GET command
# and then using it with APY. It also uses mode switching and non-pixel data set by calls to COL.
#
# License note:
# This example file is public domain and was written by sloum (The "Non-Profit Open Software License 3.0"
# that covers the software does not apply to works _created_ by the software, only to the software itself
# and variations thereupon or services provided related to said software. Any filters you, the user, create
# may be covered under any license you like so long as the core filtress software is not used against its
# license. All example filters provided with filtress are released as public domain.
RG1 WID
RG1 /2
RG2 HIG
RG2 /2
# Create sample in paralellagram shape
LOC RG1:RG2
LOC +50:-50
BEG 100
LOC -129:+1
BEG 130
GET
LOC +150:+150
APY
LOC -150:-150
LOC +1:+0
END
END
LOC 50:37
# Create vertical lines throughout
MOD 0
BEG 50
LOC +50:*73
BEG 2
LOC +1:+0
GET
APY +0:+RG2
END
END
# Create transparent red bar at top
MOD 1
LOC 0:0
COL 240:50:50:240
RG1 HIG
RG1 /10
APY +WID:+RG1
# Create noise underneath red bar
MOD 0
LOC +5:+1
BEG 50
LOC *9:+2
GET
LOC +0:+RG1
BEG 50
LOC +37:+0
APY +1:+1
END
LOC +0:-RG1
END
#Add dark bars
LOC 0:0
MOD 1
COL 0:0:0:240
RG1 7
BEG 5
LOC +0:+113
APY +WID:+RG1
RG1 *2
END

@ -0,0 +1,33 @@
# This filter creates squares and lines over an image in semi-random colors
#
# License note:
# This example file is public domain and was written by sloum (The "Non-Profit Open Software License 3.0"
# that covers the software does not apply to works _created_ by the software, only to the software itself
# and variations thereupon or services provided related to said software. Any filters you, the user, create
# may be covered under any license you like so long as the core filtress software is not used against its
# license. All example filters provided with filtress are released as public domain.
# Set mode to 1: average mode
MOD 1
# Set initial colors and set register 1
APH 255
RED 100
BLU 100
GRN 100
RG1 WID
RG1 /20
RG1 /4
LOC +1:+1
BEG 100
COL +23:-81:*27:-0
APY +4:+4
APY +1:+HIG
LOC +0:+4
APY +WID:+0
LOC +0:-4
LOC +RG1:*24
END

@ -0,0 +1,41 @@
#
# License note:
# This example file is public domain and was written by sloum (The "Non-Profit Open Software License 3.0"
# that covers the software does not apply to works _created_ by the software, only to the software itself
# and variations thereupon or services provided related to said software. Any filters you, the user, create
# may be covered under any license you like so long as the core filtress software is not used against its
# license. All example filters provided with filtress are released as public domain.
#
# Set mode to 1 (average)
MOD 1
# Set register 1 to handle our Y axis
RG1 HIG
RG1 /10
RG1 /2
# Set register 2 to handle our x axis
RG2 WID
RG2 /10
RG2 /2
LOY +RG1
# Nest loop over y then x axis
BEG 10
BEG 10
COL +80:*6:-200:-4
APY +RG2:+RG1
LOC +RG2:+0
LOC +RG2:+0
END
LOC +RG2:+RG1
LOC +0:+RG1
END

@ -170,8 +170,8 @@ func procedure(p parser.Procedure) {
case "LOY":
if len(p.Expressions) == 1 {
x := parser.Expression{Opperator: '+', Opperand: 0, Variable: ""}
exps := make([]parser.Expression,2,2)
exps = append(p.Expressions, x, p.Expressions[0])
exps := make([]parser.Expression,0,2)
exps = append(exps, x, p.Expressions[0])
fil.location.update(exps)
}
case "MOD":

@ -1,31 +0,0 @@
# Set mode to 1 (average)
MOD 1
# Set register 1 to handle our Y axis
RG1 HIG
RG1 /10
RG1 /2
# Set register 2 to handle our x axis
RG2 WID
RG2 /10
RG2 /2
# Nest loop over y then x axis
BEG 10
BEG 10
COL +80:*6:-200:-4
APY +RG2:+RG1
LOC +RG2:+0
LOC +RG2:+0
END
LOC +RG2:+RG1
LOC +0:+RG1
END

@ -1,75 +0,0 @@
# This will test image sampling
RG1 WID
RG1 /2
RG2 HIG
RG2 /2
# Create sample in paralellagram shape
LOC RG1:RG2
LOC +50:-50
BEG 100
LOC -129:+1
BEG 130
GET
LOC +150:+150
APY
LOC -150:-150
LOC +1:+0
END
END
LOC 50:37
# Create vertical lines throughout
MOD 0
BEG 50
LOC +50:*73
BEG 2
LOC +1:+0
GET
APY +0:+RG2
END
END
# Create transparent red bar at top
MOD 1
LOC 0:0
COL 240:50:50:240
RG1 HIG
RG1 /10
APY +WID:+RG1
# Create noise underneath red bar
MOD 0
LOC +5:+1
BEG 50
LOC *9:+2
GET
LOC +0:+RG1
BEG 50
LOC +37:+0
APY +1:+1
END
LOC +0:-RG1
END
#Add dark bars
LOC 0:0
MOD 1
COL 0:0:0:240
RG1 7
BEG 5
LOC +0:+113
APY +WID:+RG1
RG1 *2
END

@ -1,22 +0,0 @@
# First attempt at a filtress file!!
MOD 1
APH 255
RED 100
BLU 100
GRN 100
RG1 WID
RG1 /20
RG1 /4
LOC +1:+1
BEG 100
COL +23:-81:*27:-0
APY +3:+3
APY +1:+HIG
LOC +0:+4
APY +WID:+0
LOC +0:-4
LOC +RG1:*24
END
Loading…
Cancel
Save