diff options
Diffstat (limited to 'src/core/stencil.c')
-rw-r--r-- | src/core/stencil.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/core/stencil.c b/src/core/stencil.c new file mode 100644 index 0000000..3127544 --- /dev/null +++ b/src/core/stencil.c @@ -0,0 +1,69 @@ +#include "stencil.h" +#include "mem.h" +#include "../util/assert.h" + +bool stencil_always(byte src, byte ref) { + return 1; +} + +bool stencil_never(byte src, byte ref) { + return 0; +} + +bool stencil_less(byte src, byte ref) { + return src < ref; +} + +bool stencil_equal(byte src, byte ref) { + return src == ref; +} + +bool stencil_leuqal(byte src, byte ref) { + return src <= ref; +} + +bool stencil_greater(byte src, byte ref) { + return src > ref; +} + +bool stencil_notequal(byte src, byte ref) { + return src != ref; +} + +bool stencil_gequer(byte src, byte ref) { + return src >= ref; +} + +/*stencil op*/ + +byte stencilop_keep(byte src, byte ref) { + return src; +} + +byte stencilop_zero(byte src, byte ref) { + return 0; +} + +byte stencilop_replace(byte src, byte ref) { + return ref; +} + +byte stencilop_incr(byte src, byte ref) { + return src == 0xff ? 0xff : src + 1; +} + +byte stencilop_incrwrap(byte src, byte ref) { + return src == 0xff ? 0 : src + 1; +} + +byte stencilop_decr(byte src, byte ref) { + return src == 0 ? 0 : src - 1; +} + +byte stencilop_decrwrap(byte src, byte ref) { + return src == 0 ? 0xff : src - 1; +} + +byte stencilop_invert(byte src, byte ref) { + return (~src) & 0xff; +} |