91 lines
2.2 KiB
Plaintext
91 lines
2.2 KiB
Plaintext
Filtress
|
|
|
|
Inspired by interval.rs (generates audio via a simple command language), but filtering or otherwise drawing on images.
|
|
Things have shifted to maybe doing image mangling based on input file. To do so I could just use the standard go image library to deal with the images.
|
|
|
|
+ + + + + + + + +
|
|
|
|
Meta-langauge:
|
|
__________________
|
|
|
|
Comments:
|
|
|
|
# This is a comment. It begins with a pound sign
|
|
# Multiline comments use multiple lines all starting with a pound sign
|
|
|
|
. . .
|
|
|
|
Operators:
|
|
# Operators get applied to numerical values and always lead the number
|
|
# = is implicit when writing just an int, but can be optionally included for clarity
|
|
|
|
+, -, / (floors on decimal), *, %, =
|
|
|
|
. . .
|
|
|
|
Variables:
|
|
# The following global variables are available
|
|
|
|
WID # The image width
|
|
HIG # The image height
|
|
REG # A register for saving numbers?
|
|
|
|
. . .
|
|
|
|
Setting the current pixel:
|
|
# Valuesthat over or underflow the image dimensions will be looped to aceptable locations
|
|
|
|
LOC int:int
|
|
LOC [op]int:int
|
|
LOC int:[op]int
|
|
LOC [op]int:[op]int
|
|
|
|
. . .
|
|
|
|
Applying changes:
|
|
# Just calling APY alone applies the filter to the current selected pixel
|
|
# Calling with a ratio sets the width and height of a square in which to apply the filter
|
|
|
|
APY
|
|
APY [op]int:[op]int
|
|
|
|
. . .
|
|
|
|
Colors get set either individually or as a group:
|
|
# Using COL as opposed to the individuals requires that all four values are set
|
|
# Passing an int with no op sets to that value
|
|
# Values udner or overflowing will loop to acceptable values
|
|
|
|
RED [op]int
|
|
GRN [op]int
|
|
BLU [op]int
|
|
APH [op]int
|
|
COL [op]int:[op]int:[op]int:[op]int
|
|
|
|
. . .
|
|
|
|
Set the apply mode:
|
|
# Using an op with MOD will always loop through the modes as needed based on the operator
|
|
#
|
|
# Values:
|
|
# 0 - Hard mode, replaces pixel contents with the color settings on apply
|
|
# 1 - Average mode, averages the incoming channel with the existing channel
|
|
# 2 - Loop mode, adds the values of the existing and incoming channels and loops around on overflow
|
|
# 3 - Fade mode, works as average mode, but uses the fade timer to fade over the course of a number of pixel adjustments
|
|
|
|
MOD [op]int
|
|
|
|
. . .
|
|
|
|
Doing loops:
|
|
# The int after BEG represents the number of times to loop
|
|
# At present, loops may not be nested
|
|
|
|
BEG int
|
|
[loop contents]
|
|
END
|
|
|
|
. . .
|
|
|
|
|