(wrong string) ée

From: <git_AT_suckless.org>
Date: Wed, 12 Jul 2017 03:47:24 +0200 (CEST)

commit 6f4d55793f88540d1b1abd7410e43da83993ad6a
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Tue Jul 11 23:27:46 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Tue Jul 11 23:27:46 2017 +0200

    Add blind-repeat-tessellation
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/Makefile b/Makefile
index 319cb9d..87ecbe7 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -44,6 +44,7 @@ BIN =\
         blind-radial-gradient\
         blind-read-head\
         blind-repeat\
+ blind-repeat-tessellation\
         blind-reverse\
         blind-rewrite-head\
         blind-round-wave\
diff --git a/README b/README
index 5ef4958..eb2cd2e 100644
--- a/README
+++ b/README
_AT_@ -132,6 +132,9 @@ UTILITIES
        blind-repeat(1)
               Repeat a video
 
+ blind-repeat-tessellation(1)
+ Repeat a video horizontally and veritically to a specific size
+
        blind-reverse(1)
               Reverse a video
 
diff --git a/man/blind-repeat-tessellation.1 b/man/blind-repeat-tessellation.1
new file mode 100644
index 0000000..9e34737
--- /dev/null
+++ b/man/blind-repeat-tessellation.1
_AT_@ -0,0 +1,34 @@
+.TH BLIND-REPEAT-TESSELLATION 1 blind
+.SH NAME
+blind-repeat-tessellation - Repeat a video horizontally and veritically to a specific size
+.SH SYNOPSIS
+.B blind-repeat-tessellation
+-w
+.I width
+-h
+.I height
+.SH DESCRIPTION
+.B blind-repeat-tessellation
+reads a video from stdin and prints it, repeated both
+horizontally and vertically, to stdout.
+.SH OPTIONS
+.TP
+.BR -w " "\fIwidth\fP
+The width of the output video shall be exactly
+.I width
+pixels.
+.TP
+.BR -h " "\fIheight\fP
+The height of the output video shall be exactly
+.I height
+pixels.
+.SH REQUIREMENTS
+.B blind-repeat-tessellation
+requires enough free memory to load one full frame of
+the video from stdin into memory. A frame requires 32
+bytes per pixel it contains.
+.SH SEE ALSO
+.BR blind (7)
+.SH AUTHORS
+Mattias Andrée
+.RI < maandree_AT_kth.se >
diff --git a/man/blind.7 b/man/blind.7
index 9978017..8d65ddd 100644
--- a/man/blind.7
+++ b/man/blind.7
_AT_@ -148,6 +148,9 @@ Reads the head from a video
 .BR blind-repeat (1)
 Repeat a video
 .TP
+.BR blind-repeat-tessellation (1)
+Repeat a video horizontally and veritically to a specific size
+.TP
 .BR blind-reverse (1)
 Reverse a video
 .TP
diff --git a/src/blind-repeat-tessellation.c b/src/blind-repeat-tessellation.c
new file mode 100644
index 0000000..4e4fc60
--- /dev/null
+++ b/src/blind-repeat-tessellation.c
_AT_@ -0,0 +1,52 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+USAGE("-w width -h height")
+
+int
+main(int argc, char *argv[])
+{
+ struct stream stream;
+ size_t width = 0;
+ size_t height = 0;
+ size_t x, y, p, w;
+ char *buf;
+
+ ARGBEGIN {
+ case 'w':
+ width = etozu_flag('w', UARGF(), 1, SIZE_MAX);
+ break;
+ case 'h':
+ height = etozu_flag('h', UARGF(), 1, SIZE_MAX);
+ break;
+ default:
+ usage();
+ } ARGEND;
+
+ if (!width || !height || argc)
+ usage();
+
+ eopen_stream(&stream, NULL);
+ echeck_dimensions(&stream, WIDTH | HEIGHT, NULL);
+ x = stream.width, stream.width = width;
+ y = stream.height, stream.height = height;
+ fprint_stream_head(stdout, &stream);
+ efflush(stdout, "<stdout>");
+ stream.width = x;
+ stream.height = y;
+ buf = emalloc(stream.frame_size);
+
+ w = width % stream.width;
+ while (eread_frame(&stream, buf)) {
+ for (y = 0; y < height; y++) {
+ p = (y % stream.height) * stream.row_size;
+ for (x = 0; x < width / stream.width; x++)
+ ewriteall(STDOUT_FILENO, buf + p, stream.row_size, "<stdout>");
+ if (w)
+ ewriteall(STDOUT_FILENO, buf + p, w * stream.pixel_size, "<stdout>");
+ }
+ }
+
+ free(buf);
+ return 0;
+}
Received on Wed Jul 12 2017 - 03:47:24 CEST

This archive was generated by hypermail 2.3.0 : Wed Jul 12 2017 - 03:50:44 CEST