SMOLNET PORTAL home about changes
igroup farbfeld code in the single farbfeld tool around - ploot - simple plotting tools	Err	bitreich.org	70
hgit clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot	URL:git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot	bitreich.org	70
1Log	/scm/ploot/log.gph	bitreich.org	70
1Files	/scm/ploot/files.gph	bitreich.org	70
1Refs	/scm/ploot/refs.gph	bitreich.org	70
1Tags	/scm/ploot/tag	bitreich.org	70
1README	/scm/ploot/file/README.md.gph	bitreich.org	70
1LICENSE	/scm/ploot/file/LICENSE.gph	bitreich.org	70
i---	Err	bitreich.org	70
1commit b525323a1383dfb008a8941753702e2b05d14eee	/scm/ploot/commit/b525323a1383dfb008a8941753702e2b05d14eee.gph	bitreich.org	70
1parent f5bdc6b7ddfd050efc31f5cc89a6fba87e58819f	/scm/ploot/commit/f5bdc6b7ddfd050efc31f5cc89a6fba87e58819f.gph	bitreich.org	70
hAuthor: Josuah Demangeon <me@josuah.net>	URL:mailto:me@josuah.net	bitreich.org	70
iDate:   Wed, 23 Jun 2021 23:39:40 +0200	Err	bitreich.org	70
i	Err	bitreich.org	70
igroup farbfeld code in the single farbfeld tool around	Err	bitreich.org	70
i	Err	bitreich.org	70
iDiffstat:	Err	bitreich.org	70
i  M Makefile                            |       4 ++--	Err	bitreich.org	70
i  D ffplot.c                            |     148 -------------------------------	Err	bitreich.org	70
i  D ffplot.h                            |      34 -------------------------------	Err	bitreich.org	70
i  M ploot-farbfeld.c                    |     166 +++++++++++++++++++++++++++++--	Err	bitreich.org	70
i	Err	bitreich.org	70
i4 files changed, 159 insertions(+), 193 deletions(-)	Err	bitreich.org	70
i---	Err	bitreich.org	70
1diff --git a/Makefile b/Makefile	/scm/ploot/file/Makefile.gph	bitreich.org	70
i@@ -7,8 +7,8 @@ LFLAGS = -static -lm	Err	bitreich.org	70
i PREFIX = /usr/local	Err	bitreich.org	70
i MANOREFIX = $(PREFIX)/share/man	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-SRC = csv.c drawille.c ffplot.c font.c font13.c font8.c scale.c util.c	Err	bitreich.org	70
i-INC = csv.h drawille.h ffplot.h font.h scale.h util.h	Err	bitreich.org	70
i+SRC = csv.c drawille.c font.c font13.c font8.c scale.c util.c	Err	bitreich.org	70
i+INC = csv.h drawille.h font.h scale.h util.h	Err	bitreich.org	70
i BIN = ploot-farbfeld ploot-feed ploot-braille ploot-text	Err	bitreich.org	70
i OBJ = ${SRC:.c=.o}	Err	bitreich.org	70
i 	Err	bitreich.org	70
1diff --git a/ffplot.c b/ffplot.c	/scm/ploot/file/ffplot.c.gph	bitreich.org	70
i@@ -1,148 +0,0 @@	Err	bitreich.org	70
i-#include "ffplot.h"	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-#include <arpa/inet.h>	Err	bitreich.org	70
i-#include <stddef.h>	Err	bitreich.org	70
i-#include <string.h>	Err	bitreich.org	70
i-#include <stdio.h>	Err	bitreich.org	70
i-#include <stdint.h>	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-#include "font.h"	Err	bitreich.org	70
i-#include "util.h"	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-/*	Err	bitreich.org	70
i- * Convert (x,y) coordinates to (row,col) for printing into the buffer.	Err	bitreich.org	70
i- * The buffer only contain one number, so the coordinate is a single integer:	Err	bitreich.org	70
i- *        width * y + y.	Err	bitreich.org	70
i- * The coordinates are shifted by offx and offy to permit relative coordinates.	Err	bitreich.org	70
i- *	Err	bitreich.org	70
i- * The convention used:                                      y	Err	bitreich.org	70
i- * - (0,0) is at the lower left corner of the plotvas.        |	Err	bitreich.org	70
i- * - (0,1) is above it.                                      +--x	Err	bitreich.org	70
i- */	Err	bitreich.org	70
i-void	Err	bitreich.org	70
i-ffplot_pixel(struct ffplot *plot, struct ffcolor *color,	Err	bitreich.org	70
i-        int x, int y)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        x += plot->x;	Err	bitreich.org	70
i-        y += plot->y;	Err	bitreich.org	70
i-        if (x < 0 || x >= plot->w || y < 0 || y >= plot->h)	Err	bitreich.org	70
i-                return;	Err	bitreich.org	70
i-        memcpy(plot->buf + plot->w * (plot->h - 1 - y) + x, color, sizeof(*plot->buf));	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-void	Err	bitreich.org	70
i-ffplot_rectangle(struct ffplot *plot, struct ffcolor *color,	Err	bitreich.org	70
i-        int y1, int x1,	Err	bitreich.org	70
i-        int y2, int x2)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        int x, y, ymin, xmin, ymax, xmax;	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        ymin = MIN(y1, y2); ymax = MAX(y1, y2);	Err	bitreich.org	70
i-        xmin = MIN(x1, x2); xmax = MAX(x1, x2);	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        for (y = ymin; y <= ymax; y++)	Err	bitreich.org	70
i-                for (x = xmin; x <= xmax; x++)	Err	bitreich.org	70
i-                        ffplot_pixel(plot, color, x, y);	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-/*	Err	bitreich.org	70
i- * From Bresenham's line algorithm and dcat's tplot.	Err	bitreich.org	70
i- */	Err	bitreich.org	70
i-void	Err	bitreich.org	70
i-ffplot_line(struct ffplot *plot, struct ffcolor *color,	Err	bitreich.org	70
i-        int x0, int y0,	Err	bitreich.org	70
i-        int x1, int y1)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        int dy, dx, sy, sx, err, e;	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        sx = x0 < x1 ? 1 : -1;	Err	bitreich.org	70
i-        sy = y0 < y1 ? 1 : -1;	Err	bitreich.org	70
i-        dx = ABS(x1 - x0);	Err	bitreich.org	70
i-        dy = ABS(y1 - y0);	Err	bitreich.org	70
i-        err = (dy > dx ? dy : -dx) / 2;	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        for (;;) {	Err	bitreich.org	70
i-                ffplot_pixel(plot, color, x0, y0);	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-                if (y0 == y1 && x0 == x1)	Err	bitreich.org	70
i-                        break;	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-                e = err;	Err	bitreich.org	70
i-                if (e > -dy) {	Err	bitreich.org	70
i-                        y0 += sy;	Err	bitreich.org	70
i-                        err -= dx;	Err	bitreich.org	70
i-                }	Err	bitreich.org	70
i-                if (e < dx) {	Err	bitreich.org	70
i-                        x0 += sx;	Err	bitreich.org	70
i-                        err += dy;	Err	bitreich.org	70
i-                }	Err	bitreich.org	70
i-        }	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-/*	Err	bitreich.org	70
i- * Draw a coloured glyph from font f centered on y.	Err	bitreich.org	70
i- */	Err	bitreich.org	70
i-int	Err	bitreich.org	70
i-ffplot_char(struct ffplot *plot, struct ffcolor *color, struct font *ft, char c,	Err	bitreich.org	70
i-        int x, int y)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        int yf, xf, wf;	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        if (c & 0x80)	Err	bitreich.org	70
i-                c = '\0';	Err	bitreich.org	70
i-        y -= ft->height / 2;	Err	bitreich.org	70
i-        wf = font_width(ft, c);	Err	bitreich.org	70
i-        for (xf = 0; xf < wf; xf++)	Err	bitreich.org	70
i-                for (yf = 0; yf < ft->height; yf++)	Err	bitreich.org	70
i-                        if (ft->glyph[(int)c][wf * (ft->height - yf) + xf] == 3)	Err	bitreich.org	70
i-                                ffplot_pixel(plot, color, x + xf, y + yf);	Err	bitreich.org	70
i-        return wf + 1;	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-/*	Err	bitreich.org	70
i- * Draw a left aligned string without wrapping it.	Err	bitreich.org	70
i- */	Err	bitreich.org	70
i-size_t	Err	bitreich.org	70
i-ffplot_text_left(struct ffplot *plot, struct ffcolor *color, struct font *ft,	Err	bitreich.org	70
i-        char *s, int x, int y)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        for (; *s != '\0'; s++)	Err	bitreich.org	70
i-                x += ffplot_char(plot, color, ft, *s, x, y);	Err	bitreich.org	70
i-        return x;	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-/*	Err	bitreich.org	70
i- * Draw a center aligned string without wrapping it.	Err	bitreich.org	70
i- */	Err	bitreich.org	70
i-size_t	Err	bitreich.org	70
i-ffplot_text_center(struct ffplot *plot, struct ffcolor *color, struct font *ft,	Err	bitreich.org	70
i-        char *s, int x, int y)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        x -= font_strlen(ft, s) / 2;	Err	bitreich.org	70
i-        return ffplot_text_left(plot, color, ft, s, x, y);	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-/*	Err	bitreich.org	70
i- * Draw a right aligned string without wrapping it.	Err	bitreich.org	70
i- */	Err	bitreich.org	70
i-size_t	Err	bitreich.org	70
i-ffplot_text_right(struct ffplot *plot, struct ffcolor *color, struct font *ft,	Err	bitreich.org	70
i-        char *s, int x, int y)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        x -= font_strlen(ft, s);	Err	bitreich.org	70
i-        return ffplot_text_left(plot, color, ft, s, x, y);	Err	bitreich.org	70
i-}	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-void	Err	bitreich.org	70
i-ffplot_print(FILE *fp, struct ffplot *plot)	Err	bitreich.org	70
i-{	Err	bitreich.org	70
i-        uint32_t w, h;	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        w = htonl(plot->w);	Err	bitreich.org	70
i-        h = htonl(plot->h);	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-        fprintf(stdout, "ffplot");	Err	bitreich.org	70
i-        fwrite(&w, sizeof(w), 1, fp);	Err	bitreich.org	70
i-        fwrite(&h, sizeof(h), 1, fp);	Err	bitreich.org	70
i-        fwrite(plot->buf, plot->w * plot->h, sizeof(*plot->buf), fp);	Err	bitreich.org	70
i-}	Err	bitreich.org	70
1diff --git a/ffplot.h b/ffplot.h	/scm/ploot/file/ffplot.h.gph	bitreich.org	70
i@@ -1,34 +0,0 @@	Err	bitreich.org	70
i-#ifndef FFPLOT_H	Err	bitreich.org	70
i-#define FFPLOT_H	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-#include <stdio.h>	Err	bitreich.org	70
i-#include <stddef.h>	Err	bitreich.org	70
i-#include <stdint.h>	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-#include "font.h"	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-struct ffcolor {	Err	bitreich.org	70
i-        uint16_t red;	Err	bitreich.org	70
i-        uint16_t green;	Err	bitreich.org	70
i-        uint16_t blue;	Err	bitreich.org	70
i-        uint16_t alpha;	Err	bitreich.org	70
i-};	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-struct ffplot {	Err	bitreich.org	70
i-        int w;                /* width */	Err	bitreich.org	70
i-        int h;                /* height */	Err	bitreich.org	70
i-        int x;                /* x offset */	Err	bitreich.org	70
i-        int y;                /* y offset */	Err	bitreich.org	70
i-        struct ffcolor *buf;	Err	bitreich.org	70
i-};	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-void        ffplot_pixel(struct ffplot *, struct ffcolor *, int, int);	Err	bitreich.org	70
i-void        ffplot_rectangle(struct ffplot *, struct ffcolor *, int, int, int, int);	Err	bitreich.org	70
i-void        ffplot_line(struct ffplot *, struct ffcolor *, int, int, int, int);	Err	bitreich.org	70
i-int        ffplot_char(struct ffplot *, struct ffcolor *, struct font *, char, int, int);	Err	bitreich.org	70
i-size_t        ffplot_text_left(struct ffplot *, struct ffcolor *, struct font *, char *, int, int);	Err	bitreich.org	70
i-size_t        ffplot_text_center(struct ffplot *, struct ffcolor *, struct font *, char *, int, int);	Err	bitreich.org	70
i-size_t        ffplot_text_right(struct ffplot *, struct ffcolor *, struct font *, char *, int, int);	Err	bitreich.org	70
i-void        ffplot_print(FILE *, struct ffplot *);	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-#endif	Err	bitreich.org	70
1diff --git a/ploot-farbfeld.c b/ploot-farbfeld.c	/scm/ploot/file/ploot-farbfeld.c.gph	bitreich.org	70
i@@ -4,6 +4,7 @@	Err	bitreich.org	70
i #include <fcntl.h>	Err	bitreich.org	70
i #include <limits.h>	Err	bitreich.org	70
i #include <math.h>	Err	bitreich.org	70
i+#include <stddef.h>	Err	bitreich.org	70
i #include <stdint.h>	Err	bitreich.org	70
i #include <stdio.h>	Err	bitreich.org	70
i #include <stdlib.h>	Err	bitreich.org	70
i@@ -11,10 +12,9 @@	Err	bitreich.org	70
i #include <time.h>	Err	bitreich.org	70
i #include <unistd.h>	Err	bitreich.org	70
i #include "csv.h"	Err	bitreich.org	70
i-#include "ffplot.h"	Err	bitreich.org	70
i #include "font.h"	Err	bitreich.org	70
i-#include "util.h"	Err	bitreich.org	70
i #include "scale.h"	Err	bitreich.org	70
i+#include "util.h"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i #ifndef __OpenBSD__	Err	bitreich.org	70
i #define pledge(...) 0	Err	bitreich.org	70
i@@ -50,16 +50,22 @@	Err	bitreich.org	70
i #define LEGEND_W        (100)	Err	bitreich.org	70
i #define LEGEND_H        (PLOT_H)	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-struct colorname {	Err	bitreich.org	70
i-        char *name;	Err	bitreich.org	70
i-        struct ffcolor color;	Err	bitreich.org	70
i+struct ffcolor {	Err	bitreich.org	70
i+        uint16_t red;	Err	bitreich.org	70
i+        uint16_t green;	Err	bitreich.org	70
i+        uint16_t blue;	Err	bitreich.org	70
i+        uint16_t alpha;	Err	bitreich.org	70
i };	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-static char *tflag = "";	Err	bitreich.org	70
i-static char *uflag = "";	Err	bitreich.org	70
i-static struct font *font = &font13;	Err	bitreich.org	70
i+struct ffplot {	Err	bitreich.org	70
i+        int w, h, x, y; /* width, height and coordinamtes */	Err	bitreich.org	70
i+        struct ffcolor *buf;	Err	bitreich.org	70
i+};	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-static struct colorname colorname[] = {	Err	bitreich.org	70
i+static struct colorname {	Err	bitreich.org	70
i+        char *name;	Err	bitreich.org	70
i+        struct ffcolor color;	Err	bitreich.org	70
i+} colorname[] = {	Err	bitreich.org	70
i         /* name       red     green   blue    alpha */	Err	bitreich.org	70
i         { "red",    { 0xffff, 0x4444, 0x4444, 0xffff } },	Err	bitreich.org	70
i         { "orange", { 0xffff, 0x9999, 0x4444, 0xffff } },	Err	bitreich.org	70
i@@ -70,6 +76,148 @@ static struct colorname colorname[] = {	Err	bitreich.org	70
i         { NULL, { 0, 0, 0, 0 } }	Err	bitreich.org	70
i };	Err	bitreich.org	70
i 	Err	bitreich.org	70
i+static char *tflag = "";	Err	bitreich.org	70
i+static char *uflag = "";	Err	bitreich.org	70
i+static struct font *font = &font13;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/*	Err	bitreich.org	70
i+ * Convert (x,y) coordinates to (row,col) for printing into the buffer.	Err	bitreich.org	70
i+ * The buffer only contain one number, so the coordinate is a single integer:	Err	bitreich.org	70
i+ *        width * y + y.	Err	bitreich.org	70
i+ * The coordinates are shifted by offx and offy to permit relative coordinates.	Err	bitreich.org	70
i+ *	Err	bitreich.org	70
i+ * The convention used:                                      y	Err	bitreich.org	70
i+ * - (0,0) is at the lower left corner of the plotvas.        |	Err	bitreich.org	70
i+ * - (0,1) is above it.                                      +--x	Err	bitreich.org	70
i+ */	Err	bitreich.org	70
i+static void	Err	bitreich.org	70
i+ffplot_pixel(struct ffplot *plot, struct ffcolor *color,	Err	bitreich.org	70
i+        int x, int y)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        x += plot->x;	Err	bitreich.org	70
i+        y += plot->y;	Err	bitreich.org	70
i+        if (x < 0 || x >= plot->w || y < 0 || y >= plot->h)	Err	bitreich.org	70
i+                return;	Err	bitreich.org	70
i+        memcpy(plot->buf + plot->w * (plot->h - 1 - y) + x, color, sizeof(*plot->buf));	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+static void	Err	bitreich.org	70
i+ffplot_rectangle(struct ffplot *plot, struct ffcolor *color,	Err	bitreich.org	70
i+        int y1, int x1,	Err	bitreich.org	70
i+        int y2, int x2)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        int x, y, ymin, xmin, ymax, xmax;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        ymin = MIN(y1, y2); ymax = MAX(y1, y2);	Err	bitreich.org	70
i+        xmin = MIN(x1, x2); xmax = MAX(x1, x2);	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        for (y = ymin; y <= ymax; y++)	Err	bitreich.org	70
i+                for (x = xmin; x <= xmax; x++)	Err	bitreich.org	70
i+                        ffplot_pixel(plot, color, x, y);	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/*	Err	bitreich.org	70
i+ * From Bresenham's line algorithm and dcat's tplot.	Err	bitreich.org	70
i+ */	Err	bitreich.org	70
i+static void	Err	bitreich.org	70
i+ffplot_line(struct ffplot *plot, struct ffcolor *color,	Err	bitreich.org	70
i+        int x0, int y0,	Err	bitreich.org	70
i+        int x1, int y1)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        int dy, dx, sy, sx, err, e;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        sx = x0 < x1 ? 1 : -1;	Err	bitreich.org	70
i+        sy = y0 < y1 ? 1 : -1;	Err	bitreich.org	70
i+        dx = ABS(x1 - x0);	Err	bitreich.org	70
i+        dy = ABS(y1 - y0);	Err	bitreich.org	70
i+        err = (dy > dx ? dy : -dx) / 2;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        for (;;) {	Err	bitreich.org	70
i+                ffplot_pixel(plot, color, x0, y0);	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+                if (y0 == y1 && x0 == x1)	Err	bitreich.org	70
i+                        break;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+                e = err;	Err	bitreich.org	70
i+                if (e > -dy) {	Err	bitreich.org	70
i+                        y0 += sy;	Err	bitreich.org	70
i+                        err -= dx;	Err	bitreich.org	70
i+                }	Err	bitreich.org	70
i+                if (e < dx) {	Err	bitreich.org	70
i+                        x0 += sx;	Err	bitreich.org	70
i+                        err += dy;	Err	bitreich.org	70
i+                }	Err	bitreich.org	70
i+        }	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/*	Err	bitreich.org	70
i+ * Draw a coloured glyph from font f centered on y.	Err	bitreich.org	70
i+ */	Err	bitreich.org	70
i+static int	Err	bitreich.org	70
i+ffplot_char(struct ffplot *plot, struct ffcolor *color, struct font *ft, char c,	Err	bitreich.org	70
i+        int x, int y)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        int yf, xf, wf;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        if (c & 0x80)	Err	bitreich.org	70
i+                c = '\0';	Err	bitreich.org	70
i+        y -= ft->height / 2;	Err	bitreich.org	70
i+        wf = font_width(ft, c);	Err	bitreich.org	70
i+        for (xf = 0; xf < wf; xf++)	Err	bitreich.org	70
i+                for (yf = 0; yf < ft->height; yf++)	Err	bitreich.org	70
i+                        if (ft->glyph[(int)c][wf * (ft->height - yf) + xf] == 3)	Err	bitreich.org	70
i+                                ffplot_pixel(plot, color, x + xf, y + yf);	Err	bitreich.org	70
i+        return wf + 1;	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/*	Err	bitreich.org	70
i+ * Draw a left aligned string without wrapping it.	Err	bitreich.org	70
i+ */	Err	bitreich.org	70
i+static size_t	Err	bitreich.org	70
i+ffplot_text_left(struct ffplot *plot, struct ffcolor *color, struct font *ft,	Err	bitreich.org	70
i+        char *s, int x, int y)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        for (; *s != '\0'; s++)	Err	bitreich.org	70
i+                x += ffplot_char(plot, color, ft, *s, x, y);	Err	bitreich.org	70
i+        return x;	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/*	Err	bitreich.org	70
i+ * Draw a center aligned string without wrapping it.	Err	bitreich.org	70
i+ */	Err	bitreich.org	70
i+static size_t	Err	bitreich.org	70
i+ffplot_text_center(struct ffplot *plot, struct ffcolor *color, struct font *ft,	Err	bitreich.org	70
i+        char *s, int x, int y)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        x -= font_strlen(ft, s) / 2;	Err	bitreich.org	70
i+        return ffplot_text_left(plot, color, ft, s, x, y);	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/*	Err	bitreich.org	70
i+ * Draw a right aligned string without wrapping it.	Err	bitreich.org	70
i+ */	Err	bitreich.org	70
i+static size_t	Err	bitreich.org	70
i+ffplot_text_right(struct ffplot *plot, struct ffcolor *color, struct font *ft,	Err	bitreich.org	70
i+        char *s, int x, int y)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        x -= font_strlen(ft, s);	Err	bitreich.org	70
i+        return ffplot_text_left(plot, color, ft, s, x, y);	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+static void	Err	bitreich.org	70
i+ffplot_print(FILE *fp, struct ffplot *plot)	Err	bitreich.org	70
i+{	Err	bitreich.org	70
i+        uint32_t w, h;	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        w = htonl(plot->w);	Err	bitreich.org	70
i+        h = htonl(plot->h);	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        fprintf(stdout, "ffplot");	Err	bitreich.org	70
i+        fwrite(&w, sizeof(w), 1, fp);	Err	bitreich.org	70
i+        fwrite(&h, sizeof(h), 1, fp);	Err	bitreich.org	70
i+        fwrite(plot->buf, plot->w * plot->h, sizeof(*plot->buf), fp);	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i static int	Err	bitreich.org	70
i ffplot_t2x(time_t t, time_t tmin, time_t tmax)	Err	bitreich.org	70
i {	Err	bitreich.org	70
.
Response: text/plain
Original URLgopher://bitreich.org/0/scm/ploot/commit/b525323a1383dfb0...
Content-Typetext/plain; charset=utf-8