diff options
author | chai <chaifix@163.com> | 2019-12-21 22:24:15 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-12-21 22:24:15 +0800 |
commit | ec111247c614663d8231245a17c314b9b8b4a28c (patch) | |
tree | a66058508161da488371c90316865ae850b8be15 /src/core/stencil.c | |
parent | c3f45735ecfab6e567be371758f21395e92dfef6 (diff) |
*misc
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; +} |