From d5262930a4c91d1a4f021dc69056194818bc721d Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 16 Jul 2018 14:14:52 -0400 Subject: Add -m option to glitch --- bin/README | 1 + bin/glitch.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/README b/bin/README index 0ea3970a..3e53eba2 100644 --- a/bin/README +++ b/bin/README @@ -76,6 +76,7 @@ PNG glitcher based on pngo. -r reconstruct when filtering -d LIST declare pattern of comma-separated filters -a LIST apply pattern of comma-separated filters + -m mirror scanlines after filtering hnel diff --git a/bin/glitch.c b/bin/glitch.c index 6a3967f7..9e2f2e35 100644 --- a/bin/glitch.c +++ b/bin/glitch.c @@ -276,6 +276,7 @@ static struct { uint8_t applyFilter; enum Filter declareFilters[255]; enum Filter applyFilters[255]; + bool mirror; } options; struct Bytes { @@ -396,6 +397,16 @@ static void filterData(void) { } } +static void mirror(void) { + for (uint32_t y = 0; y < header.height; ++y) { + for (size_t i = 0, j = lineSize() - 1; i < j; ++i, --j) { + uint8_t t = lines[y]->data[i]; + lines[y]->data[i] = lines[y]->data[j]; + lines[y]->data[j] = t; + } + } +} + static void glitch(const char *inPath, const char *outPath) { if (inPath) { path = inPath; @@ -415,6 +426,7 @@ static void glitch(const char *inPath, const char *outPath) { scanlines(); reconData(); filterData(); + if (options.mirror) mirror(); free(lines); if (outPath) { @@ -462,7 +474,7 @@ int main(int argc, char *argv[]) { char *output = NULL; int opt; - while (0 < (opt = getopt(argc, argv, "a:cd:fo:pr"))) { + while (0 < (opt = getopt(argc, argv, "a:cd:fmo:pr"))) { switch (opt) { break; case 'a': options.applyFilter = parseFilters(options.applyFilters, optarg); @@ -470,6 +482,7 @@ int main(int argc, char *argv[]) { break; case 'd': options.declareFilter = parseFilters(options.declareFilters, optarg); break; case 'f': options.filt = true; + break; case 'm': options.mirror = true; break; case 'o': output = optarg; break; case 'p': options.brokenPaeth = true; break; case 'r': options.recon = true; -- cgit 1.4.1 amp;showmsg=1&follow=1'>root/www/git.causal.agency/cgit/ui-repolist.h (unfollow)
Commit message (Collapse)Author
2021-09-16Fix /* **/ comment matchingJune McEnroe
2021-09-15Remove typer, add downgrade to READMEJune McEnroe
2021-09-15Set bot mode on downgradeJune McEnroe
2021-09-15Enter capsicum in downgradeJune McEnroe
2021-09-15Factor out common parts of downgrade messagesJune McEnroe
Also bump the message cap to 1024 because that is ostensibly useful for replying to older messages.
2021-09-14Add downgrade IRC botJune McEnroe
2021-09-14Sort by title if authors matchJune McEnroe
There are probably better things to sort by but title definitely always exists.
2021-09-13Swap-remove tags as they're foundJune McEnroe
This makes it even faster. From ~1s on a sqlite3.c amalgamation to ~0.85s.
2021-09-12Replace htagml regex with strncmpJune McEnroe
Since ctags only ever produces regular expressions of the form /^re$/ or /^re/ with no other special characters, instead unescape the pattern and simply use strncmp. Running on a sqlite3.c amalgamation, the regex version takes ~37s while the strncmp version takes ~1s, producing identical output. Big win!
2021-09-11Also defer printing comment for lone close-parensJune McEnroe
2021-09-10Publish "git-comment"June McEnroe
2021-09-10Add git comment --pretty optionJune McEnroe
2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe
This fixes badly indented comments.
2021-09-08Up default min-repeat to 30 linesJune McEnroe
2021-09-08Handle dirty lines in git-commentJune McEnroe
2021-09-08Document and install git-commentJune McEnroe
2021-09-08Add repeat and all options to git-commentJune McEnroe
2021-09-08Add group threshold to git-commentJune McEnroe