Gfxprim
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- 929 discussions
10 Feb '18
This is an automated email generated because a ref change occurred in the
git repository for project gfxprim.git.
The branch, master has been updated
via 200d270c0bdbb20d7aa1b1b82de8497699227811 (commit)
via 2bb5961d3e38dc828df9182a02d51c13943a7470 (commit)
via 63d25236813b53eb15fbdf494d157e90a95119a9 (commit)
via d63701916dc11f1349f5807efe66a0cb125c234c (commit)
via 60ac88e1ae2150b7ab5836fa882141324a642a4b (commit)
via 7afea0007af1aed1fe11a4762703eecb15395516 (commit)
via c570ae390cbf5726c9f9a1c603f3c4058e840881 (commit)
via 2edcd7667a4e2377cdda83bac4608ba454fdf426 (commit)
via ebc9d039449151402a121e0c45203ace0bb6d365 (commit)
via 5f00fa3f08d6b1a8809a751b90a72884dd71e112 (commit)
from 69d7c9ef5642dee09b76da64d79f5f5e474501e5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 200d270c0bdbb20d7aa1b1b82de8497699227811
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 10 Feb 2018 16:07:07 +0100
URL: <http://repo.or.cz/gfxprim.git/200d270c0bdbb20d>
filters/gp_filter_resize_alloc: Check w and h
Check that at least one of w and h are non-zero.
If one is zero the second one is computed accordingly to
new_size/old_size ratio.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/filters/GP_Resize.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/libs/filters/GP_Resize.c b/libs/filters/GP_Resize.c
index a1ba2d60b323..562bdca21e03 100644
--- a/libs/filters/GP_Resize.c
+++ b/libs/filters/GP_Resize.c
@@ -86,8 +86,21 @@ gp_pixmap *gp_filter_resize_alloc(const gp_pixmap *src,
gp_interpolation_type type,
gp_progress_cb *callback)
{
- gp_pixmap *res = gp_pixmap_alloc(w, h, src->pixel_type);
+ gp_pixmap *res;
+ if (!w && !h) {
+ GP_WARN("Invalid result size 0x0!");
+ errno = EINVAL;
+ return NULL;
+ }
+
+ if (!w)
+ w = (h * src->w + src->h/2) / src->h;
+
+ if (!h)
+ h = (w * src->h + src->w/2) / src->w;
+
+ res = gp_pixmap_alloc(w, h, src->pixel_type);
if (!res)
return NULL;
commit 2bb5961d3e38dc828df9182a02d51c13943a7470
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 10 Feb 2018 15:51:34 +0100
URL: <http://repo.or.cz/gfxprim.git/2bb5961d3e38dc82>
demos/loaders_register: Small fixup
* Resize the image before we attempt to create ASCII Art
* Use twice as more characters
* etc.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
demos/c_simple/loaders_register.c | 36 ++++++++++++++-----------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c
index c53218d05bed..e03e3a56395a 100644
--- a/demos/c_simple/loaders_register.c
+++ b/demos/c_simple/loaders_register.c
@@ -43,7 +43,7 @@ static int write_data(const gp_pixmap *img, gp_io *io,
gp_io *bio;
int err;
- if (img->pixel_type != GP_PIXEL_G2) {
+ if (img->pixel_type != GP_PIXEL_G4) {
errno = ENOSYS;
return 1;
}
@@ -55,26 +55,14 @@ static int write_data(const gp_pixmap *img, gp_io *io,
return 1;
unsigned int i, j;
+ const char *const table[] = {" ", ".", ",", "-", "=", "#", "O", "$"};
for (j = 0; j < img->h; j++) {
for (i = 0; i < img->w; i++) {
gp_pixel p = gp_getpixel_raw(img, i, j);
+ const char *c = table[p>>1];
- switch (p) {
- case 0:
- err = gp_io_flush(bio, " ", 2);
- break;
- case 1:
- err = gp_io_flush(bio, "..", 2);
- break;
- case 2:
- err = gp_io_flush(bio, "()", 2);
- break;
- case 3:
- err = gp_io_flush(bio, "OO", 2);
- break;
- }
-
+ err = gp_io_flush(bio, c, 1);
if (err)
return 1;
}
@@ -88,12 +76,13 @@ static int write_data(const gp_pixmap *img, gp_io *io,
}
}
+ gp_io_close(bio);
gp_progress_cb_done(callback);
return 0;
}
static gp_pixel_type save_ptypes[] = {
- GP_PIXEL_G2,
+ GP_PIXEL_G4,
GP_PIXEL_UNKNOWN,
};
@@ -106,7 +95,7 @@ const gp_loader loader = {
int main(int argc, char *argv[])
{
- gp_pixmap *c, *gc;
+ gp_pixmap *c, *gc, *sc;
gp_loader_register(&loader);
@@ -121,13 +110,20 @@ int main(int argc, char *argv[])
/* Now load image and save it using our loader */
c = gp_load_image(argv[1], NULL);
-
if (c == NULL) {
fprintf(stderr, "Failed to load image: %s\n", strerror(errno));
return 1;
}
- gc = gp_filter_floyd_steinberg_alloc(c, GP_PIXEL_G2, NULL);
+ /*
+ * Font letters are not square resize the image so that it's twice it
+ * original width.
+ */
+ gp_size w = 120;
+ gp_size h = (w/2 * c->h + c->w/2)/c->w;
+
+ sc = gp_filter_resize_alloc(c, w, h, GP_INTERP_LINEAR_LF_INT, NULL);
+ gc = gp_filter_floyd_steinberg_alloc(sc, GP_PIXEL_G4, NULL);
if (gc == NULL) {
fprintf(stderr, "FloydSteinberg: %s\n", strerror(errno));
commit 63d25236813b53eb15fbdf494d157e90a95119a9
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 13 Jan 2018 00:17:27 +0100
URL: <http://repo.or.cz/gfxprim.git/63d25236813b53eb>
gfx: New gp_fill_triangle() implementation + tests
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/gfx/GP_FillTriangle.gen.c.t | 108 ++++++++++++++
libs/gfx/GP_Triangle.c | 9 --
libs/gfx/Makefile | 2 +-
tests/gfx/.gitignore | 2 +
tests/gfx/Makefile | 5 +-
tests/gfx/compare.h | 114 +++++++++++++++
tests/gfx/fill_triangle.c | 244 +++++++++++++++++++++++++++++++
tests/gfx/fill_triangle.gen.c.t | 55 +++++++
tests/gfx/line_symmetry.gen.c.t | 88 +----------
tests/gfx/test_list.txt | 3 +
10 files changed, 531 insertions(+), 99 deletions(-)
create mode 100644 libs/gfx/GP_FillTriangle.gen.c.t
create mode 100644 tests/gfx/compare.h
create mode 100644 tests/gfx/fill_triangle.c
create mode 100644 tests/gfx/fill_triangle.gen.c.t
diff --git a/libs/gfx/GP_FillTriangle.gen.c.t b/libs/gfx/GP_FillTriangle.gen.c.t
new file mode 100644
index 000000000000..20897730d497
--- /dev/null
+++ b/libs/gfx/GP_FillTriangle.gen.c.t
@@ -0,0 +1,108 @@
+@ include source.t
+/*
+ * Filled triangle drawing algorithm.
+ *
+ * Copyright (C) 2009-2018 Cyril Hrubis <metan(a)ucw.cz>
+ */
+
+#include <core/GP_Common.h>
+#include <core/GP_GetPutPixel.h>
+#include <core/GP_FnPerBpp.h>
+#include <gfx/GP_HLine.h>
+
+typedef struct gp_line {
+ gp_coord x, dx, dy, error, xstep;
+} gp_line;
+
+static void gp_line_init(gp_line *self, gp_coord x0, gp_coord y0,
+ gp_coord x1, gp_coord y1)
+{
+ if (y0 > y1) {
+ GP_SWAP(x0, x1);
+ GP_SWAP(y0, y1);
+ }
+
+ self->x = 0;
+ self->dy = y1 - y0;
+ self->dx = GP_ABS(x1 - x0);
+ self->error = self->dx/2;
+ self->xstep = (x0 < x1) ? 1 : -1;
+}
+
+static void gp_line_nexty(gp_line *self)
+{
+ self->error -= self->dx;
+
+ while (self->error < 0) {
+ self->x += self->xstep;
+ self->error += self->dy;
+ }
+}
+
+@ for ps in pixelsizes:
+static void fill_triangle_{{ ps.suffix }}(gp_pixmap *pixmap,
+ gp_coord x0, gp_coord y0,
+ gp_coord x1, gp_coord y1,
+ gp_coord x2, gp_coord y2,
+ gp_pixel pixval)
+{
+ if (y0 > y1) {
+ GP_SWAP(x0, x1);
+ GP_SWAP(y0, y1);
+ }
+
+ if (y0 > y2) {
+ GP_SWAP(x0, x2);
+ GP_SWAP(y0, y2);
+ }
+
+ if (y1 > y2) {
+ GP_SWAP(x1, x2);
+ GP_SWAP(y1, y2);
+ }
+
+ if (y0 == y2) {
+ gp_hline_raw_{{ ps.suffix }}(pixmap,
+ GP_MIN3(x0, x1, x2),
+ GP_MAX3(x0, x1, x2),
+ y0, pixval);
+ return;
+ }
+
+ gp_line l1, l2;
+ gp_line_init(&l1, x0, y0, x1, y1);
+ gp_line_init(&l2, x0, y0, x2, y2);
+
+ gp_coord y, deltay;
+
+ deltay = y1 - y0;
+
+ for (y = 0; y < deltay; y++) {
+ gp_hline_raw_{{ ps.suffix }}(pixmap, x0 + l1.x, x0 + l2.x, y0 + y, pixval);
+ gp_line_nexty(&l1);
+ gp_line_nexty(&l2);
+ }
+
+ deltay = y2 - y1;
+
+ gp_line_init(&l1, x1, y1, x2, y2);
+
+ for (y = 0; y < deltay; y++) {
+ gp_hline_raw_{{ ps.suffix }}(pixmap, x1 + l1.x, x0 + l2.x, y1 + y, pixval);
+ gp_line_nexty(&l1);
+ gp_line_nexty(&l2);
+ }
+
+ gp_hline_raw_{{ ps.suffix }}(pixmap, x1 + l1.x, x0 + l2.x, y1 + y, pixval);
+}
+
+@ end
+
+void gp_fill_triangle_raw(gp_pixmap *pixmap, gp_coord x0, gp_coord y0,
+ gp_coord x1, gp_coord y1, gp_coord x2, gp_coord y2, gp_pixel pixel)
+{
+ GP_CHECK_PIXMAP(pixmap);
+
+ GP_FN_PER_BPP_PIXMAP(fill_triangle, pixmap, pixmap, x0, y0, x1, y1, x2, y2,
+ pixel);
+}
diff --git a/libs/gfx/GP_Triangle.c b/libs/gfx/GP_Triangle.c
index 10ed2f4fb767..67a62b77d6c8 100644
--- a/libs/gfx/GP_Triangle.c
+++ b/libs/gfx/GP_Triangle.c
@@ -51,15 +51,6 @@ void gp_triangle(gp_pixmap *pixmap, gp_coord x0, gp_coord y0,
gp_triangle_raw(pixmap, x0, y0, x1, y1, x2, y2, pixel);
}
-void gp_fill_triangle_raw(gp_pixmap *pixmap, gp_coord x0, gp_coord y0,
- gp_coord x1, gp_coord y1,
- gp_coord x2, gp_coord y2, gp_pixel pixel)
-{
- const gp_coord coords[6] = {x0, y0, x1, y1, x2, y2};
-
- gp_fill_polygon_raw(pixmap, 3, coords, pixel);
-}
-
void gp_fill_triangle(gp_pixmap *pixmap, gp_coord x0, gp_coord y0,
gp_coord x1, gp_coord y1,
gp_coord x2, gp_coord y2, gp_pixel pixel)
diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile
index 8ffe38a0282c..5a775c895fc7 100644
--- a/libs/gfx/Makefile
+++ b/libs/gfx/Makefile
@@ -4,7 +4,7 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
GENSOURCES=GP_Line.gen.c GP_HLine.gen.c GP_LineAA.gen.c GP_PutPixelAA.gen.c \
GP_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c \
- GP_FillEllipse.gen.c
+ GP_FillEllipse.gen.c GP_FillTriangle.gen.c
LIBNAME=gfx
include $(TOPDIR)/gen.mk
diff --git a/tests/gfx/.gitignore b/tests/gfx/.gitignore
index 191fe86f5955..e7006bc21b07 100644
--- a/tests/gfx/.gitignore
+++ b/tests/gfx/.gitignore
@@ -14,3 +14,5 @@
/VLine
/gfx_benchmark
line_symmetry.gen
+fill_triangle
+fill_triangle.gen
diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile
index 4a5dc18b09a2..5250ad6ba9fc 100644
--- a/tests/gfx/Makefile
+++ b/tests/gfx/Makefile
@@ -2,11 +2,11 @@ TOPDIR=../..
include $(TOPDIR)/pre.mk
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
-GENSOURCES=APICoverage.gen.c line_symmetry.gen.c
+GENSOURCES=APICoverage.gen.c line_symmetry.gen.c fill_triangle.gen.c
APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse HLine\
VLine PutPixelAA HLineAA LineAA FillEllipse FillRect APICoverage.gen\
- line_symmetry.gen
+ line_symmetry.gen fill_triangle.gen fill_triangle
Circle: common.o
FillCircle: common.o
@@ -21,6 +21,7 @@ PutPixelAA: common.o
HLineAA: common.o
LineAA: common.o
FillRect: common.o
+fill_triangle: common.o
include ../tests.mk
diff --git a/tests/gfx/compare.h b/tests/gfx/compare.h
new file mode 100644
index 000000000000..9cabaf1a069c
--- /dev/null
+++ b/tests/gfx/compare.h
@@ -0,0 +1,114 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#ifndef COMPARE_H__
+#define COMPARE_H__
+
+#include <stdio.h>
+#include <core/GP_GetPutPixel.h>
+
+static inline void print_diff(gp_pixmap *p1, gp_pixmap *p2)
+{
+ gp_size x, y;
+
+ printf(" ");
+ for (x = 0; x < p1->w; x++)
+ printf("-");
+ printf("\n");
+
+ for (y = 0; y < p1->h; y++) {
+ printf("|");
+ for (x = 0; x < p1->w; x++) {
+ gp_pixel px1 = gp_getpixel_raw_8BPP(p1, x, y);
+ gp_pixel px2 = gp_getpixel_raw_8BPP(p2, x, y);
+
+ if (px1 == px2) {
+ if (px1)
+ printf("*");
+ else
+ printf(" ");
+ } else {
+ if (px1)
+ printf("1");
+ else
+ printf("2");
+ }
+ }
+ printf("|\n");
+ }
+
+ printf(" ");
+ for (x = 0; x < p1->w; x++)
+ printf("-");
+ printf("\n");
+}
+
+static inline void print(gp_pixmap *p)
+{
+ gp_size x, y;
+
+ printf(" ");
+ for (x = 0; x < p->w; x++)
+ printf("-");
+ printf("\n");
+
+ for (y = 0; y < p->h; y++) {
+ printf("|");
+ for (x = 0; x < p->w; x++) {
+ gp_pixel px = gp_getpixel_raw_8BPP(p, x, y);
+
+ if (px)
+ printf("*");
+ else
+ printf(" ");
+ }
+ printf("|\n");
+ }
+
+ printf(" ");
+ for (x = 0; x < p->w; x++)
+ printf("-");
+ printf("\n");
+}
+
+static inline int compare_pixmaps(gp_pixmap *p1, gp_pixmap *p2)
+{
+ gp_size x, y;
+ print(p1);
+ for (x = 0; x < p1->w; x++) {
+ for (y = 0; y < p1->h; y++) {
+ gp_pixel px1 = gp_getpixel_raw_8BPP(p1, x, y);
+ gp_pixel px2 = gp_getpixel_raw_8BPP(p2, x, y);
+
+ if (px1 != px2) {
+ print(p1);
+ print(p2);
+ print_diff(p1, p2);
+ return TST_FAILED;
+ }
+ }
+ }
+
+ return TST_SUCCESS;
+}
+
+#endif /* COMPARE_H__ */
diff --git a/tests/gfx/fill_triangle.c b/tests/gfx/fill_triangle.c
new file mode 100644
index 000000000000..22d61f9baf7b
--- /dev/null
+++ b/tests/gfx/fill_triangle.c
@@ -0,0 +1,244 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2018 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include <core/GP_Pixmap.h>
+#include <gfx/GP_Triangle.h>
+
+#include <gfx/GP_Line.h>
+
+#include "tst_test.h"
+
+#include "common.h"
+
+struct testcase {
+ /* line description */
+ gp_coord x0;
+ gp_coord y0;
+ gp_coord x1;
+ gp_coord y1;
+ gp_coord x2;
+ gp_coord y2;
+
+ /* expected result */
+ gp_size w, h;
+ const char pixmap[];
+};
+
+static int test_fill_triangle(const struct testcase *t)
+{
+ gp_pixmap *c;
+ int err;
+
+ c = gp_pixmap_alloc(t->w, t->h, GP_PIXEL_G8);
+
+ if (c == NULL) {
+ tst_err("Failed to allocate pixmap");
+ return TST_UNTESTED;
+ }
+
+ /* zero the pixels buffer */
+ memset(c->pixels, 0, c->w * c->h);
+/*
+ gp_line(c, t->x0, t->y0, t->x1, t->y1, 1);
+ gp_line(c, t->x0, t->y0, t->x2, t->y2, 1);
+ gp_line(c, t->x2, t->y2, t->x1, t->y1, 1);
+*/
+ gp_fill_triangle(c, t->x0, t->y0, t->x1, t->y1, t->x2, t->y2, 1);
+
+ err = compare_buffers(t->pixmap, c);
+
+ if (err)
+ return TST_FAILED;
+
+ return TST_SUCCESS;
+}
+
+static struct testcase triangle_point = {
+ .x0 = 1,
+ .y0 = 1,
+ .x1 = 1,
+ .y1 = 1,
+ .x2 = 1,
+ .y2 = 1,
+
+ .w = 3,
+ .h = 3,
+
+ .pixmap = {
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0,
+ }
+};
+
+static struct testcase triangle_hline = {
+ .x0 = 1,
+ .y0 = 1,
+ .x1 = 2,
+ .y1 = 1,
+ .x2 = 3,
+ .y2 = 1,
+
+ .w = 5,
+ .h = 3,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase triangle_vline = {
+ .x0 = 1,
+ .y0 = 1,
+ .x1 = 1,
+ .y1 = 2,
+ .x2 = 1,
+ .y2 = 3,
+
+ .w = 3,
+ .h = 5,
+
+ .pixmap = {
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 1, 0,
+ 0, 1, 0,
+ 0, 0, 0,
+ }
+};
+
+static struct testcase triangle1 = {
+ .x0 = 1,
+ .y0 = 2,
+ .x1 = 3,
+ .y1 = 2,
+ .x2 = 2,
+ .y2 = 1,
+
+ .w = 5,
+ .h = 4,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase triangle2 = {
+ .x0 = 1,
+ .y0 = 1,
+ .x1 = 3,
+ .y1 = 1,
+ .x2 = 2,
+ .y2 = 2,
+
+ .w = 5,
+ .h = 4,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase triangle3 = {
+ .x0 = 2,
+ .y0 = 2,
+ .x1 = 1,
+ .y1 = 1,
+ .x2 = 2,
+ .y2 = 1,
+
+ .w = 4,
+ .h = 4,
+
+ .pixmap = {
+ 0, 0, 0, 0,
+ 0, 1, 1, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 0,
+ }
+};
+
+static struct testcase triangle4 = {
+ .x0 = 2,
+ .y0 = 2,
+ .x1 = 1,
+ .y1 = 1,
+ .x2 = 1,
+ .y2 = 2,
+
+ .w = 4,
+ .h = 4,
+
+ .pixmap = {
+ 0, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 1, 1, 0,
+ 0, 0, 0, 0,
+ }
+};
+
+const struct tst_suite tst_suite = {
+ .suite_name = "Fill Triangle Testsuite",
+ .tests = {
+ {.name = "Fill Triangle point",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle_point},
+
+ {.name = "Fill Triangle hline",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle_hline},
+
+ {.name = "Fill Triangle vline",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle_vline},
+
+ {.name = "Fill Triangle 1",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle1},
+
+ {.name = "Fill Triangle 2",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle2},
+
+ {.name = "Fill Triangle 3",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle3},
+
+ {.name = "Fill Triangle 4",
+ .tst_fn = test_fill_triangle,
+ .data = &triangle4},
+
+ {.name = NULL}
+ }
+};
diff --git a/tests/gfx/fill_triangle.gen.c.t b/tests/gfx/fill_triangle.gen.c.t
new file mode 100644
index 000000000000..b069f511f232
--- /dev/null
+++ b/tests/gfx/fill_triangle.gen.c.t
@@ -0,0 +1,55 @@
+@ include source.t
+/*
+ * Copyright (C) 2018 Cyril Hrubis <metan(a)ucw.cz>
+ */
+
+#include <stdio.h>
+
+#include <core/GP_Pixmap.h>
+#include <gfx/GP_Gfx.h>
+#include <filters/GP_Rotate.h>
+
+#include "tst_test.h"
+#include "compare.h"
+
+@ max_x = 10
+@ max_y = 3
+
+static void prep(gp_pixmap **p1, gp_pixmap **p2, gp_size w, gp_size h)
+{
+ *p1 = gp_pixmap_alloc(w, h, GP_PIXEL_G8);
+ *p2 = gp_pixmap_alloc(w, h, GP_PIXEL_G8);
+
+ gp_fill(*p1, 0);
+ gp_fill(*p2, 0);
+}
+
+@ for x in range(2, max_x, 2):
+@ for y in range(1, max_y):
+static int isosceles_symmetry_{{ x }}_{{ y }}(void)
+{
+ gp_pixmap *p1, *p2;
+
+ prep(&p1, &p2, {{ x }}+1, {{ y }}+1);
+
+ gp_fill_triangle(p1, {{ x }}/2, 0, 0, {{ y }}, {{ x }}, {{ y }}, 1);
+ gp_fill_triangle(p2, {{ x }}/2, 0, 0, {{ y }}, {{ x }}, {{ y }}, 1);
+
+ gp_filter_mirror_h(p2, p2, NULL);
+
+ return compare_pixmaps(p1, p2);
+}
+
+@ end
+@
+const struct tst_suite tst_suite = {
+ .suite_name = "Triangle fill testsuite",
+ .tests = {
+@ for x in range(2, max_x, 2):
+@ for y in range(1, max_y):
+ {.name = "Isosceles symmetry {{ x }}, {{ y }}",
+ .tst_fn = isosceles_symmetry_{{ x }}_{{ y }}},
+@ end
+ {.name = NULL}
+ }
+};
diff --git a/tests/gfx/line_symmetry.gen.c.t b/tests/gfx/line_symmetry.gen.c.t
index 8f1b5710b631..1415a4fee2d9 100644
--- a/tests/gfx/line_symmetry.gen.c.t
+++ b/tests/gfx/line_symmetry.gen.c.t
@@ -5,102 +5,16 @@
* Copyright (C) 2018 Cyril Hrubis <metan(a)ucw.cz>
*/
-#include <stdio.h>
-
#include <core/GP_Pixmap.h>
#include <gfx/GP_Gfx.h>
#include <filters/GP_Rotate.h>
#include "tst_test.h"
+#include "compare.h"
@ max_x = 21
@ max_y = 21
-static void print_diff(gp_pixmap *p1, gp_pixmap *p2)
-{
- gp_size x, y;
-
- printf(" ");
- for (x = 0; x < p1->w; x++)
- printf("-");
- printf("\n");
-
- for (y = 0; y < p1->h; y++) {
- printf("|");
- for (x = 0; x < p1->w; x++) {
- gp_pixel px1 = gp_getpixel_raw_8BPP(p1, x, y);
- gp_pixel px2 = gp_getpixel_raw_8BPP(p2, x, y);
-
- if (px1 == px2) {
- if (px1)
- printf("*");
- else
- printf(" ");
- } else {
- if (px1)
- printf("1");
- else
- printf("2");
- }
- }
- printf("|\n");
- }
-
- printf(" ");
- for (x = 0; x < p1->w; x++)
- printf("-");
- printf("\n");
-}
-
-static void print(gp_pixmap *p)
-{
- gp_size x, y;
-
- printf(" ");
- for (x = 0; x < p->w; x++)
- printf("-");
- printf("\n");
-
- for (y = 0; y < p->h; y++) {
- printf("|");
- for (x = 0; x < p->w; x++) {
- gp_pixel px = gp_getpixel_raw_8BPP(p, x, y);
-
- if (px)
- printf("*");
- else
- printf(" ");
- }
- printf("|\n");
- }
-
- printf(" ");
- for (x = 0; x < p->w; x++)
- printf("-");
- printf("\n");
-}
-
-static int compare_pixmaps(gp_pixmap *p1, gp_pixmap *p2)
-{
- gp_size x, y;
-
- for (x = 0; x < p1->w; x++) {
- for (y = 0; y < p1->h; y++) {
- gp_pixel px1 = gp_getpixel_raw_8BPP(p1, x, y);
- gp_pixel px2 = gp_getpixel_raw_8BPP(p2, x, y);
-
- if (px1 != px2) {
- print(p1);
- print(p2);
- print_diff(p1, p2);
- return TST_FAILED;
- }
- }
- }
-
- return TST_SUCCESS;
-}
-
static void prep(gp_pixmap **p1, gp_pixmap **p2, gp_size w, gp_size h)
{
*p1 = gp_pixmap_alloc(w, h, GP_PIXEL_G8);
diff --git a/tests/gfx/test_list.txt b/tests/gfx/test_list.txt
index b8ee7ea73c5c..ef716fb60cb7 100644
--- a/tests/gfx/test_list.txt
+++ b/tests/gfx/test_list.txt
@@ -17,3 +17,6 @@ FillRect
PutPixelAA
HLineAA
LineAA
+
+fill_triangle
+fill_triangle.gen
commit d63701916dc11f1349f5807efe66a0cb125c234c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 13 Jan 2018 00:16:34 +0100
URL: <http://repo.or.cz/gfxprim.git/d63701916dc11f13>
core/GP_Common: Add MIN3()
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
include/core/GP_Common.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h
index ee61735eee90..6d80730a4c1a 100644
--- a/include/core/GP_Common.h
+++ b/include/core/GP_Common.h
@@ -44,6 +44,16 @@
})
/*
+ * Returns maximum from three numbers.
+ */
+#define GP_MIN3(a, b, c) ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ typeof(c) _c = (c); \
+ _a < _b ? (_a < _c ? _a : _c) : (_b < _c ? _b : _c); \
+})
+
+/*
* Returns a maximum of the two numbers.
*/
#define GP_MAX(a, b) ({ \
commit 60ac88e1ae2150b7ab5836fa882141324a642a4b
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu, 11 Jan 2018 18:44:03 +0100
URL: <http://repo.or.cz/gfxprim.git/60ac88e1ae2150b7>
gfx: Fix line drawing + symmetry tests
The Bresenham's line does not draw symetric line by default, if you want
line that is symmetrical when mirrored horizontally or vertically or
when rotated by multiples of 90 degrees you have to draw only half of
the line and draw second half symetrically to the line center.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/gfx/GP_Line.gen.c.t | 100 ++++++++------
tests/gfx/.gitignore | 1 +
tests/gfx/Line.c | 223 +++++++++++++++++++++++++++++++-
tests/gfx/Makefile | 5 +-
tests/gfx/gfx_benchmark.c | 4 +-
tests/gfx/line_symmetry.gen.c.t | 173 +++++++++++++++++++++++++
tests/gfx/test_list.txt | 1 +
7 files changed, 460 insertions(+), 47 deletions(-)
create mode 100644 tests/gfx/line_symmetry.gen.c.t
diff --git a/libs/gfx/GP_Line.gen.c.t b/libs/gfx/GP_Line.gen.c.t
index 6e41be9f47d7..bbccb58369ad 100644
--- a/libs/gfx/GP_Line.gen.c.t
+++ b/libs/gfx/GP_Line.gen.c.t
@@ -4,7 +4,7 @@
*
* Copyright (C) 2009-2012 Jiri "BlueBear" Dluhos
* <jiri.bluebear.dluhos(a)gmail.com>
- * Copyright (C) 2009-2014 Cyril Hrubis <metan(a)ucw.cz>
+ * Copyright (C) 2009-2018 Cyril Hrubis <metan(a)ucw.cz>
*/
#include "core/GP_Common.h"
@@ -23,6 +23,60 @@
*/
@ for ps in pixelsizes:
+static void line_dy_{{ ps.suffix }}(gp_pixmap *pixmap, int x0, int y0, int x1, int y1, gp_pixel pixval)
+{
+ if (y0 > y1) {
+ GP_SWAP(y0, y1);
+ GP_SWAP(x0, x1);
+ }
+
+ int deltay = y1 - y0;
+ int deltax = GP_ABS(x1 - x0);
+
+ int error = deltay / 2;
+
+ int x = 0, y;
+ int xstep = (x0 < x1) ? 1 : -1;
+
+ for (y = 0; y <= deltay/2; y++) {
+ gp_putpixel_raw_{{ ps.suffix }}(pixmap, x0+x, y0+y, pixval);
+ gp_putpixel_raw_{{ ps.suffix }}(pixmap, x1-x, y1-y, pixval);
+
+ error -= deltax;
+ if (error < 0) {
+ x += xstep;
+ error += deltay;
+ }
+ }
+}
+
+static void line_dx_{{ ps.suffix }}(gp_pixmap *pixmap, int x0, int y0, int x1, int y1, gp_pixel pixval)
+{
+ if (x0 > x1) {
+ GP_SWAP(x0, x1);
+ GP_SWAP(y0, y1);
+ }
+
+ int deltax = x1 - x0;
+ int deltay = GP_ABS(y1 - y0);
+
+ int error = deltax/2;
+
+ int y = 0, x;
+ int ystep = (y0 < y1) ? 1 : -1;
+
+ for (x = 0; x <= deltax/2; x++) {
+ gp_putpixel_raw_{{ ps.suffix }}(pixmap, x0+x, y0+y, pixval);
+ gp_putpixel_raw_{{ ps.suffix }}(pixmap, x1-x, y1-y, pixval);
+
+ error -= deltay;
+ if (error < 0) {
+ y += ystep;
+ error += deltax;
+ }
+ }
+}
+
void gp_line_raw_{{ ps.suffix }}(gp_pixmap *pixmap, int x0, int y0,
int x1, int y1, gp_pixel pixval)
{
@@ -41,7 +95,7 @@ void gp_line_raw_{{ ps.suffix }}(gp_pixmap *pixmap, int x0, int y0,
x0, y0, pixval);
return;
}
- gp_vline_raw(pixmap, x0, y0, y1, pixval);
+ gp_vline_raw_{{ ps.suffix }}(pixmap, x0, y0, y1, pixval);
return;
}
if (y0 == y1) {
@@ -53,44 +107,10 @@ void gp_line_raw_{{ ps.suffix }}(gp_pixmap *pixmap, int x0, int y0,
* Which axis is longer? Swap the coordinates if necessary so
* that the X axis is always the longer one and Y is shorter.
*/
- int steep = abs(y1 - y0) / abs(x1 - x0);
- if (steep) {
- GP_SWAP(x0, y0);
- GP_SWAP(x1, y1);
- }
- if (x0 > x1) {
- GP_SWAP(x0, x1);
- GP_SWAP(y0, y1);
- }
-
- /* iterate over the longer axis, calculate values on the shorter */
- int deltax = x1 - x0;
- int deltay = abs(y1 - y0);
-
- /*
- * start with error of 0.5 (multiplied by deltax for integer-only math),
- * this reflects the fact that ideally, the coordinate should be
- * in the middle of the pixel
- */
- int error = deltax / 2;
-
- int y = y0, x;
- int ystep = (y0 < y1) ? 1 : -1;
- for (x = x0; x <= x1; x++) {
-
- if (steep)
- gp_putpixel_raw_{{ ps.suffix }}(pixmap, y, x,
- pixval);
- else
- gp_putpixel_raw_{{ ps.suffix }}(pixmap, x, y,
- pixval);
-
- error -= deltay;
- if (error < 0) {
- y += ystep; /* next step on the shorter axis */
- error += deltax;
- }
- }
+ if ((y1 - y0) / (x1 - x0))
+ line_dy_{{ ps.suffix }}(pixmap, x0, y0, x1, y1, pixval);
+ else
+ line_dx_{{ ps.suffix }}(pixmap, x0, y0, x1, y1, pixval);
}
@ end
diff --git a/tests/gfx/.gitignore b/tests/gfx/.gitignore
index 92632603d889..191fe86f5955 100644
--- a/tests/gfx/.gitignore
+++ b/tests/gfx/.gitignore
@@ -13,3 +13,4 @@
/PutPixelAA
/VLine
/gfx_benchmark
+line_symmetry.gen
diff --git a/tests/gfx/Line.c b/tests/gfx/Line.c
index 1e1b2d47c25e..1b89e843ad61 100644
--- a/tests/gfx/Line.c
+++ b/tests/gfx/Line.c
@@ -153,7 +153,7 @@ static struct testcase testcase_line_45 = {
static struct testcase testcase_line_15 = {
.x0 = 0,
.y0 = 1,
- .x1 = 11,
+ .x1 = 10,
.y1 = 6,
.w = 11,
@@ -163,11 +163,11 @@ static struct testcase testcase_line_15 = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
};
@@ -205,6 +205,183 @@ static struct testcase testcase_line_large_xy = {
}
};
+static struct testcase line_nearly_vertical = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 1,
+ .y1 = 9,
+
+ .w = 2,
+ .h = 10,
+
+ .pixmap = {
+ 1, 0,
+ 1, 0,
+ 1, 0,
+ 1, 0,
+ 1, 0,
+ 0, 1,
+ 0, 1,
+ 0, 1,
+ 0, 1,
+ 0, 1,
+ }
+};
+
+static struct testcase line_nearly_horizontal = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 9,
+ .y1 = 1,
+
+ .w = 10,
+ .h = 2,
+
+ .pixmap = {
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ }
+};
+
+static struct testcase line_0_0_1_2 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 1,
+ .y1 = 2,
+
+ .w = 2,
+ .h = 3,
+
+ .pixmap = {
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ }
+};
+
+static struct testcase line_0_0_1_4 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 1,
+ .y1 = 4,
+
+ .w = 2,
+ .h = 5,
+
+ .pixmap = {
+ 1, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 0, 1,
+ }
+};
+
+static struct testcase line_0_0_2_1 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 2,
+ .y1 = 1,
+
+ .w = 3,
+ .h = 2,
+
+ .pixmap = {
+ 1, 1, 0,
+ 0, 1, 1,
+ }
+};
+
+static struct testcase line_0_0_4_1 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 4,
+ .y1 = 1,
+
+ .w = 5,
+ .h = 2,
+
+ .pixmap = {
+ 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1,
+ }
+};
+
+static struct testcase line_0_0_2_4 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 2,
+ .y1 = 4,
+
+ .w = 3,
+ .h = 5,
+
+ .pixmap = {
+ 1, 0, 0,
+ 1, 0, 0,
+ 0, 1, 0,
+ 0, 0, 1,
+ 0, 0, 1,
+ }
+};
+
+static struct testcase line_0_0_4_2 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 4,
+ .y1 = 2,
+
+ .w = 5,
+ .h = 3,
+
+ .pixmap = {
+ 1, 1, 0, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 0, 1, 1,
+ }
+};
+
+static struct testcase line_0_0_8_4 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 8,
+ .y1 = 4,
+
+ .w = 9,
+ .h = 5,
+
+ .pixmap = {
+ 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ }
+};
+
+static struct testcase line_0_0_4_8 = {
+ .x0 = 0,
+ .y0 = 0,
+ .x1 = 4,
+ .y1 = 8,
+
+ .w = 5,
+ .h = 9,
+
+ .pixmap = {
+ 1, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0,
+ 0, 1, 0, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 0, 1, 0,
+ 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 1,
+ }
+};
+
+
const struct tst_suite tst_suite = {
.suite_name = "Line Testsuite",
.tests = {
@@ -228,6 +405,46 @@ const struct tst_suite tst_suite = {
.tst_fn = test_line,
.data = &testcase_line_15},
+ {.name = "Line nearly vertical",
+ .tst_fn = test_line,
+ .data = &line_nearly_vertical},
+
+ {.name = "Line nearly horizontal",
+ .tst_fn = test_line,
+ .data = &line_nearly_horizontal},
+
+ {.name = "Line 0, 0, 1, 2",
+ .tst_fn = test_line,
+ .data = &line_0_0_1_2},
+
+ {.name = "line 0, 0, 1, 4",
+ .tst_fn = test_line,
+ .data = &line_0_0_1_4},
+
+ {.name = "Line 0, 0, 2, 1",
+ .tst_fn = test_line,
+ .data = &line_0_0_2_1},
+
+ {.name = "line 0, 0, 4, 1",
+ .tst_fn = test_line,
+ .data = &line_0_0_4_1},
+
+ {.name = "line 0, 0, 2, 4",
+ .tst_fn = test_line,
+ .data = &line_0_0_2_4},
+
+ {.name = "line 0, 0, 4, 2",
+ .tst_fn = test_line,
+ .data = &line_0_0_4_2},
+
+ {.name = "line 0, 0, 8, 4",
+ .tst_fn = test_line,
+ .data = &line_0_0_8_4},
+
+ {.name = "line 0, 0, 4, 8",
+ .tst_fn = test_line,
+ .data = &line_0_0_4_8},
+
{.name = "Line clipping",
.tst_fn = test_line,
.data = &testcase_line_clip},
diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile
index 750d4553f096..4a5dc18b09a2 100644
--- a/tests/gfx/Makefile
+++ b/tests/gfx/Makefile
@@ -2,10 +2,11 @@ TOPDIR=../..
include $(TOPDIR)/pre.mk
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
-GENSOURCES=APICoverage.gen.c
+GENSOURCES=APICoverage.gen.c line_symmetry.gen.c
APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse HLine\
- VLine PutPixelAA HLineAA LineAA FillEllipse FillRect APICoverage.gen
+ VLine PutPixelAA HLineAA LineAA FillEllipse FillRect APICoverage.gen\
+ line_symmetry.gen
Circle: common.o
FillCircle: common.o
diff --git a/tests/gfx/gfx_benchmark.c b/tests/gfx/gfx_benchmark.c
index 282ed20e3ca0..66be751ae86f 100644
--- a/tests/gfx/gfx_benchmark.c
+++ b/tests/gfx/gfx_benchmark.c
@@ -36,7 +36,7 @@ static int bench_line(gp_pixel_type type)
unsigned int i;
- for (i = 0; i < 100000; i++) {
+ for (i = 0; i < 20000; i++) {
gp_line(img, 0 + i % 100, 0 - i % 100,
800 - i%200, 600 + i%200, i % 0xff);
}
@@ -80,7 +80,7 @@ static int bench_circle(gp_pixel_type type)
unsigned int i;
- for (i = 0; i < 100000; i++) {
+ for (i = 0; i < 5000; i++) {
gp_circle(img, img->w/2, img->h/2, i % 1000, i%0xff);
}
diff --git a/tests/gfx/line_symmetry.gen.c.t b/tests/gfx/line_symmetry.gen.c.t
new file mode 100644
index 000000000000..8f1b5710b631
--- /dev/null
+++ b/tests/gfx/line_symmetry.gen.c.t
@@ -0,0 +1,173 @@
+@ include source.t
+/*
+ * Tests that lines horizontally and vertically symetric lines are symetric.
+ *
+ * Copyright (C) 2018 Cyril Hrubis <metan(a)ucw.cz>
+ */
+
+#include <stdio.h>
+
+#include <core/GP_Pixmap.h>
+#include <gfx/GP_Gfx.h>
+#include <filters/GP_Rotate.h>
+
+#include "tst_test.h"
+
+@ max_x = 21
+@ max_y = 21
+
+static void print_diff(gp_pixmap *p1, gp_pixmap *p2)
+{
+ gp_size x, y;
+
+ printf(" ");
+ for (x = 0; x < p1->w; x++)
+ printf("-");
+ printf("\n");
+
+ for (y = 0; y < p1->h; y++) {
+ printf("|");
+ for (x = 0; x < p1->w; x++) {
+ gp_pixel px1 = gp_getpixel_raw_8BPP(p1, x, y);
+ gp_pixel px2 = gp_getpixel_raw_8BPP(p2, x, y);
+
+ if (px1 == px2) {
+ if (px1)
+ printf("*");
+ else
+ printf(" ");
+ } else {
+ if (px1)
+ printf("1");
+ else
+ printf("2");
+ }
+ }
+ printf("|\n");
+ }
+
+ printf(" ");
+ for (x = 0; x < p1->w; x++)
+ printf("-");
+ printf("\n");
+}
+
+static void print(gp_pixmap *p)
+{
+ gp_size x, y;
+
+ printf(" ");
+ for (x = 0; x < p->w; x++)
+ printf("-");
+ printf("\n");
+
+ for (y = 0; y < p->h; y++) {
+ printf("|");
+ for (x = 0; x < p->w; x++) {
+ gp_pixel px = gp_getpixel_raw_8BPP(p, x, y);
+
+ if (px)
+ printf("*");
+ else
+ printf(" ");
+ }
+ printf("|\n");
+ }
+
+ printf(" ");
+ for (x = 0; x < p->w; x++)
+ printf("-");
+ printf("\n");
+}
+
+static int compare_pixmaps(gp_pixmap *p1, gp_pixmap *p2)
+{
+ gp_size x, y;
+
+ for (x = 0; x < p1->w; x++) {
+ for (y = 0; y < p1->h; y++) {
+ gp_pixel px1 = gp_getpixel_raw_8BPP(p1, x, y);
+ gp_pixel px2 = gp_getpixel_raw_8BPP(p2, x, y);
+
+ if (px1 != px2) {
+ print(p1);
+ print(p2);
+ print_diff(p1, p2);
+ return TST_FAILED;
+ }
+ }
+ }
+
+ return TST_SUCCESS;
+}
+
+static void prep(gp_pixmap **p1, gp_pixmap **p2, gp_size w, gp_size h)
+{
+ *p1 = gp_pixmap_alloc(w, h, GP_PIXEL_G8);
+ *p2 = gp_pixmap_alloc(w, h, GP_PIXEL_G8);
+
+ gp_fill(*p1, 0);
+ gp_fill(*p2, 0);
+}
+
+@ for x in range(1, max_x):
+@ for y in range(1, max_y):
+static int line_{{ x }}_{{ y }}_h(void)
+{
+ gp_pixmap *p1, *p2;
+
+ prep(&p1, &p2, {{ x }}+1, {{ y }}+1);
+
+ gp_line(p1, 0, 0, {{ x }}, {{ y }}, 1);
+ gp_line(p2, 0, {{ y }}, {{ x }}, 0, 1);
+
+ gp_filter_mirror_h(p2, p2, NULL);
+
+ return compare_pixmaps(p1, p2);
+}
+
+static int line_{{ x }}_{{ y }}_v(void)
+{
+ gp_pixmap *p1, *p2;
+
+ prep(&p1, &p2, {{ x }}+1, {{ y }}+1);
+
+ gp_line(p1, 0, 0, {{ x }}, {{ y }}, 1);
+ gp_line(p2, {{ x }}, 0, 0, {{ y }}, 1);
+
+ gp_filter_mirror_v(p2, p2, NULL);
+
+ return compare_pixmaps(p1, p2);
+}
+
+static int line_{{ x }}_{{ y }}_rot(void)
+{
+ gp_pixmap *p1, *p2;
+ gp_size w = GP_MAX({{ x }}, {{ y }}) + 1;
+
+ prep(&p1, &p2, w, w);
+
+ gp_line(p1, 0, 0, {{ x }}, {{ y }}, 1);
+ gp_line(p2, 0, w-1, {{ y }}, w - 1 - {{ x }}, 1);
+ p2 = gp_filter_rotate_90_alloc(p2, NULL);
+
+ return compare_pixmaps(p1, p2);
+}
+
+@ end
+@
+const struct tst_suite tst_suite = {
+ .suite_name = "Line symmetry testsuite",
+ .tests = {
+@ for x in range(1, max_x):
+@ for y in range(1, max_y):
+ {.name = "line_h 0, 0, {{ x }}, {{ y }} vs 0, {{ y }}, {{ x }}, 0",
+ .tst_fn = line_{{ x }}_{{ y }}_h},
+ {.name = "line_v 0, 0, {{ x }}, {{ y }} vs {{ x }}, 0, 0, {{ y }}",
+ .tst_fn = line_{{ x }}_{{ y }}_v},
+ {.name = "line 0, 0, {{ x }}, {{ y }} rot 90",
+ .tst_fn = line_{{ x }}_{{ y }}_rot},
+@ end
+ {.name = NULL}
+ }
+};
diff --git a/tests/gfx/test_list.txt b/tests/gfx/test_list.txt
index b801c5baa93e..b8ee7ea73c5c 100644
--- a/tests/gfx/test_list.txt
+++ b/tests/gfx/test_list.txt
@@ -5,6 +5,7 @@ APICoverage.gen
HLine
VLine
Line
+line_symmetry.gen
Circle
FillCircle
Ellipse
commit 7afea0007af1aed1fe11a4762703eecb15395516
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed, 13 Dec 2017 22:14:49 +0100
URL: <http://repo.or.cz/gfxprim.git/7afea0007af1aed1>
Rename API to snake_case.
The Python API no uses snake_case for functions and MixedCase for
classes. Also the Python API has been broken for quite some time
and as a side effect this a few bugs has been fixed, we really need
tests otherwise it will break again sooner or later.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/check_symbols.sh | 14 +-
build/syms/Backend_symbols.txt | 27 -
build/syms/Core_symbols.txt | 78 ---
build/syms/Filters_symbols.txt | 134 -----
build/syms/GFX_symbols.txt | 107 ----
build/syms/Grabbers_symbols.txt | 1 -
build/syms/Input_symbols.txt | 33 --
build/syms/Loaders_symbols.txt | 165 ------
build/syms/Text_symbols.txt | 33 --
build/syms/backend_symbols.txt | 19 +
build/syms/core_symbols.txt | 309 ++++++++++
build/syms/filters_symbols.txt | 0
build/syms/gfx_symbols.txt | 0
build/syms/grabbers_symbols.txt | 1 +
build/syms/input_symbols.txt | 0
build/syms/loaders_symbols.txt | 100 ++++
build/syms/text_symbols.txt | 0
demos/bogoman/bogoman.c | 30 +-
demos/bogoman/bogoman_render.c | 120 ++--
demos/bogoman/bogoman_render.h | 5 +-
demos/c_simple/SDL_glue.c | 20 +-
demos/c_simple/backend_example.c | 40 +-
demos/c_simple/backend_timers_example.c | 36 +-
demos/c_simple/blittest.c | 68 +--
demos/c_simple/convolution.c | 18 +-
demos/c_simple/data_storage.c | 26 +-
demos/c_simple/debug_handler.c | 14 +-
demos/c_simple/fileview.c | 90 +--
demos/c_simple/filters_symmetry.c | 24 +-
demos/c_simple/fonttest.c | 108 ++--
demos/c_simple/gaussian_noise.c | 10 +-
demos/c_simple/gfx_koch.c | 22 +-
demos/c_simple/input_example.c | 75 +--
demos/c_simple/koch.c | 50 +-
demos/c_simple/linetest.c | 44 +-
demos/c_simple/loaders.c | 14 +-
demos/c_simple/loaders_example.c | 10 +-
demos/c_simple/loaders_register.c | 42 +-
demos/c_simple/memory_io.c | 32 +-
demos/c_simple/meta_data.c | 12 +-
demos/c_simple/pretty_print.c | 10 +-
demos/c_simple/randomshapetest.c | 74 +--
demos/c_simple/shapetest.c | 134 ++---
demos/c_simple/showimage.c | 28 +-
demos/c_simple/textaligntest.c | 70 +--
demos/c_simple/timers.c | 28 +-
demos/c_simple/v4l2_grab.c | 21 +-
demos/c_simple/v4l2_show.c | 54 +-
demos/c_simple/version.c | 2 +-
demos/c_simple/virtual_backend_example.c | 84 +--
demos/c_simple/weighted_median.c | 16 +-
demos/c_simple/x11_windows.c | 54 +-
demos/c_simple/zip_container.c | 42 +-
demos/grinder/grinder.c | 144 ++---
demos/grinder/histogram.c | 35 +-
demos/grinder/histogram.h | 4 +-
demos/particle/particle_demo.c | 44 +-
demos/particle/space.c | 52 +-
demos/particle/space.h | 4 +-
demos/py_simple/backends.py | 18 +-
demos/py_simple/blit.py | 30 +-
demos/py_simple/blur.py | 6 +-
demos/py_simple/cam_view.py | 18 +-
demos/py_simple/convolution.py | 6 +-
demos/py_simple/dither.py | 8 +-
demos/py_simple/font_style.py | 20 +-
demos/py_simple/gfx.py | 88 +--
demos/py_simple/gfxprim_qt.py | 6 +-
demos/py_simple/invert.py | 10 +-
demos/py_simple/loaders_example.py | 8 +-
demos/py_simple/progress_callback.py | 6 +-
demos/py_simple/resize.py | 10 +-
demos/py_simple/rotate90.py | 12 +-
demos/py_simple/showimage.py | 14 +-
demos/py_simple/x11_windows.py | 26 +-
demos/spiv/image_cache.c | 28 +-
demos/spiv/image_cache.h | 14 +-
demos/spiv/image_list.c | 2 +-
demos/spiv/image_loader.c | 36 +-
demos/spiv/image_loader.h | 4 +-
demos/spiv/spiv.c | 220 ++++----
demos/spiv/spiv_config.c | 15 +-
demos/spiv/spiv_config.h | 6 +-
demos/spiv/spiv_help.c | 40 +-
demos/spiv/spiv_help.h | 4 +-
demos/termini/termini.c | 98 ++--
demos/ttf2img/ttf2img.c | 22 +-
doc/about.txt | 6 +-
doc/backends.txt | 226 ++++----
doc/basic_types.txt | 10 +-
doc/blits.txt | 52 +-
doc/coding_style.txt | 18 +-
doc/convert.txt | 20 +-
doc/coordinate_system.txt | 4 +-
doc/core_common.txt | 22 +-
doc/core_python.txt | 34 +-
doc/debug.txt | 20 +-
doc/environment_variables.txt | 16 +-
doc/event_queue.txt | 69 +--
doc/example_SDL_glue.txt | 2 +-
doc/example_loader_registration.txt | 6 +-
doc/filters.txt | 503 ++++++++---------
doc/filters_dithering.txt | 28 +-
doc/filters_python.txt | 2 +-
doc/filters_resize.txt | 90 +--
doc/gamma.txt | 21 +-
doc/get_put_pixel.txt | 20 +-
doc/gfx.txt | 139 +++--
doc/grabbers.txt | 38 +-
doc/input.txt | 98 ++--
doc/loaders.txt | 456 +++++++--------
doc/loaders_io.txt | 28 +-
doc/pixels.txt | 78 +--
doc/pixmap.txt | 94 ++--
doc/progress_callback.txt | 8 +-
doc/text.txt | 76 +--
gen/include/pixeltype.py | 2 +-
include/Makefile | 2 +-
include/backends/GP_AALib.h | 4 +-
include/backends/GP_Backend.h | 150 +++--
include/backends/GP_BackendInit.h | 2 +-
include/backends/GP_BackendVirtual.h | 14 +-
include/backends/GP_LinuxFB.h | 6 +-
include/backends/GP_SDL.h | 13 +-
include/backends/GP_SDL_Pixmap.h | 6 +-
include/backends/GP_X11.h | 16 +-
include/core/GP_BitSwap.h | 6 +-
include/core/GP_Blit.h | 80 ++-
include/core/GP_Common.h | 13 +-
include/core/GP_Convert.gen.h.t | 28 +-
include/core/GP_Convert.h | 54 +-
include/core/GP_Debug.h | 22 +-
include/core/GP_Fill.h | 4 +-
include/core/GP_FnPerBpp.h | 20 +-
include/core/GP_Gamma.h | 48 +-
include/core/GP_GammaCorrection.gen.h.t | 58 +-
include/core/GP_GammaCorrection.h | 6 +-
include/core/GP_GammaPixel.gen.h.t | 20 +-
include/core/GP_GetPutPixel.gen.h.t | 15 +-
include/core/GP_GetPutPixel.h | 30 +-
include/core/GP_MixPixels.gen.h.t | 51 +-
include/core/GP_MixPixels2.gen.h.t | 26 +-
include/core/GP_Pixel.gen.h.t | 12 +-
include/core/GP_Pixel.h | 91 ++-
include/core/GP_Pixmap.h | 88 ++-
include/core/GP_ProgressCallback.h | 22 +-
include/core/GP_TempAlloc.h | 28 +-
.../core/{GP_TempAlloc.h => GP_TempAlloc2.h} | 109 ++--
include/core/GP_Threads.h | 20 +-
include/core/GP_Transform.h | 2 +-
include/core/GP_Types.h | 34 +-
include/core/GP_WritePixel.gen.h.t | 4 +-
include/filters/GP_ApplyTables.h | 28 +-
include/filters/GP_Arithmetic.h | 84 +--
include/filters/GP_Blur.h | 46 +-
include/filters/GP_Convolution.h | 68 +--
include/filters/GP_Dither.h | 26 +-
include/filters/GP_EdgeDetection.h | 14 +-
include/filters/GP_Filters.h | 2 +-
include/filters/GP_GaussianNoise.h | 50 +-
include/filters/GP_HilbertCurve.h | 14 +-
include/filters/GP_Laplace.h | 18 +-
include/filters/GP_Linear.h | 90 ++-
include/filters/GP_LinearThreads.h | 11 +-
include/filters/GP_Median.h | 48 +-
include/filters/GP_MultiTone.h | 63 +--
include/filters/GP_Point.h | 402 ++++++-------
include/filters/GP_Rand.h | 4 +-
include/filters/GP_Resize.h | 24 +-
include/filters/GP_ResizeCubic.h | 28 +-
include/filters/GP_ResizeLinear.h | 28 +-
include/filters/GP_ResizeNN.h | 16 +-
include/filters/GP_Rotate.h | 70 +--
include/filters/GP_Sepia.h | 44 +-
include/filters/GP_Sigma.h | 54 +-
include/filters/GP_Stats.h | 43 +-
include/filters/GP_WeightedMedian.h | 52 +-
include/gfx/GP_Arc.h | 16 +-
include/gfx/GP_Circle.h | 32 +-
include/gfx/GP_CircleSeg.h | 20 +-
include/gfx/GP_Ellipse.h | 16 +-
include/gfx/GP_HLine.gen.h.t | 4 +-
include/gfx/GP_HLine.h | 30 +-
include/gfx/GP_HLineAA.h | 8 +-
include/gfx/GP_Line.h | 8 +-
include/gfx/GP_LineAA.h | 8 +-
include/gfx/GP_LineClip.h | 2 +-
include/gfx/GP_Polygon.h | 16 +-
include/gfx/GP_PutPixelAA.h | 10 +-
include/gfx/GP_Rect.h | 62 +--
include/gfx/GP_Tetragon.h | 24 +-
include/gfx/GP_Triangle.h | 24 +-
include/gfx/GP_VLine.gen.h.t | 4 +-
include/gfx/GP_VLine.h | 30 +-
include/gfx/GP_VLineAA.h | 8 +-
include/{GP.h => gfxprim.h} | 6 +-
include/grabbers/GP_Grabber.h | 44 +-
include/grabbers/GP_V4L2.h | 8 +-
include/input/GP_Event.h | 53 +-
include/input/GP_EventQueue.h | 76 +--
include/input/GP_Input.h | 2 +-
include/input/GP_InputDriverKBD.h | 6 +-
include/input/GP_InputDriverLinux.h | 18 +-
include/input/GP_TimeStamp.h | 2 +-
include/input/GP_Timer.h | 34 +-
.../{loaders/GP_ZIP.h => input/GP_Types.h} | 24 +-
include/loaders/GP_BMP.h | 68 ---
include/loaders/GP_Container.h | 53 +-
include/loaders/GP_DataStorage.h | 72 +--
include/loaders/GP_Exif.h | 8 +-
include/loaders/GP_GIF.h | 54 --
include/loaders/GP_IO.h | 101 ++--
include/loaders/GP_IOZlib.h | 4 +-
include/loaders/GP_JP2.h | 57 --
include/loaders/GP_JPG.h | 72 ---
include/loaders/GP_LineConvert.h | 10 +-
include/loaders/GP_Loader.h | 74 +--
include/loaders/GP_Loaders.gen.h.t | 44 ++
include/loaders/GP_Loaders.h | 27 +-
include/loaders/GP_PCX.h | 60 --
include/loaders/GP_PNG.h | 74 ---
include/loaders/GP_PNM.h | 106 ----
include/loaders/GP_PSD.h | 55 --
include/loaders/GP_PSP.h | 62 ---
include/loaders/GP_TIFF.h | 65 ---
include/loaders/GP_ZIP.h | 10 +-
include/loaders/Makefile | 8 +
include/text/GP_DefaultFont.h | 32 --
include/text/GP_Font.h | 75 +--
include/text/GP_Fonts.h | 23 +-
include/text/GP_Text.h | 52 +-
include/text/GP_TextMetric.h | 22 +-
include/text/GP_TextStyle.h | 14 +-
libs/backends/GP_AALib.c | 63 +--
libs/backends/GP_Backend.c | 122 ++--
libs/backends/GP_BackendInit.c | 42 +-
libs/backends/GP_BackendVirtual.c | 100 ++--
libs/backends/GP_InputDriverSDL.c | 29 +-
libs/backends/GP_InputDriverSDL.h | 5 +-
libs/backends/GP_LinuxFB.c | 69 +--
libs/backends/GP_SDL.c | 95 ++--
libs/backends/GP_X11.c | 132 ++---
libs/backends/GP_X11_Input.h | 31 +-
libs/backends/GP_X11_Win.h | 2 +-
libs/core/GP_Blit.c | 104 ++--
libs/core/GP_Blit.gen.c.t | 109 ++--
libs/core/GP_Common.c | 6 +-
libs/core/GP_Convert.gen.c.t | 12 +-
libs/core/GP_Debug.c | 23 +-
libs/core/GP_Fill.gen.c.t | 10 +-
libs/core/GP_Gamma.c | 48 +-
libs/core/GP_GammaCorrection.gen.c.t | 4 +-
libs/core/GP_GetPutPixel.c | 10 +-
libs/core/GP_Pixel.c | 73 +--
libs/core/GP_Pixel.gen.c.t | 14 +-
libs/core/GP_Pixmap.c | 103 ++--
libs/core/GP_Threads.c | 8 +-
libs/core/GP_WritePixel.c | 20 +-
.../{GP_Addition.gen.c.t => GP_Add.gen.c.t} | 6 +-
libs/filters/GP_ApplyTables.c | 24 +-
libs/filters/GP_ApplyTables.gen.c.t | 42 +-
libs/filters/GP_Blur.c | 86 +--
libs/filters/GP_Brightness.gen.c.t | 4 +-
libs/filters/GP_BrightnessContrast.gen.c.t | 4 +-
libs/filters/GP_Contrast.gen.c.t | 4 +-
libs/filters/GP_Convolution.c | 52 +-
libs/filters/GP_Cubic.gen.c.t | 2 +-
libs/filters/GP_Cubic.h | 4 +-
...{GP_Difference.gen.c.t => GP_Diff.gen.c.t} | 4 +-
libs/filters/GP_Edge.c | 76 +--
libs/filters/GP_FloydSteinberg.gen.c.t | 72 +--
libs/filters/GP_GaussianNoise.gen.c.t | 303 +++++-----
libs/filters/GP_HilbertPeano.gen.c.t | 66 +--
libs/filters/GP_Histogram.c | 34 +-
libs/filters/GP_Histogram.gen.c.t | 32 +-
libs/filters/GP_Invert.gen.c.t | 2 +-
libs/filters/GP_Laplace.c | 46 +-
libs/filters/GP_LinearConvolution.c | 55 +-
libs/filters/GP_LinearConvolution.gen.c.t | 166 +++---
libs/filters/GP_LinearThreads.c | 69 +--
libs/filters/GP_Max.gen.c.t | 4 +-
libs/filters/GP_Median.c | 104 ++--
libs/filters/GP_Min.gen.c.t | 4 +-
libs/filters/GP_MirrorH.gen.c.t | 50 +-
.../{GP_Multiply.gen.c.t => GP_Mul.gen.c.t} | 6 +-
libs/filters/GP_MultiTone.gen.c.t | 82 +--
libs/filters/GP_Posterize.gen.c.t | 2 +-
libs/filters/GP_Rand.c | 7 +-
libs/filters/GP_Resize.c | 49 +-
libs/filters/GP_ResizeCubic.gen.c.t | 52 +-
libs/filters/GP_ResizeCubicFloat.c | 46 +-
libs/filters/GP_ResizeLinear.gen.c.t | 84 ++-
libs/filters/GP_ResizeNN.gen.c.t | 38 +-
libs/filters/GP_Rotate.c | 72 ++-
libs/filters/GP_Rotate.gen.c.t | 114 ++--
libs/filters/GP_Sepia.c | 54 +-
libs/filters/GP_Sigma.c | 117 ++--
libs/filters/GP_WeightedMedian.c | 110 ++--
libs/filters/Makefile | 4 +-
libs/filters/arithmetic_filter.t | 56 +-
libs/filters/point_filter.t | 139 +++--
libs/gfx/GP_Arc.c | 28 +-
libs/gfx/GP_Circle.c | 44 +-
libs/gfx/GP_CircleSeg.c | 29 +-
libs/gfx/GP_Ellipse.c | 14 +-
libs/gfx/GP_FillCircle.gen.c.t | 46 +-
libs/gfx/GP_FillEllipse.gen.c.t | 26 +-
libs/gfx/GP_HLine.c | 26 +-
libs/gfx/GP_HLine.gen.c.t | 10 +-
libs/gfx/GP_HLineAA.c | 19 +-
libs/gfx/GP_HLineAA.gen.c.t | 24 +-
libs/gfx/GP_Line.gen.c.t | 30 +-
libs/gfx/GP_LineAA.c | 17 +-
libs/gfx/GP_LineAA.gen.c.t | 56 +-
libs/gfx/GP_LineClip.c | 8 +-
libs/gfx/GP_Polygon.c | 78 +--
libs/gfx/GP_PutPixelAA.gen.c.t | 30 +-
libs/gfx/GP_Rect.c | 58 +-
libs/gfx/GP_Tetragon.c | 42 +-
libs/gfx/GP_Triangle.c | 38 +-
libs/gfx/GP_VLine.c | 26 +-
libs/gfx/GP_VLine.gen.c.t | 6 +-
libs/gfx/GP_VLineAA.c | 18 +-
libs/gfx/GP_VLineAA.gen.c.t | 24 +-
libs/grabbers/GP_V4L2.c | 41 +-
libs/input/GP_Event.c | 16 +-
libs/input/GP_EventQueue.c | 96 ++--
libs/input/GP_InputDriverKBD.c | 14 +-
libs/input/GP_InputDriverLinux.c | 50 +-
libs/input/GP_TimeStamp.c | 8 +-
libs/input/GP_Timer.c | 53 +-
libs/loaders/GP_BMP.c | 221 ++++----
libs/loaders/GP_BMP_RLE.h | 24 +-
libs/loaders/GP_Container.c | 20 +-
libs/loaders/GP_DataStorage.c | 133 +++--
libs/loaders/GP_Exif.c | 44 +-
libs/loaders/GP_GIF.c | 73 +--
libs/loaders/GP_IO.c | 152 ++---
libs/loaders/GP_IOZlib.c | 39 +-
libs/loaders/GP_JP2.c | 72 +--
libs/loaders/GP_JPG.c | 148 +++--
libs/loaders/GP_LineConvert.c | 33 +-
libs/loaders/GP_Loader.c | 162 +++---
libs/loaders/GP_PCX.c | 176 +++---
libs/loaders/GP_PNG.c | 134 ++---
libs/loaders/GP_PNM.c | 382 ++++++-------
libs/loaders/GP_PSD.c | 168 +++---
libs/loaders/GP_PSP.c | 97 ++--
libs/loaders/GP_TIFF.c | 138 ++---
libs/loaders/GP_ZIP.c | 108 ++--
libs/text/GP_DefaultFont.c | 10 +-
libs/text/GP_Font.c | 13 +-
libs/text/GP_FontC64.c | 4 +-
libs/text/GP_FontTiny.c | 4 +-
libs/text/GP_FontTinyMono.c | 4 +-
libs/text/GP_FreeType.c | 14 +-
libs/text/GP_HaxorNarrow15.c | 9 +-
libs/text/GP_HaxorNarrow16.c | 9 +-
libs/text/GP_HaxorNarrow17.c | 9 +-
libs/text/GP_Text.c | 80 +--
libs/text/GP_Text.gen.c.t | 74 +--
libs/text/GP_TextMetric.c | 62 +--
libs/text/GP_TextStyle.c | 36 --
pylib/gfxprim/backends/__init__.py | 16 +-
pylib/gfxprim/backends/_extend_backend.py | 62 +--
pylib/gfxprim/backends/backends.i | 36 +-
pylib/gfxprim/common.i | 10 +-
pylib/gfxprim/core/__init__.py | 88 +--
pylib/gfxprim/core/core.i | 96 ++--
pylib/gfxprim/filters/__init__.py | 138 ++---
pylib/gfxprim/filters/filters.i | 106 ++--
pylib/gfxprim/gfx/__init__.py | 32 +-
pylib/gfxprim/gfx/gfx.i | 18 +-
pylib/gfxprim/grabbers/__init__.py | 32 +-
pylib/gfxprim/grabbers/grabbers.i | 24 +-
pylib/gfxprim/input/__init__.py | 2 +-
pylib/gfxprim/input/input.i | 12 +-
pylib/gfxprim/loaders/__init__.py | 54 +-
pylib/gfxprim/loaders/loaders.i | 133 ++---
pylib/gfxprim/text/__init__.py | 10 +-
pylib/gfxprim/text/text.i | 30 +-
tests/afl/loaders.c | 8 +-
tests/core/BlitClipped.c | 30 +-
tests/core/BlitConv.gen.c.t | 50 +-
tests/core/Convert.gen.c.t | 18 +-
tests/core/Debug.c | 6 +-
tests/core/GetPutPixel.gen.c.t | 50 +-
tests/core/Pixel.c | 11 +-
tests/core/Pixmap.c | 54 +-
tests/core/WritePixel.gen.c.t | 4 +-
tests/drivers/framebuffer_test.c | 58 +-
tests/drivers/linux_input.c | 18 +-
tests/filters/APICoverage.gen.c.t | 526 +++++++++---------
tests/filters/FilterMirrorH.c | 58 +-
tests/filters/FiltersCompare.gen.c.t | 164 +++---
tests/filters/LinearConvolution.c | 22 +-
tests/filters/Makefile | 4 +-
tests/filters/common.c | 6 +-
tests/filters/common.h | 4 +-
tests/gfx/APICoverage.gen.c.t | 38 +-
tests/gfx/Circle.c | 14 +-
tests/gfx/CircleSeg.c | 10 +-
tests/gfx/Ellipse.c | 16 +-
tests/gfx/FillCircle.c | 14 +-
tests/gfx/FillEllipse.c | 16 +-
tests/gfx/FillRect.c | 16 +-
tests/gfx/HLine.c | 20 +-
tests/gfx/HLineAA.c | 14 +-
tests/gfx/Line.c | 16 +-
tests/gfx/LineAA.c | 16 +-
tests/gfx/Makefile | 2 +-
tests/gfx/Polygon.c | 10 +-
tests/gfx/PutPixelAA.c | 12 +-
tests/gfx/VLine.c | 20 +-
tests/gfx/common.c | 6 +-
tests/gfx/common.h | 4 +-
tests/gfx/gfx_benchmark.c | 12 +-
tests/input/TimeStamp.c | 6 +-
tests/input/Timer.c | 46 +-
tests/loaders/DataStorage.c | 116 ++--
tests/loaders/Exif.c | 14 +-
tests/loaders/GIF.c | 14 +-
tests/loaders/IO.c | 116 ++--
tests/loaders/JPG.c | 36 +-
tests/loaders/Loader.c | 32 +-
tests/loaders/Loader.h | 74 +--
tests/loaders/Makefile | 1 +
tests/loaders/PBM.c | 6 +-
tests/loaders/PCX.c | 52 +-
tests/loaders/PGM.c | 6 +-
tests/loaders/PNG.c | 30 +-
tests/loaders/PNM.c | 2 +-
tests/loaders/PPM.c | 6 +-
tests/loaders/SaveAbort.gen.c.t | 16 +-
tests/loaders/SaveLoad.gen.c.t | 26 +-
tests/loaders/ZIP.c | 20 +-
tests/loaders/loaders_suite.c | 232 ++++----
tests/loaders/savers.t | 2 +-
tests/pylib/test_core.py | 54 +-
tests/pylib/test_gfx.py | 54 +-
tests/pylib/testutils.py | 6 +-
441 files changed, 9666 insertions(+), 10875 deletions(-)
delete mode 100644 build/syms/Backend_symbols.txt
delete mode 100644 build/syms/Core_symbols.txt
delete mode 100644 build/syms/Filters_symbols.txt
delete mode 100644 build/syms/GFX_symbols.txt
delete mode 100644 build/syms/Grabbers_symbols.txt
delete mode 100644 build/syms/Input_symbols.txt
delete mode 100644 build/syms/Loaders_symbols.txt
delete mode 100644 build/syms/Text_symbols.txt
create mode 100644 build/syms/backend_symbols.txt
create mode 100644 build/syms/core_symbols.txt
create mode 100644 build/syms/filters_symbols.txt
create mode 100644 build/syms/gfx_symbols.txt
create mode 100644 build/syms/grabbers_symbols.txt
create mode 100644 build/syms/input_symbols.txt
create mode 100644 build/syms/loaders_symbols.txt
create mode 100644 build/syms/text_symbols.txt
rewrite include/core/GP_GammaCorrection.gen.h.t (68%)
copy include/core/{GP_TempAlloc.h => GP_TempAlloc2.h} (50%)
rewrite include/filters/GP_Point.h (68%)
rename include/{GP.h => gfxprim.h} (97%)
copy include/{loaders/GP_ZIP.h => input/GP_Types.h} (84%)
delete mode 100644 include/loaders/GP_BMP.h
delete mode 100644 include/loaders/GP_GIF.h
delete mode 100644 include/loaders/GP_JP2.h
delete mode 100644 include/loaders/GP_JPG.h
create mode 100644 include/loaders/GP_Loaders.gen.h.t
delete mode 100644 include/loaders/GP_PCX.h
delete mode 100644 include/loaders/GP_PNG.h
delete mode 100644 include/loaders/GP_PNM.h
delete mode 100644 include/loaders/GP_PSD.h
delete mode 100644 include/loaders/GP_PSP.h
delete mode 100644 include/loaders/GP_TIFF.h
create mode 100644 include/loaders/Makefile
delete mode 100644 include/text/GP_DefaultFont.h
rename libs/filters/{GP_Addition.gen.c.t => GP_Add.gen.c.t} (70%)
rename libs/filters/{GP_Difference.gen.c.t => GP_Diff.gen.c.t} (67%)
rewrite libs/filters/GP_GaussianNoise.gen.c.t (64%)
rename libs/filters/{GP_Multiply.gen.c.t => GP_Mul.gen.c.t} (74%)
rewrite libs/filters/point_filter.t (71%)
delete mode 100644 libs/text/GP_TextStyle.c
rewrite pylib/gfxprim/loaders/loaders.i (78%)
rewrite tests/filters/APICoverage.gen.c.t (65%)
diff --git a/build/check_symbols.sh b/build/check_symbols.sh
index 61be791b48fd..ede319f45d16 100755
--- a/build/check_symbols.sh
+++ b/build/check_symbols.sh
@@ -61,19 +61,19 @@ do_check()
rm $SYMTMPFILE
}
-do_check libgfxprim.so syms/Core_symbols.txt syms/Input_symbols.txt \
- syms/Filters_symbols.txt syms/GFX_symbols.txt \
- syms/Text_symbols.txt
+do_check libgfxprim.so syms/core_symbols.txt syms/input_symbols.txt \
+ syms/filters_symbols.txt syms/gfx_symbols.txt \
+ syms/text_symbols.txt
-do_check libgfxprim-backends.so syms/Backend_symbols.txt
+do_check libgfxprim-backends.so syms/backend_symbols.txt
-do_check libgfxprim-grabbers.so syms/Grabbers_symbols.txt
+do_check libgfxprim-grabbers.so syms/grabbers_symbols.txt
-do_check libgfxprim-loaders.so syms/Loaders_symbols.txt
+do_check libgfxprim-loaders.so syms/loaders_symbols.txt
if [ -n "$FOUND" ]; then
echo
- echo "Set them static or update lists of exported functions in syms/Foo_symbols.txt"
+ echo "Set them static or update lists of exported functions in syms/foo_symbols.txt"
echo
echo "$WARN"
else
diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt
deleted file mode 100644
index 24bbc8b6f2c6..000000000000
--- a/build/syms/Backend_symbols.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-GP_BackendInit
-
-GP_BackendLinuxFBInit
-
-GP_BackendVirtualInit
-
-GP_BackendX11Init
-GP_BackendIsX11
-GP_BackendX11RequestFullscreen
-
-GP_BackendSDLInit
-GP_PixmapFromSDLSurface
-
-GP_BackendAALibInit
-
-GP_BackendResize
-GP_BackendResizeAck
-GP_BackendUpdateRectXYXY
-GP_BackendFlip
-GP_BackendWait
-GP_BackendPoll
-GP_BackendWaitEvent
-GP_BackendPollEvent
-GP_BackendAddTimer
-GP_BackendRemTimer
-
-GP_InputDriverSDLEventPut
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt
deleted file mode 100644
index b49ab7670191..000000000000
--- a/build/syms/Core_symbols.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-GP_PixelTypes
-GP_PixelHasFlags
-
-GP_PixmapAlloc
-GP_PixmapSetGamma
-GP_PixmapResize
-GP_PixmapConvertAlloc
-GP_PixmapPrintInfo
-GP_PixmapRotateCCW
-GP_SubPixmapAlloc
-GP_PixmapConvert
-GP_PixmapRotateCW
-GP_PixmapFree
-GP_PixmapInit
-GP_SubPixmap
-GP_PixmapCopy
-GP_PixmapEqual
-GP_PixelAddrOffset
-
-GP_GammaRelease
-GP_GammaCopy
-GP_GammaAcquire
-GP_GammaPrint
-
-GP_DebugPrint
-GP_SetDebugLevel
-GP_GetDebugLevel
-GP_SetDebugHandler
-
-GP_PrintAbortInfo
-
-GP_RGBA8888ToPixel
-GP_PixelRGBMatch
-GP_PixelTypeByName
-GP_RGB888ToPixel
-
-GP_PixelPrint
-GP_PixelSNPrint
-
-GP_BlitXYXY
-GP_BlitXYXY_Fast
-GP_BlitXYWH
-GP_BlitXYWH_Clipped
-GP_BlitXYXY_Clipped
-GP_BlitXYXY_Raw_Fast
-GP_BlitXYWH_Raw
-GP_BlitXYXY_Raw
-
-GP_WritePixels_1BPP_LE
-GP_WritePixels_2BPP_LE
-GP_WritePixels_4BPP_LE
-GP_WritePixels_1BPP_BE
-GP_WritePixels_2BPP_BE
-GP_WritePixels_4BPP_BE
-GP_WritePixels_8BPP
-GP_WritePixels_16BPP
-GP_WritePixels_18BPP_LE
-GP_WritePixels_24BPP
-GP_WritePixels_32BPP
-
-GP_PutPixel
-GP_GetPixel
-GP_PixelRGBLookup
-GP_PixelToRGB888
-GP_PixelToRGBA8888
-
-GP_Fill
-
-GP_NrThreads
-GP_NrThreadsSet
-GP_ProgressCallbackMP
-
-SWIG_exception
-
-GP_Gamma8_Linear10
-GP_Linear10_Gamma8
-
-GP_DebugPrintCStack
diff --git a/build/syms/Filters_symbols.txt b/build/syms/Filters_symbols.txt
deleted file mode 100644
index 52e078f53ad2..000000000000
--- a/build/syms/Filters_symbols.txt
+++ /dev/null
@@ -1,134 +0,0 @@
-GP_CubicTable
-
-GP_FilterTablesApply
-GP_FilterTablesAlloc
-GP_FilterTablesInit
-GP_FilterTablesFree
-
-GP_FilterInvertEx
-GP_FilterInvertExAlloc
-
-GP_FilterBrightnessEx
-GP_FilterBrightnessExAlloc
-
-GP_FilterContrastEx
-GP_FilterContrastExAlloc
-
-GP_FilterBrightnessContrastEx
-GP_FilterBrightnessContrastExAlloc
-
-GP_FilterPosterizeEx
-GP_FilterPosterizeExAlloc
-
-GP_FilterAddition
-GP_FilterAdditionAlloc
-GP_FilterAddition_Raw
-
-GP_FilterConvolutionEx
-GP_FilterConvolutionExAlloc
-GP_FilterConvolutionMP_Raw
-
-GP_FilterDifference
-GP_FilterDifferenceAlloc
-GP_FilterDifference_Raw
-
-GP_FilterEdgePrewitt
-
-GP_FilterEdgeSharpening
-GP_FilterEdgeSharpeningAlloc
-
-GP_FilterEdgeSobel
-
-GP_FilterFloydSteinberg
-GP_FilterFloydSteinbergAlloc
-
-GP_FilterHilbertPeano
-GP_FilterHilbertPeanoAlloc
-
-GP_FilterGaussianBlurEx
-GP_FilterGaussianBlurExAlloc
-GP_FilterGaussianBlur_Raw
-
-GP_FilterGaussianNoiseAddEx
-GP_FilterGaussianNoiseAddExAlloc
-GP_FilterGaussianNoiseAdd_Raw
-
-GP_FilterHConvolutionMP_Raw
-GP_FilterHLinearConvolution_Raw
-
-GP_FilterHistogram
-GP_HistogramAlloc
-GP_HistogramFree
-GP_HistogramChannelByName
-
-GP_FilterKernelPrint_Raw
-
-GP_FilterLaplace
-GP_FilterLaplaceAlloc
-GP_FilterLinearConvolution_Raw
-
-GP_FilterMax
-GP_FilterMaxAlloc
-GP_FilterMax_Raw
-
-GP_FilterMedianEx
-GP_FilterMedianExAlloc
-
-GP_FilterMin
-GP_FilterMinAlloc
-GP_FilterMin_Raw
-
-GP_FilterMirrorH
-GP_FilterMirrorHAlloc
-GP_FilterMirrorH_Raw
-
-GP_FilterMirrorV
-GP_FilterMirrorVAlloc
-GP_FilterMirrorV_Raw
-
-GP_FilterMultiply
-GP_FilterMultiplyAlloc
-GP_FilterMultiply_Raw
-
-GP_FilterResize
-GP_FilterResizeAlloc
-
-GP_FilterResizeLinearInt
-GP_FilterResizeLinearLFInt
-GP_FilterResizeNN
-GP_FilterResizeCubicInt
-GP_FilterResizeCubic
-
-GP_FilterRotate180
-GP_FilterRotate180Alloc
-
-GP_FilterRotate270
-GP_FilterRotate270Alloc
-
-GP_FilterRotate90
-GP_FilterRotate90Alloc
-
-GP_FilterSigmaEx
-GP_FilterSigmaExAlloc
-
-GP_FilterSymmetry
-GP_FilterSymmetryByName
-GP_FilterSymmetryNames
-GP_FilterSymmetryAlloc
-
-GP_FilterVConvolutionMP_Raw
-GP_FilterVHLinearConvolution_Raw
-GP_FilterVLinearConvolution_Raw
-
-GP_FilterWeightedMedianEx
-GP_FilterWeightedMedianExAlloc
-
-GP_FilterMultiToneEx
-GP_FilterMultiToneExAlloc
-
-GP_FilterSepiaEx
-GP_FilterSepiaExAlloc
-
-GP_InterpolationTypeName
-
-GP_NormInt
diff --git a/build/syms/GFX_symbols.txt b/build/syms/GFX_symbols.txt
deleted file mode 100644
index 58326502f2ee..000000000000
--- a/build/syms/GFX_symbols.txt
+++ /dev/null
@@ -1,107 +0,0 @@
-GP_Line
-GP_Line_Raw
-GP_LineAA
-GP_LineAA_Raw
-GP_LineClip
-
-GP_Line_Raw_4BPP_LE
-GP_Line_Raw_2BPP_BE
-GP_Line_Raw_32BPP
-GP_Line_Raw_8BPP
-GP_Line_Raw_2BPP_LE
-GP_Line_Raw_16BPP
-GP_Line_Raw_24BPP
-GP_Line_Raw_18BPP_LE
-GP_Line_Raw_1BPP_LE
-GP_Line_Raw_4BPP_BE
-GP_Line_Raw_1BPP_BE
-
-GP_HLineXYW_Raw
-GP_HLine_Raw_8BPP
-GP_HLineAA
-GP_HLineXYW
-GP_HLine_Raw_1BPP_LE
-GP_HLine_Raw_4BPP_BE
-GP_HLine_Raw_2BPP_BE
-GP_HLine_Raw_24BPP
-GP_HLine_Raw_32BPP
-GP_HLineXXY
-GP_HLine_Raw_4BPP_LE
-GP_HLineXXY_Raw
-GP_HLine_Raw_1BPP_BE
-GP_HLine_Raw_2BPP_LE
-GP_HLine_Raw_16BPP
-GP_HLine_Raw_18BPP_LE
-GP_HLineAA_Raw
-
-GP_VLineXYY_Raw
-GP_VLineAA
-GP_VLineAA_Raw
-GP_VLineXYH_Raw
-GP_VLineXYY
-GP_VLineXYH
-GP_VLine_Raw_16BPP
-GP_VLine_Raw_1BPP_LE
-GP_VLine_Raw_18BPP_LE
-GP_VLine_Raw_2BPP_BE
-GP_VLine_Raw_4BPP_BE
-GP_VLine_Raw_8BPP
-GP_VLine_Raw_2BPP_LE
-GP_VLine_Raw_32BPP
-GP_VLine_Raw_4BPP_LE
-GP_VLine_Raw_24BPP
-GP_VLine_Raw_1BPP_BE
-
-GP_Circle
-GP_Circle_Raw
-GP_FillCircle
-GP_FillCircle_Raw
-
-GP_CircleSeg
-GP_CircleSeg_Raw
-
-GP_Ring
-GP_Ring_Raw
-GP_FillRing_Raw
-GP_FillRing
-
-GP_Ellipse
-GP_Ellipse_Raw
-GP_FillEllipse
-GP_FillEllipse_Raw
-
-GP_RectXYXY
-GP_RectXYXY_Raw
-GP_RectXYWH
-GP_RectXYWH_Raw
-GP_FillRectXYXY
-GP_FillRectXYXY_Raw
-GP_FillRectXYWH
-GP_FillRectXYWH_Raw
-
-GP_Triangle
-GP_Triangle_Raw
-GP_FillTriangle
-GP_FillTriangle_Raw
-
-GP_Tetragon
-GP_Tetragon_Raw
-GP_FillTetragon
-GP_FillTetragon_Raw
-
-GP_Polygon
-GP_Polygon_Raw
-GP_FillPolygon
-GP_FillPolygon_Raw
-
-GP_Symbol
-GP_Symbol_Raw
-GP_FillSymbol
-GP_FillSymbol_Raw
-
-GP_PutPixelAA
-GP_PutPixelAA_Raw
-GP_PutPixelAA_Raw_Clipped
-
-GP_ArcSegment
-GP_ArcSegment_Raw
diff --git a/build/syms/Grabbers_symbols.txt b/build/syms/Grabbers_symbols.txt
deleted file mode 100644
index 1cf56e17cadc..000000000000
--- a/build/syms/Grabbers_symbols.txt
+++ /dev/null
@@ -1 +0,0 @@
-GP_GrabberV4L2Init
diff --git a/build/syms/Input_symbols.txt b/build/syms/Input_symbols.txt
deleted file mode 100644
index e6742b7f2fb8..000000000000
--- a/build/syms/Input_symbols.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-GP_EventKeyName
-GP_EventDump
-
-GP_InputDriverLinuxRead
-GP_InputDriverLinuxOpen
-GP_InputDriverLinuxClose
-GP_InputDriverKBDEventPut
-
-GP_EventQueueSetCursorPosition
-GP_EventQueueSetScreenSize
-GP_EventQueueGet
-GP_EventQueuePeek
-GP_EventQueuePutBack
-GP_EventQueueEventsQueued
-GP_EventQueueInit
-GP_EventQueueFree
-GP_EventQueueAlloc
-
-GP_EventQueuePut
-GP_EventQueuePutEvent
-GP_EventQueuePushRelTo
-GP_EventQueuePushRel
-GP_EventQueuePushKey
-GP_EventQueuePushAbs
-GP_EventQueuePush
-GP_EventQueuePushResize
-
-GP_TimerQueueDump
-GP_TimerQueueProcess
-GP_TimerQueueInsert
-GP_TimerQueueRemove
-
-GP_GetTimeStamp
diff --git a/build/syms/Loaders_symbols.txt b/build/syms/Loaders_symbols.txt
deleted file mode 100644
index 5f8d7494cd3b..000000000000
--- a/build/syms/Loaders_symbols.txt
+++ /dev/null
@@ -1,165 +0,0 @@
-
-GP_MatchJPG
-GP_ReadJPG
-GP_ReadJPGEx
-GP_LoadJPG
-GP_LoadJPGEx
-GP_WriteJPG
-GP_SaveJPG
-GP_JPG
-
-GP_MatchPNG
-GP_ReadPNG
-GP_ReadPNGEx
-GP_LoadPNG
-GP_LoadPNGEx
-GP_WritePNG
-GP_SavePNG
-GP_PNG
-
-GP_MatchBMP
-GP_WriteBMP
-GP_LoadBMP
-GP_LoadBMPEx
-GP_ReadBMP
-GP_ReadBMPEx
-GP_SaveBMP
-GP_BMP
-
-GP_MatchPSP
-GP_ReadPSP
-GP_ReadPSPEx
-GP_LoadPSP
-GP_LoadPSPEx
-GP_PSP
-
-GP_MatchGIF
-GP_ReadGIF
-GP_ReadGIFEx
-GP_LoadGIF
-GP_LoadGIFEx
-GP_GIF
-
-GP_ReadTIFF
-GP_LoadTIFF
-GP_ReadTIFFEx
-GP_LoadTIFFEx
-GP_MatchTIFF
-GP_WriteTIFF
-GP_SaveTIFF
-GP_TIFF
-
-GP_ReadPBM
-GP_ReadPBMEx
-GP_LoadPBM
-GP_WritePBM
-GP_SavePBM
-GP_MatchPBM
-GP_PBM
-
-GP_ReadPGM
-GP_ReadPGMEx
-GP_LoadPGM
-GP_WritePGM
-GP_SavePGM
-GP_MatchPGM
-GP_PGM
-
-GP_ReadPPM
-GP_ReadPPMEx
-GP_LoadPPM
-GP_WritePPM
-GP_SavePPM
-GP_MatchPPM
-GP_PPM
-
-GP_ReadPNM
-GP_ReadPNMEx
-GP_LoadPNM
-GP_WritePNM
-GP_SavePNM
-GP_MatchPNM
-GP_PNM
-
-GP_ReadJP2
-GP_LoadJP2
-GP_ReadJP2Ex
-GP_LoadJP2Ex
-GP_MatchJP2
-GP_JP2
-
-GP_ReadPCX
-GP_LoadPCX
-GP_ReadPCXEx
-GP_LoadPCXEx
-GP_MatchPCX
-GP_PCX
-
-GP_ReadPSD
-GP_ReadPSDEx
-GP_LoadPSD
-GP_LoadPSDEx
-GP_MatchPSD
-GP_PSD
-
-GP_ReadExif
-
-GP_LoaderBySignature
-GP_LoaderByFilename
-GP_LoaderLoadImage
-GP_LoaderLoadImageEx
-GP_LoaderReadImage
-GP_LoaderReadImageEx
-GP_LoaderSaveImage
-GP_ReadImage
-GP_ReadImageEx
-GP_LoadImage
-GP_LoadImageEx
-GP_LoadMetaData
-GP_SaveImage
-GP_ListLoaders
-GP_LoaderRegister
-GP_LoaderUnregister
-
-GP_ContainerLoad
-GP_ContainerLoadEx
-GP_ContainerSeek
-
-GP_MatchZip
-GP_OpenZip
-
-GP_LineConvertible
-GP_LineConvertGet
-
-GP_IOFile
-GP_IOMem
-GP_IOSubIO
-GP_IOWBuffer
-GP_IOMark
-GP_IOSize
-GP_IOFill
-GP_IOFlush
-GP_IOReadF
-GP_IOReadB2
-GP_IOReadB4
-GP_IOWriteF
-GP_IOPrintF
-
-GP_IOZlib
-GP_IOZlibReset
-
-GP_DataStorageCreate
-GP_DataStorageDestroy
-GP_DataStorageClear
-GP_DataStorageRoot
-GP_DataDictFirst
-GP_DataStorageGet
-GP_DataStorageGetByPath
-GP_DataStorageAdd
-GP_DataStorageAddInt
-GP_DataStorageAddDouble
-GP_DataStorageAddString
-GP_DataStorageAddRational
-GP_DataStorageAddDict
-GP_DataTypeName
-GP_DataPrint
diff --git a/build/syms/Text_symbols.txt b/build/syms/Text_symbols.txt
deleted file mode 100644
index 83b1b2001b11..000000000000
--- a/build/syms/Text_symbols.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-GP_FontFaceLoad
-GP_FontFaceFree
-
-GP_Text_Raw
-GP_TextAscent
-GP_TextMaxStrWidth
-GP_DefaultTextStyle
-GP_GetGlyphCount
-GP_GetGlyphBitmap
-GP_TextClear
-GP_TextMaxWidth
-GP_TextHeight
-GP_TextWidth
-GP_TextLenWidth
-GP_TextDescent
-GP_TextClearStr
-GP_Text
-GP_Print
-GP_VPrint
-
-GP_DefaultStyle
-
-GP_DefaultProportionalFont
-GP_DefaultConsoleFont
-GP_FontTiny
-GP_FontTinyMono
-GP_FontC64
-GP_FontHaxorNarrow15
-GP_FontHaxorNarrowBold15
-GP_FontHaxorNarrow16
-GP_FontHaxorNarrowBold16
-GP_FontHaxorNarrow17
-GP_FontHaxorNarrowBold17
diff --git a/build/syms/backend_symbols.txt b/build/syms/backend_symbols.txt
new file mode 100644
index 000000000000..7e1426652e60
--- /dev/null
+++ b/build/syms/backend_symbols.txt
@@ -0,0 +1,19 @@
+gp_backend_rem_timer
+gp_linux_fb_init
+gp_input_driver_sdl_event_put
+gp_backend_resize
+gp_backend_poll_event
+gp_backend_virt_init
+gp_backend_init
+gp_backend_poll
+gp_backend_update_rect_xyxy
+gp_backend_wait_event
+gp_x11_fullscreen
+gp_sdl_init
+gp_backend_wait
+gp_backend_add_timer
+gp_x11_init
+gp_backend_resize_ack
+gp_pixmap_from_sdl_surface
+gp_backend_is_x11
+gp_aalib_init
diff --git a/build/syms/core_symbols.txt b/build/syms/core_symbols.txt
new file mode 100644
index 000000000000..6defb418d0a4
--- /dev/null
+++ b/build/syms/core_symbols.txt
@@ -0,0 +1,309 @@
+gp_pixmap_convert
+gp_font_tiny_mono
+gp_sub_pixmap_alloc
+gp_write_pixels_16BPP
+gp_blit_xywh_clipped
+gp_filter_min
+gp_triangle_raw
+gp_hline_raw_32BPP
+gp_font_gfxprim
+gp_pixel_addr_offset
+gp_pixmap_alloc
+gp_tetragon_raw
+gp_set_debug_level
+gp_filter_sepia_ex_alloc
+gp_filter_max_alloc
+gp_text_max_width_chars
+gp_vline_raw_1BPP_BE
+gp_fill_circle_seg
+gp_vline_xyy_raw
+gp_filter_max
+gp_filter_resize
+gp_event_queue_alloc
+gp_circle_seg_raw
+gp_filter_edge_sharpening_alloc
+gp_filter_tables_alloc
+gp_fill_circle
+gp_filter_resize_linear_lf_int
+gp_filter_edge_prewitt
+gp_filter_brightness_contrast_ex_alloc
+gp_pixmap_set_gamma
+gp_pixel_has_flags
+gp_vline_raw_18BPP_LE
+gp_fill_circle_seg_raw
+gp_hline_raw_24BPP
+gp_filter_add_alloc
+gp_get_glyph_count
+gp_font_face_load
+gp_vline_aa_raw
+gp_pixmap_resize
+gp_pixmap_rotate_cw
+gp_filter_symmetry_by_name
+gp_line_clip
+gp_filter_multitone_ex
+gp_line_raw_32BPP
+gp_default_style
+gp_timer_queue_process
+gp_pixel_rgb_match
+gp_ellipse_raw
+gp_event_queue_init
+gp_filter_laplace
+gp_temp_alloc_
+gp_tetragon
+gp_filter_gaussian_blur_ex
+gp_hline_raw_16BPP
+gp_gamma_copy
+gp_line_raw_8BPP
+gp_set_debug_handler
+gp_get_debug_level
+gp_line_raw_18BPP_LE
+gp_font_face_free
+gp_line_raw_2BPP_BE
+gp_pixel_to_RGBA8888
+gp_filter_hilbert_peano_alloc
+gp_filter_convolution_mp_raw
+gp_filter_median_ex_alloc
+gp_print
+gp_line_raw_24BPP
+gp_gamma_release
+gp_hline_raw_1BPP_LE
+gp_write_pixels_1BPP_LE
+gp_text_raw
+gp_filter_hlinear_convolution_raw
+gp_filter_resize_nn
+gp_filter_rotate_180_alloc
+gp_event_queue_free
+gp_filter_brightness_ex
+gp_ring_raw
+gp_histogram_free
+gp_blit_xywh_raw
+gp_filter_max_raw
+gp_progress_cb_mp
+gp_line_raw_4BPP_BE
+gp_text_clear_str
+gp_event_queue_get
+gp_hline_xyw_raw
+gp_filter_vconvolution_mp_raw
+gp_pixmap_convert_alloc
+gp_fill_ellipse_raw
+gp_filter_diff_raw
+gp_line_aa_raw
+gp_filter_linear_convolution_raw
+gp_filter_resize_alloc
+gp_filter_brightness_contrast_ex
+gp_vline_raw_1BPP_LE
+gp_filter_symmetry_names
+gp_line_raw_16BPP
+gp_text_clear
+gp_filter_mul_raw
+gp_event_dump
+gp_pixel_snprint
+gp_filter_weighted_median_ex_alloc
+gp_putpixel
+_edata
+gp_cubic_table
+gp_vline_aa
+gp_circle
+gp_fill_triangle_raw
+gp_rect_xywh_raw
+gp_filter_resize_cubic
+gp_filter_diff
+gp_text_descent
+gp_fill_tetragon_raw
+gp_font_haxor_narrow_15
+gp_font_haxor_narrow_16
+gp_event_queue_push_resize
+gp_font_haxor_narrow_17
+gp_event_queue_push_rel
+gp_filter_tables_init
+gp_text_width_len
+gp_filter_mirror_v_alloc
+gp_hline_aa
+gp_putpixel_aa
+gp_filter_contrast_ex_alloc
+gp_line_raw
+gp_filter_edge_sharpening
+gp_blit_xyxy_raw_fast
+gp_default_font
+gp_pixmap_rotate_ccw
+gp_fill_polygon
+gp_filter_min_raw
+gp_temp_alloc_save
+gp_vline_raw_8BPP
+gp_fill_tetragon
+gp_event_queue_push_key
+gp_circle_seg
+gp_putpixel_aa_raw_clipped
+gp_vline_xyh
+gp_arc_segment
+gp_filter_tables_free
+gp_filter_convolution_ex_alloc
+gp_pixel_print
+gp_line_aa
+gp_RGBA8888_to_pixel
+gp_filter_mirror_v_raw
+gp_line_raw_2BPP_LE
+gp_hline_aa_raw
+gp_print_abort_info
+gp_fill_circle_raw
+gp_font_c64
+gp_triangle
+gp_get_glyph
+gp_filter_laplace_alloc
+gp_debug_print_cstack
+gp_fill_ellipse
+gp_fill_ring_raw
+gp_vline_xyy
+gp_debug_print
+gp_pixmap_init
+gp_filter_mul
+gp_filter_rotate_270_alloc
+gp_rect_xywh
+gp_line_raw_4BPP_LE
+gp_blit_xyxy_raw
+gp_filter_gaussian_noise_add_ex_alloc
+gp_input_driver_linux_read
+gp_filter_mirror_h_alloc
+gp_gamma_print
+gp_write_pixels_8BPP
+gp_interpolation_type_name
+gp_event_queue_put
+gp_pixel_to_RGB888
+gp_filter_weighted_median_ex
+gp_event_key_name
+gp_vline_xyh_raw
+gp_event_queue_put_back
+gp_filter_symmetry
+gp_filter_gaussian_noise_add_ex
+gp_write_pixels_2BPP_BE
+gp_hline_raw_2BPP_BE
+gp_filter_rotate_90
+gp_pixmap_free
+gp_fill_triangle
+gp_filter_posterize_ex_alloc
+gp_nr_threads
+gp_filter_contrast_ex
+gp_rect_xyxy_raw
+gp_filter_rotate_90_alloc
+gp_polygon
+gp_line_raw_1BPP_BE
+gp_filter_floyd_steinberg_alloc
+gp_text_max_width
+gp_pixmap_equal
+gp_gamma_acquire
+gp_event_queue_push_abs
+gp_pixel_types
+gp_getpixel
+gp_pixmap_print_info
+gp_event_queue_set_screen_size
+gp_filter_rotate_180
+gp_filter_hilbert_peano
+gp_hline_raw_4BPP_BE
+gp_norm_int
+gp_write_pixels_4BPP_BE
+gp_filter_rotate_270
+gp_vline_raw_2BPP_BE
+gp_vprint
+gp_fill_rect_xywh_raw
+gp_filter_add
+gp_filter_convolution_ex
+gp_ellipse
+gp_filter_median_ex
+gp_putpixel_aa_raw
+gp_temp_allocRestore
+gp_filter_invert_ex
+gp_input_driver_linux_open
+gp_pixmap_copy
+gp_fill_ring
+gp_text_width
+gp_vline_raw_32BPP
+gp_blit_xywh
+gp_rect_xyxy
+gp_vline_raw_4BPP_BE
+gp_timer_queue_insert
+gp_blit_xyxy_clipped
+gp_event_queue_set_cursor_pos
+gp_event_queue_events_queued
+gp_event_queue_push_rel_to
+gp_fill_rect_xywh
+gp_filter_vlinear_convolution_raw
+gp_filter_floyd_steinberg
+gp_filter_sepia_ex
+gp_text_height
+gp_hline_xxy
+gp_filter_symmetry_alloc
+gp_time_stamp
+gp_polygon_raw
+gp_vline_raw_24BPP
+gp_gamma8_linear10
+gp_sub_pixmap
+gp_filter_mul_alloc
+gp_hline_raw_8BPP
+gp_filter_brightness_ex_alloc
+gp_filter_resize_cubic_int
+gp_filter_mirror_h
+gp_histogram_alloc
+gp_hline_raw_2BPP_LE
+gp_histogram_channel_by_name
+gp_write_pixels_2BPP_LE
+gp_arc_segment_raw
+gp_ring
+gp_input_driver_linux_close
+gp_filter_gaussian_noise_add_raw
+gp_filter_add_raw
+gp_input_driver_kbd_event_put
+gp_circle_raw
+gp_timer_queue_remove
+gp_filter_sigma_ex
+gp_hline_raw_18BPP_LE
+gp_filter_min_alloc
+gp_write_pixels_32BPP
+gp_event_queue_push
+gp_line_raw_1BPP_LE
+gp_text
+gp_event_queue_peek
+gp_vline_raw_16BPP
+gp_filter_multitone_ex_alloc
+gp_hline_xyw
+gp_font_gfxprim_mono
+gp_filter_mirror_v
+gp_linear10_gamma8
+gp_font_tiny
+gp_write_pixels_4BPP_LE
+gp_hline_raw_4BPP_LE
+gp_fill
+gp_filter_gaussian_blur_ex_alloc
+gp_blit_xyxy
+gp_filter_diff_alloc
+gp_vline_raw_2BPP_LE
+gp_fill_polygon_raw
+gp_blit_xyxy_fast
+gp_filter_tables_apply
+gp_hline_xxy_raw
+gp_filter_gaussian_blur_raw
+gp_RGB888_to_pixel
+gp_filter_posterize_ex
+gp_fill_rect_xyxy_raw
+gp_fill_rect_xyxy
+gp_pixel_type_by_name
+gp_pixel_rgb_lookup
+gp_filter_edge_sobel
+gp_write_pixels_24BPP
+gp_text_ascent
+gp_timer_queue_dump
+gp_filter_sigma_ex_alloc
+gp_filter_kernel_print_raw
+gp_vline_raw_4BPP_LE
+gp_nr_threads_set
+gp_temp_allocDestroy
+gp_filter_vhlinear_convolution_raw
+gp_filter_histogram
+gp_line
+gp_font_haxor_narrow_bold_15
+gp_hline_raw_1BPP_BE
+gp_write_pixels_1BPP_BE
+gp_font_haxor_narrow_bold_16
+gp_filter_resize_linear_int
+gp_font_haxor_narrow_bold_17
+gp_filter_invert_ex_alloc
+gp_filter_hconvolution_mp_raw
diff --git a/build/syms/filters_symbols.txt b/build/syms/filters_symbols.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/build/syms/gfx_symbols.txt b/build/syms/gfx_symbols.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/build/syms/grabbers_symbols.txt b/build/syms/grabbers_symbols.txt
new file mode 100644
index 000000000000..2b12d1ce49a9
--- /dev/null
+++ b/build/syms/grabbers_symbols.txt
@@ -0,0 +1 @@
+gp_grabber_v4l2_init
diff --git a/build/syms/input_symbols.txt b/build/syms/input_symbols.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/build/syms/loaders_symbols.txt b/build/syms/loaders_symbols.txt
new file mode 100644
index 000000000000..f88e147edb75
--- /dev/null
+++ b/build/syms/loaders_symbols.txt
@@ -0,0 +1,100 @@
+gp_save_image
+gp_loader_register
+gp_io_mem
+gp_match_gif
+gp_io_wbuffer
+gp_load_image
+gp_line_convertible
+gp_pbm
+gp_read_psp_ex
+gp_loader_read_image
+gp_loader_read_image_ex
+gp_match_jpg
+gp_png
+gp_loader_by_filename
+gp_read_jp2_ex
+gp_read_pcx_ex
+gp_data_type_name
+gp_write_pbm
+gp_line_convert_get
+gp_loader_unregister
+gp_data_print
+gp_write_png
+gp_pnm
+gp_storage_add_dict
+gp_loader_save_image
+gp_io_writef
+gp_load_image_ex
+gp_container_load_ex
+gp_match_pcx
+gp_write_pnm
+gp_io_zlib
+gp_storage_root
+gp_tiff
+gp_read_psd_ex
+gp_storage_add_int
+gp_io_printf
+gp_match_tiff
+gp_gif
+gp_loader_by_signature
+gp_match_bmp
+gp_storage_destroy
+gp_load_meta_data
+gp_storage_get_by_path
+gp_read_gif_ex
+gp_jpg
+gp_match_zip
+gp_match_psd
+gp_storage_create
+gp_match_pgm
+gp_write_jpg
+gp_io_read_b2
+gp_open_zip
+gp_write_tiff
+gp_io_read_b4
+gp_storage_clear
+gp_match_ppm
+gp_pcx
+gp_match_jp2
+gp_match_psp
+gp_io_mark
+gp_read_image_ex
+gp_read_ppm_ex
+gp_storage_add_string
+gp_loader_load_image_ex
+gp_read_exif
+gp_read_pnm_ex
+gp_bmp
+gp_storage_add_rational
+gp_io_readf
+gp_storage_get
+gp_read_tiff_ex
+gp_write_bmp
+gp_read_pgm_ex
+gp_match_pbm
+gp_psd
+gp_read_png_ex
+gp_match_png
+gp_pgm
+gp_read_jpg_ex
+gp_read_pbm_ex
+gp_io_sub_io
+gp_data_dict_first
+gp_write_pgm
+gp_io_zlib_reset
+gp_storage_add
+gp_loaders_lists
+gp_match_pnm
+gp_ppm
+gp_jp2
+gp_io_flush
+gp_loader_load_image
+gp_psp
+gp_write_ppm
+gp_io_file
+gp_read_bmp_ex
+gp_read_image
+gp_container_seek
+gp_io_size
+gp_storage_add_double
+gp_io_fill
diff --git a/build/syms/text_symbols.txt b/build/syms/text_symbols.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/demos/bogoman/bogoman.c b/demos/bogoman/bogoman.c
index cd0def6c3a67..f0a9d029c426 100644
--- a/demos/bogoman/bogoman.c
+++ b/demos/bogoman/bogoman.c
@@ -20,7 +20,7 @@
* *
*****************************************************************************/
-#include <GP.h>
+#include <gfxprim.h>
#include "bogoman_debug.h"
#include "bogoman_map.h"
@@ -32,13 +32,13 @@
static void save_png(struct bogoman_map *map, unsigned int elem_size,
const char *filename)
{
- GP_Pixmap *pixmap;
+ gp_pixmap *pixmap;
unsigned int rx, ry;
rx = elem_size * map->w;
ry = elem_size * map->h;
- pixmap = GP_PixmapAlloc(rx, ry, GP_PIXEL_RGB888);
+ pixmap = gp_pixmap_alloc(rx, ry, GP_PIXEL_RGB888);
if (pixmap == NULL)
return;
@@ -53,22 +53,22 @@ static void save_png(struct bogoman_map *map, unsigned int elem_size,
bogoman_render(&render, BOGOMAN_RENDER_ALL);
- GP_SavePNG(pixmap, filename, NULL);
- GP_PixmapFree(pixmap);
+ gp_save_png(pixmap, filename, NULL);
+ gp_pixmap_free(pixmap);
}
-static struct GP_Backend *backend;
+static struct gp_backend *backend;
-static void event_loop(struct bogoman_render *render, GP_Backend *backend)
+static void event_loop(struct bogoman_render *render, gp_backend *backend)
{
struct bogoman_map *map = render->map;
char path[128];
static int screenshots;
- while (GP_BackendEventsQueued(backend)) {
- GP_Event ev;
+ while (gp_backend_events_queued(backend)) {
+ gp_event ev;
- GP_BackendGetEvent(backend, &ev);
+ gp_backend_get_event(backend, &ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -77,7 +77,7 @@ static void event_loop(struct bogoman_render *render, GP_Backend *backend)
switch (ev.val.val) {
case GP_KEY_ESC:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
case GP_KEY_RIGHT:
@@ -103,7 +103,7 @@ static void event_loop(struct bogoman_render *render, GP_Backend *backend)
case GP_EV_SYS:
switch (ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
bogoman_render(render, BOGOMAN_RENDER_ALL);
break;
}
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
unsigned int cw = map->w * ELEM_SIZE;
unsigned int ch = map->h * ELEM_SIZE;
- backend = GP_BackendX11Init(NULL, 0, 0, cw, ch, "Bogoman", 0);
+ backend = gp_x11_init(NULL, 0, 0, cw, ch, "Bogoman", 0);
if (backend == NULL) {
fprintf(stderr, "Failed to initialize backend");
@@ -158,10 +158,10 @@ int main(int argc, char *argv[])
bogoman_render(&render, BOGOMAN_RENDER_ALL);
- GP_BackendAddTimer(backend, &timer);
+ gp_backend_add_timer(backend, &timer);
for (;;) {
- GP_BackendWait(backend);
+ gp_backend_wait(backend);
event_loop(&render, backend);
}
diff --git a/demos/bogoman/bogoman_render.c b/demos/bogoman/bogoman_render.c
index c045b541935b..f23d3bc7284e 100644
--- a/demos/bogoman/bogoman_render.c
+++ b/demos/bogoman/bogoman_render.c
@@ -20,7 +20,7 @@
* *
*****************************************************************************/
-#include <GP.h>
+#include <gfxprim.h>
#include "bogoman_map.h"
#include "bogoman_debug.h"
@@ -29,44 +29,44 @@
struct render_colors {
/* global background */
- GP_Pixel bg;
+ gp_pixel bg;
/* player color */
- GP_Pixel player;
+ gp_pixel player;
/* frames around things */
- GP_Pixel frames;
+ gp_pixel frames;
/* diamod color */
- GP_Pixel diamond;
+ gp_pixel diamond;
/* wall color */
- GP_Pixel wall;
+ gp_pixel wall;
/* moveable color */
- GP_Pixel moveable;
+ gp_pixel moveable;
/* edible color */
- GP_Pixel edible;
+ gp_pixel edible;
/* particle colors */
- GP_Pixel particle;
- GP_Pixel particle_dir;
+ gp_pixel particle;
+ gp_pixel particle_dir;
};
static struct render_colors colors;
-static void init_colors(GP_Pixmap *pixmap, struct render_colors *colors)
+static void init_colors(gp_pixmap *pixmap, struct render_colors *colors)
{
- colors->bg = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap);
- colors->player = GP_RGBToPixmapPixel(0x00, 0xee, 0x00, pixmap);
- colors->frames = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- colors->diamond = GP_RGBToPixmapPixel(0x00, 0x00, 0xee, pixmap);
- colors->wall = GP_RGBToPixmapPixel(0x66, 0x66, 0x66, pixmap);
- colors->moveable = GP_RGBToPixmapPixel(0xff, 0xff, 0x60, pixmap);
- colors->edible = GP_RGBToPixmapPixel(0xff, 0x7f, 0x50, pixmap);
- colors->particle = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, pixmap);
- colors->particle_dir = GP_RGBToPixmapPixel(0xff, 0x44, 0x00, pixmap);
+ colors->bg = gp_rgb_to_pixmap_pixel(0xee, 0xee, 0xee, pixmap);
+ colors->player = gp_rgb_to_pixmap_pixel(0x00, 0xee, 0x00, pixmap);
+ colors->frames = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
+ colors->diamond = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xee, pixmap);
+ colors->wall = gp_rgb_to_pixmap_pixel(0x66, 0x66, 0x66, pixmap);
+ colors->moveable = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0x60, pixmap);
+ colors->edible = gp_rgb_to_pixmap_pixel(0xff, 0x7f, 0x50, pixmap);
+ colors->particle = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0x00, pixmap);
+ colors->particle_dir = gp_rgb_to_pixmap_pixel(0xff, 0x44, 0x00, pixmap);
}
static void render_none(struct bogoman_render *render,
@@ -77,7 +77,7 @@ static void render_none(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.bg);
}
static void render_player(struct bogoman_render *render,
@@ -88,10 +88,10 @@ static void render_player(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.bg);
- GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2 - 1, colors.player);
- GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
+ gp_fill_circle(render->pixmap, x + w/2, y + w/2, w/2 - 1, colors.player);
+ gp_fill_ring(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
}
static void render_wall(struct bogoman_render *render,
@@ -100,26 +100,26 @@ static void render_wall(struct bogoman_render *render,
{
unsigned int w = render->map_elem_size;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.wall);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.wall);
if (!(elem->flags & BOGOMAN_LEFT)) {
- GP_VLineXYH(render->pixmap, x, y, w, colors.frames);
- GP_VLineXYH(render->pixmap, x+1, y, w, colors.frames);
+ gp_vline_xyh(render->pixmap, x, y, w, colors.frames);
+ gp_vline_xyh(render->pixmap, x+1, y, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_RIGHT)) {
- GP_VLineXYH(render->pixmap, x + w - 1, y, w, colors.frames);
- GP_VLineXYH(render->pixmap, x + w - 2, y, w, colors.frames);
+ gp_vline_xyh(render->pixmap, x + w - 1, y, w, colors.frames);
+ gp_vline_xyh(render->pixmap, x + w - 2, y, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_UP)) {
- GP_HLineXYW(render->pixmap, x, y, w, colors.frames);
- GP_HLineXYW(render->pixmap, x, y+1, w, colors.frames);
+ gp_hline_xyw(render->pixmap, x, y, w, colors.frames);
+ gp_hline_xyw(render->pixmap, x, y+1, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_DOWN)) {
- GP_HLineXYW(render->pixmap, x, y + w - 1, w, colors.frames);
- GP_HLineXYW(render->pixmap, x, y + w - 2, w, colors.frames);
+ gp_hline_xyw(render->pixmap, x, y + w - 1, w, colors.frames);
+ gp_hline_xyw(render->pixmap, x, y + w - 2, w, colors.frames);
}
}
@@ -129,16 +129,16 @@ static void render_diamond(struct bogoman_render *render,
{
unsigned int w = render->map_elem_size;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.bg);
(void) elem;
- GP_FillTetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
+ gp_fill_tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
x + w/2, y + w - 1, x, y + w/2, colors.diamond);
- GP_Tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
+ gp_tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
x + w/2, y + w - 1, x, y + w/2, colors.frames);
- GP_Tetragon(render->pixmap, x + w/2, y+1, x + w - 2, y + w/2,
+ gp_tetragon(render->pixmap, x + w/2, y+1, x + w - 2, y + w/2,
x + w/2, y + w - 2, x+1, y + w/2, colors.frames);
}
@@ -150,11 +150,11 @@ static void render_moveable(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.bg);
- GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.moveable);
- GP_RectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.frames);
- GP_RectXYWH(render->pixmap, x + 2, y + 2, w - 4, w - 4, colors.frames);
+ gp_fill_rect_xywh(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.moveable);
+ gp_rect_xywh(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.frames);
+ gp_rect_xywh(render->pixmap, x + 2, y + 2, w - 4, w - 4, colors.frames);
}
static void render_edible(struct bogoman_render *render,
@@ -165,9 +165,9 @@ static void render_edible(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.bg);
- GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.edible);
+ gp_fill_rect_xywh(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.edible);
}
static void render_particle(struct bogoman_render *render,
@@ -177,43 +177,43 @@ static void render_particle(struct bogoman_render *render,
unsigned int w = render->map_elem_size;
int dir = elem->flags & BOGOMAN_DIRECTION_MASK;
- GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
+ gp_fill_rect_xywh(render->pixmap, x, y, w, w, colors.bg);
switch (elem->flags & ~BOGOMAN_DIRECTION_MASK) {
case BOGOMAN_PARTICLE_ROUND:
- GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2-1, colors.particle);
- GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
+ gp_fill_circle(render->pixmap, x + w/2, y + w/2, w/2-1, colors.particle);
+ gp_fill_ring(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
break;
case BOGOMAN_PARTICLE_SQUARE:
- GP_FillRectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.particle);
- GP_RectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.frames);
- GP_RectXYWH(render->pixmap, x+2, y+2, w-4, w-4, colors.frames);
+ gp_fill_rect_xywh(render->pixmap, x+1, y+1, w-2, w-2, colors.particle);
+ gp_rect_xywh(render->pixmap, x+1, y+1, w-2, w-2, colors.frames);
+ gp_rect_xywh(render->pixmap, x+2, y+2, w-4, w-4, colors.frames);
break;
}
switch (dir) {
case BOGOMAN_LEFT:
- GP_FillTriangle(render->pixmap, x + w/4, y + w/2,
+ gp_fill_triangle(render->pixmap, x + w/4, y + w/2,
x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.particle_dir);
- GP_Triangle(render->pixmap, x + w/4, y + w/2,
+ gp_triangle(render->pixmap, x + w/4, y + w/2,
x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.frames);
break;
case BOGOMAN_RIGHT:
- GP_FillTriangle(render->pixmap, x + 3*w/4, y + w/2,
+ gp_fill_triangle(render->pixmap, x + 3*w/4, y + w/2,
x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.particle_dir);
- GP_Triangle(render->pixmap, x + 3*w/4, y + w/2,
+ gp_triangle(render->pixmap, x + 3*w/4, y + w/2,
x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.frames);
break;
case BOGOMAN_UP:
- GP_FillTriangle(render->pixmap, x + w/2, y + w/4,
+ gp_fill_triangle(render->pixmap, x + w/2, y + w/4,
x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.particle_dir);
- GP_Triangle(render->pixmap, x + w/2, y + w/4,
+ gp_triangle(render->pixmap, x + w/2, y + w/4,
x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.frames);
break;
case BOGOMAN_DOWN:
- GP_FillTriangle(render->pixmap, x + w/2, y + 3*w/4,
+ gp_fill_triangle(render->pixmap, x + w/2, y + 3*w/4,
x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.particle_dir);
- GP_Triangle(render->pixmap, x + w/2, y + 3*w/4,
+ gp_triangle(render->pixmap, x + w/2, y + 3*w/4,
x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.frames);
break;
}
@@ -257,7 +257,7 @@ static void render_elem(struct bogoman_render *render,
renders[elem->id](render, cx, cy, elem);
if (flags & BOGOMAN_RENDER_DIRTY && render->backend) {
- GP_BackendUpdateRect(render->backend, cx, cy,
+ gp_backend_update_rect(render->backend, cx, cy,
cx + render->map_elem_size,
cy + render->map_elem_size);
}
@@ -271,7 +271,7 @@ void bogoman_render(struct bogoman_render *render, int flags)
init_colors(render->pixmap, &colors);
if (flags & BOGOMAN_RENDER_ALL)
- GP_Fill(render->pixmap, colors.bg);
+ gp_fill(render->pixmap, colors.bg);
for (y = render->map_x_offset; y < render->map->h; y++) {
for (x = render->map_x_offset; x < render->map->w; x++)
@@ -279,5 +279,5 @@ void bogoman_render(struct bogoman_render *render, int flags)
}
if (flags & BOGOMAN_RENDER_ALL && render->backend)
- GP_BackendFlip(render->backend);
+ gp_backend_flip(render->backend);
}
diff --git a/demos/bogoman/bogoman_render.h b/demos/bogoman/bogoman_render.h
index 38b7f0d59722..747437fc82f0 100644
--- a/demos/bogoman/bogoman_render.h
+++ b/demos/bogoman/bogoman_render.h
@@ -24,7 +24,6 @@
#define __BOGOMAN_RENDER_H__
struct bogoman_map;
-struct GP_Pixmap;
struct bogoman_render {
/* both in map elements */
@@ -35,10 +34,10 @@ struct bogoman_render {
struct bogoman_map *map;
/* pixmap to be used for rendering */
- struct GP_Pixmap *pixmap;
+ struct gp_pixmap *pixmap;
/* if not NULL is used to update screen */
- struct GP_Backend *backend;
+ struct gp_backend *backend;
/* elem size in pixels */
unsigned int map_elem_size;
diff --git a/demos/c_simple/SDL_glue.c b/demos/c_simple/SDL_glue.c
index ef360e0b0e84..447598e7d8d0 100644
--- a/demos/c_simple/SDL_glue.c
+++ b/demos/c_simple/SDL_glue.c
@@ -32,28 +32,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
-#include <GP.h>
+#include <gfxprim.h>
#include <backends/GP_SDL_Pixmap.h>
#define W 320
#define H 240
static SDL_Surface *display = NULL;
-static GP_Pixmap pixmap;
+static gp_pixmap pixmap;
-static GP_Pixel black_pixel, darkgray_pixel;
+static gp_pixel black_pixel, darkgray_pixel;
void redraw_screen(void)
{
SDL_LockSurface(display);
- GP_Fill(&pixmap, black_pixel);
+ gp_fill(&pixmap, black_pixel);
- GP_Text(&pixmap, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW,
+ gp_text(&pixmap, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW,
darkgray_pixel, black_pixel, "GFXprim SDL Demo");
- GP_Line(&pixmap, 0, 0, W-1, H-1, darkgray_pixel);
- GP_Line(&pixmap, 0, H-1, W-1, 0, darkgray_pixel);
+ gp_line(&pixmap, 0, 0, W-1, H-1, darkgray_pixel);
+ gp_line(&pixmap, 0, H-1, W-1, 0, darkgray_pixel);
SDL_UnlockSurface(display);
}
@@ -100,10 +100,10 @@ int main(void)
return 1;
}
- GP_PixmapFromSDLSurface(&pixmap, display);
+ gp_pixmap_from_sdl_surface(&pixmap, display);
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, &pixmap);
- darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, &pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, &pixmap);
+ darkgray_pixel = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, &pixmap);
redraw_screen();
SDL_Flip(display);
diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c
index 6c8288347871..65f22dbf90d9 100644
--- a/demos/c_simple/backend_example.c
+++ b/demos/c_simple/backend_example.c
@@ -27,27 +27,27 @@
*/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
-static void redraw(GP_Backend *self)
+static void redraw(gp_backend *self)
{
- GP_Pixmap *pixmap = self->pixmap;
- GP_Pixel white_pixel, black_pixel;
+ gp_pixmap *pixmap = self->pixmap;
+ gp_pixel white_pixel, black_pixel;
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(pixmap, black_pixel);
- GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
- GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
+ gp_fill(pixmap, black_pixel);
+ gp_line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
+ gp_line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
/* Update the backend screen */
- GP_BackendFlip(self);
+ gp_backend_flip(self);
}
int main(int argc, char *argv[])
{
- GP_Backend *backend;
+ gp_backend *backend;
const char *backend_opts = "X11:100x100";
int opt;
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
backend_opts = optarg;
break;
case 'h':
- GP_BackendInit(NULL, NULL);
+ gp_backend_init(NULL, NULL);
return 0;
break;
default:
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
}
}
- backend = GP_BackendInit(backend_opts, "Backend Example");
+ backend = gp_backend_init(backend_opts, "Backend Example");
if (backend == NULL) {
fprintf(stderr, "Failed to initialize backend\n");
@@ -77,18 +77,18 @@ int main(int argc, char *argv[])
/* Handle events */
for (;;) {
- GP_Event ev;
+ gp_event ev;
- GP_BackendWaitEvent(backend, &ev);
+ gp_backend_wait_event(backend, &ev);
- GP_EventDump(&ev);
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
switch (ev.val.val) {
case GP_KEY_ESC:
case GP_KEY_Q:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
}
@@ -96,11 +96,11 @@ int main(int argc, char *argv[])
case GP_EV_SYS:
switch (ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
redraw(backend);
break;
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
}
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
}
}
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
}
diff --git a/demos/c_simple/backend_timers_example.c b/demos/c_simple/backend_timers_example.c
index 16912fb592df..3b9282f2cc66 100644
--- a/demos/c_simple/backend_timers_example.c
+++ b/demos/c_simple/backend_timers_example.c
@@ -27,20 +27,20 @@
*/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
-static void redraw(GP_Backend *self)
+static void redraw(gp_backend *self)
{
- GP_Pixmap *pixmap = self->pixmap;
- GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ gp_pixmap *pixmap = self->pixmap;
+ gp_pixel black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
- GP_Fill(pixmap, black_pixel);
+ gp_fill(pixmap, black_pixel);
/* Update the backend screen */
- GP_BackendFlip(self);
+ gp_backend_flip(self);
}
-static uint32_t timer_callback(GP_Timer *self)
+static uint32_t timer_callback(gp_timer *self)
{
uint32_t next = random() % 10000;
@@ -52,10 +52,10 @@ static uint32_t timer_callback(GP_Timer *self)
int main(void)
{
- GP_Backend *backend;
+ gp_backend *backend;
const char *backend_opts = "X11:100x100";
- backend = GP_BackendInit(backend_opts, "Backend Timers Example");
+ backend = gp_backend_init(backend_opts, "Backend Timers Example");
if (backend == NULL) {
fprintf(stderr, "Failed to initialize backend\n");
@@ -76,23 +76,23 @@ int main(void)
*/
GP_TIMER_DECLARE(timer2, 5000, 0, "Timer 2", timer_callback, NULL);
- GP_BackendAddTimer(backend, &timer1);
- GP_BackendAddTimer(backend, &timer2);
+ gp_backend_add_timer(backend, &timer1);
+ gp_backend_add_timer(backend, &timer2);
/* Handle events */
for (;;) {
- GP_Event ev;
+ gp_event ev;
- GP_BackendWaitEvent(backend, &ev);
+ gp_backend_wait_event(backend, &ev);
- GP_EventDump(&ev);
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
switch (ev.val.val) {
case GP_KEY_ESC:
case GP_KEY_Q:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
}
@@ -100,11 +100,11 @@ int main(void)
case GP_EV_SYS:
switch (ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
redraw(backend);
break;
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
}
@@ -112,7 +112,7 @@ int main(void)
}
}
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
}
diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c
index c12c8fe70b35..cc134d4704cd 100644
--- a/demos/c_simple/blittest.c
+++ b/demos/c_simple/blittest.c
@@ -24,14 +24,14 @@
*****************************************************************************/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Pixel black;
-static GP_Pixel white;
+static gp_pixel black;
+static gp_pixel white;
-static GP_Backend *win;
+static gp_backend *win;
-static GP_Pixmap *bitmap, *bitmap_raw, *bitmap_conv;
+static gp_pixmap *bitmap, *bitmap_raw, *bitmap_conv;
static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3;
static int pause_flag = 0;
@@ -42,7 +42,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
bitmap_y += bitmap_vy;
- if (bitmap_x + GP_PixmapW(bitmap) > win->pixmap->w) {
+ if (bitmap_x + gp_pixmap_w(bitmap) > win->pixmap->w) {
bitmap_vx = -bitmap_vx;
bitmap_x += bitmap_vx;
}
@@ -52,7 +52,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
}
- if (bitmap_y + GP_PixmapH(bitmap) > win->pixmap->h) {
+ if (bitmap_y + gp_pixmap_h(bitmap) > win->pixmap->h) {
bitmap_vy = -bitmap_vy;
bitmap_y += bitmap_vy;
}
@@ -62,21 +62,21 @@ void redraw_screen(void)
bitmap_y += bitmap_vy;
}
- GP_FillRectXYWH(win->pixmap, 20, 20, 300, 50, black);
+ gp_fill_rect_xywh(win->pixmap, 20, 20, 300, 50, black);
- GP_Text(win->pixmap, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ gp_text(win->pixmap, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, text_buf);
- GP_Print(win->pixmap, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ gp_print(win->pixmap, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ',
bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' ');
- GP_Blit(bitmap, 0, 0, GP_PixmapW(bitmap), GP_PixmapH(bitmap),
- win->pixmap, bitmap_x, bitmap_y);
+ gp_blit(bitmap, 0, 0, gp_pixmap_w(bitmap), gp_pixmap_h(bitmap),
+ win->pixmap, bitmap_x, bitmap_y);
- GP_BackendUpdateRectXYWH(win, bitmap_x, bitmap_y,
- GP_PixmapW(bitmap), GP_PixmapH(bitmap));
- GP_BackendUpdateRectXYWH(win, 20, 20, 400, 50);
+ gp_backend_update_rect_xywh(win, bitmap_x, bitmap_y,
+ gp_pixmap_w(bitmap), gp_pixmap_h(bitmap));
+ gp_backend_update_rect_xywh(win, 20, 20, 400, 50);
}
static void change_bitmap(void)
@@ -87,16 +87,16 @@ static void change_bitmap(void)
bitmap = bitmap_raw;
snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'",
- GP_PixelTypeName(bitmap->pixel_type),
- GP_PixelTypeName(win->pixmap->pixel_type));
+ gp_pixel_type_name(bitmap->pixel_type),
+ gp_pixel_type_name(win->pixmap->pixel_type));
}
void event_loop(void)
{
- GP_Event ev;
+ gp_event ev;
- while (GP_BackendGetEvent(win, &ev)) {
- GP_EventDump(&ev);
+ while (gp_backend_get_event(win, &ev)) {
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -120,7 +120,7 @@ void event_loop(void)
change_bitmap();
break;
case GP_KEY_ESC:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
}
@@ -128,13 +128,13 @@ void event_loop(void)
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_QUIT:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(win);
- GP_Fill(win->pixmap, black);
- GP_BackendFlip(win);
+ gp_backend_resize_ack(win);
+ gp_fill(win->pixmap, black);
+ gp_backend_flip(win);
break;
}
break;
@@ -160,14 +160,14 @@ int main(void)
print_instructions();
- bitmap_raw = GP_LoadImage(sprite, NULL);
+ bitmap_raw = gp_load_image(sprite, NULL);
if (!bitmap_raw) {
fprintf(stderr, "Failed to load '%s'\n", sprite);
return 1;
}
- win = GP_BackendInit(backend_opts, "Blit Test");
+ win = gp_backend_init(backend_opts, "Blit Test");
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -175,18 +175,18 @@ int main(void)
return 1;
}
- bitmap_conv = GP_PixmapConvertAlloc(bitmap_raw,
- win->pixmap->pixel_type);
+ bitmap_conv = gp_pixmap_convert_alloc(bitmap_raw,
+ win->pixmap->pixel_type);
change_bitmap();
- black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
- white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ black = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
+ white = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
- GP_Fill(win->pixmap, black);
- GP_BackendFlip(win);
+ gp_fill(win->pixmap, black);
+ gp_backend_flip(win);
for (;;) {
- GP_BackendPoll(win);
+ gp_backend_poll(win);
event_loop();
usleep(8000);
diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c
index 7d26f17563f2..8501cd7df24b 100644
--- a/demos/c_simple/convolution.c
+++ b/demos/c_simple/convolution.c
@@ -30,14 +30,14 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
struct callback_priv {
char *op;
char *name;
};
-static int progress_callback(GP_ProgressCallback *self)
+static int progress_callback(gp_progress_cb *self)
{
struct callback_priv *priv = self->priv;
@@ -53,9 +53,9 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Pixmap *img;
+ gp_pixmap *img;
struct callback_priv priv;
- GP_ProgressCallback callback = {.callback = progress_callback,
+ gp_progress_cb callback = {.callback = progress_callback,
.priv = &priv};
if (argc != 2) {
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
priv.op = "Loading";
priv.name = argv[1];
- img = GP_LoadImage(argv[1], &callback);
+ img = gp_load_image(argv[1], &callback);
if (img == NULL) {
fprintf(stderr, "Failed to load image '%s': %s\n", argv[1],
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
printf("\n");
- GP_FilterKernel2D box = {
+ gp_filter_kernel_2d box = {
.w = 5,
.h = 5,
.div = 11.8,
@@ -95,15 +95,15 @@ int main(int argc, char *argv[])
/*
* Blur in-place, inner rectangle of the image.
*/
- GP_FilterConvolutionEx(img, img->w/4, img->h/4, img->w/2, img->h/2,
- img, img->w/4, img->h/4, &box, &callback);
+ gp_filter_convolution_ex(img, img->w/4, img->h/4, img->w/2, img->h/2,
+ img, img->w/4, img->h/4, &box, &callback);
printf("\n");
priv.op = "Saving";
priv.name = "out.png";
- if (GP_SavePNG(img, "out.png", &callback)) {
+ if (gp_save_png(img, "out.png", &callback)) {
fprintf(stderr, "Failed to save image: %s", strerror(errno));
return 1;
}
diff --git a/demos/c_simple/data_storage.c b/demos/c_simple/data_storage.c
index 902bbdbb871f..71437e406ce9 100644
--- a/demos/c_simple/data_storage.c
+++ b/demos/c_simple/data_storage.c
@@ -28,48 +28,48 @@
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
int main(void)
{
- GP_DataStorage *storage = GP_DataStorageCreate();
- GP_DataNode *flags;
+ gp_storage *storage = gp_storage_create();
+ gp_data_node *flags;
if (storage == NULL)
return 1;
printf("Empty storage -----------------------\n");
- GP_DataPrint(GP_DataStorageRoot(storage));
+ gp_data_print(gp_storage_root(storage));
printf("-------------------------------------\n\n");
- GP_DataNode data = {
+ gp_data_node data = {
.type = GP_DATA_INT,
.value.i = 300,
.id = "dpi"
};
- GP_DataStorageAdd(storage, NULL, &data);
+ gp_storage_add(storage, NULL, &data);
- GP_DataStorageAddString(storage, NULL, "orientation", "top-down");
+ gp_storage_add_string(storage, NULL, "orientation", "top-down");
printf("Flat storage ------------------------\n");
- GP_DataPrint(GP_DataStorageRoot(storage));
+ gp_data_print(gp_storage_root(storage));
printf("-------------------------------------\n\n");
- flags = GP_DataStorageAddDict(storage, NULL, "flags");
+ flags = gp_storage_add_dict(storage, NULL, "flags");
data.type = GP_DATA_INT;
data.id = "compression_level";
data.value.i = 10;
- GP_DataStorageAdd(storage, flags, &data);
+ gp_storage_add(storage, flags, &data);
printf("Recursive storage -------------------\n");
- GP_DataPrint(GP_DataStorageRoot(storage));
+ gp_data_print(gp_storage_root(storage));
printf("-------------------------------------\n\n");
- GP_DataPrint(GP_DataStorageGet(storage, NULL, "dpi"));
- GP_DataStorageDestroy(storage);
+ gp_data_print(gp_storage_get(storage, NULL, "dpi"));
+ gp_storage_destroy(storage);
return 0;
}
diff --git a/demos/c_simple/debug_handler.c b/demos/c_simple/debug_handler.c
index 5c472fd61e4f..23c5e1e1b1b6 100644
--- a/demos/c_simple/debug_handler.c
+++ b/demos/c_simple/debug_handler.c
@@ -27,7 +27,7 @@
*/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
static char level_to_c(int level)
{
@@ -47,7 +47,7 @@ static char level_to_c(int level)
}
}
-void debug_handler(const struct GP_DebugMsg *msg)
+void debug_handler(const struct gp_debug_msg *msg)
{
printf("%c: %s->%s():%u: %s\n", level_to_c(msg->level), msg->file,
msg->fn, msg->line, msg->msg);
@@ -56,20 +56,20 @@ void debug_handler(const struct GP_DebugMsg *msg)
int main(void)
{
/* Set custom debug handler */
- GP_SetDebugHandler(debug_handler);
+ gp_set_debug_handler(debug_handler);
/* Print some debug messages */
GP_WARN("This is a warning");
GP_FATAL("This is a fatal condition");
/* Turn on verbose debug and call some library functions */
- GP_SetDebugLevel(10);
+ gp_set_debug_level(10);
- GP_Pixmap *pixmap = GP_PixmapAlloc(1000, 1000, 1);
+ gp_pixmap *pixmap = gp_pixmap_alloc(1000, 1000, 1);
- GP_FilterGaussianBlur(pixmap, pixmap, 10, 10, NULL);
+ gp_filter_gaussian_blur(pixmap, pixmap, 10, 10, NULL);
- GP_PixmapFree(pixmap);
+ gp_pixmap_free(pixmap);
return 0;
}
diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c
index d5c870b65f8c..79837447f919 100644
--- a/demos/c_simple/fileview.c
+++ b/demos/c_simple/fileview.c
@@ -27,12 +27,12 @@
#include <stdlib.h>
#include <string.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Pixmap *win;
-static GP_Backend *backend;
+static gp_pixmap *win;
+static gp_backend *backend;
-static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel,
+static gp_pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel,
red_pixel, blue_pixel;
static int font_flag = 0;
@@ -41,38 +41,38 @@ static int tracking = 0;
static int mul = 1;
static int space = 0;
-static GP_FontFace *font;
+static gp_font_face *font;
-struct FileLine {
+struct file_line {
char *text;
- struct FileLine *next;
- struct FileLine *prev;
+ struct file_line *next;
+ struct file_line *prev;
};
-struct FileLine *first_line = NULL;
-struct FileLine *last_line = NULL;
+struct file_line *first_line = NULL;
+struct file_line *last_line = NULL;
void redraw_screen(void)
{
- GP_Fill(win, gray_pixel);
+ gp_fill(win, gray_pixel);
- GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
+ gp_text_style style = GP_DEFAULT_TEXT_STYLE;
switch (font_flag) {
case 0:
- style.font = &GP_DefaultConsoleFont;
+ style.font = gp_font_gfxprim_mono;
break;
case 1:
- style.font = &GP_DefaultProportionalFont;
+ style.font = gp_font_gfxprim;
break;
case 2:
- style.font = GP_FontTinyMono;
+ style.font = gp_font_tiny_mono;
break;
case 3:
- style.font = GP_FontTiny;
+ style.font = gp_font_tiny;
break;
case 4:
- style.font = GP_FontC64;
+ style.font = gp_font_c64;
break;
case 5:
style.font = font;
@@ -90,12 +90,12 @@ void redraw_screen(void)
*/
int align = GP_ALIGN_RIGHT|GP_VALIGN_BELOW;
- struct FileLine *line = first_line;
+ struct file_line *line = first_line;
unsigned int i;
- for (i = 0; i < win->h/GP_TextHeight(&style); i++) {
+ for (i = 0; i < win->h/gp_text_height(&style); i++) {
if (line == NULL)
break;
- GP_Text(win, &style, 16, 16 + (1.0 * GP_TextHeight(&style))*i,
+ gp_text(win, &style, 16, 16 + (1.0 * gp_text_height(&style))*i,
align, black_pixel, gray_pixel, line->text);
line = line->next;
}
@@ -108,7 +108,7 @@ static void warp_up(int lines)
first_line = first_line->prev;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
static void warp_down(int lines)
@@ -118,15 +118,15 @@ static void warp_down(int lines)
first_line = first_line->next;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
void event_loop(void)
{
- GP_Event ev;
+ gp_event ev;
for (;;) {
- GP_BackendWaitEvent(backend, &ev);
+ gp_backend_wait_event(backend, &ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -141,17 +141,17 @@ void event_loop(void)
font_flag = (font_flag + 1) % 5;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_RIGHT:
tracking++;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_LEFT:
tracking--;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_UP:
warp_up(1);
@@ -162,23 +162,23 @@ void event_loop(void)
case GP_KEY_DOT:
space++;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_COMMA:
space--;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_RIGHT_BRACE:
mul++;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_LEFT_BRACE:
if (mul > 0)
mul--;
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_KEY_PAGE_UP:
warp_up(30);
@@ -187,7 +187,7 @@ void event_loop(void)
warp_down(30);
break;
case GP_KEY_ESC:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
}
@@ -195,13 +195,13 @@ void event_loop(void)
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
}
break;
@@ -224,7 +224,7 @@ static int read_file_head(const char *filename)
if (fgets(buf, 511, f) == NULL)
break;
- struct FileLine *line = malloc(sizeof(*line));
+ struct file_line *line = malloc(sizeof(*line));
line->text = strdup(buf);
line->next = NULL;
line->prev = NULL;
@@ -253,12 +253,12 @@ int main(int argc, char *argv[])
}
if (argc > 2)
- font = GP_FontFaceLoad(argv[2], 0, 16);
+ font = gp_font_face_load(argv[2], 0, 16);
if (!read_file_head(argv[1]))
return 1;
- backend = GP_BackendInit(backend_opts, "File View");
+ backend = gp_backend_init(backend_opts, "File View");
if (backend == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -268,15 +268,15 @@ int main(int argc, char *argv[])
win = backend->pixmap;
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
- gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win);
- dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win);
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
- red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
- blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win);
+ gray_pixel = gp_rgb_to_pixmap_pixel(0xbe, 0xbe, 0xbe, win);
+ dark_gray_pixel = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, win);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win);
+ red_pixel = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win);
+ blue_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, win);
redraw_screen();
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
event_loop();
diff --git a/demos/c_simple/filters_symmetry.c b/demos/c_simple/filters_symmetry.c
index 926445354f9a..aacff3478add 100644
--- a/demos/c_simple/filters_symmetry.c
+++ b/demos/c_simple/filters_symmetry.c
@@ -31,24 +31,24 @@
#include <errno.h>
#include <getopt.h>
-#include <GP.h>
+#include <gfxprim.h>
static void usage_and_exit(int ret)
{
int i;
printf("filter_symmetry [-d debug_level] -s {");
- for (i = 0; GP_FilterSymmetryNames[i+1] != NULL; i++)
- printf("%s, ", GP_FilterSymmetryNames[i]);
+ for (i = 0; gp_filter_symmetry_names[i+1] != NULL; i++)
+ printf("%s, ", gp_filter_symmetry_names[i]);
- printf("%s} image_in image_out\n", GP_FilterSymmetryNames[i]);
+ printf("%s} image_in image_out\n", gp_filter_symmetry_names[i]);
exit(ret);
}
int main(int argc, char *argv[])
{
- GP_Pixmap *src, *res;
+ gp_pixmap *src, *res;
const char *symmetry = NULL;
int opt, sym, debug = 0;
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
}
/* Turn on debug messages */
- GP_SetDebugLevel(debug);
+ gp_set_debug_level(debug);
if (symmetry == NULL) {
printf("Symmetry not specified\n");
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
usage_and_exit(1);
}
- sym = GP_FilterSymmetryByName(symmetry);
+ sym = gp_filter_symmetry_by_name(symmetry);
if (sym < 0) {
printf("Invalid symmetry name '%s'\n", symmetry);
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
}
/* Load Image */
- src = GP_LoadImage(argv[optind], NULL);
+ src = gp_load_image(argv[optind], NULL);
if (src == NULL) {
fprintf(stderr, "Failed to load image '%s': %s\n",
@@ -99,18 +99,18 @@ int main(int argc, char *argv[])
}
/* Apply a symmetry filter */
- res = GP_FilterSymmetryAlloc(src, sym, NULL);
+ res = gp_filter_symmetry_alloc(src, sym, NULL);
/* Save Image */
- if (GP_SaveImage(res, argv[optind+1], NULL)) {
+ if (gp_save_image(res, argv[optind+1], NULL)) {
fprintf(stderr, "Failed to save image '%s': %s\n",
argv[optind+1], strerror(errno));
return 1;
}
/* Cleanup */
- GP_PixmapFree(src);
- GP_PixmapFree(res);
+ gp_pixmap_free(src);
+ gp_pixmap_free(res);
return 0;
}
diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c
index e2e5dd6c2b82..fef4c7e6ad1d 100644
--- a/demos/c_simple/fonttest.c
+++ b/demos/c_simple/fonttest.c
@@ -27,14 +27,14 @@
#include <stdlib.h>
#include <string.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Backend *win;
+static gp_backend *win;
static const char *font_path = NULL;
static unsigned int font_h = 16;
-static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel,
+static gp_pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel,
red_pixel, blue_pixel;
static const char *test_strings[] = {
@@ -46,9 +46,9 @@ static const char *test_strings[] = {
static int font_flag = 0;
static int tracking = 0;
-static GP_FontFace *font = NULL;
+static gp_font_face *font = NULL;
-static const char *glyph_bitmap_format_name(const GP_FontBitmapFormat format)
+static const char *glyph_bitmap_format_name(const gp_font_bitmap_format format)
{
switch (format) {
case GP_FONT_BITMAP_1BPP:
@@ -62,9 +62,9 @@ static const char *glyph_bitmap_format_name(const GP_FontBitmapFormat format)
}
}
-static void print_character_metadata(const GP_FontFace *font, int c)
+static void print_character_metadata(const gp_font_face *font, int c)
{
- const GP_GlyphBitmap *glyph = GP_GetGlyphBitmap(font, c);
+ const gp_glyph *glyph = gp_get_glyph(font, c);
fprintf(stderr, "Properties of the character '%c':\n", c);
if (glyph) {
@@ -79,18 +79,18 @@ static void print_character_metadata(const GP_FontFace *font, int c)
}
}
-static void print_font_properties(const GP_FontFace *font)
+static void print_font_properties(const gp_font_face *font)
{
fprintf(stderr, "Font '%s %s' properties:\n",
- GP_FontFamily(font), GP_FontStyle(font));
+ gp_font_family(font), gp_font_style(font));
fprintf(stderr, " Height: ascend: %d, descend: %d\n",
- GP_FontAscend(font), GP_FontDescend(font));
+ gp_font_ascend(font), gp_font_descend(font));
fprintf(stderr, " Max advance_x: %u\n",
- GP_FontMaxAdvanceX(font));
+ gp_font_max_advance_x(font));
fprintf(stderr, " Glyph bitmap format: %s\n",
glyph_bitmap_format_name(font->glyph_bitmap_format));
fprintf(stderr, " Bounding box width: %d, heigth: %d\n",
- GP_FontMaxWidth(font), GP_FontHeight(font));
+ gp_font_max_width(font), gp_font_height(font));
print_character_metadata(font, 'a');
print_character_metadata(font, 'm');
@@ -101,25 +101,25 @@ static void print_font_properties(const GP_FontFace *font)
void redraw_screen(void)
{
- GP_Fill(win->pixmap, black_pixel);
+ gp_fill(win->pixmap, black_pixel);
- GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
+ gp_text_style style = GP_DEFAULT_TEXT_STYLE;
switch (font_flag) {
case 0:
- style.font = &GP_DefaultProportionalFont;
+ style.font = gp_font_gfxprim;
break;
case 1:
- style.font = &GP_DefaultConsoleFont;
+ style.font = gp_font_gfxprim_mono;
break;
case 2:
- style.font = GP_FontTiny;
+ style.font = gp_font_tiny;
break;
case 3:
- style.font = GP_FontTinyMono;
+ style.font = gp_font_tiny_mono;
break;
case 4:
- style.font = GP_FontC64;
+ style.font = gp_font_c64;
break;
case 5:
style.font = font;
@@ -144,31 +144,31 @@ void redraw_screen(void)
style.pixel_yspace = 0;
style.char_xspace = tracking;
- GP_FillRectXYWH(win->pixmap,
+ gp_fill_rect_xywh(win->pixmap,
16, SPACING*i + 16,
- GP_TextWidth(&style, test_string),
- GP_FontHeight(style.font),
+ gp_text_width(&style, test_string),
+ gp_font_height(style.font),
dark_gray_pixel);
- GP_RectXYWH(win->pixmap,
+ gp_rect_xywh(win->pixmap,
15, SPACING*i + 15,
- GP_TextMaxWidth(&style, strlen(test_string)) + 1,
- GP_FontHeight(style.font) + 1,
+ gp_text_max_width(&style, strlen(test_string)) + 1,
+ gp_font_height(style.font) + 1,
blue_pixel);
- GP_Text(win->pixmap, &style, 16, SPACING*i + 16, align,
+ gp_text(win->pixmap, &style, 16, SPACING*i + 16, align,
white_pixel, dark_gray_pixel, test_string);
style.pixel_xmul = 2;
style.pixel_ymul = 2;
style.pixel_yspace = 1;
- GP_Text(win->pixmap, &style, 34, SPACING * i + 44, align,
+ gp_text(win->pixmap, &style, 34, SPACING * i + 44, align,
white_pixel, black_pixel, test_string);
- GP_RectXYWH(win->pixmap, 33, SPACING * i + 43,
- GP_TextWidth(&style, test_string) + 1,
- GP_TextHeight(&style) + 1, dark_gray_pixel);
+ gp_rect_xywh(win->pixmap, 33, SPACING * i + 43,
+ gp_text_width(&style, test_string) + 1,
+ gp_text_height(&style) + 1, dark_gray_pixel);
style.pixel_xmul = 4;
style.pixel_ymul = 2;
@@ -184,17 +184,17 @@ void redraw_screen(void)
style.pixel_yspace = 2;
}
- GP_Text(win->pixmap, &style, 64, SPACING*i + 88, align,
+ gp_text(win->pixmap, &style, 64, SPACING*i + 88, align,
dark_gray_pixel, black_pixel, test_string);
}
}
void event_loop(void)
{
- GP_Event ev;
+ gp_event ev;
for (;;) {
- GP_BackendWaitEvent(win, &ev);
+ gp_backend_wait_event(win, &ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -209,38 +209,38 @@ void event_loop(void)
font_flag = (font_flag + 1) % 5;
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
break;
case GP_KEY_UP:
tracking++;
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
break;
case GP_KEY_DOWN:
tracking--;
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
break;
case GP_KEY_B:
font_h++;
if (font_path) {
- GP_FontFaceFree(font);
- font = GP_FontFaceLoad(font_path, 0, font_h);
+ gp_font_face_free(font);
+ font = gp_font_face_load(font_path, 0, font_h);
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
}
break;
case GP_KEY_S:
font_h--;
if (font_path) {
- GP_FontFaceFree(font);
- font = GP_FontFaceLoad(font_path, 0, font_h);
+ gp_font_face_free(font);
+ font = gp_font_face_load(font_path, 0, font_h);
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
}
break;
case GP_KEY_ESC:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
}
@@ -248,9 +248,9 @@ void event_loop(void)
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(win);
+ gp_backend_resize_ack(win);
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
break;
}
break;
@@ -276,10 +276,10 @@ int main(int argc, char *argv[])
if (argc > 1) {
font_path = argv[1];
fprintf(stderr, "\nLoading font '%s'\n", argv[1]);
- font = GP_FontFaceLoad(argv[1], 0, font_h);
+ font = gp_font_face_load(argv[1], 0, font_h);
}
- win = GP_BackendInit(backend_opts, "Font Test");
+ win = gp_backend_init(backend_opts, "Font Test");
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -287,15 +287,15 @@ int main(int argc, char *argv[])
return 1;
}
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
- gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win->pixmap);
- dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap);
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
- red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap);
- blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
+ gray_pixel = gp_rgb_to_pixmap_pixel(0xbe, 0xbe, 0xbe, win->pixmap);
+ dark_gray_pixel = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, win->pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
+ red_pixel = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win->pixmap);
+ blue_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, win->pixmap);
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
event_loop();
diff --git a/demos/c_simple/gaussian_noise.c b/demos/c_simple/gaussian_noise.c
index 8c0cb152ebc9..fb5c7cd5b9d2 100644
--- a/demos/c_simple/gaussian_noise.c
+++ b/demos/c_simple/gaussian_noise.c
@@ -31,7 +31,7 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
static void help(const char *app)
{
@@ -42,7 +42,7 @@ static void help(const char *app)
int main(int argc, char *argv[])
{
- GP_Pixmap *img;
+ gp_pixmap *img;
float sigma = 0.1, mu = 0.1;
int opt;
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
return 1;
}
- img = GP_LoadImage(argv[optind], NULL);
+ img = gp_load_image(argv[optind], NULL);
if (img == NULL) {
fprintf(stderr, "Failed to load image '%s': %s\n",
@@ -73,9 +73,9 @@ int main(int argc, char *argv[])
return 1;
}
- GP_Pixmap *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL);
+ gp_pixmap *res = gp_filter_gaussian_noise_add_alloc(img, sigma, mu, NULL);
- if (GP_SaveImage(res, argv[optind + 1], NULL)) {
+ if (gp_save_image(res, argv[optind + 1], NULL)) {
fprintf(stderr, "Failed to save image '%s': %s",
argv[optind + 1], strerror(errno));
return 1;
diff --git a/demos/c_simple/gfx_koch.c b/demos/c_simple/gfx_koch.c
index 615f2345ce9e..7e54166fb5a0 100644
--- a/demos/c_simple/gfx_koch.c
+++ b/demos/c_simple/gfx_koch.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
/* Set to 1 to use Anti Aliased drawing */
static int aa_flag = 0;
@@ -41,7 +41,7 @@ static int aa_flag = 0;
* We could do this only and only because the pixmap
* pixel type is fixed to GP_PIXEL_RGB888.
*/
-static GP_Pixel do_color(int xc, int yc, float x, float y)
+static gp_pixel do_color(int xc, int yc, float x, float y)
{
float dx = GP_ABS(1.00 * xc - x)/(2*xc);
float dy = GP_ABS(1.00 * yc - y)/(2*yc);
@@ -66,17 +66,17 @@ static GP_Pixel do_color(int xc, int yc, float x, float y)
return bmask | (gmask<<8) | (rmask << 16);
}
-static void draw(GP_Pixmap *img, int level, float x0, float y0, float x1, float y1)
+static void draw(gp_pixmap *img, int level, float x0, float y0, float x1, float y1)
{
if (level == 0) {
- GP_Pixel pixel;
+ gp_pixel pixel;
pixel = do_color(img->w/2, img->h/2, 1.00 * (x0+x1)/2, 1.00 * (y0 + y1)/2);
if (aa_flag)
- GP_LineAA(img, x0 * 256, y0 * 256, x1 * 256, y1 * 256, pixel);
+ gp_line_aa(img, x0 * 256, y0 * 256, x1 * 256, y1 * 256, pixel);
else
- GP_Line(img, x0, y0, x1, y1, pixel);
+ gp_line(img, x0, y0, x1, y1, pixel);
return;
}
@@ -106,10 +106,10 @@ static void draw(GP_Pixmap *img, int level, float x0, float y0, float x1, float
int main(void)
{
- GP_Pixmap *img;
+ gp_pixmap *img;
/* Create RGB 24 bit image */
- img = GP_PixmapAlloc(600, 600, GP_PIXEL_RGB888);
+ img = gp_pixmap_alloc(600, 600, GP_PIXEL_RGB888);
if (img == NULL) {
fprintf(stderr, "Failed to allocate pixmap");
@@ -117,19 +117,19 @@ int main(void)
}
/* Clean up the bitmap */
- GP_Fill(img, 0);
+ gp_fill(img, 0);
/* Draw a fractal */
draw(img, 4, 0, 0, img->w - 1, img->h - 1);
draw(img, 4, 0, img->h - 1, img->w - 1, 0);
- if (GP_SavePNG(img, "out.png", NULL)) {
+ if (gp_save_png(img, "out.png", NULL)) {
fprintf(stderr, "Failed to save image %s", strerror(errno));
return 1;
}
/* Cleanup */
- GP_PixmapFree(img);
+ gp_pixmap_free(img);
return 0;
}
diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c
index 5ac76d302a1f..70b6c0ff2ef7 100644
--- a/demos/c_simple/input_example.c
+++ b/demos/c_simple/input_example.c
@@ -27,40 +27,40 @@
#include <stdlib.h>
#include <unistd.h>
-#include "GP.h"
+#include "gfxprim.h"
-static GP_Pixmap *win;
-static GP_Backend *backend;
+static gp_pixmap *win;
+static gp_backend *backend;
-static GP_Pixel red, green, white, black;
+static gp_pixel red, green, white, black;
-static void draw_event(GP_Event *ev)
+static void draw_event(gp_event *ev)
{
- static GP_Size size = 0;
+ static gp_size size = 0;
if (ev->type != GP_EV_KEY)
return;
int align = GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM;
- GP_TextClear(win, NULL, 20, 20, align, black, size);
- size = GP_Print(win, NULL, 20, 20, align,
+ gp_text_clear(win, NULL, 20, 20, align, black, size);
+ size = gp_print(win, NULL, 20, 20, align,
white, black, "Key=%s",
- GP_EventKeyName(ev->val.key.key));
+ gp_event_key_name(ev->val.key.key));
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
static void event_loop(void)
{
for (;;) {
- GP_BackendWait(backend);
+ gp_backend_wait(backend);
- while (GP_BackendEventsQueued(backend)) {
- GP_Event ev;
+ while (gp_backend_events_queued(backend)) {
+ gp_event ev;
- GP_BackendGetEvent(backend, &ev);
- GP_EventDump(&ev);
+ gp_backend_get_event(backend, &ev);
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -68,17 +68,17 @@ static void event_loop(void)
switch (ev.val.key.key) {
case GP_KEY_ESC:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
case GP_BTN_LEFT:
- GP_HLineXXY(win, ev.cursor_x - 3,
+ gp_hline_xxy(win, ev.cursor_x - 3,
ev.cursor_x + 3,
ev.cursor_y, red);
- GP_VLineXYY(win, ev.cursor_x,
+ gp_vline_xyy(win, ev.cursor_x,
ev.cursor_y - 3,
ev.cursor_y + 3, red);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
default:
break;
@@ -88,29 +88,30 @@ static void event_loop(void)
switch (ev.code) {
static int size = 0;
case GP_EV_REL_POS:
- if (GP_EventGetKey(&ev, GP_BTN_LEFT)) {
- GP_PutPixel(win, ev.cursor_x,
- ev.cursor_y, green);
+ if (gp_event_get_key(&ev, GP_BTN_LEFT)) {
+ gp_putpixel(win, ev.cursor_x,
+ ev.cursor_y,
+ green);
}
int align = GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM;
- GP_TextClear(win, NULL, 20, 40, align,
- black, size);
- size = GP_Print(win, NULL, 20, 40, align,
+ gp_text_clear(win, NULL, 20, 40, align,
+ black, size);
+ size = gp_print(win, NULL, 20, 40, align,
white, black, "X=%3u Y=%3u dX=%3i dY=%3i",
ev.cursor_x, ev.cursor_y,
ev.val.rel.rx, ev.val.rel.ry);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
}
break;
case GP_EV_SYS:
switch (ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
break;
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
}
@@ -131,7 +132,7 @@ int main(int argc, char *argv[])
backend_opts = optarg;
break;
case 'h':
- GP_BackendInit("help", NULL);
+ gp_backend_init("help", NULL);
return 0;
break;
default:
@@ -140,7 +141,7 @@ int main(int argc, char *argv[])
}
}
- backend = GP_BackendInit(backend_opts, "Input Test");
+ backend = gp_backend_init(backend_opts, "Input Test");
if (backend == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -150,16 +151,16 @@ int main(int argc, char *argv[])
win = backend->pixmap;
- red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
- green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win);
- white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
- black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
+ red = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win);
+ green = gp_rgb_to_pixmap_pixel(0x00, 0xff, 0x00, win);
+ white = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win);
+ black = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win);
- GP_Fill(win, black);
- GP_BackendFlip(backend);
+ gp_fill(win, black);
+ gp_backend_flip(backend);
for (;;) {
- GP_BackendWait(backend);
+ gp_backend_wait(backend);
event_loop();
}
}
diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c
index b5558c06f9ab..f421570dd424 100644
--- a/demos/c_simple/koch.c
+++ b/demos/c_simple/koch.c
@@ -31,7 +31,7 @@
#include <math.h>
-#include <GP.h>
+#include <gfxprim.h>
#define TIMER_TICK 20000
#define DISPLAY_W 640
@@ -39,21 +39,21 @@
#define sqr(x) ((x)*(x))
#define sgn(x) ((x)>0 ? 1 : -1)
-static GP_Backend *backend;
-static GP_Pixmap *pixmap;
+static gp_backend *backend;
+static gp_pixmap *pixmap;
static int iter, l, way = 1, draw_edge = 1;
-static GP_Pixel black, blue, gray, red;
+static gp_pixel black, blue, gray, red;
static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
{
double x2, y2, x3, y3, x5, y5;
- GP_Pixel pixel;
- pixel = GP_RGBToPixel(0, 0, 255-16*iter, pixmap->pixel_type);
+ gp_pixel pixel;
+ pixel = gp_rgb_to_pixel(0, 0, 255-16*iter, pixmap->pixel_type);
if (iter <= 0) {
if (draw_edge)
- GP_Line(pixmap, x1, y1, x4, y4, black);
+ gp_line(pixmap, x1, y1, x4, y4, black);
return;
}
@@ -66,11 +66,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
x5 = (x1+x4)/2 + (y2 - y3)*sqrt(3.00/4);
y5 = (y1+y4)/2 + (x3 - x2)*sqrt(3.00/4);
- GP_FillTriangle(pixmap, x2, y2, x3, y3, x5, y5, pixel);
+ gp_fill_triangle(pixmap, x2, y2, x3, y3, x5, y5, pixel);
- GP_PutPixel(pixmap, x2, y2, red);
- GP_PutPixel(pixmap, x3, y3, red);
- GP_PutPixel(pixmap, x5, y5, red);
+ gp_putpixel(pixmap, x2, y2, red);
+ gp_putpixel(pixmap, x3, y3, red);
+ gp_putpixel(pixmap, x5, y5, red);
sierpinsky(x1, y1, x2, y2, iter - 1);
sierpinsky(x2, y2, x5, y5, iter - 1);
@@ -95,15 +95,15 @@ static void draw(int x, int y, int l, int iter)
x3 = sin(1.00 * (iter+240)/57) * l + x;
y3 = cos(1.00 * (iter+240)/57) * l + y;
- GP_Fill(pixmap, gray);
+ gp_fill(pixmap, gray);
- GP_FillTriangle(pixmap, x1, y1, x2, y2, x3, y3, blue);
+ gp_fill_triangle(pixmap, x1, y1, x2, y2, x3, y3, blue);
sierpinsky(x1, y1, x2, y2, iter/60%6);
sierpinsky(x2, y2, x3, y3, iter/60%6);
sierpinsky(x3, y3, x1, y1, iter/60%6);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
static int paused = 0;
@@ -128,7 +128,7 @@ int main(void)
{
const char *backend_opts = "X11";
- backend = GP_BackendInit(backend_opts, "Koch");
+ backend = gp_backend_init(backend_opts, "Koch");
if (backend == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -138,23 +138,23 @@ int main(void)
pixmap = backend->pixmap;
- black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- blue = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap);
- gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, pixmap);
- red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap);
+ black = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
+ blue = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, pixmap);
+ gray = gp_rgb_to_pixmap_pixel(0xbe, 0xbe, 0xbe, pixmap);
+ red = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, pixmap);
iter = 0;
draw(pixmap->w/2, pixmap->h/2, l, iter);
for (;;) {
- GP_Event ev;
+ gp_event ev;
redraw();
- GP_BackendPoll(backend);
+ gp_backend_poll(backend);
- while (GP_BackendGetEvent(backend, &ev)) {
- GP_EventDump(&ev);
+ while (gp_backend_get_event(backend, &ev)) {
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -169,14 +169,14 @@ int main(void)
draw_edge = !draw_edge;
break;
case GP_KEY_ESC:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
}
break;
case GP_EV_SYS:
if (ev.code == GP_EV_SYS_RESIZE)
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
}
}
usleep(TIMER_TICK);
diff --git a/demos/c_simple/linetest.c b/demos/c_simple/linetest.c
index 7e535df94a61..2d418d650ef1 100644
--- a/demos/c_simple/linetest.c
+++ b/demos/c_simple/linetest.c
@@ -25,17 +25,17 @@
#include <math.h>
-#include <GP.h>
+#include <gfxprim.h>
/* Values for color pixels in display format. */
-static GP_Pixel black, white;
+static gp_pixel black, white;
static double start_angle = 0.0;
static int aa_flag = 0;
static int pause_flag = 0;
-static GP_Backend *win;
+static gp_backend *win;
void redraw_screen(void)
{
@@ -46,7 +46,7 @@ void redraw_screen(void)
int xcenter = w/2;
int ycenter = h/2;
- GP_Fill(win->pixmap, black);
+ gp_fill(win->pixmap, black);
for (angle = 0.0; angle < 2*M_PI; angle += 0.1) {
x = (int) (w/2 * cos(start_angle + angle));
@@ -55,30 +55,30 @@ void redraw_screen(void)
int r = 127.0 + 127.0 * cos(start_angle + angle);
int b = 127.0 + 127.0 * sin(start_angle + angle);
- GP_Pixel pixel;
- pixel = GP_RGBToPixel(r, 0, b, win->pixmap->pixel_type);
+ gp_pixel pixel;
+ pixel = gp_rgb_to_pixel(r, 0, b, win->pixmap->pixel_type);
if (aa_flag) {
- GP_LineAA_Raw(win->pixmap, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
+ gp_line_aa_raw(win->pixmap, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel);
} else {
- GP_Line(win->pixmap, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
- GP_Line(win->pixmap, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
+ gp_line(win->pixmap, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
+ gp_line(win->pixmap, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
}
}
- GP_BackendFlip(win);
+ gp_backend_flip(win);
/* axes */
-// GP_HLineXYW(&pixmap, 0, ycenter, display->w, white);
-// GP_VLineXYH(&pixmap, xcenter, 0, display->h, white);
+// gp_hline_xyw(&pixmap, 0, ycenter, display->w, white);
+// gp_vlineXYH(&pixmap, xcenter, 0, display->h, white);
}
void event_loop(void)
{
- GP_Event ev;
+ gp_event ev;
- while (GP_BackendGetEvent(win, &ev)) {
+ while (gp_backend_get_event(win, &ev)) {
switch (ev.type) {
case GP_EV_KEY:
if (ev.code != GP_EV_KEY_DOWN)
@@ -89,7 +89,7 @@ void event_loop(void)
aa_flag = !aa_flag;
break;
case GP_KEY_ESC:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
case GP_KEY_P:
@@ -100,11 +100,11 @@ void event_loop(void)
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_QUIT:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(win);
+ gp_backend_resize_ack(win);
break;
}
break;
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
}
}
- win = GP_BackendInit(backend_opts, "Line Test");
+ win = gp_backend_init(backend_opts, "Line Test");
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -135,13 +135,13 @@ int main(int argc, char *argv[])
return 1;
}
- white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
- black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ white = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
+ black = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
redraw_screen();
for (;;) {
- GP_BackendPoll(win);
+ gp_backend_poll(win);
event_loop();
usleep(20000);
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
continue;
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
start_angle += 0.01;
if (start_angle > 2*M_PI) {
diff --git a/demos/c_simple/loaders.c b/demos/c_simple/loaders.c
index e9a3a306c1c3..68ab1901d708 100644
--- a/demos/c_simple/loaders.c
+++ b/demos/c_simple/loaders.c
@@ -30,14 +30,14 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
struct callback_priv {
char *op;
char *name;
};
-static int progress_callback(GP_ProgressCallback *self)
+static int progress_callback(gp_progress_cb *self)
{
struct callback_priv *priv = self->priv;
@@ -53,10 +53,10 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Pixmap *img;
+ gp_pixmap *img;
struct callback_priv priv;
- GP_ProgressCallback callback = {.callback = progress_callback,
- .priv = &priv};
+ gp_progress_cb callback = {.callback = progress_callback,
+ .priv = &priv};
if (argc != 2) {
fprintf(stderr, "Takes an image as an parameter\n");
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
priv.op = "Loading";
priv.name = argv[1];
- img = GP_LoadImage(argv[1], &callback);
+ img = gp_load_image(argv[1], &callback);
if (img == NULL) {
fprintf(stderr, "Failed to load image '%s':%s\n", argv[1],
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
priv.op = "Saving";
priv.name = "out.png";
- if (GP_SavePNG(img, "out.png", &callback)) {
+ if (gp_save_png(img, "out.png", &callback)) {
fprintf(stderr, "Failed to save image %s", strerror(errno));
return 1;
}
diff --git a/demos/c_simple/loaders_example.c b/demos/c_simple/loaders_example.c
index b240aea952aa..7f74289ba8c8 100644
--- a/demos/c_simple/loaders_example.c
+++ b/demos/c_simple/loaders_example.c
@@ -30,21 +30,21 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
int main(int argc, char *argv[])
{
- GP_Pixmap *img;
+ gp_pixmap *img;
/* Turn on debug messages */
- GP_SetDebugLevel(10);
+ gp_set_debug_level(10);
if (argc != 2) {
fprintf(stderr, "Takes an image as an parameter\n");
return 1;
}
- img = GP_LoadImage(argv[1], NULL);
+ img = gp_load_image(argv[1], NULL);
if (img == NULL) {
fprintf(stderr, "Failed to load image '%s':%s\n", argv[1],
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
return 1;
}
- if (GP_SavePNG(img, "out.png", NULL)) {
+ if (gp_save_png(img, "out.png", NULL)) {
fprintf(stderr, "Failed to save image %s", strerror(errno));
return 1;
}
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c
index cc2c0a15adba..c53218d05bed 100644
--- a/demos/c_simple/loaders_register.c
+++ b/demos/c_simple/loaders_register.c
@@ -32,15 +32,15 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
/*
* Saves 2 bpp grayscale image as ASCII Art
*/
-static int write_data(const GP_Pixmap *img, GP_IO *io,
- GP_ProgressCallback *callback)
+static int write_data(const gp_pixmap *img, gp_io *io,
+ gp_progress_cb *callback)
{
- GP_IO *bio;
+ gp_io *bio;
int err;
if (img->pixel_type != GP_PIXEL_G2) {
@@ -49,7 +49,7 @@ static int write_data(const GP_Pixmap *img, GP_IO *io,
}
/* Create buffered I/O */
- bio = GP_IOWBuffer(io, 0);
+ bio = gp_io_wbuffer(io, 0);
if (!bio)
return 1;
@@ -58,20 +58,20 @@ static int write_data(const GP_Pixmap *img, GP_IO *io,
for (j = 0; j < img->h; j++) {
for (i = 0; i < img->w; i++) {
- GP_Pixel p = GP_GetPixel_Raw(img, i, j);
+ gp_pixel p = gp_getpixel_raw(img, i, j);
switch (p) {
case 0:
- err = GP_IOFlush(bio, " ", 2);
+ err = gp_io_flush(bio, " ", 2);
break;
case 1:
- err = GP_IOFlush(bio, "..", 2);
+ err = gp_io_flush(bio, "..", 2);
break;
case 2:
- err = GP_IOFlush(bio, "()", 2);
+ err = gp_io_flush(bio, "()", 2);
break;
case 3:
- err = GP_IOFlush(bio, "OO", 2);
+ err = gp_io_flush(bio, "OO", 2);
break;
}
@@ -79,25 +79,25 @@ static int write_data(const GP_Pixmap *img, GP_IO *io,
return 1;
}
- if (GP_IOFlush(bio, "\n", 1))
+ if (gp_io_flush(bio, "\n", 1))
return 1;
- if (GP_ProgressCallbackReport(callback, j, img->h, img->w)) {
+ if (gp_progress_cb_report(callback, j, img->h, img->w)) {
errno = ECANCELED;
return 1;
}
}
- GP_ProgressCallbackDone(callback);
+ gp_progress_cb_done(callback);
return 0;
}
-static GP_PixelType save_ptypes[] = {
+static gp_pixel_type save_ptypes[] = {
GP_PIXEL_G2,
GP_PIXEL_UNKNOWN,
};
-GP_Loader loader = {
+const gp_loader loader = {
.Write = write_data,
.save_ptypes = save_ptypes,
.fmt_name = "ASCII Art",
@@ -106,12 +106,12 @@ GP_Loader loader = {
int main(int argc, char *argv[])
{
- GP_Pixmap *c, *gc;
+ gp_pixmap *c, *gc;
- GP_LoaderRegister(&loader);
+ gp_loader_register(&loader);
/* List all loaders */
- GP_ListLoaders();
+ gp_loaders_lists();
printf("\n\n");
if (argc != 2) {
@@ -120,14 +120,14 @@ int main(int argc, char *argv[])
}
/* Now load image and save it using our loader */
- c = GP_LoadImage(argv[1], NULL);
+ c = gp_load_image(argv[1], NULL);
if (c == NULL) {
fprintf(stderr, "Failed to load image: %s\n", strerror(errno));
return 1;
}
- gc = GP_FilterFloydSteinbergAlloc(c, GP_PIXEL_G2, NULL);
+ gc = gp_filter_floyd_steinberg_alloc(c, GP_PIXEL_G2, NULL);
if (gc == NULL) {
fprintf(stderr, "FloydSteinberg: %s\n", strerror(errno));
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
printf("Saving to test.txt\n");
- if (GP_SaveImage(gc, "test.txt", NULL)) {
+ if (gp_save_image(gc, "test.txt", NULL)) {
fprintf(stderr, "Failed to save image: %s\n", strerror(errno));
return 1;
}
diff --git a/demos/c_simple/memory_io.c b/demos/c_simple/memory_io.c
index 57d09174473f..43aa53f805f7 100644
--- a/demos/c_simple/memory_io.c
+++ b/demos/c_simple/memory_io.c
@@ -27,7 +27,7 @@
*/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
/*
* Binary PGM stored in an array
@@ -55,48 +55,48 @@ static char pgm[] = {
int main(void)
{
- GP_Backend *b;
- GP_Pixmap *img;
- GP_IO *io;
+ gp_backend *b;
+ gp_pixmap *img;
+ gp_io *io;
- io = GP_IOMem(pgm, sizeof(pgm), NULL);
+ io = gp_io_mem(pgm, sizeof(pgm), NULL);
if (!io) {
fprintf(stderr, "Failed to initialize IO\n");
return 1;
}
- img = GP_ReadPGM(io, NULL);
- GP_IOClose(io);
+ img = gp_read_pgm(io, NULL);
+ gp_io_close(io);
if (!img) {
fprintf(stderr, "Failed to load image\n");
return 1;
}
- b = GP_BackendX11Init(NULL, 0, 0, WIN_W, WIN_H, "IO Example", 0);
+ b = gp_x11_init(NULL, 0, 0, WIN_W, WIN_H, "IO Example", 0);
if (!b) {
fprintf(stderr, "Failed to initialize backend\n");
return 1;
}
- GP_Fill(b->pixmap, 0);
- GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->pixmap,
+ gp_fill(b->pixmap, 0);
+ gp_blit_clipped(img, 0, 0, img->w, img->h, b->pixmap,
(WIN_W - img->w)/2, (WIN_H - img->h)/2);
- GP_BackendFlip(b);
+ gp_backend_flip(b);
for (;;) {
- GP_Event ev;
+ gp_event ev;
- GP_BackendWaitEvent(b, &ev);
+ gp_backend_wait_event(b, &ev);
switch (ev.type) {
case GP_EV_KEY:
switch (ev.val.val) {
case GP_KEY_ESC:
case GP_KEY_Q:
- GP_BackendExit(b);
+ gp_backend_exit(b);
return 0;
break;
}
@@ -105,7 +105,7 @@ int main(void)
switch (ev.code) {
case GP_EV_SYS_RESIZE:
case GP_EV_SYS_QUIT:
- GP_BackendExit(b);
+ gp_backend_exit(b);
return 0;
break;
}
@@ -113,6 +113,6 @@ int main(void)
}
}
- GP_BackendExit(b);
+ gp_backend_exit(b);
return 0;
}
diff --git a/demos/c_simple/meta_data.c b/demos/c_simple/meta_data.c
index 2e21781833b8..57a0b448f641 100644
--- a/demos/c_simple/meta_data.c
+++ b/demos/c_simple/meta_data.c
@@ -30,14 +30,14 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
#define SEP \
"-----------------------------------------------------------------------------"
int main(int argc, char *argv[])
{
- GP_DataStorage *storage;
+ gp_storage *storage;
int i;
if (argc < 2) {
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
return 1;
}
- storage = GP_DataStorageCreate();
+ storage = gp_storage_create();
if (!storage) {
fprintf(stderr, "Failed to create data storage\n");
@@ -56,13 +56,13 @@ int main(int argc, char *argv[])
puts(SEP);
printf("Opening '%s'\n", argv[i]);
- GP_DataStorageClear(storage);
+ gp_storage_clear(storage);
- if (GP_LoadMetaData(argv[i], storage)) {
+ if (gp_load_meta_data(argv[i], storage)) {
fprintf(stderr, "Failed to read '%s' meta-data: %s\n",
argv[i], strerror(errno));
} else {
- GP_DataStoragePrint(storage);
+ gp_storage_print(storage);
}
}
diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c
index ddd79bbacd25..c068dc9d79cb 100644
--- a/demos/c_simple/pretty_print.c
+++ b/demos/c_simple/pretty_print.c
@@ -26,18 +26,18 @@
*/
-#include <GP.h>
+#include <gfxprim.h>
int main(void)
{
- GP_Pixmap *pixmap = GP_PixmapAlloc(100, 100, GP_PIXEL_RGB888);
- GP_Pixel pix = ~(GP_Pixel)0;
+ gp_pixmap *pixmap = gp_pixmap_alloc(100, 100, GP_PIXEL_RGB888);
+ gp_pixel pix = ~(gp_pixel)0;
/* Pretty prints pixel values */
- GP_PixelPrint(pix, GP_PIXEL_RGB888);
+ gp_pixel_print(pix, GP_PIXEL_RGB888);
/* Pretty prints pixmap info */
- GP_PixmapPrintInfo(pixmap);
+ gp_pixmap_print_info(pixmap);
return 0;
}
diff --git a/demos/c_simple/randomshapetest.c b/demos/c_simple/randomshapetest.c
index 766b48e5ee92..e8a469be2d99 100644
--- a/demos/c_simple/randomshapetest.c
+++ b/demos/c_simple/randomshapetest.c
@@ -26,12 +26,12 @@
#include <stdio.h>
#include <stdlib.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Backend *win;
+static gp_backend *win;
/* Globally used colors. */
-static GP_Pixel white, black;
+static gp_pixel white, black;
/* Holding flag (pauses drawing). */
static int pause_flag = 0;
@@ -56,7 +56,7 @@ static int fill_flag = 1;
/* Do a clipping test? */
static int cliptest_flag = 0;
-void random_point(const GP_Pixmap *c, int *x, int *y)
+void random_point(const gp_pixmap *c, int *x, int *y)
{
if (cliptest_flag) {
*x = random() % (3*c->w) - c->w;
@@ -67,26 +67,26 @@ void random_point(const GP_Pixmap *c, int *x, int *y)
}
}
-void random_point_AA(const GP_Pixmap *c, int *x, int *y)
+void random_point_AA(const gp_pixmap *c, int *x, int *y)
{
*x = random() % (c->w<<8);
*y = random() % (c->h<<8);
}
-void draw_random_circle(GP_Pixel pixel)
+void draw_random_circle(gp_pixel pixel)
{
int x, y;
random_point(win->pixmap, &x, &y);
int r = random() % 50;
if (fill_flag)
- GP_FillCircle(win->pixmap, x, y, r, pixel);
+ gp_fill_circle(win->pixmap, x, y, r, pixel);
if (outline_flag)
- GP_Circle(win->pixmap, x, y, r, white);
+ gp_circle(win->pixmap, x, y, r, white);
}
-void draw_random_ellipse(GP_Pixel pixel)
+void draw_random_ellipse(gp_pixel pixel)
{
int x, y;
random_point(win->pixmap, &x, &y);
@@ -94,13 +94,13 @@ void draw_random_ellipse(GP_Pixel pixel)
int ry = random() % 50;
if (fill_flag)
- GP_FillEllipse(win->pixmap, x, y, rx, ry, pixel);
+ gp_fill_ellipse(win->pixmap, x, y, rx, ry, pixel);
if (outline_flag)
- GP_Ellipse(win->pixmap, x, y, rx, ry, white);
+ gp_ellipse(win->pixmap, x, y, rx, ry, white);
}
-void draw_random_triangle(GP_Pixel pixel)
+void draw_random_triangle(gp_pixel pixel)
{
int x0, y0, x1, y1, x2, y2;
random_point(win->pixmap, &x0, &y0);
@@ -108,26 +108,26 @@ void draw_random_triangle(GP_Pixel pixel)
random_point(win->pixmap, &x2, &y2);
if (fill_flag)
- GP_FillTriangle(win->pixmap, x0, y0, x1, y1, x2, y2, pixel);
+ gp_fill_triangle(win->pixmap, x0, y0, x1, y1, x2, y2, pixel);
if (outline_flag)
- GP_Triangle(win->pixmap, x0, y0, x1, y1, x2, y2, white);
+ gp_triangle(win->pixmap, x0, y0, x1, y1, x2, y2, white);
}
-void draw_random_rectangle(GP_Pixel pixel)
+void draw_random_rectangle(gp_pixel pixel)
{
int x0, y0, x1, y1;
random_point(win->pixmap, &x0, &y0);
random_point(win->pixmap, &x1, &y1);
if (fill_flag)
- GP_FillRect(win->pixmap, x0, y0, x1, y1, pixel);
+ gp_fill_rect(win->pixmap, x0, y0, x1, y1, pixel);
if (outline_flag)
- GP_Rect(win->pixmap, x0, y0, x1, y1, white);
+ gp_rect(win->pixmap, x0, y0, x1, y1, white);
}
-void draw_random_tetragon(GP_Pixel pixel)
+void draw_random_tetragon(gp_pixel pixel)
{
int x0, y0, x1, y1, x2, y2, x3, y3;
random_point(win->pixmap, &x0, &y0);
@@ -136,28 +136,28 @@ void draw_random_tetragon(GP_Pixel pixel)
random_point(win->pixmap, &x3, &y3);
if (fill_flag)
- GP_FillTetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ gp_fill_tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
if (outline_flag)
- GP_Tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ gp_tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
}
-void draw_random_polygon(GP_Pixel pixel)
+void draw_random_polygon(gp_pixel pixel)
{
- GP_Coord xy[10];
+ gp_coord xy[10];
int i;
for (i = 0; i < 5; i++) {
random_point(win->pixmap, xy + 2*i, xy + 2*i + 1);
}
- GP_FillPolygon_Raw(win->pixmap, 5, xy, pixel);
+ gp_fill_polygon_raw(win->pixmap, 5, xy, pixel);
}
void clear_screen(void)
{
- GP_Fill(win->pixmap, black);
- GP_BackendFlip(win);
+ gp_fill(win->pixmap, black);
+ gp_backend_flip(win);
}
void redraw_screen(void)
@@ -166,8 +166,8 @@ void redraw_screen(void)
return;
/* Pick a random color for drawing. */
- GP_Pixel pixel;
- pixel = GP_RGBToPixel(random() % 256, random() % 256,
+ gp_pixel pixel;
+ pixel = gp_rgb_to_pixel(random() % 256, random() % 256,
random() % 256, win->pixmap->pixel_type);
switch (shape) {
@@ -194,9 +194,9 @@ void redraw_screen(void)
void event_loop(void)
{
- GP_Event ev;
+ gp_event ev;
- while (GP_BackendGetEvent(win, &ev)) {
+ while (gp_backend_get_event(win, &ev)) {
switch (ev.type) {
case GP_EV_KEY:
if (ev.code != GP_EV_KEY_DOWN)
@@ -230,16 +230,16 @@ void event_loop(void)
clear_screen();
break;
case GP_KEY_ESC:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
}
break;
case GP_EV_SYS:
if (ev.code == GP_EV_SYS_RESIZE) {
- GP_BackendResizeAck(win);
+ gp_backend_resize_ack(win);
clear_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
}
break;
}
@@ -250,7 +250,7 @@ int main(void)
{
const char *backend_opts = "X11";
- win = GP_BackendInit(backend_opts, "Random Shape Test");
+ win = gp_backend_init(backend_opts, "Random Shape Test");
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -258,11 +258,11 @@ int main(void)
return 1;
}
- white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
- black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ white = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
+ black = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
for (;;) {
- GP_BackendPoll(win);
+ gp_backend_poll(win);
event_loop();
usleep(20000);
@@ -271,7 +271,7 @@ int main(void)
continue;
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
}
}
diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c
index 71d82c85af60..4819e37f5522 100644
--- a/demos/c_simple/shapetest.c
+++ b/demos/c_simple/shapetest.c
@@ -26,13 +26,13 @@
#include <stdio.h>
#include <stdlib.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Pixmap *win;
-static GP_Backend *backend;
+static gp_pixmap *win;
+static gp_backend *backend;
/* Basic colors in display-specific format. */
-static GP_Pixel black, white, yellow, green, red, gray, darkgray;
+static gp_pixel black, white, yellow, green, red, gray, darkgray;
/* Radius of the shape being drawn */
static int xradius = 5;
@@ -109,61 +109,61 @@ void draw_testing_triangle(int x, int y, int xradius, int yradius)
/* draw the three vertices green; they should never be visible
* because the red triangle should cover them; if they are visible,
* it means we don't draw to the end */
- GP_PutPixel(win, x0, y0, green);
- GP_PutPixel(win, x1, y1, green);
- GP_PutPixel(win, x2, y2, green);
+ gp_putpixel(win, x0, y0, green);
+ gp_putpixel(win, x1, y1, green);
+ gp_putpixel(win, x2, y2, green);
if (outline == 1)
- GP_Triangle(win, x0, y0, x1, y1, x2, y2, yellow);
+ gp_triangle(win, x0, y0, x1, y1, x2, y2, yellow);
if (fill)
- GP_FillTriangle(win, x0, y0, x1, y1, x2, y2, red);
+ gp_fill_triangle(win, x0, y0, x1, y1, x2, y2, red);
if (outline == 2)
- GP_Triangle(win, x0, y0, x1, y1, x2, y2, white);
+ gp_triangle(win, x0, y0, x1, y1, x2, y2, white);
}
void draw_testing_circle(int x, int y, int xradius,
__attribute__((unused)) int yradius)
{
if (outline == 1)
- GP_Circle(win, x, y, xradius, yellow);
+ gp_circle(win, x, y, xradius, yellow);
if (fill)
- GP_FillCircle(win, x, y, xradius, red);
+ gp_fill_circle(win, x, y, xradius, red);
if (outline == 2)
- GP_Circle(win, x, y, xradius, white);
+ gp_circle(win, x, y, xradius, white);
}
void draw_testing_ring(int x, int y, int xradius,
__attribute__((unused)) int yradius)
{
if (outline == 1)
- GP_Ring(win, x, y, xradius, yradius, yellow);
+ gp_ring(win, x, y, xradius, yradius, yellow);
if (fill)
- GP_FillRing(win, x, y, xradius, yradius, red);
+ gp_fill_ring(win, x, y, xradius, yradius, red);
if (outline == 2)
- GP_Ring(win, x, y, xradius, yradius, white);
+ gp_ring(win, x, y, xradius, yradius, white);
}
void draw_testing_ellipse(int x, int y, int xradius, int yradius)
{
if (outline == 1)
- GP_Ellipse(win, x, y, xradius, yradius, yellow);
+ gp_ellipse(win, x, y, xradius, yradius, yellow);
if (fill)
- GP_FillEllipse(win, x, y, xradius, yradius, red);
+ gp_fill_ellipse(win, x, y, xradius, yradius, red);
if (outline == 2)
- GP_Ellipse(win, x, y, xradius, yradius, white);
+ gp_ellipse(win, x, y, xradius, yradius, white);
}
void draw_testing_arc(int x, int y, int xradius, int yradius)
{
- GP_ArcSegment(win, x, y, xradius, yradius, -1,
+ gp_arc_segment(win, x, y, xradius, yradius, -1,
M_PI - M_PI/8.0, M_PI/4.0, red);
}
@@ -173,13 +173,13 @@ void draw_testing_rectangle(int x, int y, int xradius, int yradius)
int x1 = x + xradius, y1 = y + yradius;
if (outline == 1)
- GP_Rect(win, x0, y0, x1, y1, yellow);
+ gp_rect(win, x0, y0, x1, y1, yellow);
if (fill)
- GP_FillRect(win, x0, y0, x1, y1, red);
+ gp_fill_rect(win, x0, y0, x1, y1, red);
if (outline == 2)
- GP_Rect(win, x0, y0, x1, y1, white);
+ gp_rect(win, x0, y0, x1, y1, white);
}
void draw_testing_tetragon(int x, int y, int xradius, int yradius)
@@ -190,18 +190,18 @@ void draw_testing_tetragon(int x, int y, int xradius, int yradius)
int x3 = x, y3 = y + yradius;
if (outline == 1)
- GP_Tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, yellow);
+ gp_tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, yellow);
if (fill)
- GP_FillTetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, red);
+ gp_fill_tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, red);
if (outline == 2)
- GP_Tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, white);
+ gp_tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, white);
}
void draw_testing_polygon(int x, int y, int xradius, int yradius)
{
- GP_Coord xy[14];
+ gp_coord xy[14];
unsigned int edges = 7;
xy[0] = x + xradius;
@@ -226,42 +226,42 @@ void draw_testing_polygon(int x, int y, int xradius, int yradius)
xy[13] = y - yradius / 4;
if (outline == 1)
- GP_Polygon(win, edges, xy, yellow);
+ gp_polygon(win, edges, xy, yellow);
if (fill)
- GP_FillPolygon(win, edges, xy, red);
+ gp_fill_polygon(win, edges, xy, red);
if (outline == 2)
- GP_Polygon(win, edges, xy, white);
+ gp_polygon(win, edges, xy, white);
}
void redraw_screen(void)
{
/* text style for the label */
- GP_TextStyle style = {
- .font = &GP_DefaultConsoleFont,
+ gp_text_style style = {
+ .font = gp_font_gfxprim_mono,
.pixel_xmul = 2,
.pixel_ymul = 1,
.pixel_xspace = 0,
.pixel_yspace = 1,
};
- GP_Fill(win, black);
+ gp_fill(win, black);
/* axes */
if (show_axes) {
int w, h;
- w = GP_PixmapW(win);
- h = GP_PixmapH(win);
+ w = gp_pixmap_w(win);
+ h = gp_pixmap_h(win);
- GP_HLine(win, 0, w, center_y, gray);
- GP_HLine(win, 0, w, center_y-yradius, darkgray);
- GP_HLine(win, 0, w, center_y+yradius, darkgray);
- GP_VLine(win, center_x, 0, h, gray);
- GP_VLine(win, center_x-xradius, 0, h, darkgray);
- GP_VLine(win, center_x+xradius, 0, h, darkgray);
+ gp_hline(win, 0, w, center_y, gray);
+ gp_hline(win, 0, w, center_y-yradius, darkgray);
+ gp_hline(win, 0, w, center_y+yradius, darkgray);
+ gp_vline(win, center_x, 0, h, gray);
+ gp_vline(win, center_x-xradius, 0, h, darkgray);
+ gp_vline(win, center_x+xradius, 0, h, darkgray);
}
/* the shape */
@@ -301,16 +301,16 @@ void redraw_screen(void)
break;
}
- GP_Text(win, &style, 16, 16, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
+ gp_text(win, &style, 16, 16, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
white, black, title);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
static void xradius_add(int xradius_add)
{
if (xradius + xradius_add > 1 &&
- xradius + xradius_add < (int)GP_PixmapW(win))
+ xradius + xradius_add < (int) gp_pixmap_w(win))
xradius += xradius_add;
}
@@ -318,21 +318,21 @@ static void xradius_add(int xradius_add)
static void yradius_add(int yradius_add)
{
if (yradius + yradius_add > 1 &&
- yradius + yradius_add < (int)GP_PixmapH(win))
+ yradius + yradius_add < (int) gp_pixmap_h(win))
yradius += yradius_add;
}
static void xcenter_add(int xcenter_add)
{
if (center_x + xcenter_add > 1 &&
- center_x + xcenter_add < (int)GP_PixmapW(win)/2)
+ center_x + xcenter_add < (int) gp_pixmap_w(win)/2)
center_x += xcenter_add;
}
static void ycenter_add(int ycenter_add)
{
if (center_y + ycenter_add > 1 &&
- center_y + ycenter_add < (int)GP_PixmapH(win)/2)
+ center_y + ycenter_add < (int) gp_pixmap_h(win)/2)
center_y += ycenter_add;
}
@@ -340,15 +340,15 @@ void event_loop(void)
{
int shift_pressed;
- GP_Event ev;
+ gp_event ev;
for (;;) {
- GP_BackendWaitEvent(backend, &ev);
+ gp_backend_wait_event(backend, &ev);
- //GP_EventDump(&ev);
+ //gp_eventDump(&ev);
- shift_pressed = GP_EventGetKey(&ev, GP_KEY_LEFT_SHIFT) ||
- GP_EventGetKey(&ev, GP_KEY_RIGHT_SHIFT);
+ shift_pressed = gp_event_get_key(&ev, GP_KEY_LEFT_SHIFT) ||
+ gp_event_get_key(&ev, GP_KEY_RIGHT_SHIFT);
switch (ev.type) {
case GP_EV_KEY:
@@ -364,8 +364,8 @@ void event_loop(void)
break;
case GP_KEY_R:
win->axes_swap = !win->axes_swap;
- center_x = GP_PixmapW(win) / 2;
- center_y = GP_PixmapH(win) / 2;
+ center_x = gp_pixmap_w(win) / 2;
+ center_y = gp_pixmap_h(win) / 2;
break;
case GP_KEY_F:
fill = !fill;
@@ -438,7 +438,7 @@ void event_loop(void)
yradius_add(-1);
break;
case GP_KEY_ESC:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
}
@@ -446,14 +446,14 @@ void event_loop(void)
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
win = backend->pixmap;
- center_x = GP_PixmapW(win) / 2;
- center_y = GP_PixmapH(win) / 2;
+ center_x = gp_pixmap_w(win) / 2;
+ center_y = gp_pixmap_h(win) / 2;
break;
}
break;
@@ -498,7 +498,7 @@ int main(int argc, char *argv[])
}
}
- backend = GP_BackendInit(backend_opts, "Shapetest");
+ backend = gp_backend_init(backend_opts, "Shapetest");
if (backend == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -512,13 +512,13 @@ int main(int argc, char *argv[])
center_y = win->h / 2;
/* Load colors compatible with the display */
- black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
- white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
- yellow = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win);
- green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win);
- red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
- gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win);
- darkgray = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win);
+ black = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win);
+ white = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win);
+ yellow = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0x00, win);
+ green = gp_rgb_to_pixmap_pixel(0x00, 0xff, 0x00, win);
+ red = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win);
+ gray = gp_rgb_to_pixmap_pixel(0xbe, 0xbe, 0xbe, win);
+ darkgray = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, win);
print_instructions();
redraw_screen();
diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c
index 4208b201c0b5..d87491612fe6 100644
--- a/demos/c_simple/showimage.c
+++ b/demos/c_simple/showimage.c
@@ -30,12 +30,12 @@
#include <errno.h>
#include <string.h>
-#include <GP.h>
+#include <gfxprim.h>
int main(int argc, char *argv[])
{
- GP_Backend *backend;
- GP_Pixmap *image;
+ gp_backend *backend;
+ gp_pixmap *image;
if (argc != 2) {
fprintf(stderr, "Takes image as an argument\n");
@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
}
/* Load image */
- image = GP_LoadImage(argv[1], NULL);
+ image = gp_load_image(argv[1], NULL);
if (!image) {
fprintf(stderr, "Failed to load bitmap: %s\n", strerror(errno));
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
}
/* Initalize backend */
- backend = GP_BackendX11Init(NULL, 0, 0, image->w, image->h, argv[1], 0);
+ backend = gp_x11_init(NULL, 0, 0, image->w, image->h, argv[1], 0);
if (!backend) {
fprintf(stderr, "Failed to initalize backend\n");
@@ -59,31 +59,31 @@ int main(int argc, char *argv[])
}
/* Blit image into the window and show it */
- GP_Blit(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
- GP_BackendFlip(backend);
+ gp_blit(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
+ gp_backend_flip(backend);
/* Wait for events */
for (;;) {
- GP_Event ev;
+ gp_event ev;
- GP_BackendWaitEvent(backend, &ev);
+ gp_backend_wait_event(backend, &ev);
if (ev.type == GP_EV_KEY && ev.val.val == GP_KEY_Q) {
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
}
if (ev.type == GP_EV_SYS && ev.code == GP_EV_SYS_RESIZE) {
int cx, cy;
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
cx = ((int)backend->pixmap->w - (int)image->w) / 2;
cy = ((int)backend->pixmap->h - (int)image->h) / 2;
- GP_Fill(backend->pixmap, 0);
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, cx, cy);
- GP_BackendFlip(backend);
+ gp_fill(backend->pixmap, 0);
+ gp_blit_clipped(image, 0, 0, image->w, image->h, backend->pixmap, cx, cy);
+ gp_backend_flip(backend);
}
}
diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c
index 9827ee6b96a0..1977cb1bdf5f 100644
--- a/demos/c_simple/textaligntest.c
+++ b/demos/c_simple/textaligntest.c
@@ -24,9 +24,9 @@
*****************************************************************************/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Pixel black_pixel, red_pixel, yellow_pixel, green_pixel, blue_pixel,
+static gp_pixel black_pixel, red_pixel, yellow_pixel, green_pixel, blue_pixel,
darkgray_pixel, white_pixel;
static int font_flag = 0;
@@ -34,60 +34,60 @@ static int font_flag = 0;
static int X = 640;
static int Y = 480;
-static GP_FontFace *font = NULL;
-static GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
+static gp_font_face *font = NULL;
+static gp_text_style style = GP_DEFAULT_TEXT_STYLE;
-static GP_Backend *win;
+static gp_backend *win;
void redraw_screen(void)
{
- GP_Fill(win->pixmap, black_pixel);
+ gp_fill(win->pixmap, black_pixel);
/* draw axes intersecting in the middle, where text should be shown */
- GP_HLine(win->pixmap, 0, X, Y/2, darkgray_pixel);
- GP_VLine(win->pixmap, X/2, 0, Y, darkgray_pixel);
+ gp_hline(win->pixmap, 0, X, Y/2, darkgray_pixel);
+ gp_vline(win->pixmap, X/2, 0, Y, darkgray_pixel);
switch (font_flag) {
case 0:
- style.font = &GP_DefaultProportionalFont;
+ style.font = gp_font_gfxprim;
break;
case 1:
- style.font = &GP_DefaultConsoleFont;
+ style.font = gp_font_gfxprim_mono;
break;
case 2:
- style.font = GP_FontTinyMono;
+ style.font = gp_font_tiny_mono;
break;
case 3:
- style.font = GP_FontTiny;
+ style.font = gp_font_tiny;
break;
case 4:
- style.font = GP_FontC64;
+ style.font = gp_font_c64;
break;
case 5:
style.font = font;
break;
}
- GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
+ gp_text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
yellow_pixel, black_pixel, "bottom left");
- GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
+ gp_text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
red_pixel, black_pixel, "bottom right");
- GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
+ gp_text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
blue_pixel, black_pixel, "top right");
- GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
+ gp_text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
green_pixel, black_pixel, "top left");
- GP_HLine(win->pixmap, 0, X, Y/3, darkgray_pixel);
- GP_Text(win->pixmap, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE,
+ gp_hline(win->pixmap, 0, X, Y/3, darkgray_pixel);
+ gp_text(win->pixmap, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE,
white_pixel, black_pixel, "x center y baseline");
}
static void event_loop(void)
{
- GP_Event ev;
+ gp_event ev;
for (;;) {
- GP_BackendWaitEvent(win, &ev);
+ gp_backend_wait_event(win, &ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -133,7 +133,7 @@ static void event_loop(void)
style.pixel_ymul--;
break;
case GP_KEY_ESC:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
}
@@ -141,11 +141,11 @@ static void event_loop(void)
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_QUIT:
- GP_BackendExit(win);
+ gp_backend_exit(win);
exit(0);
break;
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(win);
+ gp_backend_resize_ack(win);
X = win->pixmap->w;
Y = win->pixmap->h;
break;
@@ -154,7 +154,7 @@ static void event_loop(void)
}
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
}
}
@@ -174,11 +174,11 @@ int main(int argc, char *argv[])
const char *backend_opts = "X11";
if (argc > 1)
- font = GP_FontFaceLoad(argv[1], 0, 20);
+ font = gp_font_face_load(argv[1], 0, 20);
print_instructions();
- win = GP_BackendInit(backend_opts, "Font Align Test");
+ win = gp_backend_init(backend_opts, "Font Align Test");
if (win == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n",
@@ -186,16 +186,16 @@ int main(int argc, char *argv[])
return 1;
}
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
- red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap);
- blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap);
- green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win->pixmap);
- yellow_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win->pixmap);
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
- darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
+ red_pixel = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win->pixmap);
+ blue_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, win->pixmap);
+ green_pixel = gp_rgb_to_pixmap_pixel(0x00, 0xff, 0x00, win->pixmap);
+ yellow_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0x00, win->pixmap);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
+ darkgray_pixel = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, win->pixmap);
redraw_screen();
- GP_BackendFlip(win);
+ gp_backend_flip(win);
event_loop();
return 0;
diff --git a/demos/c_simple/timers.c b/demos/c_simple/timers.c
index e98315374e4e..512617c189fe 100644
--- a/demos/c_simple/timers.c
+++ b/demos/c_simple/timers.c
@@ -26,7 +26,7 @@
*/
-#include <GP.h>
+#include <gfxprim.h>
uint32_t callback1()
{
@@ -45,41 +45,41 @@ int main(void)
GP_TIMER_DECLARE(oneshot, 30, 0, "Oneshot", callback1, NULL);
GP_TIMER_DECLARE(recurrent, 0, 4, "Recurrent", callback1, NULL);
GP_TIMER_DECLARE(random, 10, 0, "Random", callback3, NULL);
- GP_Timer timers[MAX];
- GP_Timer *queue = NULL;
+ gp_timer timers[MAX];
+ gp_timer *queue = NULL;
uint64_t now;
int i, ret;
char ids[MAX][8];
- GP_SetDebugLevel(10);
+ gp_set_debug_level(10);
- GP_TimerQueueInsert(&queue, 0, &oneshot);
- GP_TimerQueueInsert(&queue, 0, &recurrent);
- GP_TimerQueueInsert(&queue, 0, &random);
+ gp_timer_queue_insert(&queue, 0, &oneshot);
+ gp_timer_queue_insert(&queue, 0, &recurrent);
+ gp_timer_queue_insert(&queue, 0, &random);
for (i = 0; i < MAX; i++) {
timers[i].expires = MAX - i;
timers[i].period = 0;
- timers[i].Callback = callback1;
+ timers[i].callback = callback1;
timers[i].priv = NULL;
sprintf(ids[i], "Timer%i", MAX - i);
timers[i].id = ids[i];
- GP_TimerQueueInsert(&queue, 0, &timers[i]);
+ gp_timer_queue_insert(&queue, 0, &timers[i]);
}
- GP_TimerQueueDump(queue);
+ gp_timer_queue_dump(queue);
- GP_TimerQueueRemove(&queue, &timers[MAX-1]);
+ gp_timer_queue_remove(&queue, &timers[MAX-1]);
- GP_TimerQueueDump(queue);
+ gp_timer_queue_dump(queue);
for (now = 0; now < 100; now += 3) {
printf("NOW %u\n", (unsigned int) now);
printf("-------------------------------------\n");
- ret = GP_TimerQueueProcess(&queue, now);
+ ret = gp_timer_queue_process(&queue, now);
printf("Processed %i timer events\n", ret);
printf("--------------------------------------\n");
- GP_TimerQueueDump(queue);
+ gp_timer_queue_dump(queue);
printf("--------------------------------------\n\n");
}
diff --git a/demos/c_simple/v4l2_grab.c b/demos/c_simple/v4l2_grab.c
index 6498fb82ae8f..87ef85a2e986 100644
--- a/demos/c_simple/v4l2_grab.c
+++ b/demos/c_simple/v4l2_grab.c
@@ -30,32 +30,32 @@
#include <errno.h>
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
-static int get_image(const char *filename, GP_Grabber *grabber)
+static int get_image(const char *filename, gp_grabber *grabber)
{
/* turn on grabber */
- if (GP_GrabberStart(grabber)) {
+ if (gp_grabber_start(grabber)) {
fprintf(stderr, "Failed to start grabber\n");
return 1;
}
/* throw away first frame, it's usually wrong */
- while (!GP_GrabberPoll(grabber))
+ while (!gp_grabber_poll(grabber))
usleep(100000);
- while (!GP_GrabberPoll(grabber))
+ while (!gp_grabber_poll(grabber))
usleep(100000);
/* save image */
- if (GP_SaveJPG(grabber->frame, filename, NULL)) {
+ if (gp_save_jpg(grabber->frame, filename, NULL)) {
fprintf(stderr, "Failed to save image '%s': %s",
filename, strerror(errno));
return 1;
}
/* turn off grabber */
- if (GP_GrabberStop(grabber)) {
+ if (gp_grabber_stop(grabber)) {
fprintf(stderr, "Failed to start grabber\n");
return 1;
}
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
secs = atoi(optarg);
break;
case 'l':
- GP_SetDebugLevel(atoi(optarg));
+ gp_set_debug_level(atoi(optarg));
break;
case 'h':
printf("Usage; %s opts\n", argv[0]);
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
}
}
- GP_Grabber *grabber = GP_GrabberV4L2Init(v4l2_device, w, h);
+ gp_grabber *grabber = gp_grabber_v4l2_init(v4l2_device, w, h);
if (grabber == NULL) {
fprintf(stderr, "Failed to initalize grabber '%s': %s\n",
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
if (secs == 0) {
get_image(image_filename, grabber);
- GP_GrabberExit(grabber);
+ gp_grabber_exit(grabber);
return 0;
}
@@ -137,6 +137,5 @@ int main(int argc, char *argv[])
sleep(secs);
}
-
return 0;
}
diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c
index 5f5dacf86c72..6c5b0163ff49 100644
--- a/demos/c_simple/v4l2_show.c
+++ b/demos/c_simple/v4l2_show.c
@@ -30,12 +30,12 @@
#include <string.h>
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
int main(int argc, char *argv[])
{
- GP_Backend *backend;
- GP_Grabber *grabber;
+ gp_backend *backend;
+ gp_grabber *grabber;
const char *v4l2_device = "/dev/video0";
unsigned int w = 640, h = 480;
int mode = 0;
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
h = atoi(optarg);
break;
case 'l':
- GP_SetDebugLevel(atoi(optarg));
+ gp_set_debug_level(atoi(optarg));
break;
case 'h':
printf("Usage; %s opts\n", argv[0]);
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
}
}
- grabber = GP_GrabberV4L2Init(v4l2_device, w, h);
+ grabber = gp_grabber_v4l2_init(v4l2_device, w, h);
if (grabber == NULL) {
fprintf(stderr, "Failed to initalize grabber '%s': %s\n",
@@ -78,59 +78,59 @@ int main(int argc, char *argv[])
return 1;
}
- backend = GP_BackendX11Init(NULL, 0, 0, grabber->frame->w,
+ backend = gp_x11_init(NULL, 0, 0, grabber->frame->w,
grabber->frame->h, "V4L2", 0);
if (backend == NULL) {
- GP_GrabberExit(grabber);
+ gp_grabber_exit(grabber);
return 1;
}
- if (GP_GrabberStart(grabber)) {
+ if (gp_grabber_start(grabber)) {
fprintf(stderr, "Failed to start grabber\n");
- GP_BackendExit(backend);
- GP_GrabberExit(grabber);
+ gp_backend_exit(backend);
+ gp_grabber_exit(grabber);
return 1;
}
printf("Press SPACE to change mode and Q to exit.\n");
for (;;) {
- if (GP_GrabberPoll(grabber) > 0) {
- GP_Pixmap *res, *img = grabber->frame;
+ if (gp_grabber_poll(grabber) > 0) {
+ gp_pixmap *res, *img = grabber->frame;
switch (mode) {
case 0:
res = img;
break;
case 1:
- // GP_FilterEdgePrewitt(img, &res, NULL, NULL);
- GP_FilterEdgeSobel(img, &res, NULL, NULL);
+ // gp_filter_edge_prewitt(img, &res, NULL, NULL);
+ gp_filter_edge_sobel(img, &res, NULL, NULL);
break;
case 2:
- GP_FilterGaussianBlur(img, img, 1, 1, NULL);
- res = GP_FilterFloydSteinbergAlloc(img, GP_PIXEL_G2, NULL);
+ gp_filter_gaussian_blur(img, img, 1, 1, NULL);
+ res = gp_filter_floyd_steinberg_alloc(img, GP_PIXEL_G2, NULL);
break;
}
unsigned int c_x = (backend->pixmap->w - res->w) / 2;
unsigned int c_y = (backend->pixmap->h - res->h) / 2;
- GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->pixmap, c_x, c_y);
- GP_BackendFlip(backend);
+ gp_blit_clipped(res, 0, 0, res->w, res->h, backend->pixmap, c_x, c_y);
+ gp_backend_flip(backend);
if (mode)
- GP_PixmapFree(res);
+ gp_pixmap_free(res);
}
usleep(1000);
- GP_BackendPoll(backend);
+ gp_backend_poll(backend);
/* Read and parse events */
- GP_Event ev;
+ gp_event ev;
- while (GP_BackendGetEvent(backend, &ev)) {
+ while (gp_backend_get_event(backend, &ev)) {
switch (ev.type) {
case GP_EV_KEY:
@@ -141,8 +141,8 @@ int main(int argc, char *argv[])
switch (ev.val.key.key) {
case GP_KEY_ESC:
case GP_KEY_Q:
- GP_BackendExit(backend);
- GP_GrabberExit(grabber);
+ gp_backend_exit(backend);
+ gp_grabber_exit(grabber);
return 0;
break;
case GP_KEY_SPACE:
@@ -156,15 +156,15 @@ int main(int argc, char *argv[])
break;
case GP_EV_SYS:
if (ev.code == GP_EV_SYS_RESIZE) {
- GP_BackendResizeAck(backend);
- GP_Fill(backend->pixmap, 0);
+ gp_backend_resize_ack(backend);
+ gp_fill(backend->pixmap, 0);
}
break;
}
}
}
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
}
diff --git a/demos/c_simple/version.c b/demos/c_simple/version.c
index 874bf2bf5a3e..86d403d8ddb2 100644
--- a/demos/c_simple/version.c
+++ b/demos/c_simple/version.c
@@ -26,7 +26,7 @@
*/
-#include <GP.h>
+#include <gfxprim.h>
int main(void)
{
diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c
index b1d8199f5b89..f77fe3624bb3 100644
--- a/demos/c_simple/virtual_backend_example.c
+++ b/demos/c_simple/virtual_backend_example.c
@@ -29,66 +29,66 @@
*/
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel;
+static gp_pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel;
-static void redraw(GP_Backend *backend)
+static void redraw(gp_backend *backend)
{
- GP_Pixmap *pixmap = backend->pixmap;
+ gp_pixmap *pixmap = backend->pixmap;
/* Now draw some testing patters */
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap);
- blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap);
- green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, pixmap);
+ red_pixel = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, pixmap);
+ blue_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, pixmap);
+ green_pixel = gp_rgb_to_pixmap_pixel(0x00, 0xff, 0x00, pixmap);
- GP_Fill(pixmap, white_pixel);
+ gp_fill(pixmap, white_pixel);
unsigned int i, j;
for (i = 0; i < 40; i++) {
- GP_HLineXYW(pixmap, 0, i, i, black_pixel);
- GP_HLineXYW(pixmap, 1, i + 40, i, black_pixel);
- GP_HLineXYW(pixmap, 2, i + 80, i, black_pixel);
- GP_HLineXYW(pixmap, 3, i + 120, i, black_pixel);
- GP_HLineXYW(pixmap, 4, i + 160, i, black_pixel);
- GP_HLineXYW(pixmap, 5, i + 200, i, black_pixel);
- GP_HLineXYW(pixmap, 6, i + 240, i, black_pixel);
- GP_HLineXYW(pixmap, 7, i + 280, i, black_pixel);
+ gp_hline_xyw(pixmap, 0, i, i, black_pixel);
+ gp_hline_xyw(pixmap, 1, i + 40, i, black_pixel);
+ gp_hline_xyw(pixmap, 2, i + 80, i, black_pixel);
+ gp_hline_xyw(pixmap, 3, i + 120, i, black_pixel);
+ gp_hline_xyw(pixmap, 4, i + 160, i, black_pixel);
+ gp_hline_xyw(pixmap, 5, i + 200, i, black_pixel);
+ gp_hline_xyw(pixmap, 6, i + 240, i, black_pixel);
+ gp_hline_xyw(pixmap, 7, i + 280, i, black_pixel);
}
for (i = 0; i < 256; i++) {
for (j = 0; j < 256; j++) {
uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5;
- GP_Pixel pix = GP_RGBToPixmapPixel(i, j, val, pixmap);
- GP_PutPixel(pixmap, i + 60, j + 10, pix);
+ gp_pixel pix = gp_rgb_to_pixmap_pixel(i, j, val, pixmap);
+ gp_putpixel(pixmap, i + 60, j + 10, pix);
}
}
- GP_Text(pixmap, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ gp_text(pixmap, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
black_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(pixmap, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ gp_text(pixmap, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
red_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(pixmap, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ gp_text(pixmap, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
green_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(pixmap, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ gp_text(pixmap, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
blue_pixel, white_pixel, "Lorem Ipsum dolor sit...");
/* Update the backend screen */
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
int main(int argc, char *argv[])
{
- GP_Backend *backend;
+ gp_backend *backend;
const char *backend_opts = "X11:350x350";
int opt;
- GP_PixelType emul_type = GP_PIXEL_UNKNOWN;
+ gp_pixel_type emul_type = GP_PIXEL_UNKNOWN;
while ((opt = getopt(argc, argv, "b:h:p:")) != -1) {
switch (opt) {
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
backend_opts = optarg;
break;
case 'p':
- emul_type = GP_PixelTypeByName(optarg);
+ emul_type = gp_pixel_type_by_name(optarg);
if (emul_type == GP_PIXEL_UNKNOWN) {
fprintf(stderr, "Invalid pixel type '%s'\n", optarg);
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
}
break;
case 'h':
- GP_BackendInit("help", NULL);
+ gp_backend_init("help", NULL);
return 0;
break;
default:
@@ -114,12 +114,12 @@ int main(int argc, char *argv[])
}
/* Turn on debug messages */
- GP_SetDebugLevel(10);
+ gp_set_debug_level(10);
- backend = GP_BackendInit(backend_opts, "Virtual Backend Example");
+ backend = gp_backend_init(backend_opts, "Virtual Backend Example");
if (emul_type != GP_PIXEL_UNKNOWN) {
- GP_Backend *emul;
+ gp_backend *emul;
/*
* Create an emulated backend on the top of real backend.
@@ -128,11 +128,11 @@ int main(int argc, char *argv[])
* emulated backend, the real backend exit will be called as
* well.
*/
- emul = GP_BackendVirtualInit(backend, emul_type, GP_BACKEND_CALL_EXIT);
+ emul = gp_backend_virt_init(backend, emul_type, GP_BACKEND_CALL_EXIT);
if (emul == NULL) {
fprintf(stderr, "Failed to create Virtual Backend\n");
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 1;
}
@@ -143,24 +143,24 @@ int main(int argc, char *argv[])
redraw(backend);
for (;;) {
- if (backend->Poll)
- GP_BackendPoll(backend);
+ if (backend->poll)
+ gp_backend_poll(backend);
usleep(1000);
/* Read and parse events */
- GP_Event ev;
+ gp_event ev;
- while (GP_BackendGetEvent(backend, &ev)) {
+ while (gp_backend_get_event(backend, &ev)) {
- GP_EventDump(&ev);
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
switch (ev.val.key.key) {
case GP_KEY_ESC:
case GP_KEY_Q:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
}
@@ -168,7 +168,7 @@ int main(int argc, char *argv[])
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
redraw(backend);
break;
}
@@ -177,7 +177,7 @@ int main(int argc, char *argv[])
}
}
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
}
diff --git a/demos/c_simple/weighted_median.c b/demos/c_simple/weighted_median.c
index dc481603f9d5..b52247ded411 100644
--- a/demos/c_simple/weighted_median.c
+++ b/demos/c_simple/weighted_median.c
@@ -30,14 +30,14 @@
#include <string.h>
#include <errno.h>
-#include <GP.h>
+#include <gfxprim.h>
struct callback_priv {
char *op;
char *name;
};
-static int progress_callback(GP_ProgressCallback *self)
+static int progress_callback(gp_progress_cb *self)
{
struct callback_priv *priv = self->priv;
@@ -53,9 +53,9 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Pixmap *img;
+ gp_pixmap *img;
struct callback_priv priv;
- GP_ProgressCallback callback = {.callback = progress_callback,
+ gp_progress_cb callback = {.callback = progress_callback,
.priv = &priv};
if (argc != 2) {
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
priv.op = "Loading";
priv.name = argv[1];
- img = GP_LoadImage(argv[1], &callback);
+ img = gp_load_image(argv[1], &callback);
if (img == NULL) {
fprintf(stderr, "Failed to load image '%s': %s\n", argv[1],
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
};
- GP_MedianWeights weights = {
+ gp_median_weights weights = {
.w = 11,
.h = 11,
.weights = circle,
@@ -141,14 +141,14 @@ int main(int argc, char *argv[])
priv.op = "Weighted Median";
- GP_Pixmap *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback);
+ gp_pixmap *res = gp_filter_weighted_median_alloc(img, &weights, &callback);
printf("\n");
priv.op = "Saving";
priv.name = "out.png";
- if (GP_SavePNG(res, "out.png", &callback)) {
+ if (gp_save_png(res, "out.png", &callback)) {
fprintf(stderr, "Failed to save image: %s", strerror(errno));
return 1;
}
diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c
index da9d8d8b8041..7364e1ebd268 100644
--- a/demos/c_simple/x11_windows.c
+++ b/demos/c_simple/x11_windows.c
@@ -27,39 +27,39 @@
*/
#include <stdio.h>
-#include <GP.h>
+#include <gfxprim.h>
-static void redraw(struct GP_Pixmap *pixmap)
+static void redraw(struct gp_pixmap *pixmap)
{
- GP_Pixel white_pixel, black_pixel;
+ gp_pixel white_pixel, black_pixel;
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(pixmap, black_pixel);
- GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
- GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
+ gp_fill(pixmap, black_pixel);
+ gp_line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
+ gp_line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
}
-static int ev_loop(struct GP_Backend *backend, const char *name)
+static int ev_loop(struct gp_backend *backend, const char *name)
{
- GP_Event ev;
+ gp_event ev;
if (backend == NULL)
return 0;
- while (GP_BackendGetEvent(backend, &ev)) {
+ while (gp_backend_get_event(backend, &ev)) {
printf("-------------------------- %s\n", name);
- GP_EventDump(&ev);
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
switch (ev.val.val) {
case GP_KEY_ESC:
case GP_KEY_Q:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 1;
break;
}
@@ -67,12 +67,12 @@ static int ev_loop(struct GP_Backend *backend, const char *name)
case GP_EV_SYS:
switch (ev.code) {
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
redraw(backend->pixmap);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
break;
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 1;
break;
}
@@ -87,14 +87,14 @@ static int ev_loop(struct GP_Backend *backend, const char *name)
int main(void)
{
- GP_Backend *win_1, *win_2;
+ gp_backend *win_1, *win_2;
- win_1 = GP_BackendX11Init(NULL, 0, 0, 300, 300, "win 1", 0);
- win_2 = GP_BackendX11Init(NULL, 0, 0, 300, 300, "win 2", 0);
+ win_1 = gp_x11_init(NULL, 0, 0, 300, 300, "win 1", 0);
+ win_2 = gp_x11_init(NULL, 0, 0, 300, 300, "win 2", 0);
if (win_1 == NULL || win_2 == NULL) {
- GP_BackendExit(win_1);
- GP_BackendExit(win_2);
+ gp_backend_exit(win_1);
+ gp_backend_exit(win_2);
return 1;
}
@@ -102,8 +102,8 @@ int main(void)
redraw(win_1->pixmap);
redraw(win_2->pixmap);
- GP_BackendFlip(win_1);
- GP_BackendFlip(win_2);
+ gp_backend_flip(win_1);
+ gp_backend_flip(win_2);
for (;;) {
/*
@@ -111,12 +111,12 @@ int main(void)
*
* Either window is fine as they share connection.
*/
- GP_Backend *b = win_1 ? win_1 : win_2;
+ gp_backend *b = win_1 ? win_1 : win_2;
if (b == NULL)
return 0;
- GP_BackendWait(b);
+ gp_backend_wait(b);
if (ev_loop(win_1, "win 1"))
win_1 = NULL;
@@ -125,8 +125,8 @@ int main(void)
win_2 = NULL;
}
- GP_BackendExit(win_1);
- GP_BackendExit(win_2);
+ gp_backend_exit(win_1);
+ gp_backend_exit(win_2);
return 0;
}
diff --git a/demos/c_simple/zip_container.c b/demos/c_simple/zip_container.c
index 4cf77fd9aef1..e277e53c4326 100644
--- a/demos/c_simple/zip_container.c
+++ b/demos/c_simple/zip_container.c
@@ -30,11 +30,11 @@
#include <errno.h>
#include <string.h>
-#include <GP.h>
+#include <gfxprim.h>
-static GP_Backend *backend;
-static GP_Pixmap *image;
-static GP_Container *container;
+static gp_backend *backend;
+static gp_pixmap *image;
+static gp_container *container;
/*
* Try to load next image in container, if image has different size than the
@@ -45,21 +45,21 @@ static GP_Container *container;
*/
static void load_next(void)
{
- GP_PixmapFree(image);
+ gp_pixmap_free(image);
- image = GP_ContainerLoadNext(container, NULL);
+ image = gp_container_load_next(container, NULL);
if (image == NULL)
return;
if (image->w != backend->pixmap->w ||
image->h != backend->pixmap->h) {
- GP_BackendResize(backend, image->w, image->h);
+ gp_backend_resize(backend, image->w, image->h);
return;
}
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
- GP_BackendFlip(backend);
+ gp_blit_clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
+ gp_backend_flip(backend);
}
int main(int argc, char *argv[])
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
}
/* Open zip container */
- container = GP_OpenZip(argv[1]);
+ container = gp_open_zip(argv[1]);
if (container == NULL) {
fprintf(stderr, "Failed to open container: %s\n", strerror(errno));
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
}
/* Load image */
- image = GP_ContainerLoadNext(container, NULL);
+ image = gp_container_load_next(container, NULL);
if (image == NULL) {
fprintf(stderr, "Failed to load image %s\n", strerror(errno));
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
}
/* Initalize backend */
- backend = GP_BackendX11Init(NULL, 0, 0, image->w, image->h, argv[1], 0);
+ backend = gp_x11_init(NULL, 0, 0, image->w, image->h, argv[1], 0);
if (backend == NULL) {
fprintf(stderr, "Failed to initalize backend\n");
@@ -95,23 +95,23 @@ int main(int argc, char *argv[])
}
/* Blit image into the window and show it */
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
- GP_BackendFlip(backend);
+ gp_blit_clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
+ gp_backend_flip(backend);
/* Wait for events */
for (;;) {
- GP_Event ev;
+ gp_event ev;
- GP_BackendWaitEvent(backend, &ev);
+ gp_backend_wait_event(backend, &ev);
switch (ev.type) {
case GP_EV_KEY:
- if (!ev.code == GP_EV_KEY_DOWN)
+ if (!(ev.code == GP_EV_KEY_DOWN))
continue;
switch (ev.val.val) {
case GP_KEY_Q:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
case GP_KEY_SPACE:
@@ -121,10 +121,10 @@ int main(int argc, char *argv[])
break;
case GP_EV_SYS:
if (ev.code == GP_EV_SYS_RESIZE) {
- GP_BackendResizeAck(backend);
- GP_Blit_Clipped(image, 0, 0, image->w, image->h,
+ gp_backend_resize_ack(backend);
+ gp_blit_clipped(image, 0, 0, image->w, image->h,
backend->pixmap, 0, 0);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
break;
}
diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c
index fe40e2529e2a..79dbfd98b6f4 100644
--- a/demos/grinder/grinder.c
+++ b/demos/grinder/grinder.c
@@ -26,16 +26,16 @@
#include <string.h>
#include <errno.h>
-#include "GP.h"
+#include "gfxprim.h"
#include "params.h"
#include "histogram.h"
-static GP_ProgressCallback *progress_callback = NULL;
+static gp_progress_cb *progress_callback = NULL;
static const char *progress_prefix = NULL;
-static int show_progress(GP_ProgressCallback *self)
+static int show_progress(gp_progress_cb *self)
{
fprintf(stderr, "\r%s %3.2f%%",
progress_prefix, self->percentage);
@@ -106,7 +106,7 @@ static struct param resize_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int resize(GP_Pixmap **c, const char *params)
+static int resize(gp_pixmap **c, const char *params)
{
int alg = 1;
float ratio = -1;
@@ -120,16 +120,16 @@ static int resize(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_Size w = ratio * (*c)->w;
- GP_Size h = ratio * (*c)->h;
- GP_Pixmap *res = NULL;
+ gp_size w = ratio * (*c)->w;
+ gp_size h = ratio * (*c)->h;
+ gp_pixmap *res = NULL;
- res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback);
+ res = gp_filter_resize_alloc(*c, w, h, alg, progress_callback);
if (res == NULL)
return EINVAL;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = res;
return 0;
@@ -164,7 +164,7 @@ static struct param scale_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int scale(GP_Pixmap **c, const char *params)
+static int scale(gp_pixmap **c, const char *params)
{
int alg = 1;
int w = -1;
@@ -185,14 +185,14 @@ static int scale(GP_Pixmap **c, const char *params)
if (h == -1)
h = (*c)->h * (1.00 * w/(*c)->w) + 0.5;
- GP_Pixmap *res = NULL;
+ gp_pixmap *res = NULL;
- res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback);
+ res = gp_filter_resize_alloc(*c, w, h, alg, progress_callback);
if (res == NULL)
return EINVAL;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = res;
return 0;
@@ -211,7 +211,7 @@ static struct param rotate_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int rotate(GP_Pixmap **c, const char *params)
+static int rotate(gp_pixmap **c, const char *params)
{
int rot = -1;
@@ -223,24 +223,24 @@ static int rotate(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_Pixmap *res = NULL;
+ gp_pixmap *res = NULL;
switch (rot) {
case 0:
- res = GP_FilterRotate90Alloc(*c, progress_callback);
+ res = gp_filter_rotate_90_alloc(*c, progress_callback);
break;
case 1:
- res = GP_FilterRotate180Alloc(*c, progress_callback);
+ res = gp_filter_rotate_180_alloc(*c, progress_callback);
break;
case 2:
- res = GP_FilterRotate270Alloc(*c, progress_callback);
+ res = gp_filter_rotate_270_alloc(*c, progress_callback);
break;
}
if (res == NULL)
return ENOMEM;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = res;
return 0;
@@ -254,7 +254,7 @@ static struct param mirror_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int mirror(GP_Pixmap **c, const char *params)
+static int mirror(gp_pixmap **c, const char *params)
{
int vert = 0, horiz = 0;
@@ -262,10 +262,10 @@ static int mirror(GP_Pixmap **c, const char *params)
return EINVAL;
if (vert)
- GP_FilterMirrorV(*c, *c, progress_callback);
+ gp_filter_mirror_v(*c, *c, progress_callback);
if (horiz)
- GP_FilterMirrorH(*c, *c, progress_callback);
+ gp_filter_mirror_h(*c, *c, progress_callback);
return 0;
}
@@ -277,14 +277,14 @@ static struct param bright_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int bright(GP_Pixmap **c, const char *params)
+static int bright(gp_pixmap **c, const char *params)
{
float bright = 0;
if (param_parse(params, bright_params, "bright", param_err, &bright))
return EINVAL;
- GP_FilterBrightness(*c, *c, bright, progress_callback);
+ gp_filter_brightness(*c, *c, bright, progress_callback);
return 0;
}
@@ -296,7 +296,7 @@ static struct param contrast_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int contrast(GP_Pixmap **c, const char *params)
+static int contrast(gp_pixmap **c, const char *params)
{
float mul = 0;
@@ -308,7 +308,7 @@ static int contrast(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_FilterContrast(*c, *c, mul, progress_callback);
+ gp_filter_contrast(*c, *c, mul, progress_callback);
return 0;
}
@@ -319,12 +319,12 @@ static struct param invert_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int invert(GP_Pixmap **c, const char *params)
+static int invert(gp_pixmap **c, const char *params)
{
if (param_parse(params, invert_params, "invert", param_err))
return EINVAL;
- GP_FilterInvert(*c, *c, progress_callback);
+ gp_filter_invert(*c, *c, progress_callback);
return 0;
}
@@ -338,7 +338,7 @@ static struct param blur_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int blur(GP_Pixmap **c, const char *params)
+static int blur(gp_pixmap **c, const char *params)
{
float sigma = 0;
float sigma_x = 0;
@@ -357,7 +357,7 @@ static int blur(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_FilterGaussianBlur(*c, *c, sigma_x, sigma_y, progress_callback);
+ gp_filter_gaussian_blur(*c, *c, sigma_x, sigma_y, progress_callback);
return 0;
}
@@ -375,7 +375,7 @@ static const char *dither_formats[] = {
NULL,
};
-static const GP_PixelType dither_pixel_types[] = {
+static const gp_pixel_type dither_pixel_types[] = {
GP_PIXEL_G1,
GP_PIXEL_G2,
GP_PIXEL_G4,
@@ -389,7 +389,7 @@ static struct param dither_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int dither(GP_Pixmap **c, const char *params)
+static int dither(gp_pixmap **c, const char *params)
{
int fmt = -1;
@@ -401,15 +401,15 @@ static int dither(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_Pixmap *bw;
- bw = GP_FilterFloydSteinbergAlloc(*c, dither_pixel_types[fmt],
+ gp_pixmap *bw;
+ bw = gp_filter_floyd_steinberg_alloc(*c, dither_pixel_types[fmt],
progress_callback);
//TODO: so far we convert the pixmap back to RGB888
//(so we can do further work with it)
- GP_Blit(bw, 0, 0, GP_PixmapW(bw), GP_PixmapH(bw), *c, 0, 0);
+ gp_blit(bw, 0, 0, gp_pixmap_w(bw), gp_pixmap_h(bw), *c, 0, 0);
- GP_PixmapFree(bw);
+ gp_pixmap_free(bw);
return 0;
}
@@ -421,7 +421,7 @@ static struct param save_jpg_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int save_jpg(GP_Pixmap **c, const char *params)
+static int save_jpg(gp_pixmap **c, const char *params)
{
char *file = NULL;
@@ -433,7 +433,7 @@ static int save_jpg(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_SaveJPG(*c, file, progress_callback);
+ gp_save_jpg(*c, file, progress_callback);
return 0;
}
@@ -445,7 +445,7 @@ static struct param save_png_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int save_png(GP_Pixmap **c, const char *params)
+static int save_png(gp_pixmap **c, const char *params)
{
char *file = NULL;
@@ -457,7 +457,7 @@ static int save_png(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_SavePNG(*c, file, progress_callback);
+ gp_save_png(*c, file, progress_callback);
return 0;
}
@@ -471,7 +471,7 @@ static struct param median_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int median(GP_Pixmap **c, const char *params)
+static int median(gp_pixmap **c, const char *params)
{
int rad = -1, rad_x, rad_y;
@@ -486,12 +486,12 @@ static int median(GP_Pixmap **c, const char *params)
if (rad_x < 0 || rad_y < 0)
return EINVAL;
- GP_Pixmap *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback);
+ gp_pixmap *ret = gp_filter_median_alloc(*c, rad_x, rad_y, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = ret;
return 0;
@@ -508,7 +508,7 @@ static struct param sigma_mean_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int sigma_mean(GP_Pixmap **c, const char *params)
+static int sigma_mean(gp_pixmap **c, const char *params)
{
int rad = -1, rad_x, rad_y, min = 0;
float sigma = 0.1;
@@ -525,14 +525,14 @@ static int sigma_mean(GP_Pixmap **c, const char *params)
if (rad_x < 0 || rad_y < 0)
return EINVAL;
- (*c)->gamma = GP_GammaAcquire((*c)->pixel_type, 1.2);
+ (*c)->gamma = gp_gamma_acquire((*c)->pixel_type, 1.2);
- GP_Pixmap *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback);
+ gp_pixmap *ret = gp_filter_sigma_alloc(*c, rad_x, rad_y, min, sigma, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = ret;
return 0;
@@ -545,19 +545,19 @@ static struct param sharpen_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int sharpen(GP_Pixmap **c, const char *params)
+static int sharpen(gp_pixmap **c, const char *params)
{
float weight = 0.1;
if (param_parse(params, sharpen_params, "sigma", param_err, &weight))
return EINVAL;
- GP_Pixmap *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback);
+ gp_pixmap *ret = gp_filter_edge_sharpening_alloc(*c, weight, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = ret;
return 0;
@@ -571,7 +571,7 @@ static struct param gauss_noise_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int gauss_noise(GP_Pixmap **c, const char *params)
+static int gauss_noise(gp_pixmap **c, const char *params)
{
float sigma = 0.1;
float mu = 0;
@@ -579,7 +579,7 @@ static int gauss_noise(GP_Pixmap **c, const char *params)
if (param_parse(params, gauss_noise_params, "gaussian noise", param_err, &sigma, &mu))
return EINVAL;
- GP_FilterGaussianNoiseAdd(*c, *c, sigma, mu, progress_callback);
+ gp_filter_gaussian_noise_add(*c, *c, sigma, mu, progress_callback);
return 0;
}
@@ -601,7 +601,7 @@ static struct param arithmetic_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int arithmetic(GP_Pixmap **c, const char *params)
+static int arithmetic(gp_pixmap **c, const char *params)
{
char *file = NULL;
int op = -1;
@@ -614,35 +614,35 @@ static int arithmetic(GP_Pixmap **c, const char *params)
return EINVAL;
}
- GP_Pixmap *img, *res = NULL;
+ gp_pixmap *img, *res = NULL;
- if ((img = GP_LoadImage(file, progress_callback)) == NULL) {
+ if ((img = gp_load_image(file, progress_callback)) == NULL) {
print_error("arithmetic: Invalid image.");
return EINVAL;
}
switch (op) {
case 0:
- res = GP_FilterDifferenceAlloc(*c, img, progress_callback);
+ res = gp_filter_diff_alloc(*c, img, progress_callback);
break;
case 1:
- res = GP_FilterAdditionAlloc(*c, img, progress_callback);
+ res = gp_filter_add_alloc(*c, img, progress_callback);
break;
case 2:
- res = GP_FilterMultiplyAlloc(*c, img, progress_callback);
+ res = gp_filter_mul_alloc(*c, img, progress_callback);
break;
case 3:
- res = GP_FilterMinAlloc(*c, img, progress_callback);
+ res = gp_filter_min_alloc(*c, img, progress_callback);
break;
case 4:
- res = GP_FilterMaxAlloc(*c, img, progress_callback);
+ res = gp_filter_max_alloc(*c, img, progress_callback);
break;
}
if (res == NULL)
return ENOMEM;
- GP_PixmapFree(*c);
+ gp_pixmap_free(*c);
*c = res;
@@ -656,7 +656,7 @@ static struct param histogram_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int histogram(GP_Pixmap **c, const char *params)
+static int histogram(gp_pixmap **c, const char *params)
{
char *file = "histogram.png";
@@ -678,7 +678,7 @@ struct filter {
const char *name;
const char *desc;
struct param *param_desc;
- int (*apply)(GP_Pixmap **c, const char *params);
+ int (*apply)(gp_pixmap **c, const char *params);
};
static struct filter filter_table[] = {
@@ -763,7 +763,7 @@ static void add_filter(char *params)
filter_params[filter_cnt++] = params;
}
-static void apply_filters(GP_Pixmap **src)
+static void apply_filters(gp_pixmap **src)
{
unsigned int i;
int ret;
@@ -845,18 +845,18 @@ static void check_fmt(const char *fmt)
exit(1);
}
-static void save_by_fmt(struct GP_Pixmap *bitmap, const char *name, const char *fmt)
+static void save_by_fmt(struct gp_pixmap *bitmap, const char *name, const char *fmt)
{
int ret;
progress_prefix = "Saving Image";
if (!strcmp(fmt, "ppm"))
- ret = GP_SavePPM(bitmap, name, progress_callback);
+ ret = gp_save_ppm(bitmap, name, progress_callback);
else if (!strcmp(fmt, "jpg"))
- ret = GP_SaveJPG(bitmap, name, progress_callback);
+ ret = gp_save_jpg(bitmap, name, progress_callback);
else if (!strcmp(fmt, "png"))
- ret = GP_SavePNG(bitmap, name, progress_callback);
+ ret = gp_save_png(bitmap, name, progress_callback);
else {
printf("Invalid format %s\n", fmt);
exit(1);
@@ -874,11 +874,11 @@ static void save_by_fmt(struct GP_Pixmap *bitmap, const char *name, const char *
int main(int argc, char *argv[])
{
- GP_Pixmap *bitmap;
+ gp_pixmap *bitmap;
int opt, i;
const char *out_fmt = "ppm";
- GP_ProgressCallback callback = {
+ gp_progress_cb callback = {
.callback = show_progress,
};
@@ -898,7 +898,7 @@ int main(int argc, char *argv[])
return 1;
}
- GP_SetDebugLevel(i);
+ gp_set_debug_level(i);
break;
case 'o':
out_fmt = optarg;
@@ -929,7 +929,7 @@ int main(int argc, char *argv[])
progress_prefix = "Loading image";
- if ((bitmap = GP_LoadImage(argv[i], progress_callback)) == NULL) {
+ if ((bitmap = gp_load_image(argv[i], progress_callback)) == NULL) {
fprintf(stderr, "Failed to load bitmap: %s\n", strerror(errno));
return 1;
}
diff --git a/demos/grinder/histogram.c b/demos/grinder/histogram.c
index d02f17518235..fb42a4ff9f14 100644
--- a/demos/grinder/histogram.c
+++ b/demos/grinder/histogram.c
@@ -22,44 +22,44 @@
#include "histogram.h"
-void histogram_to_png(const GP_Pixmap *src, const char *filename)
+void histogram_to_png(const gp_pixmap *src, const char *filename)
{
- GP_Histogram *hist;
+ gp_histogram *hist;
- hist = GP_HistogramAlloc(src->pixel_type);
+ hist = gp_histogram_alloc(src->pixel_type);
if (!hist) {
fprintf(stderr, "Failed to allocate histogram\n");
return;
}
- GP_FilterHistogram(hist, src, NULL);
+ gp_filter_histogram(hist, src, NULL);
unsigned int i, j;
- GP_Pixmap *res = GP_PixmapAlloc(257*4, 256, GP_PIXEL_RGB888);
+ gp_pixmap *res = gp_pixmap_alloc(257 * 4, 256, GP_PIXEL_RGB888);
- GP_Fill(res, 0xffffff);
+ gp_fill(res, 0xffffff);
- GP_HistogramChannel *hist_r = GP_HistogramChannelByName(hist, "R");
+ gp_histogram_channel *hist_r = gp_histogram_channel_by_name(hist, "R");
for (i = 0; i < hist_r->len; i++)
- GP_VLineXYH(res, i, 256, -255.00 * hist_r->hist[i] / hist_r->max + 0.5 , 0xff0000);
+ gp_vline_xyh(res, i, 256, -255.00 * hist_r->hist[i] / hist_r->max + 0.5 , 0xff0000);
- GP_HistogramChannel *hist_g = GP_HistogramChannelByName(hist, "G");
+ gp_histogram_channel *hist_g = gp_histogram_channel_by_name(hist, "G");
for (i = 0; i < hist_g->len; i++)
- GP_VLineXYH(res, i+257, 256, -255.00 * hist_g->hist[i] / hist_g->max + 0.5 , 0x00ff00);
+ gp_vline_xyh(res, i+257, 256, -255.00 * hist_g->hist[i] / hist_g->max + 0.5 , 0x00ff00);
- GP_HistogramChannel *hist_b = GP_HistogramChannelByName(hist, "B");
+ gp_histogram_channel *hist_b = gp_histogram_channel_by_name(hist, "B");
for (i = 0; i < hist_b->len; i++)
- GP_VLineXYH(res, i+514, 256, -255.00 * hist_b->hist[i] / hist_b->max + 0.5 , 0x0000ff);
+ gp_vline_xyh(res, i+514, 256, -255.00 * hist_b->hist[i] / hist_b->max + 0.5 , 0x0000ff);
uint32_t max = GP_MAX3(hist_r->max, hist_g->max, hist_b->max);
for (i = 0; i < hist_r->len; i++) {
for (j = 0; j < hist_r->len; j++) {
- GP_Pixel pix = 0;
+ gp_pixel pix = 0;
if (255 * hist_r->hist[i] / max + 0.5 > j)
pix |= 0xff0000;
@@ -70,12 +70,11 @@ void histogram_to_png(const GP_Pixmap *src, const char *filename)
if (255 * hist_b->hist[i] / max + 0.5 > j)
pix |= 0x0000ff;
- GP_PutPixel(res, i+771, 256-j, pix);
+ gp_putpixel(res, i + 771, 256 - j, pix);
}
}
- GP_SavePNG(res, filename, NULL);
-
- GP_PixmapFree(res);
- GP_HistogramFree(hist);
+ gp_save_png(res, filename, NULL);
+ gp_pixmap_free(res);
+ gp_histogram_free(hist);
}
diff --git a/demos/grinder/histogram.h b/demos/grinder/histogram.h
index e58dfd4c4527..da530d0672aa 100644
--- a/demos/grinder/histogram.h
+++ b/demos/grinder/histogram.h
@@ -23,8 +23,8 @@
#ifndef HISTOGRAM_H
#define HISTOGRAM_H
-#include <GP.h>
+#include <gfxprim.h>
-void histogram_to_png(const GP_Pixmap *src, const char *filename);
+void histogram_to_png(const gp_pixmap *src, const char *filename);
#endif /* HISTOGRAM_H */
diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c
index e4226c27114b..9a3422f24181 100644
--- a/demos/particle/particle_demo.c
+++ b/demos/particle/particle_demo.c
@@ -28,21 +28,21 @@
#include <signal.h>
#include <string.h>
-#include <GP.h>
+#include <gfxprim.h>
#include <backends/GP_Backends.h>
#include "space.h"
-static GP_Pixel black_pixel;
-static GP_Pixel white_pixel;
+static gp_pixel black_pixel;
+static gp_pixel white_pixel;
-static GP_Backend *backend = NULL;
-static GP_Pixmap *pixmap = NULL;
+static gp_backend *backend = NULL;
+static gp_pixmap *pixmap = NULL;
static void sighandler(int signo)
{
if (backend != NULL)
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
fprintf(stderr, "Got signal %i\n", signo);
@@ -51,7 +51,7 @@ static void sighandler(int signo)
static void init_backend(const char *backend_opts)
{
- backend = GP_BackendInit(backend_opts, "Particles");
+ backend = gp_backend_init(backend_opts, "Particles");
if (backend == NULL) {
fprintf(stderr, "Failed to initalize backend '%s'\n", backend_opts);
@@ -79,8 +79,6 @@ int main(int argc, char *argv[])
}
}
-// GP_SetDebugLevel(10);
-
signal(SIGINT, sighandler);
signal(SIGSEGV, sighandler);
signal(SIGBUS, sighandler);
@@ -90,27 +88,27 @@ int main(int argc, char *argv[])
pixmap = backend->pixmap;
- black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ black_pixel = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(pixmap, black_pixel);
- GP_BackendFlip(backend);
+ gp_fill(pixmap, black_pixel);
+ gp_backend_flip(backend);
struct space *space;
space = space_create(particles, 10<<8, 10<<8, (pixmap->w - 10)<<8, (pixmap->h - 10)<<8);
for (;;) {
- if (backend->Poll)
- GP_BackendPoll(backend);
+ if (backend->poll)
+ gp_backend_poll(backend);
usleep(1000);
/* Read and parse events */
- GP_Event ev;
+ gp_event ev;
- while (GP_BackendGetEvent(backend, &ev)) {
+ while (gp_backend_get_event(backend, &ev)) {
- GP_EventDump(&ev);
+ gp_event_dump(&ev);
switch (ev.type) {
case GP_EV_KEY:
@@ -121,7 +119,7 @@ int main(int argc, char *argv[])
case GP_KEY_ESC:
case GP_KEY_ENTER:
case GP_KEY_Q:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
break;
case GP_KEY_P:
@@ -138,11 +136,11 @@ int main(int argc, char *argv[])
case GP_EV_SYS:
switch(ev.code) {
case GP_EV_SYS_QUIT:
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
exit(0);
break;
case GP_EV_SYS_RESIZE:
- GP_BackendResizeAck(backend);
+ gp_backend_resize_ack(backend);
space_destroy(space);
space = space_create(particles,
10<<8, 10<<8,
@@ -157,11 +155,11 @@ int main(int argc, char *argv[])
if (!pause_flag) {
space_time_tick(space, 1);
space_draw_particles(pixmap, space);
- GP_BackendFlip(backend);
+ gp_backend_flip(backend);
}
}
- GP_BackendExit(backend);
+ gp_backend_exit(backend);
return 0;
}
diff --git a/demos/particle/space.c b/demos/particle/space.c
index 8dfc956d656a..87928bf21340 100644
--- a/demos/particle/space.c
+++ b/demos/particle/space.c
@@ -67,19 +67,19 @@ void space_destroy(struct space *space)
#define SQUARE(x) ((x) * (x))
-void space_draw_particles(GP_Pixmap *pixmap, struct space *space)
+void space_draw_particles(gp_pixmap *pixmap, struct space *space)
{
unsigned int i;
- GP_Fill(pixmap, 0x000000);
+ gp_fill(pixmap, 0x000000);
for (i = 0; i < space->particle_count; i++) {
- GP_Pixel color;
+ gp_pixel color;
- GP_Coord x = space->particles[i].x;
- GP_Coord y = space->particles[i].y;
- GP_Coord a1 = GP_FP_1 * 4;
- GP_Coord a2 = GP_FP_1_2 * 2;
+ gp_coord x = space->particles[i].x;
+ gp_coord y = space->particles[i].y;
+ gp_coord a1 = GP_FP_1 * 4;
+ gp_coord a2 = GP_FP_1_2 * 2;
/*
if (i == 0) {
@@ -88,9 +88,9 @@ void space_draw_particles(GP_Pixmap *pixmap, struct space *space)
}
*/
- color = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap);
+ color = gp_rgb_to_pixmap_pixel(0xee, 0xee, 0xee, pixmap);
- GP_PutPixelAA(pixmap, x, y, color);
+ gp_putpixel_aa(pixmap, x, y, color);
int val = SQUARE(space->particles[i].vx) + SQUARE(space->particles[i].vy);
@@ -99,29 +99,29 @@ void space_draw_particles(GP_Pixmap *pixmap, struct space *space)
if (val > 255)
val = 255;
- color = GP_RGBToPixmapPixel(val, val, 0x40, pixmap);
+ color = gp_rgb_to_pixmap_pixel(val, val, 0x40, pixmap);
/* Hexagons */
- GP_LineAA(pixmap, x - a2, y - a1, x + a2, y - a1, color);
- // GP_LineAA(pixmap, x + a2, y - a1, x + a1, y - a2, color);
- GP_LineAA(pixmap, x + a1, y - a2, x + a1, y + a2, color);
- // GP_LineAA(pixmap, x + a1, y + a2, x + a2, y + a1, color);
- GP_LineAA(pixmap, x + a2, y + a1, x - a2, y + a1, color);
- // GP_LineAA(pixmap, x - a2, y + a1, x - a1, y + a2, color);
- GP_LineAA(pixmap, x - a1, y + a2, x - a1, y - a2, color);
- // GP_LineAA(pixmap, x - a1, y - a2, x - a2, y - a1, color);
+ gp_line_aa(pixmap, x - a2, y - a1, x + a2, y - a1, color);
+ // gp_line_aa(pixmap, x + a2, y - a1, x + a1, y - a2, color);
+ gp_line_aa(pixmap, x + a1, y - a2, x + a1, y + a2, color);
+ // gp_line_aa(pixmap, x + a1, y + a2, x + a2, y + a1, color);
+ gp_line_aa(pixmap, x + a2, y + a1, x - a2, y + a1, color);
+ // gp_line_aa(pixmap, x - a2, y + a1, x - a1, y + a2, color);
+ gp_line_aa(pixmap, x - a1, y + a2, x - a1, y - a2, color);
+ // gp_line_aa(pixmap, x - a1, y - a2, x - a2, y - a1, color);
/*
- GP_PutPixelAA(pixmap, x + a2, y - a1, 0xffffff);
- GP_PutPixelAA(pixmap, x + a1, y - a2, 0xffffff);
+ gp_putpixel_aa(pixmap, x + a2, y - a1, 0xffffff);
+ gp_putpixel_aa(pixmap, x + a1, y - a2, 0xffffff);
- GP_PutPixelAA(pixmap, x + a1, y + a2, 0xffffff);
- GP_PutPixelAA(pixmap, x + a2, y + a1, 0xffffff);
+ gp_putpixel_aa(pixmap, x + a1, y + a2, 0xffffff);
+ gp_putpixel_aa(pixmap, x + a2, y + a1, 0xffffff);
- GP_PutPixelAA(pixmap, x - a2, y + a1, 0xffffff);
- GP_PutPixelAA(pixmap, x - a1, y + a2, 0xffffff);
+ gp_putpixel_aa(pixmap, x - a2, y + a1, 0xffffff);
+ gp_putpixel_aa(pixmap, x - a1, y + a2, 0xffffff);
- GP_PutPixelAA(pixmap, x - a1, y - a2, 0xffffff);
- GP_PutPixelAA(pixmap, x - a2, y - a1, 0xffffff);
+ gp_putpixel_aa(pixmap, x - a1, y - a2, 0xffffff);
+ gp_putpixel_aa(pixmap, x - a2, y - a1, 0xffffff);
*/
}
}
diff --git a/demos/particle/space.h b/demos/particle/space.h
index 021d615b36fc..31c994424c67 100644
--- a/demos/particle/space.h
+++ b/demos/particle/space.h
@@ -29,7 +29,7 @@
#ifndef PARTICLE_H
#define PARTICLE_H
-#include <GP.h>
+#include <gfxprim.h>
struct particle {
/* fixed point coordinates */
@@ -69,7 +69,7 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h,
void space_destroy(struct space *space);
-void space_draw_particles(GP_Pixmap *pixmap, struct space *space);
+void space_draw_particles(gp_pixmap *pixmap, struct space *space);
void space_time_tick(struct space *space, int time);
diff --git a/demos/py_simple/backends.py b/demos/py_simple/backends.py
index 84715526aa2c..c8ca7a3f07f5 100755
--- a/demos/py_simple/backends.py
+++ b/demos/py_simple/backends.py
@@ -11,15 +11,15 @@ import gfxprim.input as input
def redraw(bk):
c = bk.pixmap
- black = c.RGBToPixel(0, 0, 0)
- white = c.RGBToPixel(0xff, 0xff, 0xff)
+ black = c.rgb_to_pixel(0, 0, 0)
+ white = c.rgb_to_pixel(0xff, 0xff, 0xff)
- c.gfx.Fill(black)
+ c.gfx.fill(black)
align = text.C.ALIGN_CENTER | text.C.VALIGN_CENTER
- c.text.Text(None, c.w//2, c.h//2, align, white, black, "Hello World!")
+ c.text.text(None, c.w//2, c.h//2, align, white, black, "Hello World!")
- bk.Flip()
+ bk.flip()
def main():
backend_string = "X11:100x100"
@@ -32,16 +32,16 @@ def main():
sys.exit(1)
# Create backend window
- bk = backends.BackendInit(backend_string, "Backend Example")
+ bk = backends.backend_init(backend_string, "Backend Example")
assert(bk)
redraw(bk)
# Event loop
while True:
- ev = bk.WaitEvent()
+ ev = bk.wait_event()
- input.EventDump(ev)
+ input.event_dump(ev)
if (ev.type == input.EV_KEY):
sys.exit(0)
@@ -49,7 +49,7 @@ def main():
if (ev.code == input.EV_SYS_QUIT):
sys.exit(0)
if (ev.code == input.EV_SYS_RESIZE):
- bk.ResizeAck()
+ bk.resize_ack()
redraw(bk)
if __name__ == '__main__':
diff --git a/demos/py_simple/blit.py b/demos/py_simple/blit.py
index e76b8c08e0aa..7e637b5c85df 100755
--- a/demos/py_simple/blit.py
+++ b/demos/py_simple/blit.py
@@ -10,7 +10,7 @@ import gfxprim.input as input
class Ball:
def __init__(self, x, y, dx, dy, path, bg_img):
- self.ball = loaders.Load(path)
+ self.ball = loaders.load(path)
assert(self.ball)
self.x = x
@@ -21,13 +21,13 @@ class Ball:
self.bg_img = bg_img
def draw(self, bk):
- self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
+ self.ball.blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
def move(self, bk):
old_x = self.x;
old_y = self.y;
- self.bg_img.Blit(old_x, old_y, bk.pixmap, old_x, old_y, self.ball.w, self.ball.h)
+ self.bg_img.blit(old_x, old_y, bk.pixmap, old_x, old_y, self.ball.w, self.ball.h)
self.x += self.dx
self.y += self.dy
@@ -38,18 +38,18 @@ class Ball:
if (self.y <= 0 or self.y >= self.bg_img.h - self.ball.h):
self.dy = -self.dy
- self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
- bk.UpdateRect(min(old_x, self.x), min(self.y, old_y),
- max(old_x, self.x) + self.ball.w - 1,
- max(old_y, self.y) + self.ball.h - 1)
+ self.ball.blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
+ bk.update_rect(min(old_x, self.x), min(self.y, old_y),
+ max(old_x, self.x) + self.ball.w - 1,
+ max(old_y, self.y) + self.ball.h - 1)
def main():
if len(sys.argv) != 2:
print("Takes an image as an argument")
sys.exit(1)
- # Load Backgroudn Image and ball sprite
- bg = loaders.Load(sys.argv[1])
+ # load Backgroudn Image and ball sprite
+ bg = loaders.load(sys.argv[1])
assert(bg)
ball1 = Ball(bg.w//2, bg.h//2, -3, -3, 'ball_red.png', bg)
@@ -57,28 +57,30 @@ def main():
ball3 = Ball(bg.w//2, bg.h//2, 2, -3, 'ball_blue.png', bg)
# Create X11 window
- bk = backends.BackendX11Init(None, 0, 0, bg.w, bg.h, sys.argv[1], 0)
+ bk = backends.x11_init(None, 0, 0, bg.w, bg.h, sys.argv[1], 0)
assert(bk)
- bg.Blit(0, 0, bk.pixmap, 0, 0, bg.w, bg.h)
+ bg.blit(0, 0, bk.pixmap, 0, 0, bg.w, bg.h)
- bk.Flip()
+ bk.flip()
# Event loop
while True:
while True:
- ev = bk.PollEvent()
+ ev = bk.poll_event()
if (ev is None):
break
- input.EventDump(ev)
+ input.event_dump(ev)
if (ev.type == input.EV_KEY and ev.val.val == input.KEY_ESC):
sys.exit(0)
elif (ev.type == input.EV_SYS):
if (ev.code == input.EV_SYS_QUIT):
sys.exit(0)
+ if (ev.code == input.EV_SYS_RESIZE):
+ bk.resize_ack()
sleep(0.005)
diff --git a/demos/py_simple/blur.py b/demos/py_simple/blur.py
index 70e9da5af4ff..e6713d2b06ea 100755
--- a/demos/py_simple/blur.py
+++ b/demos/py_simple/blur.py
@@ -13,11 +13,11 @@ def main():
radii = float(sys.argv[1])
# Load Image
- img = loaders.Load(sys.argv[2])
+ img = loaders.load(sys.argv[2])
# Do in-place gaussian blur
- filters.GaussianBlur(img, img, radii, radii)
+ filters.gaussian_blur(img, img, radii, radii)
# Save result
- img.loaders.SaveJPG("out.jpg")
+ img.loaders.save_jpg("out.jpg")
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/cam_view.py b/demos/py_simple/cam_view.py
index dd7bcc88286c..f17457d71754 100755
--- a/demos/py_simple/cam_view.py
+++ b/demos/py_simple/cam_view.py
@@ -10,36 +10,38 @@ import gfxprim.grabbers as grabbers
def main():
# Open grabber (i.e. web camera)
- grabber = grabbers.GrabberV4L2Init("/dev/video0", 320, 240);
+ grabber = grabbers.grabber_v4l2_init("/dev/video0", 320, 240);
assert(grabber)
# Create X11 window
- bk = backends.BackendX11Init(None, 0, 0, grabber.frame.w, grabber.frame.h, "Grabbers test", 0)
+ bk = backends.x11_init(None, 0, 0, grabber.frame.w, grabber.frame.h, "Grabbers test", 0)
assert(bk)
# Start grabber capture
- grabber.Start();
+ grabber.start();
# Event loop
while True:
sleep(0.01)
- if (grabber.Poll()):
- grabber.frame.Blit(0, 0, bk.pixmap, 0, 0, grabber.frame.w, grabber.frame.h)
- bk.Flip()
+ if (grabber.poll()):
+ grabber.frame.blit(0, 0, bk.pixmap, 0, 0, grabber.frame.w, grabber.frame.h)
+ bk.flip()
- ev = bk.PollEvent()
+ ev = bk.poll_event()
if (ev is None):
continue
- input.EventDump(ev)
+ input.event_dump(ev)
if (ev.type == input.EV_KEY):
exit(0)
elif (ev.type == input.EV_SYS):
if (ev.code == input.EV_SYS_QUIT):
exit(0)
+ if (ev.code == input.EV_SYS_RESIZE):
+ bk.resize_ack()
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/convolution.py b/demos/py_simple/convolution.py
index 3dbc975b6ca1..320def9cd74c 100755
--- a/demos/py_simple/convolution.py
+++ b/demos/py_simple/convolution.py
@@ -11,16 +11,16 @@ def main():
sys.exit(1)
# Load Image
- img = loaders.Load(sys.argv[1])
+ img = loaders.load(sys.argv[1])
# Box blur kernel
kern = [[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1]]
- res = img.filters.ConvolutionAlloc(kern, 25);
+ res = img.filters.convolution_alloc(kern, 25);
# Save result into png
- res.loaders.SavePNG("out.png")
+ res.loaders.save_png("out.png")
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/dither.py b/demos/py_simple/dither.py
index d2b9e043c0cf..9b6d7e9f2a68 100755
--- a/demos/py_simple/dither.py
+++ b/demos/py_simple/dither.py
@@ -10,12 +10,12 @@ def main():
print("usage: dither.py image")
sys.exit(1)
- # Load Image
- img = loaders.Load(sys.argv[1])
+ # load Image
+ img = loaders.load(sys.argv[1])
# Use Floyd-Steinberg dithering
- res = img.filters.FloydSteinbergAlloc(core.C.PIXEL_G1)
+ res = img.filters.floyd_steinberg_alloc(core.C.PIXEL_G1)
# Save result into grayscale png
- res.loaders.SavePNG("out.png")
+ res.loaders.save_png("out.png")
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/font_style.py b/demos/py_simple/font_style.py
index 1799253d8a10..62b3d67afc73 100755
--- a/demos/py_simple/font_style.py
+++ b/demos/py_simple/font_style.py
@@ -11,39 +11,39 @@ import gfxprim.text as text
def redraw(win):
c = win.pixmap
- black = c.RGBToPixel(0, 0, 0)
- white = c.RGBToPixel(0xff, 0xff, 0xff)
+ black = c.rgb_to_pixel(0, 0, 0)
+ white = c.rgb_to_pixel(0xff, 0xff, 0xff)
- c.gfx.Fill(black)
+ c.gfx.fill(black)
align = text.C.ALIGN_CENTER | text.C.VALIGN_CENTER
- style = text.TextStyle(text.DefaultProportionalFont, 0, 0, 1, 1, 1)
+ style = text.text_style(text.font_gfxprim, 0, 0, 1, 1, 1)
spacing = 20
y = 20
while y < c.h:
- y += text.TextHeight(style) + spacing
- c.text.Text(style, c.w//2, y, align, white, black, "Lorem Ipsum Dolor Sit Amet.")
+ y += text.text_height(style) + spacing
+ c.text.text(style, c.w//2, y, align, white, black, "Lorem Ipsum Dolor Sit Amet.")
style.pixel_xspace += 1
style.pixel_yspace += 1
style.pixel_xmul += 1
style.pixel_ymul += 1
- win.Flip()
+ win.flip()
def main():
# Create X11 window
- win = backends.BackendX11Init(None, 0, 0, 800, 600, "Fonts", 0)
+ win = backends.x11_init(None, 0, 0, 800, 600, "Fonts", 0)
assert(win)
redraw(win)
# Event loop
while True:
- ev = win.WaitEvent()
+ ev = win.wait_event()
if (ev.type == input.EV_KEY and ev.val.val == input.KEY_ESC):
sys.exit(0)
@@ -51,7 +51,7 @@ def main():
if (ev.code == input.EV_SYS_QUIT):
sys.exit(0)
if (ev.code == input.EV_SYS_RESIZE):
- win.ResizeAck()
+ win.resize_ack()
redraw(win)
if __name__ == '__main__':
diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py
index 0ee8dbe6517e..c580d4aa320d 100755
--- a/demos/py_simple/gfx.py
+++ b/demos/py_simple/gfx.py
@@ -8,85 +8,85 @@ import gfxprim.backends as backends
import gfxprim.input as input
def fill(bk):
- color = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bk.pixmap.gfx.Fill(color)
- bk.Flip()
+ color = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bk.pixmap.gfx.fill(color)
+ bk.flip()
def hline(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
for i in range(0, bk.pixmap.h, 10):
- bk.pixmap.gfx.HLine(0, bk.pixmap.w, i, fg)
- bk.Flip()
+ bk.pixmap.gfx.hline(0, bk.pixmap.w, i, fg)
+ bk.flip()
def vline(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
for i in range(0, bk.pixmap.w, 10):
- bk.pixmap.gfx.VLine(i, 0, bk.pixmap.h, fg)
+ bk.pixmap.gfx.vline(i, 0, bk.pixmap.h, fg)
- bk.Flip()
+ bk.flip()
def line(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
for i in range(0, 2 * max(bk.pixmap.w, bk.pixmap.h), 13):
- bk.pixmap.gfx.Line(0, i, i, 0, fg)
+ bk.pixmap.gfx.line(0, i, i, 0, fg)
- bk.Flip()
+ bk.flip()
def rect(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
for i in range(10, 130, 10):
- bk.pixmap.gfx.Rect(i, i, bk.pixmap.w - i, bk.pixmap.h - i, fg)
+ bk.pixmap.gfx.rect(i, i, bk.pixmap.w - i, bk.pixmap.h - i, fg)
- bk.Flip()
+ bk.flip()
def triangle(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
w = bk.pixmap.w
h = bk.pixmap.h
for i in range(10, 90, 10):
- bk.pixmap.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg)
+ bk.pixmap.gfx.triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg)
- bk.Flip()
+ bk.flip()
def tetragon(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
w = bk.pixmap.w
h = bk.pixmap.h
for i in range(10, 70, 10):
- bk.pixmap.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg)
+ bk.pixmap.gfx.tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg)
- bk.Flip()
+ bk.flip()
def polygon(bk):
- fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.pixmap.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.rgb_to_pixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.rgb_to_pixel(0, 0, 0);
- bk.pixmap.gfx.Fill(bg)
+ bk.pixmap.gfx.fill(bg)
w = bk.pixmap.w
h = bk.pixmap.h
@@ -98,9 +98,9 @@ def polygon(bk):
(w-10, (h-10)//3), (w-10, 10), (2*(w-10)//3, 10),
((w-10)//2, (h-10)//3), ((w-10)//3, 10)]
- bk.pixmap.gfx.Polygon(polygon, fg)
+ bk.pixmap.gfx.polygon(polygon, fg)
- bk.Flip()
+ bk.flip()
def next(bk, i):
@@ -137,10 +137,10 @@ def next(bk, i):
def main():
# Create X11 window
- bk = backends.BackendX11Init(None, 0, 0, 320, 240, "GFX demo", 0)
+ bk = backends.x11_init(None, 0, 0, 320, 240, "GFX demo", 0)
assert(bk)
- bk.Flip()
+ bk.flip()
i = 0
@@ -148,9 +148,9 @@ def main():
# Event loop
while True:
- ev = bk.WaitEvent()
+ ev = bk.wait_event()
- input.EventDump(ev)
+ input.event_dump(ev)
if (ev.type == input.EV_KEY and ev.code == input.EV_KEY_DOWN):
@@ -163,9 +163,9 @@ def main():
if (ev.code == input.EV_SYS_QUIT):
sys.exit(0)
elif (ev.code == input.EV_SYS_RESIZE):
- bk.ResizeAck()
+ bk.resize_ack()
fill(bk)
- bk.Flip()
+ bk.flip()
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/gfxprim_qt.py b/demos/py_simple/gfxprim_qt.py
index 61eabb2d5180..f6fbe1591c93 100755
--- a/demos/py_simple/gfxprim_qt.py
+++ b/demos/py_simple/gfxprim_qt.py
@@ -6,10 +6,10 @@ import gfxprim.core as core
import gfxprim.loaders as loaders
def getpixmap(path):
- img = loaders.Load(path)
+ img = loaders.load(path)
if img.pixel_type != core.C.PIXEL_BGR888:
- img = img.Convert(core.C.PIXEL_BGR888)
- qt_img = QtGui.QImage(img.ToByteArray(), img.w, img.h,
+ img = img.convert(core.C.PIXEL_BGR888)
+ qt_img = QtGui.QImage(img.to_byte_array(), img.w, img.h,
img.bytes_per_row, QtGui.QImage.Format_RGB888)
pix = QtGui.QPixmap.fromImage(qt_img)
return pix
diff --git a/demos/py_simple/invert.py b/demos/py_simple/invert.py
index 684facc79746..4b316305042b 100755
--- a/demos/py_simple/invert.py
+++ b/demos/py_simple/invert.py
@@ -10,12 +10,12 @@ def main():
print("usage: invert.py image")
sys.exit(1)
- # Load Image
- img = loaders.Load(sys.argv[1])
- # Invert image in-place
- img.filters.Invert(img);
+ # load Image
+ img = loaders.load(sys.argv[1])
+ # invert image in-place
+ img.filters.invert(img);
# Save result into png
- img.loaders.SavePNG("out.png")
+ img.loaders.save_png("out.png")
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/loaders_example.py b/demos/py_simple/loaders_example.py
index 9b463d516a8c..55b0a1fad31f 100755
--- a/demos/py_simple/loaders_example.py
+++ b/demos/py_simple/loaders_example.py
@@ -10,10 +10,10 @@ def main():
print("Takes an image as an argument")
sys.exit(1)
- # Load Image
- img = loaders.Load(sys.argv[1])
- # Save result
- img.loaders.Save("out.png");
+ # load Image
+ img = loaders.load(sys.argv[1])
+ # save result
+ img.loaders.save("out.png");
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/progress_callback.py b/demos/py_simple/progress_callback.py
index 17b1570494fd..344400d8e1d4 100755
--- a/demos/py_simple/progress_callback.py
+++ b/demos/py_simple/progress_callback.py
@@ -7,7 +7,7 @@ import gfxprim.loaders as loaders
import gfxprim.filters as filters
def progress_callback1(perc):
- sys.stdout.write("\rLoading %3.2f%%" % perc)
+ sys.stdout.write("\rloading %3.2f%%" % perc)
sys.stdout.flush()
return 0
@@ -22,7 +22,7 @@ def main():
sys.exit(1)
try:
- img = loaders.Load(sys.argv[1], progress_callback1)
+ img = loaders.load(sys.argv[1], progress_callback1)
print('')
except OSError as detail:
print("Failed to load image '%s': %s" % (sys.argv[1], detail))
@@ -30,7 +30,7 @@ def main():
try:
callback = (progress_callback2, "Gaussian Blur")
- img = img.filters.GaussianBlurAlloc(50, 50, callback)
+ img = img.filters.gaussian_blur_alloc(50, 50, callback)
print('')
except OSError:
print("Filter Aborted")
diff --git a/demos/py_simple/resize.py b/demos/py_simple/resize.py
index 7d11e2290f37..8fdb30455e36 100755
--- a/demos/py_simple/resize.py
+++ b/demos/py_simple/resize.py
@@ -10,12 +10,12 @@ def main():
print("USAGE: %s imput_image output_image" % sys.argv[0]);
sys.exit(1)
- # Load Image
- src = loaders.Load(sys.argv[1])
+ # load Image
+ src = loaders.load(sys.argv[1])
# Resize image to the half of the original
- res = src.filters.ResizeLFIntAlloc(src.w//2, src.h//2)
- # Save Image
- res.loaders.Save(sys.argv[2])
+ res = src.filters.resize_linear_lf_int_alloc(src.w//2, src.h//2)
+ # save Image
+ res.loaders.save(sys.argv[2])
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/rotate90.py b/demos/py_simple/rotate90.py
index 3a49af161de3..f73efd507573 100755
--- a/demos/py_simple/rotate90.py
+++ b/demos/py_simple/rotate90.py
@@ -11,14 +11,14 @@ def main():
sys.exit(1)
# Turns on debug messages
- core.SetDebugLevel(10);
+ core.set_debug_level(10);
- # Load Image
- src = loaders.Load(sys.argv[1])
+ # load Image
+ src = loaders.load(sys.argv[1])
# Rotate by 90 degrees
- res = src.filters.Rotate90Alloc()
- # Save Image
- res.loaders.Save(sys.argv[2])
+ res = src.filters.rotate_90_alloc()
+ # save Image
+ res.loaders.save(sys.argv[2])
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py
index 07c54b41913a..7e6dc71f2519 100755
--- a/demos/py_simple/showimage.py
+++ b/demos/py_simple/showimage.py
@@ -12,20 +12,20 @@ def main():
print("Takes an image as an argument")
sys.exit(1)
- # Load Image
- img = loaders.Load(sys.argv[1])
+ # load Image
+ img = loaders.load(sys.argv[1])
# Create X11 window
- bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0)
+ bk = backends.x11_init(None, 0, 0, img.w, img.h, sys.argv[1], 0)
assert(bk)
- img.Blit(0, 0, bk.pixmap, 0, 0, img.w, img.h)
- bk.Flip()
+ img.blit(0, 0, bk.pixmap, 0, 0, img.w, img.h)
+ bk.flip()
# Event loop
while True:
- ev = bk.WaitEvent()
+ ev = bk.wait_event()
- input.EventDump(ev)
+ input.event_dump(ev)
if (ev.type == input.EV_KEY):
sys.exit(0)
diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py
index 3c34ff7a941e..2dda31265964 100755
--- a/demos/py_simple/x11_windows.py
+++ b/demos/py_simple/x11_windows.py
@@ -11,28 +11,28 @@ import gfxprim.text as text
def redraw(bk, id):
c = bk.pixmap
- black = c.RGBToPixel(0, 0, 0)
- white = c.RGBToPixel(0xff, 0xff, 0xff)
+ black = c.rgb_to_pixel(0, 0, 0)
+ white = c.rgb_to_pixel(0xff, 0xff, 0xff)
- c.gfx.Fill(black)
+ c.gfx.fill(black)
align = text.C.ALIGN_CENTER | text.C.VALIGN_CENTER
- c.text.Text(None, c.w//2, c.h//2, align, white, black, "%s - %sx%s" % (id, c.w, c.h))
+ c.text.text(None, c.w//2, c.h//2, align, white, black, "%s - %sx%s" % (id, c.w, c.h))
- bk.Flip()
+ bk.flip()
def parse_events(bk, id):
print("------ Window %s -------" % (id))
while True:
- ev = bk.GetEvent()
+ ev = bk.get_event()
if (ev == None):
print("--------------------------")
return
- input.EventDump(ev)
+ input.event_dump(ev)
if (ev.type == input.EV_KEY and ev.val.val == input.KEY_ESC):
sys.exit(0)
@@ -40,13 +40,13 @@ def parse_events(bk, id):
if (ev.code == input.EV_SYS_QUIT):
sys.exit(0)
if (ev.code == input.EV_SYS_RESIZE):
- bk.ResizeAck()
+ bk.resize_ack()
redraw(bk, id)
def main():
# Create X11 windows
- win1 = backends.BackendX11Init(None, 0, 0, 200, 100, "Win 1", 0)
- win2 = backends.BackendX11Init(None, 0, 0, 200, 100, "Win 2", 0)
+ win1 = backends.x11_init(None, 0, 0, 200, 100, "Win 1", 0)
+ win2 = backends.x11_init(None, 0, 0, 200, 100, "Win 2", 0)
assert(win1)
assert(win2)
@@ -55,12 +55,12 @@ def main():
# Event loop
while True:
- win1.Wait()
+ win1.wait()
- if (win1.EventsQueued()):
+ if (win1.events_queued()):
parse_events(win1, "win1")
- if (win2.EventsQueued()):
+ if (win2.events_queued()):
parse_events(win2, "win2")
if __name__ == '__main__':
diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c
index 28ea5bbbfc22..37631e4f8243 100644
--- a/demos/spiv/image_cache.c
+++ b/demos/spiv/image_cache.c
@@ -22,12 +22,12 @@
#include <stdarg.h>
#include <string.h>
-#include <GP.h>
+#include <gfxprim.h>
#include "image_cache.h"
struct image {
- GP_Pixmap *pixmap;
- GP_DataStorage *meta_data;
+ gp_pixmap *pixmap;
+ gp_storage *meta_data;
struct image *prev;
struct image *next;
@@ -73,11 +73,11 @@ size_t image_cache_get_ram_size(void)
/*
* Reports correct image record size.
*/
-static size_t image_size2(GP_Pixmap *pixmap, GP_DataStorage *meta_data,
+static size_t image_size2(gp_pixmap *pixmap, gp_storage *meta_data,
const char *path)
{
size_t meta_data_size = 0;
- size_t pixmap_size = pixmap->bytes_per_row * pixmap->h + sizeof(GP_Pixmap);
+ size_t pixmap_size = pixmap->bytes_per_row * pixmap->h + sizeof(gp_pixmap);
//TODO! 4096 is a size of single block, data storage may have more blocks
if (meta_data)
@@ -135,8 +135,8 @@ static void remove_img_free(struct image_cache *self,
...e-mail trimmed, has been too large.
1
0
13 Nov '17
This is an automated email generated because a ref change occurred in the
git repository for project gfxprim.git.
The branch, master has been updated
discards 302953014e10dcef71b369e495dfb91b0fed705e (commit)
discards afb3d2823c56ff76b757359c589c449252757303 (commit)
discards b10281ba4c6ef9ade39e86b8c3aa42878fdff59f (commit)
via 69d7c9ef5642dee09b76da64d79f5f5e474501e5 (commit)
via 500eb1a9b1bc02f690025bdbcc6bde1920146ed5 (commit)
via 8af53840ba1296b26bdfe86753ec1eb32ddfa1cd (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (302953014e10dcef71b369e495dfb91b0fed705e)
\
N -- N -- N (69d7c9ef5642dee09b76da64d79f5f5e474501e5)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 69d7c9ef5642dee09b76da64d79f5f5e474501e5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 18:26:46 +0200
URL: <http://repo.or.cz/gfxprim.git/69d7c9ef5642dee0>
spiv: Fix image list counter
We have to add cur_file only and only if we are inside of a directory,
otherwise we end up with random position.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
demos/spiv/image_list.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/demos/spiv/image_list.c b/demos/spiv/image_list.c
index be6532c0763e..cf1d18c09a21 100644
--- a/demos/spiv/image_list.c
+++ b/demos/spiv/image_list.c
@@ -360,6 +360,9 @@ unsigned int image_list_count(struct image_list *self)
unsigned int image_list_pos(struct image_list *self)
{
+ if (!self->in_dir)
+ return count_img_to(self, self->cur_arg);
+
return count_img_to(self, self->cur_arg) + self->cur_file;
}
commit 500eb1a9b1bc02f690025bdbcc6bde1920146ed5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 14:15:48 +0200
URL: <http://repo.or.cz/gfxprim.git/500eb1a9b1bc02f6>
loaders: PNG: Wire up gamma tables.
Now the loader at least tries to set the gamma value for the pixmap,
which is later used by some of the resampling functions, etc.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/loaders/GP_PNG.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index fa01db1c5939..d0191cf5f103 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -196,6 +196,9 @@ static int read_convert_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
unsigned int y;
+ if (gamma < 0.01)
+ GP_PixmapSetGamma(res, 2.2);
+
for (y = 0; y < res->h; y++) {
png_read_row(png, (void*)row, NULL);
uint8_t *rrow = GP_PIXEL_ADDR(res, 0, y);
@@ -385,6 +388,9 @@ int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
goto err2;
}
+ if (gamma > 0.1)
+ GP_PixmapSetGamma(res, 1/gamma);
+
if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
png_set_packswap(png);
commit 8af53840ba1296b26bdfe86753ec1eb32ddfa1cd
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 13:52:39 +0200
URL: <http://repo.or.cz/gfxprim.git/8af53840ba1296b2>
core: GP_Pixmap: Add GP_PixmapSetGamma() function
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/syms/Core_symbols.txt | 1 +
include/core/GP_Pixmap.h | 5 +++++
libs/core/GP_Gamma.c | 7 ++++++-
libs/core/GP_Pixmap.c | 9 +++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt
index 7ee4ff213aff..b49ab7670191 100644
--- a/build/syms/Core_symbols.txt
+++ b/build/syms/Core_symbols.txt
@@ -2,6 +2,7 @@ GP_PixelTypes
GP_PixelHasFlags
GP_PixmapAlloc
+GP_PixmapSetGamma
GP_PixmapResize
GP_PixmapConvertAlloc
GP_PixmapPrintInfo
diff --git a/include/core/GP_Pixmap.h b/include/core/GP_Pixmap.h
index f67e6ec2f9d6..d599fbe792eb 100644
--- a/include/core/GP_Pixmap.h
+++ b/include/core/GP_Pixmap.h
@@ -111,6 +111,11 @@ typedef struct GP_Pixmap {
GP_Pixmap *GP_PixmapAlloc(GP_Size w, GP_Size h, GP_PixelType type);
/*
+ * Sets gamma for the pixmap.
+ */
+int GP_PixmapSetGamma(GP_Pixmap *self, float gamma);
+
+/*
* Free pixmap.
*
* If pixmap->free_pixels, also free pixel data.
diff --git a/libs/core/GP_Gamma.c b/libs/core/GP_Gamma.c
index 05500f9a0c36..26286b03f43a 100644
--- a/libs/core/GP_Gamma.c
+++ b/libs/core/GP_Gamma.c
@@ -186,7 +186,12 @@ GP_Gamma *GP_GammaCopy(GP_Gamma *self)
void GP_GammaRelease(GP_Gamma *self)
{
- int channels = GP_PixelTypes[self->pixel_type].numchannels, i;
+ int channels, i;
+
+ if (!self)
+ return;
+
+ channels = GP_PixelTypes[self->pixel_type].numchannels;
GP_DEBUG(1, "Releasing Gamma table %s gamma %f", GP_PixelTypeName(self->pixel_type), self->tables[0]->gamma);
diff --git a/libs/core/GP_Pixmap.c b/libs/core/GP_Pixmap.c
index 53c289e1c007..72dbae21fd13 100644
--- a/libs/core/GP_Pixmap.c
+++ b/libs/core/GP_Pixmap.c
@@ -114,6 +114,15 @@ GP_Pixmap *GP_PixmapAlloc(GP_Size w, GP_Size h, GP_PixelType type)
return pixmap;
}
+int GP_PixmapSetGamma(GP_Pixmap *self, float gamma)
+{
+ GP_GammaRelease(self->gamma);
+
+ self->gamma = GP_GammaAcquire(self->pixel_type, gamma);
+
+ return !self->gamma;
+}
+
void GP_PixmapFree(GP_Pixmap *pixmap)
{
GP_DEBUG(1, "Freeing pixmap (%p)", pixmap);
-----------------------------------------------------------------------
Summary of changes:
demos/spiv/spiv.c | 2 +-
libs/core/GP_Gamma.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
23 Oct '17
This is an automated email generated because a ref change occurred in the
git repository for project gfxprim.git.
The branch, master has been updated
via 302953014e10dcef71b369e495dfb91b0fed705e (commit)
via afb3d2823c56ff76b757359c589c449252757303 (commit)
via b10281ba4c6ef9ade39e86b8c3aa42878fdff59f (commit)
via 5375aac799b568e58846b992e69de3193378f904 (commit)
via 2b4e84bec2aa6e1fa027e8e4142e42f3f2b7f3da (commit)
via 4b85b2f8355a32e7c9b150a9a451aff558694a88 (commit)
via 8037a5517128c97aeaedaba084c158d3f3f37935 (commit)
via 97cdacf0adedaba34769631b8f506924d61b3e36 (commit)
via 55369a6db09675043a60fe95c2b0f010143de78e (commit)
via 852fad1c42dbd29205b14d721deff3439c8af635 (commit)
via 31709183a28656764eb165da6f8492d67102f556 (commit)
from da4d05501970c57531ab9243239873c733993690 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 302953014e10dcef71b369e495dfb91b0fed705e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 18:26:46 +0200
URL: <http://repo.or.cz/gfxprim.git/302953014e10dcef>
spiv: Fix image list counter
We have to add cur_file only and only if we are inside of a directory,
otherwise we end up with random position.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
demos/spiv/image_list.c | 3 +++
demos/spiv/spiv.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/demos/spiv/image_list.c b/demos/spiv/image_list.c
index be6532c0763e..cf1d18c09a21 100644
--- a/demos/spiv/image_list.c
+++ b/demos/spiv/image_list.c
@@ -360,6 +360,9 @@ unsigned int image_list_count(struct image_list *self)
unsigned int image_list_pos(struct image_list *self)
{
+ if (!self->in_dir)
+ return count_img_to(self, self->cur_arg);
+
return count_img_to(self, self->cur_arg) + self->cur_file;
}
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index 947390c964be..586cc54deb60 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -277,7 +277,7 @@ static void show_info(struct loader_params *params, GP_Pixmap *img,
unsigned int count = image_loader_count();
unsigned int pos = image_loader_pos() + 1;
-
+ printf("pos %u\n", pos);
info_printf(pixmap, 10, y, "%u of %u", pos, count);
y += th + 2;
commit afb3d2823c56ff76b757359c589c449252757303
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 14:15:48 +0200
URL: <http://repo.or.cz/gfxprim.git/afb3d2823c56ff76>
loaders: PNG: Wire up gamma tables.
Now the loader at least tries to set the gamma value for the pixmap,
which is later used by some of the resampling functions, etc.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/loaders/GP_PNG.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index fa01db1c5939..d0191cf5f103 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -196,6 +196,9 @@ static int read_convert_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
unsigned int y;
+ if (gamma < 0.01)
+ GP_PixmapSetGamma(res, 2.2);
+
for (y = 0; y < res->h; y++) {
png_read_row(png, (void*)row, NULL);
uint8_t *rrow = GP_PIXEL_ADDR(res, 0, y);
@@ -385,6 +388,9 @@ int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
goto err2;
}
+ if (gamma > 0.1)
+ GP_PixmapSetGamma(res, 1/gamma);
+
if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
png_set_packswap(png);
commit b10281ba4c6ef9ade39e86b8c3aa42878fdff59f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 13:52:39 +0200
URL: <http://repo.or.cz/gfxprim.git/b10281ba4c6ef9ad>
core: GP_Pixmap: Add GP_PixmapSetGamma() function
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/syms/Core_symbols.txt | 1 +
include/core/GP_Pixmap.h | 5 +++++
libs/core/GP_Gamma.c | 7 ++++++-
libs/core/GP_Pixmap.c | 9 +++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt
index 7ee4ff213aff..b49ab7670191 100644
--- a/build/syms/Core_symbols.txt
+++ b/build/syms/Core_symbols.txt
@@ -2,6 +2,7 @@ GP_PixelTypes
GP_PixelHasFlags
GP_PixmapAlloc
+GP_PixmapSetGamma
GP_PixmapResize
GP_PixmapConvertAlloc
GP_PixmapPrintInfo
diff --git a/include/core/GP_Pixmap.h b/include/core/GP_Pixmap.h
index f67e6ec2f9d6..d599fbe792eb 100644
--- a/include/core/GP_Pixmap.h
+++ b/include/core/GP_Pixmap.h
@@ -111,6 +111,11 @@ typedef struct GP_Pixmap {
GP_Pixmap *GP_PixmapAlloc(GP_Size w, GP_Size h, GP_PixelType type);
/*
+ * Sets gamma for the pixmap.
+ */
+int GP_PixmapSetGamma(GP_Pixmap *self, float gamma);
+
+/*
* Free pixmap.
*
* If pixmap->free_pixels, also free pixel data.
diff --git a/libs/core/GP_Gamma.c b/libs/core/GP_Gamma.c
index 05500f9a0c36..afde6fa5e4e9 100644
--- a/libs/core/GP_Gamma.c
+++ b/libs/core/GP_Gamma.c
@@ -186,7 +186,12 @@ GP_Gamma *GP_GammaCopy(GP_Gamma *self)
void GP_GammaRelease(GP_Gamma *self)
{
- int channels = GP_PixelTypes[self->pixel_type].numchannels, i;
+ int channels;
+
+ if (!self)
+ return;
+
+ channels = GP_PixelTypes[self->pixel_type].numchannels, i;
GP_DEBUG(1, "Releasing Gamma table %s gamma %f", GP_PixelTypeName(self->pixel_type), self->tables[0]->gamma);
diff --git a/libs/core/GP_Pixmap.c b/libs/core/GP_Pixmap.c
index 53c289e1c007..72dbae21fd13 100644
--- a/libs/core/GP_Pixmap.c
+++ b/libs/core/GP_Pixmap.c
@@ -114,6 +114,15 @@ GP_Pixmap *GP_PixmapAlloc(GP_Size w, GP_Size h, GP_PixelType type)
return pixmap;
}
+int GP_PixmapSetGamma(GP_Pixmap *self, float gamma)
+{
+ GP_GammaRelease(self->gamma);
+
+ self->gamma = GP_GammaAcquire(self->pixel_type, gamma);
+
+ return !self->gamma;
+}
+
void GP_PixmapFree(GP_Pixmap *pixmap)
{
GP_DEBUG(1, "Freeing pixmap (%p)", pixmap);
commit 5375aac799b568e58846b992e69de3193378f904
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 13:46:50 +0200
URL: <http://repo.or.cz/gfxprim.git/5375aac799b568e5>
core: Rename GP_Context.c -> GP_Pixmap.c
This is leftover from the previous rename.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/core/{GP_Context.c => GP_Pixmap.c} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename libs/core/{GP_Context.c => GP_Pixmap.c} (100%)
diff --git a/libs/core/GP_Context.c b/libs/core/GP_Pixmap.c
similarity index 100%
rename from libs/core/GP_Context.c
rename to libs/core/GP_Pixmap.c
commit 2b4e84bec2aa6e1fa027e8e4142e42f3f2b7f3da
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 13:31:12 +0200
URL: <http://repo.or.cz/gfxprim.git/2b4e84bec2aa6e1f>
gfx: Remove PartialElipse
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/syms/GFX_symbols.txt | 7 ---
include/gfx/GP_AngleUtils.h | 30 -------------
libs/gfx/GP_AngleUtils.c | 49 --------------------
libs/gfx/GP_PartialEllipse.c | 55 -----------------------
libs/gfx/algo/PartialEllipse.algo.h | 69 -----------------------------
5 files changed, 210 deletions(-)
delete mode 100644 include/gfx/GP_AngleUtils.h
delete mode 100644 libs/gfx/GP_AngleUtils.c
delete mode 100644 libs/gfx/GP_PartialEllipse.c
delete mode 100644 libs/gfx/algo/PartialEllipse.algo.h
diff --git a/build/syms/GFX_symbols.txt b/build/syms/GFX_symbols.txt
index 3ffccdca6c63..58326502f2ee 100644
--- a/build/syms/GFX_symbols.txt
+++ b/build/syms/GFX_symbols.txt
@@ -70,9 +70,6 @@ GP_Ellipse_Raw
GP_FillEllipse
GP_FillEllipse_Raw
-GP_PartialEllipse
-GP_PartialEllipse_Raw
-
GP_RectXYXY
GP_RectXYXY_Raw
GP_RectXYWH
@@ -108,7 +105,3 @@ GP_PutPixelAA_Raw_Clipped
GP_ArcSegment
GP_ArcSegment_Raw
-
-GP_AngleInRange
-GP_NormalizeAngle
-
diff --git a/include/gfx/GP_AngleUtils.h b/include/gfx/GP_AngleUtils.h
deleted file mode 100644
index 6d8bd67c99c0..000000000000
--- a/include/gfx/GP_AngleUtils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
- * Copyright (c) 2012 Jiri Dluhos <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- *****************************************************************************/
-
-#ifndef GP_ANGLE_UTILS_H
-#define GP_ANGLE_UTILS_H
-
-double GP_NormalizeAngle(double phi);
-int GP_AngleInRange(double angle, double start, double end);
-
-#endif
diff --git a/libs/gfx/GP_AngleUtils.c b/libs/gfx/GP_AngleUtils.c
deleted file mode 100644
index 67911b41626d..000000000000
--- a/libs/gfx/GP_AngleUtils.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * Copyright (C) 2012 Cyril Hrubis <metan(a)ucw.cz> *
- * Copyright (C) 2012 Jiri Dluhos <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- *****************************************************************************/
-
-#include "GP_AngleUtils.h"
-
-#include <math.h>
-
-double GP_NormalizeAngle(double phi)
-{
- // clamp angle to <-2*pi, 2*pi>
- double phi2 = fmod(phi, 2*M_PI);
-
- // clamp angle to <0, 2*pi>
- if (phi2 < 0)
- phi2 += 2*M_PI;
-
- return phi2;
-}
-
-int GP_AngleInRange(double angle, double start, double end)
-{
- if (start < end) {
- return (angle >= start && angle <= end);
- } else {
- return (angle >= start && angle <= 2*M_PI)
- || (angle >= 0 && angle <= end);
- }
-}
diff --git a/libs/gfx/GP_PartialEllipse.c b/libs/gfx/GP_PartialEllipse.c
deleted file mode 100644
index 0cfd1c9d2072..000000000000
--- a/libs/gfx/GP_PartialEllipse.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2012 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include "core/GP_GetPutPixel.h"
-#include "core/GP_FnPerBpp.h"
-
-#include "gfx/GP_Ellipse.h"
-
-#include "algo/PartialEllipse.algo.h"
-
-/* Generate drawing functions for various bit depths. */
-GP_DEF_DRAW_FN_PER_BPP(GP_PartialEllipse_Raw, DEF_PARTIAL_ELLIPSE_FN)
-
-void GP_PartialEllipse_Raw(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, int start, int end, GP_Pixel pixel)
-{
- GP_CHECK_PIXMAP(pixmap);
-
- GP_FN_PER_BPP_PIXMAP(GP_PartialEllipse_Raw, pixmap, pixmap,
- xcenter, ycenter, a, b, start, end, pixel);
-}
-
-void GP_PartialEllipse(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, int start, int end, GP_Pixel pixel)
-{
- GP_CHECK_PIXMAP(pixmap);
-
- /* recalculate center point and swap a and b when axes are swapped */
- GP_TRANSFORM_POINT(pixmap, xcenter, ycenter);
- GP_TRANSFORM_SWAP(pixmap, a, b);
-
- GP_PartialEllipse_Raw(pixmap, xcenter, ycenter, a, b, start, end, pixel);
-}
diff --git a/libs/gfx/algo/PartialEllipse.algo.h b/libs/gfx/algo/PartialEllipse.algo.h
deleted file mode 100644
index 6bf4385e7b25..000000000000
--- a/libs/gfx/algo/PartialEllipse.algo.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include "GP_AngleUtils.h"
-
-#include <math.h>
-
-/*
- * This macro defines a partial ellipse drawing function.
- * Arguments:
- * PIXMAP_T - user-defined type of drawing pixmap (passed to PUTPIXEL)
- * PIXVAL_T - user-defined pixel value type (passed to PUTPIXEL)
- * PUTPIXEL - a pixel drawing function f(pixmap, x, y, pixval)
- * FN_NAME - name of the function to be defined
- */
-#define DEF_PARTIAL_ELLIPSE_FN(FN_NAME, PIXMAP_T, PIXVAL_T, PUTPIXEL) \
-static void FN_NAME(PIXMAP_T pixmap, int xcenter, int ycenter, int a, int b, \
- int start, int end, PIXVAL_T pixval) \
-{ \
- double startAngle = GP_NormalizeAngle(2*M_PI*(start / 360000.0)); \
- double endAngle = GP_NormalizeAngle(2*M_PI*(end / 360000.0)); \
-\
- int x; \
- for (x = -a; x <= a; x++) { \
- double angle = acos(((double) x) / a); \
- double y = floor(b*sin(angle)); \
- if (GP_AngleInRange(angle, startAngle, endAngle)) { \
- PUTPIXEL(pixmap, xcenter+x, ycenter-y, pixval); \
- } \
- if (GP_AngleInRange(2*M_PI - angle, startAngle, endAngle)) { \
- PUTPIXEL(pixmap, xcenter+x, ycenter+y, pixval); \
- } \
- } \
-\
- int y; \
- for (y = -b; y <= b; y++) { \
- double angle = asin(((double) y) / b); \
- double x = floor(a*cos(angle)); \
- if (GP_AngleInRange(angle, startAngle, endAngle)) { \
- PUTPIXEL(pixmap, xcenter+x, ycenter-y, pixval); \
- } \
- if (GP_AngleInRange(M_PI - angle, startAngle, endAngle)) { \
- PUTPIXEL(pixmap, xcenter-x, ycenter-y, pixval); \
- } \
- } \
-}
-
commit 4b85b2f8355a32e7c9b150a9a451aff558694a88
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 13:17:55 +0200
URL: <http://repo.or.cz/gfxprim.git/4b85b2f8355a32e7>
demos: py_simple: Remove *_AA.py
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
demos/py_simple/gravplots_AA.py | 112 --------------------------------
demos/py_simple/sinplots_AA.py | 59 -----------------
2 files changed, 171 deletions(-)
delete mode 100755 demos/py_simple/gravplots_AA.py
delete mode 100755 demos/py_simple/sinplots_AA.py
diff --git a/demos/py_simple/gravplots_AA.py b/demos/py_simple/gravplots_AA.py
deleted file mode 100755
index 5de7bcc6a0a7..000000000000
--- a/demos/py_simple/gravplots_AA.py
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/env python
-import gfxprim.core as core
-import gfxprim.backends as backends
-import gfxprim.loaders as loaders
-import gfxprim.gfx as gfx
-import random
-from math import sqrt
-
-AA = True
-W = 320*2
-H = 240*2
-BPP = 24
-N = 8 # Try 5 or 42
-
-# Gravity, brake factor and desired total speeds (in dir. X and total)
-G = 0.1 # Adjust: 0.1 for N<20, 0.01 for N=100
-BRAKE = 0.001
-VX0 = 0.6
-V0 = 0.9
-
-# Try one max and other ~50 :
-MAXR = 255
-MAXG = 255
-MAXB = 255
-
-# timeout in moves, -1 for none
-TIMEOUT = -1
-# after timeout save to this file, None for none
-SAVETO = "gravplot.png"
-
-class elem(object):
- def __init__(self):
- #self.x = random.uniform(0.0 * W, 0.6 * W)
- self.x = 0
- self.y = random.uniform(0.2 * H, 0.8 * H)
- self.vx = random.uniform(VX0 - 0.5, VX0 + 0.5)
- self.vy = random.uniform(-0.5, 0.5)
- self.r = random.randint(MAXR / 5, MAXR)
- self.g = random.randint(MAXG / 5, MAXG)
- self.b = random.randint(MAXB / 5, MAXB)
-
- def grav(self, other, t):
- dx = other.x - self.x
- dy = other.y - self.y
- # Minimal distance is bounded
- d2 = max(dx ** 2 + dy ** 2, 0.1 ** 2)
- f = G / d2
- self.vx += dx * f * t
- self.vy += dy * f * t
-
- def move(self, t):
- self.x += self.vx * t
- self.y += self.vy * t
- # "Gravity" to y=H/2
- if self.y > 0.6 * H:
- self.vy -= V0 * t * BRAKE
- if self.y < 0.4 * H:
- self.vy += V0 * t * BRAKE
- # Magic to adjust speed
- v = sqrt(self.vx ** 2 + self.vy ** 2)
- self.vx *= (1.0 - BRAKE) + (BRAKE * V0 / v)
- self.vy *= (1.0 - BRAKE) + (BRAKE * V0 / v)
- self.vx = (1.0 - BRAKE) * self.vx + BRAKE * VX0
- # Bound speed
- self.vx = max(min(self.vx, 4.0), -4.0)
- self.vy = max(min(self.vy, 4.0), -4.0)
-
-
-def main():
- bk = backends.BackendSDLInit(W, H, BPP, 0, "Gravplots AA")
- assert bk
- print(bk)
- print("Modify source for parameters,")
- print("Kill to terminate ;-)")
- black = bk.pixmap.RGBToPixel(0, 0, 0)
-
- es = [elem() for i in range(N)]
- while True:
- for e in es:
- for e2 in es:
- if not (e is e2):
- e.grav(e2, 1.0)
- for e in es:
- e.move(1.0)
- if AA:
- x = int((e.x % W) * 0x100)
- y = int(e.y * 0x100)
- if e.vx > 0.2:
- bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black)
- if e.vx < -0.2:
- bk.pixmap.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black)
- bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b))
- else:
- x = int(e.x % W)
- y = int(e.y)
- if e.vx > 0.2:
- bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black)
- if e.vx < -0.2:
- bk.pixmap.gfx.VLine(x - 1, y - 2, y + 2, black)
- bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b))
- bk.Poll()
- bk.Flip()
- global TIMEOUT
- if TIMEOUT > 0:
- TIMEOUT -= 1
- if TIMEOUT == 0:
- break
- if SAVETO:
- bk.pixmap.Save(SAVETO)
-
-if __name__ == '__main__':
- main()
diff --git a/demos/py_simple/sinplots_AA.py b/demos/py_simple/sinplots_AA.py
deleted file mode 100755
index 44afd21ecb7c..000000000000
--- a/demos/py_simple/sinplots_AA.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-import gfxprim.core as core
-import gfxprim.backends as backends
-import gfxprim.gfx as gfx
-import random
-from math import sin
-
-AA = True
-W = 320
-H = 240
-N = 10
-
-class plotter(object):
- def __init__(self):
- self.x0 = random.uniform(0, W)
- self.y0 = random.uniform(H*0.2, H*0.8)
- self.a = H * (0.06 + random.uniform(0, 0.1) + random.uniform(0, 0.2))
- self.period = 4.0 + random.expovariate(4.0/W)
- self.speed = random.uniform(0.04, min(max(0.05, 0.5 * self.period / self.a), 1.0))
- def pos(self, t):
- x = self.x0 + self.speed * t
- y = self.y0 + sin(x / self.period) * self.a
- return (x % W, y)
- def color(self, t):
- return (
- 128 + 120 * sin(t / (self.a + 10.0)),
- 128 + 120 * sin(t / (self.y0 + 3.0)),
- 128 + 120 * sin(t / (self.x0 + 5.0)))
-
-
-def main():
- bk = backends.BackendSDLInit(W, H, 16, 0, "Sinplots AA")
- assert bk
- print(bk)
- print("Modify source for parameters,")
- print("Kill to terminate ;-)")
- black = bk.pixmap.RGBToPixel(0, 0, 0)
-
- ps = [plotter() for i in range(N)]
- t = random.uniform(0.0, 10.0 * W)
- while True:
- t += 1.0
- for p in ps:
- (x, y) = p.pos(t)
- (r, g, b) = p.color(t)
- if AA:
- x = int(x * 0x100)
- y = int(y * 0x100)
- bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black)
- bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b)))
- else:
- x = int(x)
- y = int(y)
- bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black)
- bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b)))
- bk.Flip()
-
-if __name__ == '__main__':
- main()
commit 8037a5517128c97aeaedaba084c158d3f3f37935
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 13:15:38 +0200
URL: <http://repo.or.cz/gfxprim.git/8037a5517128c97a>
demos: c_simple: Remove sin_AA
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
demos/c_simple/Makefile | 3 +-
demos/c_simple/sin_AA.c | 126 ----------------------------------------
2 files changed, 1 insertion(+), 128 deletions(-)
delete mode 100644 demos/c_simple/sin_AA.c
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile
index 0525e72131e5..f12f491b7fcf 100644
--- a/demos/c_simple/Makefile
+++ b/demos/c_simple/Makefile
@@ -16,7 +16,7 @@ APPS=backend_example loaders_example loaders filters_symmetry gfx_koch\
virtual_backend_example meta_data showimage\
v4l2_show v4l2_grab convolution weighted_median shapetest koch \
input_example fileview linetest randomshapetest fonttest\
- loaders_register blittest textaligntest sin_AA x11_windows\
+ loaders_register blittest textaligntest x11_windows\
debug_handler gaussian_noise version pretty_print timers\
zip_container backend_timers_example memory_io data_storage
@@ -50,7 +50,6 @@ textaligntest: LDLIBS+=-lgfxprim-backends
loaders_register: LDLIBS+=-lgfxprim-loaders
gaussian_noise: LDLIBS+=-lgfxprim-loaders
blittest: LDLIBS+=-lgfxprim-backends -lgfxprim-loaders
-sin_AA: LDLIBS+=-lgfxprim-backends -lm
x11_windows: LDLIBS+=-lgfxprim-backends
zip_container: LDLIBS+=-lgfxprim-loaders -lgfxprim-backends
memory_io: LDLIBS+=-lgfxprim-backends -lgfxprim-loaders
diff --git a/demos/c_simple/sin_AA.c b/demos/c_simple/sin_AA.c
deleted file mode 100644
index 0191918a2e80..000000000000
--- a/demos/c_simple/sin_AA.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-/*
-
- Simple example that shows HLineAA() usage.
-
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-
-#include <GP.h>
-
-static void redraw(GP_Pixmap *pixmap)
-{
- static float param = 1;
- static float param2 = 0.01;
- static int flag = 1;
- GP_Pixel b = GP_RGBToPixmapPixel(0xbe, 0xbe, 0x9e, pixmap);
- unsigned int y;
-
- GP_Fill(pixmap, b);
-
- for (y = 0; y < pixmap->w; y++) {
- GP_Coord x0, x1, l1, l2;
-
- x0 = (pixmap->w)<<7;
- x1 = (pixmap->w)<<7;
-
- l1 = (pixmap->w)<<5;
- l2 = (pixmap->w)<<3;
-
- GP_Pixel p = GP_RGBToPixmapPixel(120 - 3 * param, abs(40 * param), 0, pixmap);
-
- l2 *= 4.00 * y / pixmap->h;
-
- l1 *= param;
-
- x0 += l1 * sin(param2 * y) + l2;
- x1 -= l1 * cos(param2 * y) + l2;
-
- GP_HLineAA(pixmap, x0, x1, y<<8, p);
- }
-
- if (flag) {
- param -= 0.02;
-
- if (param <= -2.40) {
- flag = 0;
- param2 += 0.01;
-
- if (param2 > 0.02)
- param2 = 0.01;
- }
- } else {
- param += 0.02;
-
- if (param >= 2.40)
- flag = 1;
- }
-}
-
-int main(void)
-{
- GP_Backend *backend;
- static int pause_flag = 0;
-
- /* Initalize backend */
- backend = GP_BackendX11Init(NULL, 0, 0, 800, 600, "sin AA", 0);
-
- if (backend == NULL) {
- fprintf(stderr, "Failed to initalize backend\n");
- return 1;
- }
-
- /* Wait for events */
- for (;;) {
- if (!pause_flag) {
- redraw(backend->pixmap);
- GP_BackendFlip(backend);
- }
-
- GP_BackendPoll(backend);
-
- GP_Event ev;
-
- while (GP_BackendGetEvent(backend, &ev)) {
- if (ev.type == GP_EV_KEY && ev.code == GP_EV_KEY_DOWN) {
- switch (ev.val.val) {
- case GP_KEY_ESC:
- case GP_KEY_Q:
- GP_BackendExit(backend);
- return 0;
- case GP_KEY_P:
- pause_flag = !pause_flag;
- break;
- }
- }
- }
-
- usleep(10000);
- }
-
- return 0;
-}
commit 97cdacf0adedaba34769631b8f506924d61b3e36
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 12:53:07 +0200
URL: <http://repo.or.cz/gfxprim.git/97cdacf0adedaba3>
loaders: PNG: Handle gamma on 16bpp conversion
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/loaders/GP_PNG.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index 21b5b133fc71..fa01db1c5939 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -35,6 +35,7 @@
#include "../../config.h"
#include "core/GP_ByteOrder.h"
#include "core/GP_Debug.h"
+#include "core/GP_GammaCorrection.h"
#include "GP_PNG.h"
@@ -178,7 +179,7 @@ static int read_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
}
static int read_convert_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
- png_structp png, int passes)
+ png_structp png, int passes, double gamma)
{
uint16_t *row;
@@ -200,11 +201,19 @@ static int read_convert_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
uint8_t *rrow = GP_PIXEL_ADDR(res, 0, y);
unsigned int x = 0;
- //TODO: Gamma
- for (x = 0; x < res->w; x++) {
- rrow[3*x] = row[3 * x]>>8;
- rrow[3*x + 1] = row[3 * x + 1]>>8;
- rrow[3*x + 2] = row[3 * x + 2]>>8;
+
+ if (gamma > 0.1) {
+ for (x = 0; x < res->w; x++) {
+ rrow[3*x] = row[3 * x]>>8;
+ rrow[3*x + 1] = row[3 * x + 1]>>8;
+ rrow[3*x + 2] = row[3 * x + 2]>>8;
+ }
+ } else {
+ for (x = 0; x < res->w; x++) {
+ rrow[3*x] = GP_Linear16ToGamma8(row[3 * x]);
+ rrow[3*x + 1] = GP_Linear16ToGamma8(row[3 * x + 1]);
+ rrow[3*x + 2] = GP_Linear16ToGamma8(row[3 * x + 2]);
+ }
}
if (GP_ProgressCallbackReport(callback, y, res->h, res->w)) {
@@ -390,7 +399,7 @@ int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
}
#endif
if (convert_16_to_8) {
- if ((err = read_convert_bitmap(res, callback, png, passes)))
+ if ((err = read_convert_bitmap(res, callback, png, passes, gamma)))
goto err3;
} else {
if ((err = read_bitmap(res, callback, png, passes)))
commit 55369a6db09675043a60fe95c2b0f010143de78e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 12:32:44 +0200
URL: <http://repo.or.cz/gfxprim.git/55369a6db0967504>
core: GP_GammaCorrection.gen.h.t: Add 16bpp helpers
Add 16bpp linear to gamma helpers.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
include/core/GP_GammaCorrection.gen.h.t | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/core/GP_GammaCorrection.gen.h.t b/include/core/GP_GammaCorrection.gen.h.t
index 59610665c186..593324b966b6 100644
--- a/include/core/GP_GammaCorrection.gen.h.t
+++ b/include/core/GP_GammaCorrection.gen.h.t
@@ -21,4 +21,9 @@ static inline uint8_t GP_Linear10ToGamma{{ i }}(uint16_t val)
return (GP_Linear10_Gamma8[val] + {{ int(2 ** (7 - i))}})>>{{8 - i}};
}
+static inline uint8_t GP_Linear16ToGamma{{ i }}(uint16_t val)
+{
+ return (GP_Linear10_Gamma8[val>>6] + {{ int(2 ** (7 - i))}})>>{{8 - i}};
+}
+
@ end
commit 852fad1c42dbd29205b14d721deff3439c8af635
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 12:23:29 +0200
URL: <http://repo.or.cz/gfxprim.git/852fad1c42dbd292>
loaders: PNG: Add support for loading 16bpp RGB
The data are converted to 8bpp RGB at this point.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/loaders/GP_PNG.c | 96 ++++++++++++++++++++++++++++++++++---------
1 file changed, 76 insertions(+), 20 deletions(-)
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index ce8f650074a0..21b5b133fc71 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -153,6 +153,71 @@ static void load_meta_data(png_structp png, png_infop png_info,
}
}
+static int read_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
+ png_structp png, int passes)
+{
+ uint32_t y;
+ int p;
+
+ /*
+ * The passes are needed for adam7 interlacing.
+ */
+ for (p = 0; p < passes; p++) {
+ for (y = 0; y < res->h; y++) {
+ png_bytep row = GP_PIXEL_ADDR(res, 0, y);
+ png_read_row(png, row, NULL);
+
+ if (GP_ProgressCallbackReport(callback, y + res->h * p, res->h * passes, res->w)) {
+ GP_DEBUG(1, "Operation aborted");
+ return ECANCELED;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int read_convert_bitmap(GP_Pixmap *res, GP_ProgressCallback *callback,
+ png_structp png, int passes)
+{
+ uint16_t *row;
+
+ if (passes > 1) {
+ GP_DEBUG(1, "Interlaced 16 bit PNG not supported");
+ return ENOSYS;
+ }
+
+ row = malloc(6 * res->w);
+ if (!row) {
+ GP_DEBUG(1, "Malloc failed :(");
+ return ENOMEM;
+ }
+
+ unsigned int y;
+
+ for (y = 0; y < res->h; y++) {
+ png_read_row(png, (void*)row, NULL);
+ uint8_t *rrow = GP_PIXEL_ADDR(res, 0, y);
+ unsigned int x = 0;
+
+ //TODO: Gamma
+ for (x = 0; x < res->w; x++) {
+ rrow[3*x] = row[3 * x]>>8;
+ rrow[3*x + 1] = row[3 * x + 1]>>8;
+ rrow[3*x + 2] = row[3 * x + 2]>>8;
+ }
+
+ if (GP_ProgressCallbackReport(callback, y, res->h, res->w)) {
+ GP_DEBUG(1, "Operation aborted");
+ free(row);
+ return ECANCELED;
+ }
+ }
+
+ free(row);
+ return 0;
+}
+
int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
GP_DataStorage *storage, GP_ProgressCallback *callback)
{
@@ -164,6 +229,7 @@ int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
GP_Pixmap *res = NULL;
int err, passes = 1;
double gamma;
+ int convert_16_to_8 = 0;
png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -250,6 +316,10 @@ int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
case 8:
pixel_type = GP_PIXEL_RGB888;
break;
+ case 16:
+ pixel_type = GP_PIXEL_RGB888;
+ convert_16_to_8 = 1;
+ break;
}
break;
case PNG_COLOR_TYPE_RGB | PNG_COLOR_MASK_ALPHA:
@@ -319,26 +389,12 @@ int GP_ReadPNGEx(GP_IO *io, GP_Pixmap **img,
png_set_swap(png);
}
#endif
-
- uint32_t y;
- int p;
-
- /*
- * Do the actuall reading.
- *
- * The passes are needed for adam7 interlacing.
- */
- for (p = 0; p < passes; p++) {
- for (y = 0; y < h; y++) {
- png_bytep row = GP_PIXEL_ADDR(res, 0, y);
- png_read_row(png, row, NULL);
-
- if (GP_ProgressCallbackReport(callback, y + h * p, h * passes, w)) {
- GP_DEBUG(1, "Operation aborted");
- err = ECANCELED;
- goto err3;
- }
- }
+ if (convert_16_to_8) {
+ if ((err = read_convert_bitmap(res, callback, png, passes)))
+ goto err3;
+ } else {
+ if ((err = read_bitmap(res, callback, png, passes)))
+ goto err3;
}
exit:
commit 31709183a28656764eb165da6f8492d67102f556
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon, 23 Oct 2017 11:55:47 +0200
URL: <http://repo.or.cz/gfxprim.git/31709183a2865676>
demos/loaders_register: Fix progress callback
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
demos/c_simple/loaders_register.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c
index 4279c51f1014..cc2c0a15adba 100644
--- a/demos/c_simple/loaders_register.c
+++ b/demos/c_simple/loaders_register.c
@@ -82,7 +82,7 @@ static int write_data(const GP_Pixmap *img, GP_IO *io,
if (GP_IOFlush(bio, "\n", 1))
return 1;
- if (GP_ProgressCallbackReport(callback, img->h, j, img->w)) {
+ if (GP_ProgressCallbackReport(callback, j, img->h, img->w)) {
errno = ECANCELED;
return 1;
}
-----------------------------------------------------------------------
Summary of changes:
build/syms/Core_symbols.txt | 1 +
build/syms/GFX_symbols.txt | 7 --
demos/c_simple/Makefile | 3 +-
demos/c_simple/loaders_register.c | 2 +-
demos/c_simple/sin_AA.c | 126 ------------------------
demos/py_simple/gravplots_AA.py | 112 ---------------------
demos/py_simple/sinplots_AA.py | 59 -----------
demos/spiv/image_list.c | 3 +
demos/spiv/spiv.c | 2 +-
include/core/GP_GammaCorrection.gen.h.t | 5 +
include/core/GP_Pixmap.h | 5 +
include/gfx/GP_AngleUtils.h | 30 ------
libs/core/GP_Gamma.c | 7 +-
libs/core/{GP_Context.c => GP_Pixmap.c} | 9 ++
libs/gfx/GP_AngleUtils.c | 49 ---------
libs/gfx/GP_PartialEllipse.c | 55 -----------
libs/gfx/algo/PartialEllipse.algo.h | 69 -------------
libs/loaders/GP_PNG.c | 111 +++++++++++++++++----
18 files changed, 123 insertions(+), 532 deletions(-)
delete mode 100644 demos/c_simple/sin_AA.c
delete mode 100755 demos/py_simple/gravplots_AA.py
delete mode 100755 demos/py_simple/sinplots_AA.py
delete mode 100644 include/gfx/GP_AngleUtils.h
rename libs/core/{GP_Context.c => GP_Pixmap.c} (98%)
delete mode 100644 libs/gfx/GP_AngleUtils.c
delete mode 100644 libs/gfx/GP_PartialEllipse.c
delete mode 100644 libs/gfx/algo/PartialEllipse.algo.h
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
29 Sep '17
This is an automated email generated because a ref change occurred in the
git repository for project gfxprim.git.
The branch, master has been updated
via da4d05501970c57531ab9243239873c733993690 (commit)
via 7d4836a776c798bab9ba8cb8a367c12d07d98ae7 (commit)
from edf5e7cc9c3fece148b15f59939164d9017de42f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit da4d05501970c57531ab9243239873c733993690
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 10:51:05 +0200
URL: <http://repo.or.cz/gfxprim.git/da4d05501970c575>
demos: Add termini libvterm based terminal
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
configure | 3 +
demos/Makefile | 4 +
demos/termini/.gitignore | 1 +
demos/termini/Makefile | 17 ++
demos/termini/runtest.sh | 9 +
demos/termini/termini.c | 612 +++++++++++++++++++++++++++++++++++++++
6 files changed, 646 insertions(+)
create mode 100644 demos/termini/.gitignore
create mode 100644 demos/termini/Makefile
create mode 100755 demos/termini/runtest.sh
create mode 100644 demos/termini/termini.c
diff --git a/configure b/configure
index 7d7a3c056d4a..a01830e050d8 100755
--- a/configure
+++ b/configure
@@ -404,6 +404,9 @@ if __name__ == '__main__':
["V4L2",
"Video for linux 2",
[header_exists, "linux/videodev2.h"], "", "", ["grabbers"]],
+ ["libvterm",
+ "Implementation of a VT220/xterm/ECMA-48 terminal emulator",
+ [header_exists, "vterm.h"], "", "", [""]],
["pthread",
"Posix Threads",
[header_exists, "pthread.h"], "-pthread", "-pthread", ["core"]],
diff --git a/demos/Makefile b/demos/Makefile
index 1943f919b785..bf71c075d541 100644
--- a/demos/Makefile
+++ b/demos/Makefile
@@ -1,3 +1,7 @@
TOPDIR=..
+include $(TOPDIR)/config.gen.mk
SUBDIRS=grinder spiv particle ttf2img c_simple bogoman
+ifeq ($(HAVE_LIBVTERM),yes)
+SUBDIRS+=termini
+endif
include $(TOPDIR)/post.mk
diff --git a/demos/termini/.gitignore b/demos/termini/.gitignore
new file mode 100644
index 000000000000..23409a7d1275
--- /dev/null
+++ b/demos/termini/.gitignore
@@ -0,0 +1 @@
+termini
diff --git a/demos/termini/Makefile b/demos/termini/Makefile
new file mode 100644
index 000000000000..f54364741e4d
--- /dev/null
+++ b/demos/termini/Makefile
@@ -0,0 +1,17 @@
+TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
+CSOURCES=$(shell echo *.c)
+
+INCLUDE=
+LDFLAGS+=-L$(TOPDIR)/build/
+
+LDLIBS+=-lgfxprim-backends -lgfxprim -lvterm -lutil
+
+APPS=termini
+
+INSTALL_BIN=termini
+
+include $(TOPDIR)/app.mk
+include $(TOPDIR)/install.mk
+include $(TOPDIR)/post.mk
diff --git a/demos/termini/runtest.sh b/demos/termini/runtest.sh
new file mode 100755
index 000000000000..dac7bc8b8671
--- /dev/null
+++ b/demos/termini/runtest.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Run dynamically linked test.
+#
+
+PROG="$1"
+shift
+
+LD_LIBRARY_PATH=../../build/ ./$PROG "$@"
diff --git a/demos/termini/termini.c b/demos/termini/termini.c
new file mode 100644
index 000000000000..488bd8f73d4e
--- /dev/null
+++ b/demos/termini/termini.c
@@ -0,0 +1,612 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2017 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+ /*
+
+ TERMINI -- minimal terminal emulator.
+
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <pty.h>
+#include <vterm.h>
+#include <GP.h>
+
+static GP_Backend *backend;
+
+static VTerm *vt;
+static VTermScreen *vts;
+
+static unsigned int cols;
+static unsigned int rows;
+static unsigned int char_width;
+static unsigned int char_height;
+static GP_TextStyle *text_style;
+static GP_TextStyle *text_style_bold;
+
+static GP_Pixel colors[16];
+
+/* delay before we repaint merged damage */
+static int repaint_sleep_ms = -1;
+
+/* HACK to draw frames */
+static void draw_utf8_frames(int x, int y, uint32_t val, GP_Pixel fg)
+{
+ switch (val) {
+ case 0x2500: /* Horizontal line */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width, fg);
+ break;
+ case 0x2502: /* Vertical line */
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg);
+ break;
+ case 0x250c: /* Upper left corner */
+ GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg);
+ break;
+ case 0x2510: /* Upper right corner */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg);
+ break;
+ case 0x2514: /* Bottom left corner */
+ GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2, fg);
+ break;
+ case 0x2518: /* Bottom right corner */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2+1, fg);
+ break;
+ case 0x251c: /* Left vertical tee */
+ GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg);
+ break;
+ case 0x2524: /* Right vertical tee */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg);
+ break;
+ default:
+ fprintf(stderr, "WARN: unhandled utf8 char %x\n", val);
+ }
+}
+
+static void draw_cell(VTermPos pos)
+{
+ VTermScreenCell c;
+
+ vterm_screen_get_cell(vts, pos, &c);
+
+ GP_Pixel bg = colors[c.bg.red];
+ GP_Pixel fg = colors[c.fg.red];
+
+ if (c.attrs.reverse)
+ GP_SWAP(bg, fg);
+
+ char buf[2] = {c.chars[0], 0};
+
+ int x = pos.col * char_width;
+ int y = pos.row * char_height;
+
+ GP_FillRectXYWH(backend->pixmap, x, y, char_width, char_height, bg);
+
+ //fprintf(stderr, "Drawing %x %c %02i %02i\n", buf[0], buf[0], pos.row, pos.col);
+
+ if (c.width > 1)
+ fprintf(stderr, "%i\n", c.width);
+
+ if (c.chars[0] > 0x7f) {
+ draw_utf8_frames(x, y, c.chars[0], fg);
+ return;
+ }
+
+ GP_TextStyle *style = c.attrs.bold ? text_style_bold : text_style;
+
+ GP_Text(backend->pixmap, style, x, y, GP_ALIGN_RIGHT | GP_VALIGN_BELOW, fg, bg, buf);
+}
+
+static void update_rect(VTermRect rect)
+{
+ int x = rect.start_col * char_width;
+ int y = rect.start_row * char_height;
+ int w = rect.end_col * char_width;
+ int h = rect.end_row * char_height;
+
+ GP_BackendUpdateRectXYXY(backend, x, y, w, h);
+}
+
+static VTermRect damaged;
+static int damage_repainted = 1;
+
+static void merge_damage(VTermRect rect)
+{
+ if (damage_repainted) {
+ damaged = rect;
+ damage_repainted = 0;
+ return;
+ }
+
+ damaged.start_col = GP_MIN(damaged.start_col, rect.start_col);
+ damaged.end_col = GP_MAX(damaged.end_col, rect.end_col);
+
+ damaged.start_row = GP_MIN(damaged.start_row, rect.start_row);
+ damaged.end_row = GP_MAX(damaged.end_row, rect.end_row);
+
+}
+
+static void repaint_damage(void)
+{
+ int row, col;
+
+ for (row = damaged.start_row; row < damaged.end_row; row++) {
+ for (col = damaged.start_col; col < damaged.end_col; col++) {
+ VTermPos pos = {.row = row, .col = col};
+ draw_cell(pos);
+ }
+ }
+
+ update_rect(damaged);
+ damage_repainted = 1;
+ repaint_sleep_ms = -1;
+}
+
+
+static int term_damage(VTermRect rect, void *user_data)
+{
+ (void)user_data;
+
+ merge_damage(rect);
+// fprintf(stderr, "rect: %i %i %i %i\n", rect.start_row, rect.end_row, rect.start_col, rect.end_col);
+ repaint_sleep_ms = 1;
+
+ return 1;
+}
+
+static int term_moverect(VTermRect dest, VTermRect src, void *user_data)
+{
+ (void)dest;
+ (void)src;
+ (void)user_data;
+ fprintf(stderr, "Move rect!\n");
+
+ return 0;
+}
+
+static int term_movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user_data)
+{
+ (void)user_data;
+ unsigned int x = oldpos.col * char_width;
+ unsigned int y = oldpos.row * char_height;
+
+ draw_cell(oldpos);
+ GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height);
+
+ x = pos.col * char_width;
+ y = pos.row * char_height;
+
+ GP_RectXYWH(backend->pixmap, x, y, char_width, char_height, 0xffffff);
+ GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height);
+
+ //fprintf(stderr, "Move cursor %i %i -> %i %i!\n", oldpos.col, oldpos.row, pos.col, pos.row);
+
+ //vterm_screen_flush_damage(vts);
+
+ return 1;
+}
+
+static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data)
+{
+ (void)user_data;
+
+ switch (prop) {
+ case VTERM_PROP_TITLE:
+ fprintf(stderr, "caption %s\n", val->string);
+ GP_BackendSetCaption(backend, val->string);
+ return 1;
+ case VTERM_PROP_ALTSCREEN:
+ fprintf(stderr, "altscreen\n");
+ return 0;
+ case VTERM_PROP_ICONNAME:
+ fprintf(stderr, "iconname %s\n", val->string);
+ return 0;
+ case VTERM_PROP_CURSORSHAPE:
+ fprintf(stderr, "cursorshape %i\n", val->number);
+ return 0;
+ case VTERM_PROP_REVERSE:
+ fprintf(stderr, "reverse %i\n", val->boolean);
+ return 0;
+ case VTERM_PROP_CURSORVISIBLE:
+ fprintf(stderr, "cursorvisible %i\n", val->boolean);
+ return 0;
+ case VTERM_PROP_CURSORBLINK:
+ fprintf(stderr, "blink %i\n", val->boolean);
+ return 0;
+ case VTERM_PROP_MOUSE:
+ fprintf(stderr, "mouse %i\n", val->number);
+ return 0;
+ default:
+ break;
+ }
+
+ fprintf(stderr, "Set term prop!\n");
+
+ return 0;
+}
+
+static int term_screen_resize(int new_rows, int new_cols, void *user)
+{
+ (void)new_rows;
+ (void)new_cols;
+ (void)user;
+
+ fprintf(stderr, "Resize %i %i\n", new_rows, new_cols);
+
+ return 1;
+}
+
+static int term_bell(void *user)
+{
+ (void)user;
+ fprintf(stderr, "Bell!\n");
+
+ return 1;
+}
+
+static int term_sb_pushline(int cols, const VTermScreenCell *cells, void *user)
+{
+ (void)cols;
+ (void)cells;
+ (void)user;
+
+ fprintf(stderr, "Pushline!\n");
+
+ return 0;
+}
+
+static VTermScreenCallbacks screen_callbacks = {
+ .damage = term_damage,
+// .moverect = term_moverect,
+ .movecursor = term_movecursor,
+ .settermprop = term_settermprop,
+ .bell = term_bell,
+// .sb_pushline = term_sb_pushline,
+ .resize = term_screen_resize,
+// .sb_popline = term_sb_popline,
+};
+
+static void term_init(void)
+{
+ int i;
+
+ vt = vterm_new(rows, cols);
+ vterm_set_utf8(vt, 1);
+
+ vts = vterm_obtain_screen(vt);
+ vterm_screen_enable_altscreen(vts, 1);
+ vterm_screen_set_callbacks(vts, &screen_callbacks, NULL);
+ VTermState *vs = vterm_obtain_state(vt);
+ vterm_state_set_bold_highbright(vs, 1);
+
+ //vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_SCROLL);
+ //vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_ROW);
+
+ /* We use the vterm color as an array index */
+ for (i = 0; i < 16; i++) {
+ VTermColor col = {i, i, i};
+ vterm_state_set_palette_color(vs, i, &col);
+ }
+
+ VTermColor bg = {0, 0, 0};
+ VTermColor fg = {7, 7, 7};
+
+ vterm_state_set_default_colors(vs, &fg, &bg);
+
+ vterm_screen_reset(vts, 1);
+}
+
+/*
+ * Forks and runs a shell, returns master fd.
+ */
+static int open_console(void)
+{
+ int fd, pid, flags;
+
+ pid = forkpty(&fd, NULL, NULL, NULL);
+ if (pid < 0)
+ return -1;
+
+ if (pid == 0) {
+ char *shell = getenv("SHELL");
+
+ if (!shell)
+ shell = "/bin/sh";
+
+ putenv("TERM=xterm");
+
+ execl(shell, shell, NULL);
+ }
+
+ flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+
+ return fd;
+}
+
+static void close_console(int fd)
+{
+ close(fd);
+}
+
+static int console_read(int fd)
+{
+ char buf[1024];
+ int len;
+
+ len = read(fd, buf, sizeof(buf));
+
+ if (len > 0)
+ vterm_input_write(vt, buf, len);
+
+ return len;
+}
+
+static void console_write(int fd, char *buf, int buf_len)
+{
+ write(fd, buf, buf_len);
+}
+
+static void console_resize(int fd, int cols, int rows)
+{
+ struct winsize size = {rows, cols, 0, 0};
+ ioctl(fd, TIOCSWINSZ, &size);
+}
+
+static void do_exit(int fd)
+{
+ close_console(fd);
+ GP_BackendExit(backend);
+ vterm_free(vt);
+}
+
+static void event_to_console(GP_Event *ev, int fd)
+{
+ int ctrl = GP_EventGetKey(ev, GP_KEY_RIGHT_CTRL) ||
+ GP_EventGetKey(ev, GP_KEY_LEFT_CTRL);
+
+ if (ctrl) {
+ if (ev->val.key.ascii >= 'a' && ev->val.key.ascii <= 'z') {
+ char buf = ev->val.key.ascii - 'a' + 1;
+ console_write(fd, &buf, 1);
+ }
+ return;
+ }
+
+ if (ev->val.key.ascii) {
+ write(fd, &ev->val.key.ascii, 1);
+ return;
+ }
+
+ switch (ev->val.key.key) {
+ case GP_KEY_UP:
+ console_write(fd, "\eOA", 3);
+ break;
+ case GP_KEY_DOWN:
+ console_write(fd, "\eOB", 3);
+ break;
+ case GP_KEY_RIGHT:
+ console_write(fd, "\eOC", 3);
+ break;
+ case GP_KEY_LEFT:
+ console_write(fd, "\eOD", 3);
+ break;
+ case GP_KEY_DELETE:
+ console_write(fd, "\e[3~", 4);
+ break;
+ case GP_KEY_PAGE_UP:
+ console_write(fd, "\e[5~", 4);
+ break;
+ case GP_KEY_PAGE_DOWN:
+ console_write(fd, "\e[6~", 4);
+ break;
+ case GP_KEY_HOME:
+ console_write(fd, "\e[7~", 4);
+ break;
+ case GP_KEY_END:
+ console_write(fd, "\e[8~", 4);
+ break;
+ case GP_KEY_F1:
+ console_write(fd, "\e[11~", 5);
+ break;
+ case GP_KEY_F2:
+ console_write(fd, "\e[12~", 5);
+ break;
+ case GP_KEY_F3:
+ console_write(fd, "\e[13~", 5);
+ break;
+ case GP_KEY_F4:
+ console_write(fd, "\e[14~", 5);
+ break;
+ case GP_KEY_F5:
+ console_write(fd, "\e[15~", 5);
+ break;
+ case GP_KEY_F6:
+ console_write(fd, "\e[17~", 5);
+ break;
+ case GP_KEY_F7:
+ console_write(fd, "\e[18~", 5);
+ break;
+ case GP_KEY_F8:
+ console_write(fd, "\e[19~", 5);
+ break;
+ case GP_KEY_F9:
+ console_write(fd, "\e[20~", 5);
+ break;
+ case GP_KEY_F10:
+ console_write(fd, "\e[21~", 5);
+ break;
+ case GP_KEY_F11:
+ console_write(fd, "\e[23~", 5);
+ break;
+ case GP_KEY_F12:
+ console_write(fd, "\e[24~", 5);
+ break;
+ }
+}
+
+struct RGB {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+};
+
+struct RGB RGB_colors[16] = {
+ /* BLACK */
+ {0x00, 0x00, 0x00},
+ /* RED */
+ {0xff, 0x00, 0x00},
+ /* GREEN */
+ {0x00, 0xff, 0x00},
+ /* YELLOW */
+ {0xff, 0xff, 0x00},
+ /* BLUE */
+ {0x00, 0x00, 0xff},
+ /* MAGENTA */
+ {0xff, 0x00, 0xff},
+ /* CYAN */
+ {0x00, 0xff, 0xff},
+ /* GRAY */
+ {0xee, 0xee, 0xee},
+
+ /* BRIGHT BLACK */
+ {0x44, 0x44, 0x44},
+ /* BRIGHT RED */
+ {0xff, 0x44, 0x44},
+ /* BRIGHT GREEN */
+ {0x44, 0xff, 0x44},
+ /* BRIGHT YELLOW */
+ {0xff, 0xff, 0x44},
+ /* BRIGHT BLUE */
+ {0x44, 0x44, 0xff},
+ /* BRIGHT MAGENTA */
+ {0xff, 0x44, 0xff},
+ /* BRIGHT CYAN */
+ {0x44, 0xff, 0xff},
+ /* WHITE */
+ {0xff, 0xff, 0xff},
+};
+
+
+static void backend_init(void)
+{
+ int i;
+
+ backend = GP_BackendInit("X11", "Termini");
+ if (backend == NULL) {
+ fprintf(stderr, "Failed to initalize backend\n");
+ exit(1);
+ }
+
+ for (i = 0; i < 16; i++) {
+ colors[i] = GP_RGBToPixmapPixel(RGB_colors[i].r,
+ RGB_colors[i].g,
+ RGB_colors[i].b,
+ backend->pixmap);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ backend_init();
+
+ GP_TextStyle style = {
+ .font = GP_FontHaxorNarrow17,
+ //.font = &GP_DefaultConsoleFont,
+ .pixel_xmul = 1,
+ .pixel_ymul = 1,
+ };
+
+ GP_TextStyle style_bold = {
+ .font = GP_FontHaxorNarrowBold17,
+ //.font = &GP_DefaultConsoleFont,
+ .pixel_xmul = 1,
+ .pixel_ymul = 1,
+ };
+
+ text_style = &style;
+ text_style_bold = &style_bold;
+
+ char_width = GP_TextMaxWidth(text_style, 1);
+ char_height = GP_TextHeight(text_style);
+
+ cols = GP_PixmapW(backend->pixmap)/char_width;
+ rows = GP_PixmapH(backend->pixmap)/char_height;
+
+ fprintf(stderr, "Cols %i Rows %i\n", cols, rows);
+
+ term_init();
+
+ int fd = open_console();
+
+ struct pollfd fds[2] = {
+ {.fd = fd, .events = POLLIN},
+ {.fd = backend->fd, .events = POLLIN}
+ };
+
+ for (;;) {
+ GP_Event ev;
+
+ if (poll(fds, 2, repaint_sleep_ms) == 0)
+ repaint_damage();
+
+ while (GP_BackendPollEvent(backend, &ev)) {
+ switch (ev.type) {
+ case GP_EV_KEY:
+ if (ev.code == GP_EV_KEY_UP)
+ break;
+
+ event_to_console(&ev, fd);
+ break;
+ case GP_EV_SYS:
+ switch (ev.code) {
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(backend);
+ cols = ev.val.sys.w/char_width;
+ rows = ev.val.sys.h/char_height;
+ vterm_set_size(vt, rows, cols);
+ console_resize(fd, cols, rows);
+ GP_Fill(backend->pixmap, 0);
+ VTermRect rect = {.start_row = 0, .start_col = 0, .end_row = rows, .end_col = cols};
+ term_damage(rect, NULL);
+ //TODO cursor
+ break;
+ case GP_EV_SYS_QUIT:
+ do_exit(fd);
+ break;
+ }
+ break;
+ }
+ }
+
+ console_read(fd);
+ }
+
+ return 0;
+}
commit 7d4836a776c798bab9ba8cb8a367c12d07d98ae7
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri, 29 Sep 2017 19:01:14 +0200
URL: <http://repo.or.cz/gfxprim.git/7d4836a776c798ba>
text: Add HaxorNarrow fonts.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/syms/Text_symbols.txt | 6 +
include/text/GP_Font.h | 9 +-
include/text/GP_Fonts.h | 12 +
libs/text/GP_HaxorNarrow15.c | 442 +++++++++++++++++++++++++++++++++++
libs/text/GP_HaxorNarrow16.c | 442 +++++++++++++++++++++++++++++++++++
libs/text/GP_HaxorNarrow17.c | 442 +++++++++++++++++++++++++++++++++++
libs/text/GP_Text.gen.c.t | 4 +-
7 files changed, 1352 insertions(+), 5 deletions(-)
create mode 100644 libs/text/GP_HaxorNarrow15.c
create mode 100644 libs/text/GP_HaxorNarrow16.c
create mode 100644 libs/text/GP_HaxorNarrow17.c
diff --git a/build/syms/Text_symbols.txt b/build/syms/Text_symbols.txt
index 3b04747fb71c..21019ba20dfa 100644
--- a/build/syms/Text_symbols.txt
+++ b/build/syms/Text_symbols.txt
@@ -24,3 +24,9 @@ GP_DefaultConsoleFont
GP_FontTiny
GP_FontTinyMono
GP_FontC64
+GP_FontHaxorNarrow15
+GP_FontHaxorNarrowBold15
+GP_FontHaxorNarrow16
+GP_FontHaxorNarrowBold16
+GP_FontHaxorNarrow17
+GP_FontHaxorNarrowBold17
diff --git a/include/text/GP_Font.h b/include/text/GP_Font.h
index a6a584c22f99..e14e6cb12bc6 100644
--- a/include/text/GP_Font.h
+++ b/include/text/GP_Font.h
@@ -143,9 +143,12 @@ typedef struct GP_FontFace {
/*
* Offsets to the glyph data.
*
- * If glyph_offset[0] == 0, the table glyph_offsets holds
- * offsets for all characters in glyphs. Otherwise the
- * glyph_offset[0] defines step in the glyph table.
+ * If glyph_offset[0] == 0, the table glyph_offsets holds offsets for
+ * all characters in glyphs, the last offset i.e. offsets[len] holds
+ * the size of glyphs array.
+ *
+ * If glyph_offset[0] != 0 the glyph_offset[0] defines step in the
+ * glyph table.
*/
uint32_t glyph_offsets[];
} GP_FontFace;
diff --git a/include/text/GP_Fonts.h b/include/text/GP_Fonts.h
index 3a54da300bc8..b2176cd56451 100644
--- a/include/text/GP_Fonts.h
+++ b/include/text/GP_Fonts.h
@@ -44,4 +44,16 @@ extern const GP_FontFace *GP_FontTiny;
*/
extern const GP_FontFace *GP_FontC64;
+/*
+ * HaxorNarrow family, converted from bdf fonts from:
+ *
+ * https://github.com/metan-ucw/fonts
+ */
+extern const GP_FontFace *GP_FontHaxorNarrow15;
+extern const GP_FontFace *GP_FontHaxorNarrowBold15;
+extern const GP_FontFace *GP_FontHaxorNarrow16;
+extern const GP_FontFace *GP_FontHaxorNarrowBold16;
+extern const GP_FontFace *GP_FontHaxorNarrow17;
+extern const GP_FontFace *GP_FontHaxorNarrowBold17;
+
#endif /* TEXT_GP_FONTS_H */
diff --git a/libs/text/GP_HaxorNarrow15.c b/libs/text/GP_HaxorNarrow15.c
new file mode 100644
index 000000000000..1dffc3848246
--- /dev/null
+++ b/libs/text/GP_HaxorNarrow15.c
@@ -0,0 +1,442 @@
+/* Generated file, do not touch */
+
+#include <text/GP_Font.h>
+
+static uint8_t font_glyphs[] = {
+ /* ' ' */ 0, 0, 0, 0, 8,
+ 0x00, 0x00, 0x00,
+ /* '!' */ 1, 11, 3, 11, 8,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80,
+ /* '"' */ 5, 4, 1, 12, 8,
+ 0xd8, 0x48, 0x48, 0x90, 0x00, 0x00, 0x00,
+ /* '#' */ 7, 10, 0, 10, 8,
+ 0x14, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x50, 0x00,
+ /* '$' */ 7, 11, 0, 11, 8,
+ 0x10, 0x7c, 0x92, 0x90, 0x90, 0x7c, 0x12, 0x12, 0x92, 0x7c, 0x10,
+ /* '%' */ 7, 11, 0, 11, 8,
+ 0x62, 0x92, 0x94, 0x68, 0x08, 0x10, 0x20, 0x2c, 0x52, 0x92, 0x8c,
+ /* '&' */ 7, 11, 0, 11, 8,
+ 0x30, 0x48, 0x48, 0x48, 0x30, 0x52, 0x8a, 0x8a, 0x86, 0x84, 0x7a,
+ /* ''' */ 2, 4, 2, 12, 8,
+ 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '(' */ 4, 13, 1, 12, 8,
+ 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x00, 0x00,
+ /* ')' */ 4, 13, 1, 12, 8,
+ 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00,
+ /* '*' */ 5, 6, 1, 9, 8,
+ 0x20, 0xa8, 0x70, 0x70, 0xa8, 0x20, 0x00,
+ /* '+' */ 7, 7, 0, 9, 8,
+ 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10,
+ /* ',' */ 2, 4, 2, 3, 8,
+ 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '-' */ 5, 1, 1, 6, 8,
+ 0xf8, 0x00, 0x00,
+ /* '.' */ 2, 2, 2, 2, 8,
+ 0xc0, 0xc0, 0x00,
+ /* '/' */ 6, 11, 0, 11, 8,
+ 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80,
+ /* '0' */ 6, 11, 0, 11, 8,
+ 0x30, 0x48, 0x84, 0x84, 0x94, 0xb4, 0xa4, 0x84, 0x84, 0x48, 0x30,
+ /* '1' */ 4, 11, 1, 11, 8,
+ 0x30, 0x50, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ /* '2' */ 5, 11, 1, 11, 8,
+ 0x70, 0x88, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xf8,
+ /* '3' */ 5, 11, 1, 11, 8,
+ 0x70, 0x88, 0x08, 0x08, 0x08, 0x30, 0x08, 0x08, 0x08, 0x88, 0x70,
+ /* '4' */ 6, 11, 1, 11, 8,
+ 0x08, 0x18, 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08,
+ /* '5' */ 5, 11, 1, 11, 8,
+ 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70,
+ /* '6' */ 5, 11, 1, 11, 8,
+ 0x70, 0x88, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
+ /* '7' */ 5, 11, 1, 11, 8,
+ 0xf8, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40,
+ /* '8' */ 5, 11, 1, 11, 8,
+ 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
+ /* '9' */ 5, 11, 1, 11, 8,
+ 0x70, 0x88, 0x88, 0x88, 0x88, 0x78, 0x08, 0x08, 0x08, 0x88, 0x70,
+ /* ':' */ 2, 8, 2, 9, 8,
+ 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* ';' */ 2, 9, 2, 9, 8,
+ 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, 0x00, 0x00,
+ /* '<' */ 5, 9, 0, 10, 8,
+ 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00,
+ /* '=' */ 6, 5, 0, 8, 8,
+ 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00,
+ /* '>' */ 5, 9, 0, 10, 8,
+ 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
+ /* '?' */ 6, 11, 0, 11, 8,
+ 0x78, 0x84, 0x04, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20,
+ /* '@' */ 6, 11, 0, 11, 8,
+ 0x78, 0x84, 0x84, 0x9c, 0xa4, 0xa4, 0xa4, 0x9c, 0x80, 0x80, 0x78,
+ /* 'A' */ 5, 11, 0, 11, 8,
+ 0x20, 0x50, 0x50, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x88,
+ /* 'B' */ 5, 11, 0, 11, 8,
+ 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0,
+ /* 'C' */ 5, 11, 0, 11, 8,
+ 0x70, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70,
+ /* 'D' */ 5, 11, 0, 11, 8,
+ 0xe0, 0x90, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x90, 0xe0,
+ /* 'E' */ 5, 11, 0, 11, 8,
+ 0xf8, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0xf8,
+ /* 'F' */ 5, 11, 0, 11, 8,
+ 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ /* 'G' */ 5, 11, 0, 11, 8,
+ 0x70, 0x88, 0x80, 0x80, 0x80, 0x98, 0x88, 0x88, 0x88, 0x88, 0x70,
+ /* 'H' */ 5, 11, 0, 11, 8,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x88, 0x88,
+ /* 'I' */ 3, 11, 1, 11, 8,
+ 0xe0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0,
+ /* 'J' */ 5, 11, 0, 11, 8,
+ 0xf8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x88, 0x70,
+ /* 'K' */ 5, 11, 0, 11, 8,
+ 0x88, 0x88, 0x90, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x90, 0x88, 0x88,
+ /* 'L' */ 5, 11, 0, 11, 8,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8,
+ /* 'M' */ 5, 11, 0, 11, 8,
+ 0x88, 0xd8, 0xd8, 0xa8, 0xa8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ /* 'N' */ 5, 11, 0, 11, 8,
+ 0x88, 0xc8, 0xc8, 0xa8, 0xa8, 0x98, 0x98, 0x88, 0x88, 0x88, 0x88,
+ /* 'O' */ 5, 11, 0, 11, 8,
+ 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
+ /* 'P' */ 5, 11, 0, 11, 8,
+ 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80,
+ /* 'Q' */ 5, 11, 0, 11, 8,
+ 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68,
+ /* 'R' */ 5, 11, 0, 11, 8,
+ 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x90, 0x90, 0x88, 0x88, 0x88,
+ /* 'S' */ 5, 11, 0, 11, 8,
+ 0x70, 0x88, 0x80, 0x80, 0x40, 0x20, 0x10, 0x08, 0x08, 0x88, 0x70,
+ /* 'T' */ 5, 11, 0, 11, 8,
+ 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ /* 'U' */ 5, 11, 0, 11, 8,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
+ /* 'V' */ 5, 11, 0, 11, 8,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x50, 0x50, 0x20, 0x20,
+ /* 'W' */ 7, 11, 0, 11, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44,
+ /* 'X' */ 5, 11, 0, 11, 8,
+ 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x50, 0x50, 0x88, 0x88, 0x88,
+ /* 'Y' */ 5, 11, 0, 11, 8,
+ 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ /* 'Z' */ 5, 11, 0, 11, 8,
+ 0xf8, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, 0x40, 0x80, 0xf8,
+ /* '[' */ 3, 12, 1, 12, 8,
+ 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, 0x00,
+ /* '\' */ 6, 11, 0, 11, 8,
+ 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04,
+ /* ']' */ 3, 12, 1, 12, 8,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, 0x00,
+ /* '^' */ 5, 4, 1, 11, 8,
+ 0x20, 0x50, 0x50, 0x88, 0x00, 0x00, 0x00,
+ /* '_' */ 6, 1, 0, 1, 8,
+ 0xfc, 0x00, 0x00,
+ /* '`' */ 3, 3, 1, 13, 8,
+ 0x80, 0x40, 0x20,
+ /* 'a' */ 5, 8, 0, 8, 8,
+ 0x70, 0x88, 0x08, 0x78, 0x88, 0x88, 0x98, 0x68, 0x00, 0x00, 0x00,
+ /* 'b' */ 5, 11, 0, 11, 8,
+ 0x80, 0x80, 0x80, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0xc8, 0xb0,
+ /* 'c' */ 5, 8, 0, 8, 8,
+ 0x70, 0x88, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, 0x00, 0x00,
+ /* 'd' */ 5, 11, 0, 11, 8,
+ 0x08, 0x08, 0x08, 0x68, 0x98, 0x88, 0x88, 0x88, 0x88, 0x98, 0x68,
+ /* 'e' */ 5, 8, 0, 8, 8,
+ 0x70, 0x88, 0x88, 0xf8, 0x80, 0x80, 0x88, 0x70, 0x00, 0x00, 0x00,
+ /* 'f' */ 5, 11, 0, 11, 8,
+ 0x38, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ /* 'g' */ 6, 10, 0, 8, 8,
+ 0x7c, 0x88, 0x88, 0x88, 0x70, 0x80, 0x78, 0x84, 0x84, 0x78, 0x00,
+ /* 'h' */ 5, 11, 0, 11, 8,
+ 0x80, 0x80, 0x80, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ /* 'i' */ 5, 11, 0, 11, 8,
+ 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8,
+ /* 'j' */ 5, 13, 0, 11, 8,
+ 0x08, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70, 0x00, 0x00,
+ /* 'k' */ 5, 11, 0, 11, 8,
+ 0x80, 0x80, 0x80, 0x88, 0x90, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x88,
+ /* 'l' */ 5, 11, 0, 11, 8,
+ 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8,
+ /* 'm' */ 5, 8, 0, 8, 8,
+ 0xf0, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, 0x00, 0x00,
+ /* 'n' */ 5, 8, 0, 8, 8,
+ 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00,
+ /* 'o' */ 5, 8, 0, 8, 8,
+ 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00,
+ /* 'p' */ 5, 10, 0, 8, 8,
+ 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0xc8, 0xb0, 0x80, 0x80, 0x00,
+ /* 'q' */ 5, 10, 0, 8, 8,
+ 0x68, 0x98, 0x88, 0x88, 0x88, 0x88, 0x98, 0x68, 0x08, 0x08, 0x00,
+ /* 'r' */ 5, 8, 1, 8, 8,
+ 0xb0, 0xc8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* 's' */ 5, 8, 0, 8, 8,
+ 0x70, 0x88, 0x80, 0x60, 0x10, 0x08, 0x88, 0x70, 0x00, 0x00, 0x00,
+ /* 't' */ 5, 11, 0, 11, 8,
+ 0x40, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x38,
+ /* 'u' */ 5, 8, 0, 8, 8,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x98, 0x68, 0x00, 0x00, 0x00,
+ /* 'v' */ 5, 8, 0, 8, 8,
+ 0x88, 0x88, 0x88, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00,
+ /* 'w' */ 5, 8, 0, 8, 8,
+ 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xa8, 0x50, 0x50, 0x00, 0x00, 0x00,
+ /* 'x' */ 5, 8, 0, 8, 8,
+ 0x88, 0x88, 0x50, 0x20, 0x20, 0x50, 0x88, 0x88, 0x00, 0x00, 0x00,
+ /* 'y' */ 5, 11, 0, 8, 8,
+ 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x40, 0x40, 0x80, 0x80,
+ /* 'z' */ 5, 8, 0, 8, 8,
+ 0xf8, 0x08, 0x10, 0x20, 0x20, 0x40, 0x80, 0xf8, 0x00, 0x00, 0x00,
+ /* '{' */ 3, 13, 2, 12, 8,
+ 0x60, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x80, 0x80, 0x80, 0x60, 0x00, 0x00,
+ /* '|' */ 1, 11, 3, 11, 8,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ /* '}' */ 3, 13, 3, 12, 8,
+ 0xc0, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
+ /* '~' */ 7, 3, 0, 7, 8,
+ 0x60, 0x92, 0x0c,
+};
+
+static struct GP_FontFace font = {
+ .family_name = "HaxorNarrow15",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 13,
+ .descend = 3,
+ .max_glyph_width = 7,
+ .max_glyph_advance = 8,
+ .glyphs = &font_glyphs,
+ .glyph_offsets = {
+ 0x0000, 0x0008, 0x0018, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064,
+ 0x0070, 0x0084, 0x0098, 0x00a4, 0x00b0, 0x00bc, 0x00c4, 0x00cc,
+ 0x00dc, 0x00ec, 0x00fc, 0x010c, 0x011c, 0x012c, 0x013c, 0x014c,
+ 0x015c, 0x016c, 0x017c, 0x018c, 0x019c, 0x01ac, 0x01b8, 0x01c8,
+ 0x01d8, 0x01e8, 0x01f8, 0x0208, 0x0218, 0x0228, 0x0238, 0x0248,
+ 0x0258, 0x0268, 0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8,
+ 0x02d8, 0x02e8, 0x02f8, 0x0308, 0x0318, 0x0328, 0x0338, 0x0348,
+ 0x0358, 0x0368, 0x0378, 0x0388, 0x039c, 0x03ac, 0x03c0, 0x03cc,
+ 0x03d4, 0x03dc, 0x03ec, 0x03fc, 0x040c, 0x041c, 0x042c, 0x043c,
+ 0x044c, 0x045c, 0x046c, 0x0480, 0x0490, 0x04a0, 0x04b0, 0x04c0,
+ 0x04d0, 0x04e0, 0x04f0, 0x0500, 0x0510, 0x0520, 0x0530, 0x0540,
+ 0x0550, 0x0560, 0x0570, 0x0580, 0x0594, 0x05a4, 0x05b8, 0x05c0,
+ }
+};
+
+const struct GP_FontFace *GP_FontHaxorNarrow15 = &font;
+static uint8_t font_bold_glyphs[] = {
+ /* ' ' */ 0, 0, 0, 0, 8,
+ 0x00, 0x00, 0x00,
+ /* '!' */ 2, 11, 3, 11, 8,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0,
+ /* '"' */ 6, 4, 1, 12, 8,
+ 0xfc, 0x6c, 0x6c, 0xd8, 0x00, 0x00, 0x00,
+ /* '#' */ 7, 10, 0, 10, 8,
+ 0x1e, 0x1e, 0x1e, 0x7f, 0x3c, 0x3c, 0xfe, 0x78, 0x78, 0x78, 0x00,
+ /* '$' */ 7, 11, 0, 11, 8,
+ 0x18, 0x7e, 0xdb, 0xd8, 0xd8, 0x7e, 0x1b, 0x1b, 0xdb, 0x7e, 0x18,
+ /* '%' */ 7, 11, 0, 11, 8,
+ 0x73, 0xdb, 0xde, 0x7c, 0x0c, 0x18, 0x30, 0x3e, 0x7b, 0xdb, 0xce,
+ /* '&' */ 7, 11, 0, 11, 8,
+ 0x38, 0x6c, 0x6c, 0x6c, 0x38, 0x7b, 0xcf, 0xcf, 0xc7, 0xc6, 0x7f,
+ /* ''' */ 3, 4, 2, 12, 8,
+ 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+ /* '(' */ 5, 13, 1, 12, 8,
+ 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x18, 0x00, 0x00,
+ /* ')' */ 5, 13, 1, 12, 8,
+ 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, 0x00, 0x00,
+ /* '*' */ 6, 6, 1, 9, 8,
+ 0x30, 0xfc, 0x78, 0x78, 0xfc, 0x30, 0x00,
+ /* '+' */ 7, 7, 0, 9, 8,
+ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18,
+ /* ',' */ 3, 4, 2, 3, 8,
+ 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+ /* '-' */ 6, 1, 1, 6, 8,
+ 0xfc, 0x00, 0x00,
+ /* '.' */ 3, 2, 2, 2, 8,
+ 0xe0, 0xe0, 0x00,
+ /* '/' */ 7, 11, 0, 11, 8,
+ 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0,
+ /* '0' */ 7, 11, 0, 11, 8,
+ 0x38, 0x6c, 0xc6, 0xc6, 0xde, 0xfe, 0xf6, 0xc6, 0xc6, 0x6c, 0x38,
+ /* '1' */ 5, 11, 1, 11, 8,
+ 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ /* '2' */ 6, 11, 1, 11, 8,
+ 0x78, 0xcc, 0x0c, 0x0c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfc,
+ /* '3' */ 6, 11, 1, 11, 8,
+ 0x78, 0xcc, 0x0c, 0x0c, 0x0c, 0x38, 0x0c, 0x0c, 0x0c, 0xcc, 0x78,
+ /* '4' */ 7, 11, 1, 11, 8,
+ 0x0c, 0x1c, 0x1c, 0x3c, 0x6c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c,
+ /* '5' */ 6, 11, 1, 11, 8,
+ 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78,
+ /* '6' */ 6, 11, 1, 11, 8,
+ 0x78, 0xcc, 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78,
+ /* '7' */ 6, 11, 1, 11, 8,
+ 0xfc, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60,
+ /* '8' */ 6, 11, 1, 11, 8,
+ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78,
+ /* '9' */ 6, 11, 1, 11, 8,
+ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78,
+ /* ':' */ 3, 8, 2, 9, 8,
+ 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00,
+ /* ';' */ 3, 9, 2, 9, 8,
+ 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 0xc0, 0x00, 0x00,
+ /* '<' */ 6, 9, 0, 10, 8,
+ 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00,
+ /* '=' */ 7, 5, 0, 8, 8,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
+ /* '>' */ 6, 9, 0, 10, 8,
+ 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00,
+ /* '?' */ 7, 11, 0, 11, 8,
+ 0x7c, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x30, 0x30,
+ /* '@' */ 7, 11, 0, 11, 8,
+ 0x7c, 0xc6, 0xc6, 0xde, 0xf6, 0xf6, 0xf6, 0xde, 0xc0, 0xc0, 0x7c,
+ /* 'A' */ 6, 11, 0, 11, 8,
+ 0x30, 0x78, 0x78, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc,
+ /* 'B' */ 6, 11, 0, 11, 8,
+ 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8,
+ /* 'C' */ 6, 11, 0, 11, 8,
+ 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x78,
+ /* 'D' */ 6, 11, 0, 11, 8,
+ 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0,
+ /* 'E' */ 6, 11, 0, 11, 8,
+ 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc,
+ /* 'F' */ 6, 11, 0, 11, 8,
+ 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
+ /* 'G' */ 6, 11, 0, 11, 8,
+ 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78,
+ /* 'H' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
+ /* 'I' */ 4, 11, 1, 11, 8,
+ 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0,
+ /* 'J' */ 6, 11, 0, 11, 8,
+ 0xfc, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78,
+ /* 'K' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xcc, 0xd8, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xd8, 0xcc, 0xcc,
+ /* 'L' */ 6, 11, 0, 11, 8,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc,
+ /* 'M' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xfc, 0xfc, 0xfc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
+ /* 'N' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xec, 0xec, 0xfc, 0xfc, 0xdc, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc,
+ /* 'O' */ 6, 11, 0, 11, 8,
+ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78,
+ /* 'P' */ 6, 11, 0, 11, 8,
+ 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
+ /* 'Q' */ 6, 11, 0, 11, 8,
+ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xd8, 0x7c,
+ /* 'R' */ 6, 11, 0, 11, 8,
+ 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xd8, 0xd8, 0xcc, 0xcc, 0xcc,
+ /* 'S' */ 6, 11, 0, 11, 8,
+ 0x78, 0xcc, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x0c, 0xcc, 0x78,
+ /* 'T' */ 6, 11, 0, 11, 8,
+ 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ /* 'U' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78,
+ /* 'V' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x78, 0x78, 0x30, 0x30,
+ /* 'W' */ 7, 11, 0, 11, 8,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0x66, 0x66,
+ /* 'X' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xcc, 0x78, 0x78, 0x30, 0x30, 0x78, 0x78, 0xcc, 0xcc, 0xcc,
+ /* 'Y' */ 6, 11, 0, 11, 8,
+ 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ /* 'Z' */ 6, 11, 0, 11, 8,
+ 0xfc, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xfc,
+ /* '[' */ 4, 12, 1, 12, 8,
+ 0xf0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x00, 0x00, 0x00,
+ /* '\' */ 7, 11, 0, 11, 8,
+ 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06,
+ /* ']' */ 4, 12, 1, 12, 8,
+ 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x00, 0x00, 0x00,
+ /* '^' */ 6, 4, 1, 11, 8,
+ 0x30, 0x78, 0x78, 0xcc, 0x00, 0x00, 0x00,
+ /* '_' */ 7, 1, 0, 1, 8,
+ 0xfe, 0x00, 0x00,
+ /* '`' */ 4, 3, 1, 13, 8,
+ 0xc0, 0x60, 0x30,
+ /* 'a' */ 6, 8, 0, 8, 8,
+ 0x78, 0xcc, 0x0c, 0x7c, 0xcc, 0xcc, 0xdc, 0x7c, 0x00, 0x00, 0x00,
+ /* 'b' */ 6, 11, 0, 11, 8,
+ 0xc0, 0xc0, 0xc0, 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xf8,
+ /* 'c' */ 6, 8, 0, 8, 8,
+ 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00,
+ /* 'd' */ 6, 11, 0, 11, 8,
+ 0x0c, 0x0c, 0x0c, 0x7c, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7c,
+ /* 'e' */ 6, 8, 0, 8, 8,
+ 0x78, 0xcc, 0xcc, 0xfc, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00,
+ /* 'f' */ 6, 11, 0, 11, 8,
+ 0x3c, 0x60, 0x60, 0xfc, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
+ /* 'g' */ 7, 10, 0, 8, 8,
+ 0x7e, 0xcc, 0xcc, 0xcc, 0x78, 0xc0, 0x7c, 0xc6, 0xc6, 0x7c, 0x00,
+ /* 'h' */ 6, 11, 0, 11, 8,
+ 0xc0, 0xc0, 0xc0, 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
+ /* 'i' */ 6, 11, 0, 11, 8,
+ 0x30, 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc,
+ /* 'j' */ 6, 13, 0, 11, 8,
+ 0x0c, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, 0x00, 0x00,
+ /* 'k' */ 6, 11, 0, 11, 8,
+ 0xc0, 0xc0, 0xc0, 0xcc, 0xd8, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xcc,
+ /* 'l' */ 6, 11, 0, 11, 8,
+ 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc,
+ /* 'm' */ 6, 8, 0, 8, 8,
+ 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00,
+ /* 'n' */ 6, 8, 0, 8, 8,
+ 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00,
+ /* 'o' */ 6, 8, 0, 8, 8,
+ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00,
+ /* 'p' */ 6, 10, 0, 8, 8,
+ 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xf8, 0xc0, 0xc0, 0x00,
+ /* 'q' */ 6, 10, 0, 8, 8,
+ 0x7c, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7c, 0x0c, 0x0c, 0x00,
+ /* 'r' */ 6, 8, 1, 8, 8,
+ 0xf8, 0xec, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* 's' */ 6, 8, 0, 8, 8,
+ 0x78, 0xcc, 0xc0, 0x70, 0x18, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00,
+ /* 't' */ 6, 11, 0, 11, 8,
+ 0x60, 0x60, 0x60, 0xfc, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x3c,
+ /* 'u' */ 6, 8, 0, 8, 8,
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7c, 0x00, 0x00, 0x00,
+ /* 'v' */ 6, 8, 0, 8, 8,
+ 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x78, 0x30, 0x30, 0x00, 0x00, 0x00,
+ /* 'w' */ 6, 8, 0, 8, 8,
+ 0xcc, 0xcc, 0xcc, 0xfc, 0xfc, 0xfc, 0x78, 0x78, 0x00, 0x00, 0x00,
+ /* 'x' */ 6, 8, 0, 8, 8,
+ 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0xcc, 0xcc, 0x00, 0x00, 0x00,
+ /* 'y' */ 6, 11, 0, 8, 8,
+ 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x30, 0x60, 0x60, 0xc0, 0xc0,
+ /* 'z' */ 6, 8, 0, 8, 8,
+ 0xfc, 0x0c, 0x18, 0x30, 0x30, 0x60, 0xc0, 0xfc, 0x00, 0x00, 0x00,
+ /* '{' */ 4, 13, 2, 12, 8,
+ 0x70, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x70, 0x00, 0x00,
+ /* '|' */ 2, 11, 3, 11, 8,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
+ /* '}' */ 4, 13, 3, 12, 8,
+ 0xe0, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00,
+ /* '~' */ 7, 3, 0, 7, 8,
+ 0x70, 0xdb, 0x0e,
+};
+
+static struct GP_FontFace font_bold = {
+ .family_name = "HaxorNarrowBold15",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 13,
+ .descend = 3,
+ .max_glyph_width = 7,
+ .max_glyph_advance = 8,
+ .glyphs = &font_bold_glyphs,
+ .glyph_offsets = {
+ 0x0000, 0x0008, 0x0018, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064,
+ 0x0070, 0x0084, 0x0098, 0x00a4, 0x00b0, 0x00bc, 0x00c4, 0x00cc,
+ 0x00dc, 0x00ec, 0x00fc, 0x010c, 0x011c, 0x012c, 0x013c, 0x014c,
+ 0x015c, 0x016c, 0x017c, 0x018c, 0x019c, 0x01ac, 0x01b8, 0x01c8,
+ 0x01d8, 0x01e8, 0x01f8, 0x0208, 0x0218, 0x0228, 0x0238, 0x0248,
+ 0x0258, 0x0268, 0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8,
+ 0x02d8, 0x02e8, 0x02f8, 0x0308, 0x0318, 0x0328, 0x0338, 0x0348,
+ 0x0358, 0x0368, 0x0378, 0x0388, 0x039c, 0x03ac, 0x03c0, 0x03cc,
+ 0x03d4, 0x03dc, 0x03ec, 0x03fc, 0x040c, 0x041c, 0x042c, 0x043c,
+ 0x044c, 0x045c, 0x046c, 0x0480, 0x0490, 0x04a0, 0x04b0, 0x04c0,
+ 0x04d0, 0x04e0, 0x04f0, 0x0500, 0x0510, 0x0520, 0x0530, 0x0540,
+ 0x0550, 0x0560, 0x0570, 0x0580, 0x0594, 0x05a4, 0x05b8, 0x05c0,
+ }
+};
+
+const struct GP_FontFace *GP_FontHaxorNarrowBold15 = &font_bold;
diff --git a/libs/text/GP_HaxorNarrow16.c b/libs/text/GP_HaxorNarrow16.c
new file mode 100644
index 000000000000..ee5ad84b7371
--- /dev/null
+++ b/libs/text/GP_HaxorNarrow16.c
@@ -0,0 +1,442 @@
+/* Generated file, do not touch */
+
+#include <text/GP_Font.h>
+
+static uint8_t font_glyphs[] = {
+ /* ' ' */ 0, 0, 0, 0, 9,
+ 0x00, 0x00, 0x00,
+ /* '!' */ 1, 12, 4, 12, 9,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* '"' */ 7, 4, 0, 12, 9,
+ 0xee, 0x22, 0x22, 0x44, 0x00, 0x00, 0x00,
+ /* '#' */ 8, 11, 0, 11, 9,
+ 0x12, 0x12, 0x12, 0x7f, 0x24, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x48,
+ /* '$' */ 7, 12, 0, 12, 9,
+ 0x10, 0x7c, 0x92, 0x90, 0x90, 0x70, 0x1c, 0x12, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, 0x00,
+ /* '%' */ 7, 12, 0, 12, 9,
+ 0x62, 0x92, 0x94, 0x64, 0x08, 0x10, 0x10, 0x20, 0x4c, 0x52, 0x92, 0x8c, 0x00, 0x00, 0x00,
+ /* '&' */ 7, 12, 0, 12, 9,
+ 0x30, 0x48, 0x48, 0x48, 0x30, 0x60, 0xd2, 0x92, 0x8a, 0x8a, 0xc4, 0x7a, 0x00, 0x00, 0x00,
+ /* ''' */ 2, 4, 2, 12, 9,
+ 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '(' */ 4, 14, 1, 13, 9,
+ 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x00,
+ /* ')' */ 4, 14, 1, 13, 9,
+ 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00,
+ /* '*' */ 5, 6, 1, 10, 9,
+ 0x20, 0xa8, 0x70, 0x70, 0xa8, 0x20, 0x00,
+ /* '+' */ 7, 7, 0, 9, 9,
+ 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10,
+ /* ',' */ 2, 4, 2, 3, 9,
+ 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '-' */ 5, 1, 1, 6, 9,
+ 0xf8, 0x00, 0x00,
+ /* '.' */ 2, 3, 2, 3, 9,
+ 0xc0, 0xc0, 0xc0,
+ /* '/' */ 5, 12, 1, 12, 9,
+ 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* '0' */ 7, 12, 0, 12, 9,
+ 0x38, 0x44, 0x82, 0x82, 0x8a, 0x92, 0x92, 0xa2, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00,
+ /* '1' */ 4, 12, 1, 12, 9,
+ 0x30, 0x50, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* '2' */ 6, 12, 1, 12, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfc, 0x00, 0x00, 0x00,
+ /* '3' */ 6, 12, 1, 12, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x04, 0x38, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* '4' */ 6, 12, 1, 12, 9,
+ 0x08, 0x18, 0x18, 0x28, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
+ /* '5' */ 6, 12, 1, 12, 9,
+ 0xfc, 0x80, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* '6' */ 6, 12, 1, 12, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* '7' */ 6, 12, 1, 12, 9,
+ 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00,
+ /* '8' */ 6, 12, 1, 12, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* '9' */ 6, 12, 1, 12, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* ':' */ 2, 8, 3, 9, 9,
+ 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* ';' */ 2, 9, 3, 9, 9,
+ 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, 0x00, 0x00,
+ /* '<' */ 5, 9, 1, 10, 9,
+ 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00,
+ /* '=' */ 6, 5, 0, 8, 9,
+ 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00,
+ /* '>' */ 5, 9, 1, 10, 9,
+ 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
+ /* '?' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00,
+ /* '@' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x9c, 0xa4, 0xa4, 0xa4, 0x9c, 0x80, 0x80, 0x78, 0x00, 0x00, 0x00,
+ /* 'A' */ 6, 12, 0, 12, 9,
+ 0x30, 0x48, 0x48, 0x48, 0x84, 0x84, 0x84, 0xfc, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'B' */ 6, 12, 0, 12, 9,
+ 0xf8, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00, 0x00,
+ /* 'C' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* 'D' */ 6, 12, 0, 12, 9,
+ 0xf0, 0x88, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x88, 0xf0, 0x00, 0x00, 0x00,
+ /* 'E' */ 5, 12, 0, 12, 9,
+ 0xf8, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00, 0x00, 0x00,
+ /* 'F' */ 5, 12, 0, 12, 9,
+ 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* 'G' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x8c, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* 'H' */ 6, 12, 0, 12, 9,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0xfc, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'I' */ 5, 12, 0, 12, 9,
+ 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, 0x00,
+ /* 'J' */ 6, 12, 0, 12, 9,
+ 0xfc, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* 'K' */ 6, 12, 0, 12, 9,
+ 0x84, 0x84, 0x88, 0x90, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x88, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'L' */ 6, 12, 0, 12, 9,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, 0x00,
+ /* 'M' */ 7, 12, 0, 12, 9,
+ 0x82, 0xc6, 0xaa, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00,
+ /* 'N' */ 6, 12, 0, 12, 9,
+ 0x84, 0xc4, 0xa4, 0xa4, 0x94, 0x94, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'O' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* 'P' */ 6, 12, 0, 12, 9,
+ 0xf8, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* 'Q' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x94, 0x88, 0x74, 0x00, 0x00, 0x00,
+ /* 'R' */ 6, 12, 0, 12, 9,
+ 0xf8, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x88, 0x88, 0x88, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'S' */ 6, 12, 0, 12, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x40, 0x30, 0x08, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* 'T' */ 7, 12, 0, 12, 9,
+ 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* 'U' */ 6, 12, 0, 12, 9,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00,
+ /* 'V' */ 7, 12, 0, 12, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* 'W' */ 7, 12, 0, 12, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x00, 0x00, 0x00,
+ /* 'X' */ 7, 12, 0, 12, 9,
+ 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, 0x10, 0x28, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, 0x00,
+ /* 'Y' */ 7, 12, 0, 12, 9,
+ 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* 'Z' */ 6, 12, 0, 12, 9,
+ 0xfc, 0x04, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfc, 0x00, 0x00, 0x00,
+ /* '[' */ 3, 13, 2, 13, 9,
+ 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00,
+ /* '\' */ 5, 12, 1, 12, 9,
+ 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, 0x00,
+ /* ']' */ 3, 13, 2, 13, 9,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00,
+ /* '^' */ 5, 5, 1, 12, 9,
+ 0x20, 0x50, 0x50, 0x88, 0x88, 0x00, 0x00,
+ /* '_' */ 7, 1, 0, 1, 9,
+ 0xfe, 0x00, 0x00,
+ /* '`' */ 3, 3, 1, 13, 9,
+ 0x80, 0x40, 0x20,
+ /* 'a' */ 6, 9, 0, 9, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00,
+ /* 'b' */ 6, 12, 0, 12, 9,
+ 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x00, 0x00, 0x00,
+ /* 'c' */ 6, 9, 0, 9, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00,
+ /* 'd' */ 6, 12, 0, 12, 9,
+ 0x04, 0x04, 0x04, 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00, 0x00,
+ /* 'e' */ 6, 9, 0, 9, 9,
+ 0x78, 0x84, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00,
+ /* 'f' */ 6, 12, 0, 12, 9,
+ 0x1c, 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00,
+ /* 'g' */ 7, 12, 0, 9, 9,
+ 0x7e, 0x84, 0x84, 0x84, 0x78, 0x80, 0x80, 0x7c, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00,
+ /* 'h' */ 6, 12, 0, 12, 9,
+ 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'i' */ 5, 12, 1, 12, 9,
+ 0x20, 0x00, 0x00, 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, 0x00,
+ /* 'j' */ 5, 14, 1, 12, 9,
+ 0x08, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70, 0x00,
+ /* 'k' */ 6, 12, 0, 12, 9,
+ 0x80, 0x80, 0x80, 0x84, 0x88, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x84, 0x84, 0x00, 0x00, 0x00,
+ /* 'l' */ 5, 12, 1, 12, 9,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, 0x00,
+ /* 'm' */ 7, 9, 0, 9, 9,
+ 0xec, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
+ /* 'n' */ 6, 9, 0, 9, 9,
+ 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
+ /* 'o' */ 6, 9, 0, 9, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* 'p' */ 6, 12, 0, 9, 9,
+ 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* 'q' */ 6, 12, 0, 9, 9,
+ 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00,
+ /* 'r' */ 6, 9, 0, 9, 9,
+ 0xb8, 0xc4, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 's' */ 6, 9, 0, 9, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x78, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00,
+ /* 't' */ 6, 12, 0, 12, 9,
+ 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, 0x00,
+ /* 'u' */ 6, 9, 0, 9, 9,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00,
+ /* 'v' */ 7, 9, 0, 9, 9,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x00, 0x00,
+ /* 'w' */ 7, 9, 0, 9, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x00, 0x00,
+ /* 'x' */ 7, 9, 0, 9, 9,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
+ /* 'y' */ 7, 12, 0, 9, 9,
+ 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00,
+ /* 'z' */ 6, 9, 0, 9, 9,
+ 0xfc, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00,
+ /* '{' */ 3, 13, 2, 13, 9,
+ 0x60, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x80, 0x80, 0x80, 0x60, 0x00, 0x00,
+ /* '|' */ 1, 12, 3, 12, 9,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* '}' */ 3, 13, 3, 13, 9,
+ 0xc0, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
+ /* '~' */ 7, 3, 0, 7, 9,
+ 0x60, 0x92, 0x0c,
+};
+
+static struct GP_FontFace font = {
+ .family_name = "HaxorNarrow16",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 15,
+ .descend = 3,
+ .max_glyph_width = 8,
+ .max_glyph_advance = 9,
+ .glyphs = &font_glyphs,
+ .glyph_offsets = {
+ 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074,
+ 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc,
+ 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c,
+ 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204,
+ 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4,
+ 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344,
+ 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4,
+ 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c,
+ 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8,
+ 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590,
+ 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c,
+ 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4,
+ }
+};
+
+const struct GP_FontFace *GP_FontHaxorNarrow16 = &font;
+static uint8_t font_bold_glyphs[] = {
+ /* ' ' */ 0, 0, 0, 0, 9,
+ 0x00, 0x00, 0x00,
+ /* '!' */ 2, 12, 4, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* '"' */ 8, 4, 0, 12, 9,
+ 0xff, 0x33, 0x33, 0x66, 0x00, 0x00, 0x00,
+ /* '#' */ 8, 11, 0, 11, 9,
+ 0x1b, 0x1b, 0x1b, 0x7f, 0x36, 0x36, 0x36, 0xff, 0x6c, 0x6c, 0x6c,
+ /* '$' */ 8, 12, 0, 12, 9,
+ 0x18, 0x7e, 0xdb, 0xd8, 0xd8, 0x78, 0x1e, 0x1b, 0x1b, 0xdb, 0x7e, 0x18, 0x00, 0x00, 0x00,
+ /* '%' */ 8, 12, 0, 12, 9,
+ 0x73, 0xdb, 0xde, 0x76, 0x0c, 0x18, 0x18, 0x30, 0x6e, 0x7b, 0xdb, 0xce, 0x00, 0x00, 0x00,
+ /* '&' */ 8, 12, 0, 12, 9,
+ 0x38, 0x6c, 0x6c, 0x6c, 0x38, 0x70, 0xfb, 0xdb, 0xcf, 0xcf, 0xe6, 0x7f, 0x00, 0x00, 0x00,
+ /* ''' */ 3, 4, 2, 12, 9,
+ 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+ /* '(' */ 5, 14, 1, 13, 9,
+ 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x18, 0x00,
+ /* ')' */ 5, 14, 1, 13, 9,
+ 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, 0x00,
+ /* '*' */ 6, 6, 1, 10, 9,
+ 0x30, 0xfc, 0x78, 0x78, 0xfc, 0x30, 0x00,
+ /* '+' */ 8, 7, 0, 9, 9,
+ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18,
+ /* ',' */ 3, 4, 2, 3, 9,
+ 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+ /* '-' */ 6, 1, 1, 6, 9,
+ 0xfc, 0x00, 0x00,
+ /* '.' */ 3, 3, 2, 3, 9,
+ 0xe0, 0xe0, 0xe0,
+ /* '/' */ 6, 12, 1, 12, 9,
+ 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* '0' */ 8, 12, 0, 12, 9,
+ 0x3c, 0x66, 0xc3, 0xc3, 0xcf, 0xdb, 0xdb, 0xf3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00,
+ /* '1' */ 5, 12, 1, 12, 9,
+ 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
+ /* '2' */ 7, 12, 1, 12, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00,
+ /* '3' */ 7, 12, 1, 12, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* '4' */ 7, 12, 1, 12, 9,
+ 0x0c, 0x1c, 0x1c, 0x3c, 0x3c, 0x6c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00,
+ /* '5' */ 7, 12, 1, 12, 9,
+ 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* '6' */ 7, 12, 1, 12, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* '7' */ 7, 12, 1, 12, 9,
+ 0xfe, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
+ /* '8' */ 7, 12, 1, 12, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* '9' */ 7, 12, 1, 12, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* ':' */ 3, 8, 3, 9, 9,
+ 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00,
+ /* ';' */ 3, 9, 3, 9, 9,
+ 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 0xc0, 0x00, 0x00,
+ /* '<' */ 6, 9, 1, 10, 9,
+ 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00,
+ /* '=' */ 7, 5, 0, 8, 9,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
+ /* '>' */ 6, 9, 1, 10, 9,
+ 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00,
+ /* '?' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00,
+ /* '@' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xf6, 0xf6, 0xf6, 0xde, 0xc0, 0xc0, 0x7c, 0x00, 0x00, 0x00,
+ /* 'A' */ 7, 12, 0, 12, 9,
+ 0x38, 0x6c, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'B' */ 7, 12, 0, 12, 9,
+ 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, 0x00,
+ /* 'C' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* 'D' */ 7, 12, 0, 12, 9,
+ 0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x00, 0x00, 0x00,
+ /* 'E' */ 6, 12, 0, 12, 9,
+ 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0x00, 0x00, 0x00,
+ /* 'F' */ 6, 12, 0, 12, 9,
+ 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* 'G' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xce, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* 'H' */ 7, 12, 0, 12, 9,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'I' */ 6, 12, 0, 12, 9,
+ 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00,
+ /* 'J' */ 7, 12, 0, 12, 9,
+ 0xfe, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* 'K' */ 7, 12, 0, 12, 9,
+ 0xc6, 0xc6, 0xcc, 0xd8, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xcc, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'L' */ 7, 12, 0, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00,
+ /* 'M' */ 8, 12, 0, 12, 9,
+ 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00,
+ /* 'N' */ 7, 12, 0, 12, 9,
+ 0xc6, 0xe6, 0xf6, 0xf6, 0xde, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'O' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* 'P' */ 7, 12, 0, 12, 9,
+ 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* 'Q' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xde, 0xcc, 0x7e, 0x00, 0x00, 0x00,
+ /* 'R' */ 7, 12, 0, 12, 9,
+ 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xcc, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'S' */ 7, 12, 0, 12, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0x60, 0x38, 0x0c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* 'T' */ 8, 12, 0, 12, 9,
+ 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
+ /* 'U' */ 7, 12, 0, 12, 9,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00,
+ /* 'V' */ 8, 12, 0, 12, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00,
+ /* 'W' */ 8, 12, 0, 12, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0x66, 0x66, 0x00, 0x00, 0x00,
+ /* 'X' */ 8, 12, 0, 12, 9,
+ 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00,
+ /* 'Y' */ 8, 12, 0, 12, 9,
+ 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
+ /* 'Z' */ 7, 12, 0, 12, 9,
+ 0xfe, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00,
+ /* '[' */ 4, 13, 2, 13, 9,
+ 0xf0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x00, 0x00,
+ /* '\' */ 6, 12, 1, 12, 9,
+ 0xc0, 0xc0, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, 0x00,
+ /* ']' */ 4, 13, 2, 13, 9,
+ 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x00, 0x00,
+ /* '^' */ 6, 5, 1, 12, 9,
+ 0x30, 0x78, 0x78, 0xcc, 0xcc, 0x00, 0x00,
+ /* '_' */ 8, 1, 0, 1, 9,
+ 0xff, 0x00, 0x00,
+ /* '`' */ 4, 3, 1, 13, 9,
+ 0xc0, 0x60, 0x30,
+ /* 'a' */ 7, 9, 0, 9, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x7e, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00,
+ /* 'b' */ 7, 12, 0, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0x00, 0x00, 0x00,
+ /* 'c' */ 7, 9, 0, 9, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00,
+ /* 'd' */ 7, 12, 0, 12, 9,
+ 0x06, 0x06, 0x06, 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00, 0x00,
+ /* 'e' */ 7, 9, 0, 9, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00,
+ /* 'f' */ 7, 12, 0, 12, 9,
+ 0x1e, 0x30, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
+ /* 'g' */ 8, 12, 0, 9, 9,
+ 0x7f, 0xc6, 0xc6, 0xc6, 0x7c, 0xc0, 0xc0, 0x7e, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00,
+ /* 'h' */ 7, 12, 0, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'i' */ 6, 12, 1, 12, 9,
+ 0x30, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00,
+ /* 'j' */ 6, 14, 1, 12, 9,
+ 0x0c, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, 0x00,
+ /* 'k' */ 7, 12, 0, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xc6, 0xcc, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc6, 0x00, 0x00, 0x00,
+ /* 'l' */ 6, 12, 1, 12, 9,
+ 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00,
+ /* 'm' */ 8, 9, 0, 9, 9,
+ 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00,
+ /* 'n' */ 7, 9, 0, 9, 9,
+ 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00,
+ /* 'o' */ 7, 9, 0, 9, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,
+ /* 'p' */ 7, 12, 0, 9, 9,
+ 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* 'q' */ 7, 12, 0, 9, 9,
+ 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00,
+ /* 'r' */ 7, 9, 0, 9, 9,
+ 0xfc, 0xe6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00,
+ /* 's' */ 7, 9, 0, 9, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00,
+ /* 't' */ 7, 12, 0, 12, 9,
+ 0x30, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x00, 0x00,
+ /* 'u' */ 7, 9, 0, 9, 9,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00,
+ /* 'v' */ 8, 9, 0, 9, 9,
+ 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00,
+ /* 'w' */ 8, 9, 0, 9, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xff, 0xff, 0x66, 0x66, 0x00, 0x00,
+ /* 'x' */ 8, 9, 0, 9, 9,
+ 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'y' */ 8, 12, 0, 9, 9,
+ 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00,
+ /* 'z' */ 7, 9, 0, 9, 9,
+ 0xfe, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x60, 0xc0, 0xfe, 0x00, 0x00,
+ /* '{' */ 4, 13, 2, 13, 9,
+ 0x70, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x70, 0x00, 0x00,
+ /* '|' */ 2, 12, 3, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* '}' */ 4, 13, 3, 13, 9,
+ 0xe0, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00,
+ /* '~' */ 8, 3, 0, 7, 9,
+ 0x70, 0xdb, 0x0e,
+};
+
+static struct GP_FontFace font_bold = {
+ .family_name = "HaxorNarrowBold16",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 15,
+ .descend = 3,
+ .max_glyph_width = 8,
+ .max_glyph_advance = 9,
+ .glyphs = &font_bold_glyphs,
+ .glyph_offsets = {
+ 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074,
+ 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc,
+ 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c,
+ 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204,
+ 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4,
+ 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344,
+ 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4,
+ 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c,
+ 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8,
+ 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590,
+ 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c,
+ 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4,
+ }
+};
+
+const struct GP_FontFace *GP_FontHaxorNarrowBold16 = &font_bold;
diff --git a/libs/text/GP_HaxorNarrow17.c b/libs/text/GP_HaxorNarrow17.c
new file mode 100644
index 000000000000..46d3d9bbdfad
--- /dev/null
+++ b/libs/text/GP_HaxorNarrow17.c
@@ -0,0 +1,442 @@
+/* Generated file, do not touch */
+
+#include <text/GP_Font.h>
+
+static uint8_t font_glyphs[] = {
+ /* ' ' */ 0, 0, 0, 0, 9,
+ 0x00, 0x00, 0x00,
+ /* '!' */ 1, 13, 4, 13, 9,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00,
+ /* '"' */ 7, 4, 0, 13, 9,
+ 0xee, 0x22, 0x22, 0x44, 0x00, 0x00, 0x00,
+ /* '#' */ 8, 11, 0, 11, 9,
+ 0x12, 0x12, 0x12, 0x7f, 0x24, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x48,
+ /* '$' */ 7, 13, 0, 13, 9,
+ 0x10, 0x7c, 0x92, 0x90, 0x90, 0x50, 0x38, 0x14, 0x12, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
+ /* '%' */ 7, 13, 0, 13, 9,
+ 0x62, 0x92, 0x94, 0x64, 0x08, 0x08, 0x10, 0x20, 0x20, 0x4c, 0x52, 0x92, 0x8c, 0x00, 0x00,
+ /* '&' */ 7, 13, 0, 13, 9,
+ 0x38, 0x44, 0x44, 0x44, 0x48, 0x30, 0x60, 0xd2, 0x92, 0x8a, 0x8a, 0xc4, 0x7a, 0x00, 0x00,
+ /* ''' */ 2, 4, 2, 13, 9,
+ 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '(' */ 4, 15, 1, 14, 9,
+ 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10,
+ /* ')' */ 4, 15, 1, 14, 9,
+ 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80,
+ /* '*' */ 5, 6, 1, 10, 9,
+ 0x20, 0xa8, 0x70, 0x70, 0xa8, 0x20, 0x00,
+ /* '+' */ 7, 7, 0, 10, 9,
+ 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10,
+ /* ',' */ 2, 4, 2, 3, 9,
+ 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '-' */ 5, 1, 1, 7, 9,
+ 0xf8, 0x00, 0x00,
+ /* '.' */ 2, 3, 2, 3, 9,
+ 0xc0, 0xc0, 0xc0,
+ /* '/' */ 5, 13, 1, 13, 9,
+ 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* '0' */ 7, 13, 0, 13, 9,
+ 0x38, 0x44, 0x82, 0x82, 0x82, 0x8a, 0x92, 0xa2, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
+ /* '1' */ 4, 13, 1, 13, 9,
+ 0x30, 0x50, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* '2' */ 6, 13, 1, 13, 9,
+ 0x78, 0x84, 0x84, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* '3' */ 6, 13, 1, 13, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x04, 0x38, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00,
+ /* '4' */ 7, 13, 0, 13, 9,
+ 0x04, 0x0c, 0x0c, 0x14, 0x24, 0x24, 0x44, 0x84, 0xfe, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
+ /* '5' */ 6, 13, 1, 13, 9,
+ 0xfc, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00,
+ /* '6' */ 6, 13, 1, 13, 9,
+ 0x78, 0x84, 0x80, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '7' */ 7, 13, 0, 13, 9,
+ 0xfe, 0x02, 0x02, 0x04, 0x04, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
+ /* '8' */ 6, 13, 1, 13, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '9' */ 6, 13, 1, 13, 9,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00,
+ /* ':' */ 2, 8, 3, 10, 9,
+ 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* ';' */ 2, 9, 3, 10, 9,
+ 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, 0x00, 0x00,
+ /* '<' */ 7, 9, 0, 11, 9,
+ 0x02, 0x0c, 0x10, 0x60, 0x80, 0x60, 0x10, 0x0c, 0x02, 0x00, 0x00,
+ /* '=' */ 7, 5, 0, 9, 9,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
+ /* '>' */ 7, 9, 0, 11, 9,
+ 0x80, 0x60, 0x10, 0x0c, 0x02, 0x0c, 0x10, 0x60, 0x80, 0x00, 0x00,
+ /* '?' */ 6, 13, 1, 13, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00,
+ /* '@' */ 7, 13, 0, 13, 9,
+ 0x38, 0x44, 0x82, 0x82, 0x9e, 0xa2, 0xa2, 0xa2, 0xa2, 0x9c, 0x80, 0x42, 0x3c, 0x00, 0x00,
+ /* 'A' */ 7, 13, 0, 13, 9,
+ 0x10, 0x28, 0x28, 0x44, 0x44, 0x44, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'B' */ 7, 13, 0, 13, 9,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
+ /* 'C' */ 7, 13, 0, 13, 9,
+ 0x3c, 0x42, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x42, 0x3c, 0x00, 0x00,
+ /* 'D' */ 7, 13, 0, 13, 9,
+ 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
+ /* 'E' */ 6, 13, 0, 13, 9,
+ 0xfc, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* 'F' */ 6, 13, 0, 13, 9,
+ 0xfc, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'G' */ 7, 13, 0, 13, 9,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x8e, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'H' */ 7, 13, 0, 13, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'I' */ 5, 13, 1, 13, 9,
+ 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
+ /* 'J' */ 7, 13, 0, 13, 9,
+ 0xfe, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'K' */ 7, 13, 0, 13, 9,
+ 0x84, 0x84, 0x88, 0x90, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x88, 0x84, 0x84, 0x82, 0x00, 0x00,
+ /* 'L' */ 7, 13, 0, 13, 9,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'M' */ 7, 13, 0, 13, 9,
+ 0x82, 0xc6, 0xaa, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'N' */ 7, 13, 0, 13, 9,
+ 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'O' */ 7, 13, 0, 13, 9,
+ 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
+ /* 'P' */ 7, 13, 0, 13, 9,
+ 0xf8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'Q' */ 7, 13, 0, 13, 9,
+ 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x8a, 0x44, 0x3a, 0x00, 0x00,
+ /* 'R' */ 7, 13, 0, 13, 9,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x84, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'S' */ 7, 13, 0, 13, 9,
+ 0x38, 0x44, 0x82, 0x80, 0x80, 0x40, 0x38, 0x04, 0x02, 0x02, 0x82, 0x44, 0x38, 0x00, 0x00,
+ /* 'T' */ 7, 13, 0, 13, 9,
+ 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'U' */ 7, 13, 0, 13, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
+ /* 'V' */ 7, 13, 0, 13, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
+ /* 'W' */ 7, 13, 0, 13, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x00, 0x00,
+ /* 'X' */ 7, 13, 0, 13, 9,
+ 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00,
+ /* 'Y' */ 7, 13, 0, 13, 9,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'Z' */ 7, 13, 0, 13, 9,
+ 0xfe, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* '[' */ 3, 13, 2, 13, 9,
+ 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00,
+ /* '\' */ 5, 13, 1, 13, 9,
+ 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00,
+ /* ']' */ 3, 13, 2, 13, 9,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00,
+ /* '^' */ 7, 4, 0, 13, 9,
+ 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00,
+ /* '_' */ 8, 1, 0, 1, 9,
+ 0xff, 0x00, 0x00,
+ /* '`' */ 3, 3, 1, 13, 9,
+ 0x80, 0x40, 0x20,
+ /* 'a' */ 6, 10, 1, 10, 9,
+ 0x78, 0x84, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00,
+ /* 'b' */ 6, 13, 1, 13, 9,
+ 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x00, 0x00,
+ /* 'c' */ 6, 10, 1, 10, 9,
+ 0x38, 0x44, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x44, 0x38, 0x00,
+ /* 'd' */ 6, 13, 1, 13, 9,
+ 0x04, 0x04, 0x04, 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00,
+ /* 'e' */ 6, 10, 1, 10, 9,
+ 0x78, 0x84, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00,
+ /* 'f' */ 7, 13, 0, 13, 9,
+ 0x1c, 0x22, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
+ /* 'g' */ 7, 13, 0, 10, 9,
+ 0x7e, 0x84, 0x84, 0x84, 0x84, 0x78, 0x80, 0x80, 0x7c, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'h' */ 6, 13, 1, 13, 9,
+ 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
+ /* 'i' */ 5, 13, 2, 13, 9,
+ 0x20, 0x00, 0x00, 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
+ /* 'j' */ 5, 15, 1, 13, 9,
+ 0x08, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70,
+ /* 'k' */ 6, 13, 1, 13, 9,
+ 0x80, 0x80, 0x80, 0x84, 0x88, 0x90, 0xa0, 0xc0, 0xe0, 0x90, 0x88, 0x84, 0x84, 0x00, 0x00,
+ /* 'l' */ 5, 13, 2, 13, 9,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
+ /* 'm' */ 7, 10, 0, 10, 9,
+ 0xec, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00,
+ /* 'n' */ 6, 10, 1, 10, 9,
+ 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00,
+ /* 'o' */ 7, 10, 0, 10, 9,
+ 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00,
+ /* 'p' */ 6, 13, 1, 10, 9,
+ 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'q' */ 6, 13, 1, 10, 9,
+ 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x04, 0x04, 0x04, 0x00, 0x00,
+ /* 'r' */ 6, 10, 1, 10, 9,
+ 0xb8, 0xc4, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+ /* 's' */ 7, 10, 0, 10, 9,
+ 0x3c, 0x42, 0x40, 0x40, 0x30, 0x0c, 0x02, 0x02, 0x82, 0x7c, 0x00,
+ /* 't' */ 7, 13, 0, 13, 9,
+ 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00,
+ /* 'u' */ 6, 10, 1, 10, 9,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00,
+ /* 'v' */ 7, 10, 0, 10, 9,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x00,
+ /* 'w' */ 7, 10, 0, 10, 9,
+ 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x00,
+ /* 'x' */ 7, 10, 0, 10, 9,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00,
+ /* 'y' */ 7, 13, 0, 10, 9,
+ 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00,
+ /* 'z' */ 7, 10, 0, 10, 9,
+ 0xfe, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00,
+ /* '{' */ 3, 13, 2, 13, 9,
+ 0x60, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x80, 0x80, 0x80, 0x60, 0x00, 0x00,
+ /* '|' */ 1, 12, 3, 12, 9,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
+ /* '}' */ 3, 13, 3, 13, 9,
+ 0xc0, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
+ /* '~' */ 7, 3, 0, 7, 9,
+ 0x60, 0x92, 0x0c,
+};
+
+static struct GP_FontFace font = {
+ .family_name = "HaxorNarrow17",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 16,
+ .descend = 3,
+ .max_glyph_width = 8,
+ .max_glyph_advance = 9,
+ .glyphs = &font_glyphs,
+ .glyph_offsets = {
+ 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074,
+ 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc,
+ 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c,
+ 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204,
+ 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4,
+ 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344,
+ 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4,
+ 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c,
+ 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8,
+ 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590,
+ 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c,
+ 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4,
+ }
+};
+
+const struct GP_FontFace *GP_FontHaxorNarrow17 = &font;
+static uint8_t font_bold_glyphs[] = {
+ /* ' ' */ 0, 0, 0, 0, 9,
+ 0x00, 0x00, 0x00,
+ /* '!' */ 2, 13, 4, 13, 9,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00,
+ /* '"' */ 8, 4, 0, 13, 9,
+ 0xff, 0x33, 0x33, 0x66, 0x00, 0x00, 0x00,
+ /* '#' */ 8, 11, 0, 11, 9,
+ 0x1b, 0x1b, 0x1b, 0x7f, 0x36, 0x36, 0x36, 0xff, 0x6c, 0x6c, 0x6c,
+ /* '$' */ 8, 13, 0, 13, 9,
+ 0x18, 0x7e, 0xdb, 0xd8, 0xd8, 0x78, 0x3c, 0x1e, 0x1b, 0x1b, 0xdb, 0x7e, 0x18, 0x00, 0x00,
+ /* '%' */ 8, 13, 0, 13, 9,
+ 0x73, 0xdb, 0xde, 0x76, 0x0c, 0x0c, 0x18, 0x30, 0x30, 0x6e, 0x7b, 0xdb, 0xce, 0x00, 0x00,
+ /* '&' */ 8, 13, 0, 13, 9,
+ 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x38, 0x70, 0xfb, 0xdb, 0xcf, 0xcf, 0xe6, 0x7f, 0x00, 0x00,
+ /* ''' */ 3, 4, 2, 13, 9,
+ 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+ /* '(' */ 5, 15, 1, 14, 9,
+ 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x18,
+ /* ')' */ 5, 15, 1, 14, 9,
+ 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0,
+ /* '*' */ 6, 6, 1, 10, 9,
+ 0x30, 0xfc, 0x78, 0x78, 0xfc, 0x30, 0x00,
+ /* '+' */ 8, 7, 0, 10, 9,
+ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18,
+ /* ',' */ 3, 4, 2, 3, 9,
+ 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
+ /* '-' */ 6, 1, 1, 7, 9,
+ 0xfc, 0x00, 0x00,
+ /* '.' */ 3, 3, 2, 3, 9,
+ 0xe0, 0xe0, 0xe0,
+ /* '/' */ 6, 13, 1, 13, 9,
+ 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x00, 0x00,
+ /* '0' */ 8, 13, 0, 13, 9,
+ 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xcf, 0xdb, 0xf3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00,
+ /* '1' */ 5, 13, 1, 13, 9,
+ 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
+ /* '2' */ 7, 13, 1, 13, 9,
+ 0x7c, 0xc6, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00,
+ /* '3' */ 7, 13, 1, 13, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00,
+ /* '4' */ 8, 13, 0, 13, 9,
+ 0x06, 0x0e, 0x0e, 0x1e, 0x36, 0x36, 0x66, 0xc6, 0xff, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00,
+ /* '5' */ 7, 13, 1, 13, 9,
+ 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00,
+ /* '6' */ 7, 13, 1, 13, 9,
+ 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,
+ /* '7' */ 8, 13, 0, 13, 9,
+ 0xff, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00,
+ /* '8' */ 7, 13, 1, 13, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00,
+ /* '9' */ 7, 13, 1, 13, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00,
+ /* ':' */ 3, 8, 3, 10, 9,
+ 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00,
+ /* ';' */ 3, 9, 3, 10, 9,
+ 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 0xc0, 0x00, 0x00,
+ /* '<' */ 8, 9, 0, 11, 9,
+ 0x03, 0x0e, 0x18, 0x70, 0xc0, 0x70, 0x18, 0x0e, 0x03, 0x00, 0x00,
+ /* '=' */ 8, 5, 0, 9, 9,
+ 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
+ /* '>' */ 8, 9, 0, 11, 9,
+ 0xc0, 0x70, 0x18, 0x0e, 0x03, 0x0e, 0x18, 0x70, 0xc0, 0x00, 0x00,
+ /* '?' */ 7, 13, 1, 13, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00,
+ /* '@' */ 8, 13, 0, 13, 9,
+ 0x3c, 0x66, 0xc3, 0xc3, 0xdf, 0xf3, 0xf3, 0xf3, 0xf3, 0xde, 0xc0, 0x63, 0x3e, 0x00, 0x00,
+ /* 'A' */ 8, 13, 0, 13, 9,
+ 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'B' */ 8, 13, 0, 13, 9,
+ 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0x00, 0x00,
+ /* 'C' */ 8, 13, 0, 13, 9,
+ 0x3e, 0x63, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x63, 0x3e, 0x00, 0x00,
+ /* 'D' */ 8, 13, 0, 13, 9,
+ 0xfc, 0xc6, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc6, 0xfc, 0x00, 0x00,
+ /* 'E' */ 7, 13, 0, 13, 9,
+ 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00,
+ /* 'F' */ 7, 13, 0, 13, 9,
+ 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00,
+ /* 'G' */ 8, 13, 0, 13, 9,
+ 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcf, 0xc3, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00,
+ /* 'H' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'I' */ 6, 13, 1, 13, 9,
+ 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00,
+ /* 'J' */ 8, 13, 0, 13, 9,
+ 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xc3, 0xc3, 0x7e, 0x00, 0x00,
+ /* 'K' */ 8, 13, 0, 13, 9,
+ 0xc6, 0xc6, 0xcc, 0xd8, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xcc, 0xc6, 0xc6, 0xc3, 0x00, 0x00,
+ /* 'L' */ 8, 13, 0, 13, 9,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00,
+ /* 'M' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'N' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xe3, 0xf3, 0xf3, 0xdb, 0xcf, 0xcf, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'O' */ 8, 13, 0, 13, 9,
+ 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00,
+ /* 'P' */ 8, 13, 0, 13, 9,
+ 0xfc, 0xc6, 0xc3, 0xc3, 0xc3, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00,
+ /* 'Q' */ 8, 13, 0, 13, 9,
+ 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xcf, 0x66, 0x3f, 0x00, 0x00,
+ /* 'R' */ 8, 13, 0, 13, 9,
+ 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xcc, 0xc6, 0xc6, 0xc3, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'S' */ 8, 13, 0, 13, 9,
+ 0x3c, 0x66, 0xc3, 0xc0, 0xc0, 0x60, 0x3c, 0x06, 0x03, 0x03, 0xc3, 0x66, 0x3c, 0x00, 0x00,
+ /* 'T' */ 8, 13, 0, 13, 9,
+ 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
+ /* 'U' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00,
+ /* 'V' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00,
+ /* 'W' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0xff, 0x66, 0x66, 0x00, 0x00,
+ /* 'X' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00,
+ /* 'Y' */ 8, 13, 0, 13, 9,
+ 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
+ /* 'Z' */ 8, 13, 0, 13, 9,
+ 0xff, 0x03, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xff, 0x00, 0x00,
+ /* '[' */ 4, 13, 2, 13, 9,
+ 0xf0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x00, 0x00,
+ /* '\' */ 6, 13, 1, 13, 9,
+ 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00,
+ /* ']' */ 4, 13, 2, 13, 9,
+ 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x00, 0x00,
+ /* '^' */ 8, 4, 0, 13, 9,
+ 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00,
+ /* '_' */ 8, 1, 0, 1, 9,
+ 0xff, 0x00, 0x00,
+ /* '`' */ 4, 3, 1, 13, 9,
+ 0xc0, 0x60, 0x30,
+ /* 'a' */ 7, 10, 1, 10, 9,
+ 0x7c, 0xc6, 0x06, 0x06, 0x7e, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00,
+ /* 'b' */ 7, 13, 1, 13, 9,
+ 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0x00, 0x00,
+ /* 'c' */ 7, 10, 1, 10, 9,
+ 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00,
+ /* 'd' */ 7, 13, 1, 13, 9,
+ 0x06, 0x06, 0x06, 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00,
+ /* 'e' */ 7, 10, 1, 10, 9,
+ 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00,
+ /* 'f' */ 8, 13, 0, 13, 9,
+ 0x1e, 0x33, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00,
+ /* 'g' */ 8, 13, 0, 10, 9,
+ 0x7f, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc0, 0xc0, 0x7e, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00,
+ /* 'h' */ 7, 13, 1, 13, 9,
+ 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00,
+ /* 'i' */ 6, 13, 2, 13, 9,
+ 0x30, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00,
+ /* 'j' */ 6, 15, 1, 13, 9,
+ 0x0c, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78,
+ /* 'k' */ 7, 13, 1, 13, 9,
+ 0xc0, 0xc0, 0xc0, 0xc6, 0xcc, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc6, 0x00, 0x00,
+ /* 'l' */ 6, 13, 2, 13, 9,
+ 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00,
+ /* 'm' */ 8, 10, 0, 10, 9,
+ 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00,
+ /* 'n' */ 7, 10, 1, 10, 9,
+ 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00,
+ /* 'o' */ 8, 10, 0, 10, 9,
+ 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00,
+ /* 'p' */ 7, 13, 1, 10, 9,
+ 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00,
+ /* 'q' */ 7, 13, 1, 10, 9,
+ 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00,
+ /* 'r' */ 7, 10, 1, 10, 9,
+ 0xfc, 0xe6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00,
+ /* 's' */ 8, 10, 0, 10, 9,
+ 0x3e, 0x63, 0x60, 0x60, 0x38, 0x0e, 0x03, 0x03, 0xc3, 0x7e, 0x00,
+ /* 't' */ 8, 13, 0, 13, 9,
+ 0x30, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00,
+ /* 'u' */ 7, 10, 1, 10, 9,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00,
+ /* 'v' */ 8, 10, 0, 10, 9,
+ 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x00,
+ /* 'w' */ 8, 10, 0, 10, 9,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0x66, 0x66, 0x00,
+ /* 'x' */ 8, 10, 0, 10, 9,
+ 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x66, 0xc3, 0xc3, 0x00,
+ /* 'y' */ 8, 13, 0, 10, 9,
+ 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00,
+ /* 'z' */ 8, 10, 0, 10, 9,
+ 0xff, 0x03, 0x06, 0x0c, 0x18, 0x18, 0x30, 0x60, 0xc0, 0xff, 0x00,
+ /* '{' */ 4, 13, 2, 13, 9,
+ 0x70, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x70, 0x00, 0x00,
+ /* '|' */ 2, 12, 3, 12, 9,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
+ /* '}' */ 4, 13, 3, 13, 9,
+ 0xe0, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00,
+ /* '~' */ 8, 3, 0, 7, 9,
+ 0x70, 0xdb, 0x0e,
+};
+
+static struct GP_FontFace font_bold = {
+ .family_name = "HaxorNarrowBold17",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 16,
+ .descend = 3,
+ .max_glyph_width = 8,
+ .max_glyph_advance = 9,
+ .glyphs = &font_bold_glyphs,
+ .glyph_offsets = {
+ 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074,
+ 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc,
+ 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c,
+ 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204,
+ 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4,
+ 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344,
+ 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4,
+ 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c,
+ 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8,
+ 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590,
+ 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c,
+ 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4,
+ }
+};
+
+const struct GP_FontFace *GP_FontHaxorNarrowBold17 = &font_bold;
diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t
index 189cf7f2f031..4e06be6cc5e5 100644
--- a/libs/text/GP_Text.gen.c.t
+++ b/libs/text/GP_Text.gen.c.t
@@ -56,8 +56,8 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle *
int start_x = x + (i + glyph->bearing_x) * x_mul;
- if (p == str)
- start_x -= glyph->bearing_x * x_mul;
+ //if (p == str)
+ // start_x -= glyph->bearing_x * x_mul;
int start_y = y - (glyph->bearing_y - style->font->ascend) * y_mul;
-----------------------------------------------------------------------
Summary of changes:
build/syms/Text_symbols.txt | 6 +
configure | 3 +
demos/Makefile | 4 +
demos/termini/.gitignore | 1 +
demos/{particle => termini}/Makefile | 10 +-
demos/{ttf2img => termini}/runtest.sh | 0
demos/termini/termini.c | 612 ++++++++++++++++++++++++++
include/text/GP_Font.h | 9 +-
include/text/GP_Fonts.h | 12 +
libs/text/GP_HaxorNarrow15.c | 442 +++++++++++++++++++
libs/text/GP_HaxorNarrow16.c | 442 +++++++++++++++++++
libs/text/GP_HaxorNarrow17.c | 442 +++++++++++++++++++
libs/text/GP_Text.gen.c.t | 4 +-
13 files changed, 1978 insertions(+), 9 deletions(-)
create mode 100644 demos/termini/.gitignore
copy demos/{particle => termini}/Makefile (57%)
copy demos/{ttf2img => termini}/runtest.sh (100%)
create mode 100644 demos/termini/termini.c
create mode 100644 libs/text/GP_HaxorNarrow15.c
create mode 100644 libs/text/GP_HaxorNarrow16.c
create mode 100644 libs/text/GP_HaxorNarrow17.c
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
29 Sep '17
This is an automated email generated because a ref change occurred in the
git repository for project gfxprim.git.
The branch, master has been updated
discards 68ca236236dffbd3fbb303802e6824f747d3cc50 (commit)
discards c97efe2001dac56f7f16079c6ae1ada635262ff2 (commit)
discards e0e66873d593fa879e90c19fb6c521f4bfc63ca2 (commit)
discards 112167d6829f8dd4d26491ff63e0a8c4887061df (commit)
via edf5e7cc9c3fece148b15f59939164d9017de42f (commit)
via f00e352e51f3f7988c2a8f544eca87b996b51a1a (commit)
via 98cd4f682a77e56eea48dbcd85336c5073deb00c (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (68ca236236dffbd3fbb303802e6824f747d3cc50)
\
N -- N -- N (edf5e7cc9c3fece148b15f59939164d9017de42f)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit edf5e7cc9c3fece148b15f59939164d9017de42f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 11:09:42 +0200
URL: <http://repo.or.cz/gfxprim.git/edf5e7cc9c3fece1>
text/GP_Text.gen.c.t: Optimize 1BPP font drawing
Calling a HLine() function from the inner loop was a bad idea after all.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/text/GP_Text.gen.c.t | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t
index 209d00defd07..189cf7f2f031 100644
--- a/libs/text/GP_Text.gen.c.t
+++ b/libs/text/GP_Text.gen.c.t
@@ -38,7 +38,7 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle *
if (glyph == NULL)
glyph = GP_GetGlyphBitmap(style->font, ' ');
- int i, j, k;
+ int i, j, k, l;
unsigned int x_mul = style->pixel_xmul + style->pixel_xspace;
unsigned int y_mul = style->pixel_ymul + style->pixel_yspace;
@@ -51,17 +51,25 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle *
for (i = 0; i < glyph->width; i++) {
uint8_t bit = (glyph->bitmap[i/8 + j * bpp]) & (0x80>>(i%8));
- unsigned int x_start = x + (i + glyph->bearing_x) * x_mul;
+ if (!bit)
+ continue;
+
+ int start_x = x + (i + glyph->bearing_x) * x_mul;
if (p == str)
- x_start -= glyph->bearing_x * x_mul;
+ start_x -= glyph->bearing_x * x_mul;
- if (!bit)
- continue;
+ int start_y = y - (glyph->bearing_y - style->font->ascend) * y_mul;
- for (k = 0; k < style->pixel_ymul; k++)
- GP_HLine(pixmap, x_start, x_start + style->pixel_xmul - 1,
- y - (glyph->bearing_y - style->font->ascend) * y_mul + k, fg);
+ for (k = start_y; k < start_y + style->pixel_ymul; k++) {
+ for (l = start_x; l < start_x + style->pixel_xmul; l++) {
+ int px = l;
+ int py = k;
+ GP_TRANSFORM_POINT(pixmap, px, py);
+ if (!GP_PIXEL_IS_CLIPPED(pixmap, px, py))
+ GP_PutPixel_Raw_{{ pt.pixelsize.suffix }}(pixmap, px, py, fg);
+ }
+ }
}
y += style->pixel_ymul + style->pixel_yspace;
commit f00e352e51f3f7988c2a8f544eca87b996b51a1a
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 11:08:49 +0200
URL: <http://repo.or.cz/gfxprim.git/f00e352e51f3f798>
fonts/GP_DefaultFont: Whitespace cleanup.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/text/GP_DefaultFont.c | 876 ++++++++++++++++++-------------------
1 file changed, 438 insertions(+), 438 deletions(-)
rewrite libs/text/GP_DefaultFont.c (82%)
diff --git a/libs/text/GP_DefaultFont.c b/libs/text/GP_DefaultFont.c
dissimilarity index 82%
index d67fa99e9e9b..5dd67b182890 100644
--- a/libs/text/GP_DefaultFont.c
+++ b/libs/text/GP_DefaultFont.c
@@ -1,438 +1,438 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include "GP_Font.h"
-
-static int8_t default_console_glyphs[] = {
- /* ' ' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '!' */ 7, 11, 0, 9, 8,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
- /* '"' */ 7, 11, 0, 9, 8,
- 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '#' */ 7, 11, 0, 9, 8,
- 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00,
- /* '$' */ 7, 11, 0, 9, 8,
- 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
- /* '%' */ 7, 11, 0, 9, 8,
- 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
- /* '&' */ 7, 11, 0, 9, 8,
- 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
- /* ''' */ 7, 11, 0, 9, 8,
- 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '(' */ 7, 11, 0, 9, 8,
- 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00,
- /* ')' */ 7, 11, 0, 9, 8,
- 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
- /* '*' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00,
- /* '+' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- /* ',' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00,
- /* '-' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '.' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- /* '/' */ 7, 11, 0, 9, 8,
- 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00,
- /* '0' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
- /* '1' */ 7, 11, 1, 9, 8,
- 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
- /* '2' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
- /* '3' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '4' */ 7, 11, 1, 9, 8,
- 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
- /* '5' */ 7, 11, 1, 9, 8,
- 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '6' */ 7, 11, 1, 9, 8,
- 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '7' */ 7, 11, 1, 9, 8,
- 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* '8' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '9' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
- /* ':' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- /* ';' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00,
- /* '<' */ 7, 11, 0, 9, 8,
- 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
- /* '=' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
- /* '>' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00,
- /* '?' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
- /* '@' */ 8, 11, 0, 9, 8,
- 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
- /* 'A' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'B' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
- /* 'C' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
- /* 'D' */ 7, 11, 0, 9, 8,
- 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
- /* 'E' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
- /* 'F' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'G' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'H' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'I' */ 7, 11, 0, 9, 8,
- 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
- /* 'J' */ 7, 11, 0, 9, 8,
- 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'K' */ 7, 11, 0, 9, 8,
- 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'L' */ 7, 11, 0, 9, 8,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
- /* 'M' */ 7, 11, 0, 9, 8,
- 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'N' */ 7, 11, 0, 9, 8,
- 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
- /* 'O' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'P' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'Q' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
- /* 'R' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'S' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'T' */ 7, 11, 0, 9, 8,
- 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'U' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'V' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
- /* 'W' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
- /* 'X' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
- /* 'Y' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'Z' */ 7, 11, 0, 9, 8,
- 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
- /* '[' */ 7, 11, 0, 9, 8,
- 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00,
- /* '\' */ 7, 11, 0, 9, 8,
- 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00,
- /* ']' */ 7, 11, 0, 9, 8,
- 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00,
- /* '^' */ 7, 11, 0, 9, 8,
- 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '_' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
- /* '`' */ 7, 11, 0, 9, 8,
- 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* 'a' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00,
- /* 'b' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00,
- /* 'c' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00,
- /* 'd' */ 7, 11, 0, 9, 8,
- 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
- /* 'e' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00,
- /* 'f' */ 7, 11, 0, 9, 8,
- 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
- /* 'g' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
- /* 'h' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
- /* 'i' */ 7, 11, 0, 9, 8,
- 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00,
- /* 'j' */ 7, 11, 0, 9, 8,
- 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70,
- /* 'k' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
- /* 'l' */ 7, 11, 0, 9, 8,
- 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
- /* 'm' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
- /* 'n' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
- /* 'o' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00,
- /* 'p' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40,
- /* 'q' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02,
- /* 'r' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
- /* 's' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
- /* 't' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
- /* 'u' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
- /* 'v' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
- /* 'w' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
- /* 'x' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00,
- /* 'y' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
- /* 'z' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00,
- /* '{' */ 7, 11, 0, 9, 8,
- 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00,
- /* '|' */ 7, 11, 0, 9, 8,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
- /* '}' */ 7, 11, 0, 9, 8,
- 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00,
- /* '~' */ 7, 11, 0, 9, 8,
- 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-struct GP_FontFace GP_DefaultConsoleFont = {
- .family_name = "Gfxprim",
- .style_name = "Mono",
- .charset = GP_CHARSET_7BIT,
- .ascend = 9,
- .descend = 2,
- .max_glyph_width = 8,
- .max_glyph_advance = 8,
- .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
- .glyphs = default_console_glyphs,
- .glyph_offsets = {16},
-};
-
-static uint8_t default_proportional_glyphs[] = {
- /* ' ' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '!' */ 4, 11, 0, 9, 6,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00,
- /* '"' */ 8, 11, 0, 9, 9,
- 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '#' */ 8, 11, 0, 9, 9,
- 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00,
- /* '$' */ 7, 11, 0, 9, 8,
- 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
- /* '%' */ 7, 11, 0, 9, 8,
- 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
- /* '&' */ 7, 11, 0, 9, 8,
- 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
- /* ''' */ 4, 11, 0, 9, 5,
- 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '(' */ 2, 11, 0, 9, 4,
- 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00,
- /* ')' */ 2, 11, 0, 9, 4,
- 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00,
- /* '*' */ 5, 11, 0, 9, 6,
- 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00,
- /* '+' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- /* ',' */ 4, 11, 0, 9, 6,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00,
- /* '-' */ 4, 11, 0, 9, 6,
- 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '.' */ 4, 11, 0, 9, 6,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- /* '/' */ 5, 11, 0, 9, 6,
- 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00,
- /* '0' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
- /* '1' */ 6, 11, 0, 9, 7,
- 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
- /* '2' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
- /* '3' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '4' */ 6, 11, 0, 9, 7,
- 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
- /* '5' */ 6, 11, 0, 9, 7,
- 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '6' */ 6, 11, 0, 9, 7,
- 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '7' */ 6, 11, 0, 9, 7,
- 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* '8' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '9' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
- /* ':' */ 4, 11, 0, 9, 5,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- /* ';' */ 4, 11, 0, 9, 5,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00,
- /* '<' */ 4, 11, 0, 9, 6,
- 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00,
- /* '=' */ 5, 11, 0, 9, 6,
- 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
- /* '>' */ 4, 11, 0, 9, 6,
- 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
- /* '?' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
- /* '@' */ 8, 11, 0, 9, 9,
- 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
- /* 'A' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'B' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
- /* 'C' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
- /* 'D' */ 7, 11, 0, 9, 8,
- 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
- /* 'E' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
- /* 'F' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'G' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'H' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'I' */ 1, 11, 0, 9, 2,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'J' */ 7, 11, 0, 9, 8,
- 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'K' */ 7, 11, 0, 9, 8,
- 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'L' */ 6, 11, 0, 9, 7,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00,
- /* 'M' */ 7, 11, 0, 9, 8,
- 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'N' */ 7, 11, 0, 9, 8,
- 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
- /* 'O' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'P' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'Q' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
- /* 'R' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'S' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'T' */ 7, 11, 0, 9, 8,
- 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'U' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'V' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
- /* 'W' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
- /* 'X' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
- /* 'Y' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'Z' */ 7, 11, 0, 9, 8,
- 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
- /* '[' */ 3, 11, 0, 9, 4,
- 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00,
- /* '\' */ 5, 11, 0, 9, 6,
- 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00,
- /* ']' */ 3, 11, 0, 9, 4,
- 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00,
- /* '^' */ 8, 11, 0, 9, 9,
- 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '_' */ 8, 11, 0, 9, 9,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
- /* '`' */ 2, 11, 0, 9, 3,
- 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* 'a' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00,
- /* 'b' */ 6, 11, 0, 9, 7,
- 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00,
- /* 'c' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00,
- /* 'd' */ 6, 11, 0, 9, 7,
- 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
- /* 'e' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00,
- /* 'f' */ 6, 11, 0, 9, 7,
- 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
- /* 'g' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
- /* 'h' */ 6, 11, 0, 9, 7,
- 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
- /* 'i' */ 2, 11, 0, 9, 4,
- 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
- /* 'j' */ 3, 11, 0, 9, 4,
- 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0,
- /* 'k' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
- /* 'l' */ 4, 11, 0, 9, 5,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00,
- /* 'm' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
- /* 'n' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
- /* 'o' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* 'p' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80,
- /* 'q' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04,
- /* 'r' */ 5, 11, 0, 9, 6,
- 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 's' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
- /* 't' */ 6, 11, 0, 9, 7,
- 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00,
- /* 'u' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
- /* 'v' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00,
- /* 'w' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
- /* 'x' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00,
- /* 'y' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
- /* 'z' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00,
- /* '{' */ 5, 11, 0, 9, 6,
- 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00,
- /* '|' */ 1, 11, 0, 9, 2,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* '}' */ 5, 11, 0, 9, 6,
- 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
- /* '~' */ 6, 11, 0, 9, 7,
- 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-struct GP_FontFace GP_DefaultProportionalFont = {
- .family_name = "Gfxprim",
- .style_name = "Proportional",
- .charset = GP_CHARSET_7BIT,
- .ascend = 9,
- .descend = 2,
- .max_glyph_width = 9,
- .max_glyph_advance = 9,
- .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
- .glyphs = default_proportional_glyphs,
- .glyph_offsets = {16},
-};
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * <jiri.bluebear.dluhos(a)gmail.com> *
+ * *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include "GP_Font.h"
+
+static int8_t default_console_glyphs[] = {
+ /* ' ' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '!' */ 7, 11, 0, 9, 8,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
+ /* '"' */ 7, 11, 0, 9, 8,
+ 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '#' */ 7, 11, 0, 9, 8,
+ 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00,
+ /* '$' */ 7, 11, 0, 9, 8,
+ 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
+ /* '%' */ 7, 11, 0, 9, 8,
+ 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
+ /* '&' */ 7, 11, 0, 9, 8,
+ 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
+ /* ''' */ 7, 11, 0, 9, 8,
+ 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '(' */ 7, 11, 0, 9, 8,
+ 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00,
+ /* ')' */ 7, 11, 0, 9, 8,
+ 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
+ /* '*' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00,
+ /* '+' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* ',' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00,
+ /* '-' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '.' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+ /* '/' */ 7, 11, 0, 9, 8,
+ 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00,
+ /* '0' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
+ /* '1' */ 7, 11, 1, 9, 8,
+ 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+ /* '2' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* '3' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '4' */ 7, 11, 1, 9, 8,
+ 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
+ /* '5' */ 7, 11, 1, 9, 8,
+ 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '6' */ 7, 11, 1, 9, 8,
+ 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '7' */ 7, 11, 1, 9, 8,
+ 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* '8' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '9' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
+ /* ':' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+ /* ';' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00,
+ /* '<' */ 7, 11, 0, 9, 8,
+ 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
+ /* '=' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
+ /* '>' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00,
+ /* '?' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
+ /* '@' */ 8, 11, 0, 9, 8,
+ 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
+ /* 'A' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'B' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
+ /* 'C' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
+ /* 'D' */ 7, 11, 0, 9, 8,
+ 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
+ /* 'E' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'F' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'G' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'H' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'I' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+ /* 'J' */ 7, 11, 0, 9, 8,
+ 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'K' */ 7, 11, 0, 9, 8,
+ 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'L' */ 7, 11, 0, 9, 8,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'M' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'N' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
+ /* 'O' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'P' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'Q' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
+ /* 'R' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'S' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'T' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'U' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'V' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
+ /* 'W' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
+ /* 'X' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
+ /* 'Y' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'Z' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
+ /* '[' */ 7, 11, 0, 9, 8,
+ 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00,
+ /* '\' */ 7, 11, 0, 9, 8,
+ 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00,
+ /* ']' */ 7, 11, 0, 9, 8,
+ 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00,
+ /* '^' */ 7, 11, 0, 9, 8,
+ 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '_' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
+ /* '`' */ 7, 11, 0, 9, 8,
+ 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* 'a' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00,
+ /* 'b' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00,
+ /* 'c' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00,
+ /* 'd' */ 7, 11, 0, 9, 8,
+ 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
+ /* 'e' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00,
+ /* 'f' */ 7, 11, 0, 9, 8,
+ 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
+ /* 'g' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
+ /* 'h' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
+ /* 'i' */ 7, 11, 0, 9, 8,
+ 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00,
+ /* 'j' */ 7, 11, 0, 9, 8,
+ 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70,
+ /* 'k' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
+ /* 'l' */ 7, 11, 0, 9, 8,
+ 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
+ /* 'm' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
+ /* 'n' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
+ /* 'o' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00,
+ /* 'p' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40,
+ /* 'q' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02,
+ /* 'r' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
+ /* 's' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
+ /* 't' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
+ /* 'u' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
+ /* 'v' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
+ /* 'w' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
+ /* 'x' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00,
+ /* 'y' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
+ /* 'z' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00,
+ /* '{' */ 7, 11, 0, 9, 8,
+ 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00,
+ /* '|' */ 7, 11, 0, 9, 8,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
+ /* '}' */ 7, 11, 0, 9, 8,
+ 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00,
+ /* '~' */ 7, 11, 0, 9, 8,
+ 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+struct GP_FontFace GP_DefaultConsoleFont = {
+ .family_name = "Gfxprim",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 9,
+ .descend = 2,
+ .max_glyph_width = 8,
+ .max_glyph_advance = 8,
+ .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
+ .glyphs = default_console_glyphs,
+ .glyph_offsets = {16},
+};
+
+static uint8_t default_proportional_glyphs[] = {
+ /* ' ' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '!' */ 4, 11, 0, 9, 6,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00,
+ /* '"' */ 8, 11, 0, 9, 9,
+ 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '#' */ 8, 11, 0, 9, 9,
+ 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00,
+ /* '$' */ 7, 11, 0, 9, 8,
+ 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
+ /* '%' */ 7, 11, 0, 9, 8,
+ 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
+ /* '&' */ 7, 11, 0, 9, 8,
+ 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
+ /* ''' */ 4, 11, 0, 9, 5,
+ 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '(' */ 2, 11, 0, 9, 4,
+ 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00,
+ /* ')' */ 2, 11, 0, 9, 4,
+ 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00,
+ /* '*' */ 5, 11, 0, 9, 6,
+ 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00,
+ /* '+' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* ',' */ 4, 11, 0, 9, 6,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00,
+ /* '-' */ 4, 11, 0, 9, 6,
+ 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '.' */ 4, 11, 0, 9, 6,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
+ /* '/' */ 5, 11, 0, 9, 6,
+ 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00,
+ /* '0' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
+ /* '1' */ 6, 11, 0, 9, 7,
+ 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
+ /* '2' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* '3' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '4' */ 6, 11, 0, 9, 7,
+ 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
+ /* '5' */ 6, 11, 0, 9, 7,
+ 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '6' */ 6, 11, 0, 9, 7,
+ 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '7' */ 6, 11, 0, 9, 7,
+ 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* '8' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '9' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
+ /* ':' */ 4, 11, 0, 9, 5,
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
+ /* ';' */ 4, 11, 0, 9, 5,
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00,
+ /* '<' */ 4, 11, 0, 9, 6,
+ 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00,
+ /* '=' */ 5, 11, 0, 9, 6,
+ 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
+ /* '>' */ 4, 11, 0, 9, 6,
+ 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '?' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
+ /* '@' */ 8, 11, 0, 9, 9,
+ 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
+ /* 'A' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'B' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
+ /* 'C' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
+ /* 'D' */ 7, 11, 0, 9, 8,
+ 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
+ /* 'E' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'F' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'G' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'H' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'I' */ 1, 11, 0, 9, 2,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'J' */ 7, 11, 0, 9, 8,
+ 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'K' */ 7, 11, 0, 9, 8,
+ 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'L' */ 6, 11, 0, 9, 7,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* 'M' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'N' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
+ /* 'O' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'P' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'Q' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
+ /* 'R' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'S' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'T' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'U' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'V' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
+ /* 'W' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
+ /* 'X' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
+ /* 'Y' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'Z' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
+ /* '[' */ 3, 11, 0, 9, 4,
+ 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00,
+ /* '\' */ 5, 11, 0, 9, 6,
+ 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00,
+ /* ']' */ 3, 11, 0, 9, 4,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00,
+ /* '^' */ 8, 11, 0, 9, 9,
+ 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '_' */ 8, 11, 0, 9, 9,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
+ /* '`' */ 2, 11, 0, 9, 3,
+ 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* 'a' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00,
+ /* 'b' */ 6, 11, 0, 9, 7,
+ 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00,
+ /* 'c' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00,
+ /* 'd' */ 6, 11, 0, 9, 7,
+ 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
+ /* 'e' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00,
+ /* 'f' */ 6, 11, 0, 9, 7,
+ 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
+ /* 'g' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
+ /* 'h' */ 6, 11, 0, 9, 7,
+ 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
+ /* 'i' */ 2, 11, 0, 9, 4,
+ 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
+ /* 'j' */ 3, 11, 0, 9, 4,
+ 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0,
+ /* 'k' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
+ /* 'l' */ 4, 11, 0, 9, 5,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00,
+ /* 'm' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
+ /* 'n' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
+ /* 'o' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* 'p' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80,
+ /* 'q' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04,
+ /* 'r' */ 5, 11, 0, 9, 6,
+ 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 's' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
+ /* 't' */ 6, 11, 0, 9, 7,
+ 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00,
+ /* 'u' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
+ /* 'v' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00,
+ /* 'w' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
+ /* 'x' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00,
+ /* 'y' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
+ /* 'z' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00,
+ /* '{' */ 5, 11, 0, 9, 6,
+ 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00,
+ /* '|' */ 1, 11, 0, 9, 2,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* '}' */ 5, 11, 0, 9, 6,
+ 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
+ /* '~' */ 6, 11, 0, 9, 7,
+ 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+struct GP_FontFace GP_DefaultProportionalFont = {
+ .family_name = "Gfxprim",
+ .style_name = "Proportional",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 9,
+ .descend = 2,
+ .max_glyph_width = 9,
+ .max_glyph_advance = 9,
+ .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
+ .glyphs = default_proportional_glyphs,
+ .glyph_offsets = {16},
+};
commit 98cd4f682a77e56eea48dbcd85336c5073deb00c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 10:54:22 +0200
URL: <http://repo.or.cz/gfxprim.git/98cd4f682a77e56e>
Rename GP_Context -> GP_Pixmap
This should have been done long long time ago.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/syms/Backend_symbols.txt | 2 +-
build/syms/Core_symbols.txt | 26 +--
demos/bogoman/bogoman.c | 14 +-
demos/bogoman/bogoman_render.c | 98 ++++----
demos/bogoman/bogoman_render.h | 6 +-
demos/c_simple/SDL_glue.c | 18 +-
demos/c_simple/backend_example.c | 12 +-
demos/c_simple/backend_timers_example.c | 6 +-
demos/c_simple/blittest.c | 32 +--
demos/c_simple/convolution.c | 2 +-
demos/c_simple/debug_handler.c | 6 +-
demos/c_simple/fileview.c | 16 +-
demos/c_simple/filters_symmetry.c | 6 +-
demos/c_simple/fonttest.c | 26 +--
demos/c_simple/gaussian_noise.c | 4 +-
demos/c_simple/gfx_koch.c | 12 +-
demos/c_simple/input_example.c | 12 +-
demos/c_simple/koch.c | 36 +--
demos/c_simple/linetest.c | 22 +-
demos/c_simple/loaders.c | 2 +-
demos/c_simple/loaders_example.c | 2 +-
demos/c_simple/loaders_register.c | 4 +-
demos/c_simple/memory_io.c | 6 +-
demos/c_simple/pretty_print.c | 8 +-
demos/c_simple/randomshapetest.c | 58 ++---
demos/c_simple/shapetest.c | 40 ++--
demos/c_simple/showimage.c | 12 +-
demos/c_simple/sin_AA.c | 24 +-
demos/c_simple/textaligntest.c | 42 ++--
demos/c_simple/v4l2_show.c | 12 +-
demos/c_simple/virtual_backend_example.c | 42 ++--
demos/c_simple/weighted_median.c | 4 +-
demos/c_simple/x11_windows.c | 18 +-
demos/c_simple/zip_container.c | 14 +-
demos/grinder/grinder.c | 78 +++----
demos/grinder/histogram.c | 6 +-
demos/grinder/histogram.h | 2 +-
demos/particle/particle_demo.c | 18 +-
demos/particle/space.c | 42 ++--
demos/particle/space.h | 2 +-
demos/py_simple/backends.py | 2 +-
demos/py_simple/blit.py | 8 +-
demos/py_simple/cam_view.py | 2 +-
demos/py_simple/font_style.py | 2 +-
demos/py_simple/gfx.py | 78 +++----
demos/py_simple/gravplots_AA.py | 16 +-
demos/py_simple/showimage.py | 2 +-
demos/py_simple/sinplots_AA.py | 10 +-
demos/py_simple/x11_windows.py | 2 +-
demos/spiv/image_cache.c | 32 +--
demos/spiv/image_cache.h | 8 +-
demos/spiv/image_loader.c | 10 +-
demos/spiv/image_loader.h | 4 +-
demos/spiv/spiv.c | 134 +++++------
demos/spiv/spiv_help.c | 6 +-
demos/ttf2img/ttf2img.c | 14 +-
doc/Makefile | 2 +-
doc/about.txt | 2 +-
doc/backends.txt | 20 +-
doc/backends_python.txt | 4 +-
doc/blits.txt | 24 +-
doc/coding_style.txt | 8 +-
doc/convert.txt | 8 +-
doc/core.txt | 6 +-
doc/core_python.txt | 34 +--
doc/debug.txt | 2 +-
doc/environment_variables.txt | 6 +-
doc/example_SDL_glue.txt | 2 +-
doc/filters.txt | 218 ++++++++---------
doc/filters_dithering.txt | 16 +-
doc/filters_resize.txt | 28 +--
doc/gamma.txt | 2 +-
doc/get_put_pixel.txt | 22 +-
doc/gfx.txt | 56 ++---
doc/gfx_python.txt | 48 ++--
doc/grabbers.txt | 4 +-
doc/images/regen.py | 8 +-
doc/loaders.txt | 200 ++++++++--------
doc/loaders_python.txt | 2 +-
doc/{context.txt => pixmap.txt} | 146 ++++++------
doc/text.txt | 6 +-
include/backends/GP_Backend.h | 14 +-
.../{GP_SDL_Context.h => GP_SDL_Pixmap.h} | 18 +-
include/core/GP_Blit.h | 36 +--
include/core/GP_Convert.gen.h.t | 2 +-
include/core/GP_Convert.h | 26 +--
include/core/GP_Core.h | 4 +-
include/core/GP_Debug.h | 2 +-
include/core/GP_Fill.h | 4 +-
include/core/GP_FnPerBpp.h | 20 +-
include/core/GP_Gamma.h | 4 +-
include/core/GP_GammaCorrection.h | 2 +-
include/core/GP_GammaPixel.gen.h.t | 2 +-
include/core/GP_GetPutPixel.gen.h.t | 16 +-
include/core/GP_GetPutPixel.h | 36 +--
include/core/GP_MixPixels.gen.h.t | 26 +--
include/core/GP_Pixel.gen.h.t | 4 +-
include/core/GP_Pixel.h | 4 +-
include/core/{GP_Context.h => GP_Pixmap.h} | 136 +++++------
include/core/GP_Transform.h | 90 +++----
include/filters/GP_ApplyTables.h | 10 +-
include/filters/GP_Arithmetic.h | 50 ++--
include/filters/GP_Blur.h | 10 +-
include/filters/GP_Convolution.h | 12 +-
include/filters/GP_Dither.h | 12 +-
include/filters/GP_EdgeDetection.h | 8 +-
include/filters/GP_Filter.h | 2 +-
include/filters/GP_Filters.h | 2 +-
include/filters/GP_GaussianNoise.h | 14 +-
include/filters/GP_Laplace.h | 8 +-
include/filters/GP_Linear.h | 22 +-
include/filters/GP_Median.h | 12 +-
include/filters/GP_MultiTone.h | 12 +-
include/filters/GP_Point.h | 56 ++---
include/filters/GP_Resize.h | 8 +-
include/filters/GP_ResizeCubic.h | 8 +-
include/filters/GP_ResizeLinear.h | 8 +-
include/filters/GP_ResizeNN.h | 4 +-
include/filters/GP_Rotate.h | 38 +--
include/filters/GP_Sepia.h | 12 +-
include/filters/GP_Sigma.h | 12 +-
include/filters/GP_Stats.h | 2 +-
include/filters/GP_WeightedMedian.h | 12 +-
include/gfx/GP_Arc.h | 6 +-
include/gfx/GP_Circle.h | 18 +-
include/gfx/GP_CircleSeg.h | 10 +-
include/gfx/GP_Ellipse.h | 10 +-
include/gfx/GP_Gfx.h | 2 +-
include/gfx/GP_HLine.gen.h.t | 2 +-
include/gfx/GP_HLine.h | 18 +-
include/gfx/GP_HLineAA.h | 10 +-
include/gfx/GP_Line.h | 6 +-
include/gfx/GP_LineAA.h | 10 +-
include/gfx/GP_Polygon.h | 10 +-
include/gfx/GP_PutPixelAA.h | 14 +-
include/gfx/GP_Rect.h | 34 +--
include/gfx/GP_Tetragon.h | 10 +-
include/gfx/GP_Triangle.h | 10 +-
include/gfx/GP_VLine.gen.h.t | 2 +-
include/gfx/GP_VLine.h | 18 +-
include/gfx/GP_VLineAA.h | 10 +-
include/grabbers/GP_Grabber.h | 6 +-
include/loaders/GP_BMP.h | 12 +-
include/loaders/GP_Container.h | 14 +-
include/loaders/GP_GIF.h | 6 +-
include/loaders/GP_JP2.h | 8 +-
include/loaders/GP_JPG.h | 12 +-
include/loaders/GP_Loader.h | 30 +--
include/loaders/GP_Loaders.h | 2 +-
include/loaders/GP_PCX.h | 8 +-
include/loaders/GP_PNG.h | 14 +-
include/loaders/GP_PNM.h | 32 +--
include/loaders/GP_PSD.h | 8 +-
include/loaders/GP_PSP.h | 10 +-
include/loaders/GP_TIFF.h | 12 +-
include/loaders/GP_ZIP.h | 2 +-
include/text/GP_Text.h | 20 +-
libs/backends/GP_AALib.c | 14 +-
libs/backends/GP_Backend.c | 14 +-
libs/backends/GP_BackendVirtual.c | 30 +--
libs/backends/GP_LinuxFB.c | 40 ++--
libs/backends/GP_SDL.c | 38 +--
libs/backends/GP_X11.c | 46 ++--
libs/backends/GP_X11_Win.h | 2 +-
libs/core/GP_Blit.c | 66 +++---
libs/core/GP_Blit.gen.c.t | 38 +--
libs/core/GP_Context.c | 220 +++++++++---------
libs/core/GP_Fill.gen.c.t | 8 +-
libs/core/GP_GetPutPixel.c | 16 +-
libs/filters/GP_ApplyTables.c | 10 +-
libs/filters/GP_ApplyTables.gen.c.t | 10 +-
libs/filters/GP_Blur.c | 16 +-
libs/filters/GP_Convolution.c | 10 +-
libs/filters/GP_Edge.c | 30 +--
libs/filters/GP_FloydSteinberg.gen.c.t | 16 +-
libs/filters/GP_GaussianNoise.gen.c.t | 20 +-
libs/filters/GP_HilbertPeano.gen.c.t | 16 +-
libs/filters/GP_Histogram.gen.c.t | 8 +-
libs/filters/GP_Laplace.c | 16 +-
libs/filters/GP_LinearConvolution.c | 6 +-
libs/filters/GP_LinearConvolution.gen.c.t | 26 +--
libs/filters/GP_Median.c | 16 +-
libs/filters/GP_MirrorH.gen.c.t | 18 +-
libs/filters/GP_MultiTone.gen.c.t | 18 +-
libs/filters/GP_Resize.c | 12 +-
libs/filters/GP_ResizeCubic.gen.c.t | 10 +-
libs/filters/GP_ResizeCubicFloat.c | 4 +-
libs/filters/GP_ResizeLinear.gen.c.t | 14 +-
libs/filters/GP_ResizeNN.gen.c.t | 8 +-
libs/filters/GP_Rotate.c | 16 +-
libs/filters/GP_Rotate.gen.c.t | 48 ++--
libs/filters/GP_Sepia.c | 6 +-
libs/filters/GP_Sigma.c | 16 +-
libs/filters/GP_WeightedMedian.c | 16 +-
libs/filters/arithmetic_filter.t | 22 +-
libs/filters/point_filter.t | 10 +-
libs/gfx/GP_Arc.c | 16 +-
libs/gfx/GP_Circle.c | 42 ++--
libs/gfx/GP_CircleSeg.c | 38 +--
libs/gfx/GP_Ellipse.c | 16 +-
libs/gfx/GP_FillCircle.gen.c.t | 22 +-
libs/gfx/GP_FillEllipse.gen.c.t | 24 +-
libs/gfx/GP_HLine.c | 36 +--
libs/gfx/GP_HLine.gen.c.t | 10 +-
libs/gfx/GP_HLineAA.c | 28 +--
libs/gfx/GP_HLineAA.gen.c.t | 16 +-
libs/gfx/GP_Line.gen.c.t | 38 +--
libs/gfx/GP_LineAA.c | 16 +-
libs/gfx/GP_LineAA.gen.c.t | 40 ++--
libs/gfx/GP_PartialEllipse.c | 16 +-
libs/gfx/GP_Polygon.c | 24 +-
libs/gfx/GP_PutPixelAA.gen.c.t | 22 +-
libs/gfx/GP_Rect.c | 54 ++---
libs/gfx/GP_Tetragon.c | 44 ++--
libs/gfx/GP_Triangle.c | 36 +--
libs/gfx/GP_VLine.c | 42 ++--
libs/gfx/GP_VLine.gen.c.t | 4 +-
libs/gfx/GP_VLineAA.c | 28 +--
libs/gfx/GP_VLineAA.gen.c.t | 16 +-
libs/gfx/algo/Arc.algo.h | 24 +-
libs/gfx/algo/Circle.algo.h | 26 +--
libs/gfx/algo/CircleSeg.algo.h | 26 +--
libs/gfx/algo/Ellipse.algo.h | 28 +--
libs/gfx/algo/FillRing.algo.h | 20 +-
libs/gfx/algo/FillTriangle.algo.h | 10 +-
libs/gfx/algo/PartialEllipse.algo.h | 16 +-
libs/grabbers/GP_V4L2.c | 8 +-
libs/loaders/GP_BMP.c | 48 ++--
libs/loaders/GP_BMP_RLE.h | 12 +-
libs/loaders/GP_Container.c | 2 +-
libs/loaders/GP_GIF.c | 16 +-
libs/loaders/GP_JP2.c | 14 +-
libs/loaders/GP_JPG.c | 30 +--
libs/loaders/GP_Loader.c | 28 +--
libs/loaders/GP_PCX.c | 24 +-
libs/loaders/GP_PNG.c | 26 +--
libs/loaders/GP_PNM.c | 188 +++++++--------
libs/loaders/GP_PSD.c | 32 +--
libs/loaders/GP_PSP.c | 10 +-
libs/loaders/GP_TIFF.c | 30 +--
libs/loaders/GP_ZIP.c | 12 +-
libs/text/GP_Text.c | 22 +-
libs/text/GP_Text.gen.c.t | 46 ++--
pylib/gfxprim/__init__.py | 6 +-
pylib/gfxprim/backends/__init__.py | 2 +-
pylib/gfxprim/backends/_extend_backend.py | 2 +-
pylib/gfxprim/core/__init__.py | 124 +++++-----
pylib/gfxprim/core/core.i | 86 +++----
pylib/gfxprim/filters/__init__.py | 12 +-
pylib/gfxprim/gfx/__init__.py | 16 +-
pylib/gfxprim/gfx/gfx.i | 8 +-
pylib/gfxprim/loaders/__init__.py | 6 +-
pylib/gfxprim/text/__init__.py | 12 +-
tests/afl/loaders.c | 4 +-
tests/core/.gitignore | 2 +-
tests/core/BlitClipped.c | 14 +-
tests/core/BlitConv.gen.c.t | 26 +--
tests/core/GetPutPixel.gen.c.t | 28 +--
tests/core/Makefile | 4 +-
tests/core/{Context.c => Pixmap.c} | 142 +++++------
tests/core/runtest.sh | 2 +-
tests/core/test_list.txt | 2 +-
tests/drivers/framebuffer_test.c | 34 +--
tests/filters/APICoverage.gen.c.t | 100 ++++----
tests/filters/FilterMirrorH.c | 30 +--
tests/filters/FiltersCompare.gen.c.t | 22 +-
tests/filters/LinearConvolution.c | 10 +-
tests/filters/common.c | 4 +-
tests/filters/common.h | 6 +-
tests/gfx/APICoverage.gen.c.t | 42 ++--
tests/gfx/Circle.c | 8 +-
tests/gfx/CircleSeg.c | 8 +-
tests/gfx/Ellipse.c | 8 +-
tests/gfx/FillCircle.c | 8 +-
tests/gfx/FillEllipse.c | 8 +-
tests/gfx/FillRect.c | 28 +--
tests/gfx/HLine.c | 8 +-
tests/gfx/HLineAA.c | 8 +-
tests/gfx/Line.c | 8 +-
tests/gfx/LineAA.c | 8 +-
tests/gfx/Polygon.c | 8 +-
tests/gfx/PutPixelAA.c | 8 +-
tests/gfx/VLine.c | 8 +-
tests/gfx/common.c | 4 +-
tests/gfx/common.h | 6 +-
tests/gfx/gfx_benchmark.c | 6 +-
tests/loaders/GIF.c | 6 +-
tests/loaders/JPG.c | 22 +-
tests/loaders/Loader.h | 44 ++--
tests/loaders/PBM.c | 2 +-
tests/loaders/PCX.c | 12 +-
tests/loaders/PGM.c | 2 +-
tests/loaders/PNG.c | 28 +--
tests/loaders/PNM.c | 2 +-
tests/loaders/PPM.c | 2 +-
tests/loaders/SaveAbort.gen.c.t | 12 +-
tests/loaders/SaveLoad.gen.c.t | 18 +-
tests/loaders/ZIP.c | 8 +-
tests/loaders/loaders_suite.c | 44 ++--
tests/pylib/test_core.py | 76 +++---
tests/pylib/test_gfx.py | 26 +--
tests/pylib/testutils.py | 16 +-
302 files changed, 3327 insertions(+), 3327 deletions(-)
rename doc/{context.txt => pixmap.txt} (65%)
rename include/backends/{GP_SDL_Context.h => GP_SDL_Pixmap.h} (82%)
rename include/core/{GP_Context.h => GP_Pixmap.h} (59%)
rename tests/core/{Context.c => Pixmap.c} (60%)
diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt
index 4c830bf39987..24bbc8b6f2c6 100644
--- a/build/syms/Backend_symbols.txt
+++ b/build/syms/Backend_symbols.txt
@@ -9,7 +9,7 @@ GP_BackendIsX11
GP_BackendX11RequestFullscreen
GP_BackendSDLInit
-GP_ContextFromSDLSurface
+GP_PixmapFromSDLSurface
GP_BackendAALibInit
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt
index 47acec59d1db..7ee4ff213aff 100644
--- a/build/syms/Core_symbols.txt
+++ b/build/syms/Core_symbols.txt
@@ -1,19 +1,19 @@
GP_PixelTypes
GP_PixelHasFlags
-GP_ContextAlloc
-GP_ContextResize
-GP_ContextConvertAlloc
-GP_ContextPrintInfo
-GP_ContextRotateCCW
-GP_SubContextAlloc
-GP_ContextConvert
-GP_ContextRotateCW
-GP_ContextFree
-GP_ContextInit
-GP_SubContext
-GP_ContextCopy
-GP_ContextEqual
+GP_PixmapAlloc
+GP_PixmapResize
+GP_PixmapConvertAlloc
+GP_PixmapPrintInfo
+GP_PixmapRotateCCW
+GP_SubPixmapAlloc
+GP_PixmapConvert
+GP_PixmapRotateCW
+GP_PixmapFree
+GP_PixmapInit
+GP_SubPixmap
+GP_PixmapCopy
+GP_PixmapEqual
GP_PixelAddrOffset
GP_GammaRelease
diff --git a/demos/bogoman/bogoman.c b/demos/bogoman/bogoman.c
index 36402c845038..cd0def6c3a67 100644
--- a/demos/bogoman/bogoman.c
+++ b/demos/bogoman/bogoman.c
@@ -32,29 +32,29 @@
static void save_png(struct bogoman_map *map, unsigned int elem_size,
const char *filename)
{
- GP_Context *ctx;
+ GP_Pixmap *pixmap;
unsigned int rx, ry;
rx = elem_size * map->w;
ry = elem_size * map->h;
- ctx = GP_ContextAlloc(rx, ry, GP_PIXEL_RGB888);
+ pixmap = GP_PixmapAlloc(rx, ry, GP_PIXEL_RGB888);
- if (ctx == NULL)
+ if (pixmap == NULL)
return;
struct bogoman_render render = {
.map = map,
.map_x_offset = 0,
.map_y_offset = 0,
- .ctx = ctx,
+ .pixmap = pixmap,
.map_elem_size = elem_size,
};
bogoman_render(&render, BOGOMAN_RENDER_ALL);
- GP_SavePNG(ctx, filename, NULL);
- GP_ContextFree(ctx);
+ GP_SavePNG(pixmap, filename, NULL);
+ GP_PixmapFree(pixmap);
}
static struct GP_Backend *backend;
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
.map = map,
.map_x_offset = 0,
.map_y_offset = 0,
- .ctx = backend->context,
+ .pixmap = backend->pixmap,
.backend = backend,
.map_elem_size = ELEM_SIZE,
};
diff --git a/demos/bogoman/bogoman_render.c b/demos/bogoman/bogoman_render.c
index bc47f7d22530..c045b541935b 100644
--- a/demos/bogoman/bogoman_render.c
+++ b/demos/bogoman/bogoman_render.c
@@ -56,17 +56,17 @@ struct render_colors {
static struct render_colors colors;
-static void init_colors(GP_Context *ctx, struct render_colors *colors)
+static void init_colors(GP_Pixmap *pixmap, struct render_colors *colors)
{
- colors->bg = GP_RGBToContextPixel(0xee, 0xee, 0xee, ctx);
- colors->player = GP_RGBToContextPixel(0x00, 0xee, 0x00, ctx);
- colors->frames = GP_RGBToContextPixel(0x00, 0x00, 0x00, ctx);
- colors->diamond = GP_RGBToContextPixel(0x00, 0x00, 0xee, ctx);
- colors->wall = GP_RGBToContextPixel(0x66, 0x66, 0x66, ctx);
- colors->moveable = GP_RGBToContextPixel(0xff, 0xff, 0x60, ctx);
- colors->edible = GP_RGBToContextPixel(0xff, 0x7f, 0x50, ctx);
- colors->particle = GP_RGBToContextPixel(0xff, 0xff, 0x00, ctx);
- colors->particle_dir = GP_RGBToContextPixel(0xff, 0x44, 0x00, ctx);
+ colors->bg = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap);
+ colors->player = GP_RGBToPixmapPixel(0x00, 0xee, 0x00, pixmap);
+ colors->frames = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ colors->diamond = GP_RGBToPixmapPixel(0x00, 0x00, 0xee, pixmap);
+ colors->wall = GP_RGBToPixmapPixel(0x66, 0x66, 0x66, pixmap);
+ colors->moveable = GP_RGBToPixmapPixel(0xff, 0xff, 0x60, pixmap);
+ colors->edible = GP_RGBToPixmapPixel(0xff, 0x7f, 0x50, pixmap);
+ colors->particle = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, pixmap);
+ colors->particle_dir = GP_RGBToPixmapPixel(0xff, 0x44, 0x00, pixmap);
}
static void render_none(struct bogoman_render *render,
@@ -77,7 +77,7 @@ static void render_none(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
}
static void render_player(struct bogoman_render *render,
@@ -88,10 +88,10 @@ static void render_player(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
- GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2 - 1, colors.player);
- GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
+ GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2 - 1, colors.player);
+ GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
}
static void render_wall(struct bogoman_render *render,
@@ -100,26 +100,26 @@ static void render_wall(struct bogoman_render *render,
{
unsigned int w = render->map_elem_size;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.wall);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.wall);
if (!(elem->flags & BOGOMAN_LEFT)) {
- GP_VLineXYH(render->ctx, x, y, w, colors.frames);
- GP_VLineXYH(render->ctx, x+1, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x+1, y, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_RIGHT)) {
- GP_VLineXYH(render->ctx, x + w - 1, y, w, colors.frames);
- GP_VLineXYH(render->ctx, x + w - 2, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x + w - 1, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x + w - 2, y, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_UP)) {
- GP_HLineXYW(render->ctx, x, y, w, colors.frames);
- GP_HLineXYW(render->ctx, x, y+1, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y+1, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_DOWN)) {
- GP_HLineXYW(render->ctx, x, y + w - 1, w, colors.frames);
- GP_HLineXYW(render->ctx, x, y + w - 2, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y + w - 1, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y + w - 2, w, colors.frames);
}
}
@@ -129,16 +129,16 @@ static void render_diamond(struct bogoman_render *render,
{
unsigned int w = render->map_elem_size;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
(void) elem;
- GP_FillTetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2,
+ GP_FillTetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
x + w/2, y + w - 1, x, y + w/2, colors.diamond);
- GP_Tetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2,
+ GP_Tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
x + w/2, y + w - 1, x, y + w/2, colors.frames);
- GP_Tetragon(render->ctx, x + w/2, y+1, x + w - 2, y + w/2,
+ GP_Tetragon(render->pixmap, x + w/2, y+1, x + w - 2, y + w/2,
x + w/2, y + w - 2, x+1, y + w/2, colors.frames);
}
@@ -150,11 +150,11 @@ static void render_moveable(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
- GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.moveable);
- GP_RectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.frames);
- GP_RectXYWH(render->ctx, x + 2, y + 2, w - 4, w - 4, colors.frames);
+ GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.moveable);
+ GP_RectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.frames);
+ GP_RectXYWH(render->pixmap, x + 2, y + 2, w - 4, w - 4, colors.frames);
}
static void render_edible(struct bogoman_render *render,
@@ -165,9 +165,9 @@ static void render_edible(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
- GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.edible);
+ GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.edible);
}
static void render_particle(struct bogoman_render *render,
@@ -177,43 +177,43 @@ static void render_particle(struct bogoman_render *render,
unsigned int w = render->map_elem_size;
int dir = elem->flags & BOGOMAN_DIRECTION_MASK;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
switch (elem->flags & ~BOGOMAN_DIRECTION_MASK) {
case BOGOMAN_PARTICLE_ROUND:
- GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2-1, colors.particle);
- GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
+ GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2-1, colors.particle);
+ GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
break;
case BOGOMAN_PARTICLE_SQUARE:
- GP_FillRectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.particle);
- GP_RectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.frames);
- GP_RectXYWH(render->ctx, x+2, y+2, w-4, w-4, colors.frames);
+ GP_FillRectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.particle);
+ GP_RectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.frames);
+ GP_RectXYWH(render->pixmap, x+2, y+2, w-4, w-4, colors.frames);
break;
}
switch (dir) {
case BOGOMAN_LEFT:
- GP_FillTriangle(render->ctx, x + w/4, y + w/2,
+ GP_FillTriangle(render->pixmap, x + w/4, y + w/2,
x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.particle_dir);
- GP_Triangle(render->ctx, x + w/4, y + w/2,
+ GP_Triangle(render->pixmap, x + w/4, y + w/2,
x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.frames);
break;
case BOGOMAN_RIGHT:
- GP_FillTriangle(render->ctx, x + 3*w/4, y + w/2,
+ GP_FillTriangle(render->pixmap, x + 3*w/4, y + w/2,
x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.particle_dir);
- GP_Triangle(render->ctx, x + 3*w/4, y + w/2,
+ GP_Triangle(render->pixmap, x + 3*w/4, y + w/2,
x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.frames);
break;
case BOGOMAN_UP:
- GP_FillTriangle(render->ctx, x + w/2, y + w/4,
+ GP_FillTriangle(render->pixmap, x + w/2, y + w/4,
x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.particle_dir);
- GP_Triangle(render->ctx, x + w/2, y + w/4,
+ GP_Triangle(render->pixmap, x + w/2, y + w/4,
x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.frames);
break;
case BOGOMAN_DOWN:
- GP_FillTriangle(render->ctx, x + w/2, y + 3*w/4,
+ GP_FillTriangle(render->pixmap, x + w/2, y + 3*w/4,
x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.particle_dir);
- GP_Triangle(render->ctx, x + w/2, y + 3*w/4,
+ GP_Triangle(render->pixmap, x + w/2, y + 3*w/4,
x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.frames);
break;
}
@@ -268,10 +268,10 @@ void bogoman_render(struct bogoman_render *render, int flags)
unsigned int x, y;
//TODO: Hack
- init_colors(render->ctx, &colors);
+ init_colors(render->pixmap, &colors);
if (flags & BOGOMAN_RENDER_ALL)
- GP_Fill(render->ctx, colors.bg);
+ GP_Fill(render->pixmap, colors.bg);
for (y = render->map_x_offset; y < render->map->h; y++) {
for (x = render->map_x_offset; x < render->map->w; x++)
diff --git a/demos/bogoman/bogoman_render.h b/demos/bogoman/bogoman_render.h
index e27744e2b064..38b7f0d59722 100644
--- a/demos/bogoman/bogoman_render.h
+++ b/demos/bogoman/bogoman_render.h
@@ -24,7 +24,7 @@
#define __BOGOMAN_RENDER_H__
struct bogoman_map;
-struct GP_Context;
+struct GP_Pixmap;
struct bogoman_render {
/* both in map elements */
@@ -34,8 +34,8 @@ struct bogoman_render {
/* current map */
struct bogoman_map *map;
- /* context to be used for rendering */
- struct GP_Context *ctx;
+ /* pixmap to be used for rendering */
+ struct GP_Pixmap *pixmap;
/* if not NULL is used to update screen */
struct GP_Backend *backend;
diff --git a/demos/c_simple/SDL_glue.c b/demos/c_simple/SDL_glue.c
index 8e9e2162db29..ef360e0b0e84 100644
--- a/demos/c_simple/SDL_glue.c
+++ b/demos/c_simple/SDL_glue.c
@@ -33,13 +33,13 @@
#include <stdlib.h>
#include <SDL/SDL.h>
#include <GP.h>
-#include <backends/GP_SDL_Context.h>
+#include <backends/GP_SDL_Pixmap.h>
#define W 320
#define H 240
static SDL_Surface *display = NULL;
-static GP_Context context;
+static GP_Pixmap pixmap;
static GP_Pixel black_pixel, darkgray_pixel;
@@ -47,13 +47,13 @@ void redraw_screen(void)
{
SDL_LockSurface(display);
- GP_Fill(&context, black_pixel);
+ GP_Fill(&pixmap, black_pixel);
- GP_Text(&context, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW,
+ GP_Text(&pixmap, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW,
darkgray_pixel, black_pixel, "GFXprim SDL Demo");
- GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel);
- GP_Line(&context, 0, H-1, W-1, 0, darkgray_pixel);
+ GP_Line(&pixmap, 0, 0, W-1, H-1, darkgray_pixel);
+ GP_Line(&pixmap, 0, H-1, W-1, 0, darkgray_pixel);
SDL_UnlockSurface(display);
}
@@ -100,10 +100,10 @@ int main(void)
return 1;
}
- GP_ContextFromSDLSurface(&context, display);
+ GP_PixmapFromSDLSurface(&pixmap, display);
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, &context);
- darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, &context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, &pixmap);
+ darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, &pixmap);
redraw_screen();
SDL_Flip(display);
diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c
index 5e87ff18f178..6c8288347871 100644
--- a/demos/c_simple/backend_example.c
+++ b/demos/c_simple/backend_example.c
@@ -31,15 +31,15 @@
static void redraw(GP_Backend *self)
{
- GP_Context *context = self->context;
+ GP_Pixmap *pixmap = self->pixmap;
GP_Pixel white_pixel, black_pixel;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, black_pixel);
- GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel);
- GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel);
+ GP_Fill(pixmap, black_pixel);
+ GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
+ GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
/* Update the backend screen */
GP_BackendFlip(self);
diff --git a/demos/c_simple/backend_timers_example.c b/demos/c_simple/backend_timers_example.c
index 7b7aae2a06fd..16912fb592df 100644
--- a/demos/c_simple/backend_timers_example.c
+++ b/demos/c_simple/backend_timers_example.c
@@ -31,10 +31,10 @@
static void redraw(GP_Backend *self)
{
- GP_Context *context = self->context;
- GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
+ GP_Pixmap *pixmap = self->pixmap;
+ GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- GP_Fill(context, black_pixel);
+ GP_Fill(pixmap, black_pixel);
/* Update the backend screen */
GP_BackendFlip(self);
diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c
index 362ef8b09cc2..c12c8fe70b35 100644
--- a/demos/c_simple/blittest.c
+++ b/demos/c_simple/blittest.c
@@ -31,7 +31,7 @@ static GP_Pixel white;
static GP_Backend *win;
-static GP_Context *bitmap, *bitmap_raw, *bitmap_conv;
+static GP_Pixmap *bitmap, *bitmap_raw, *bitmap_conv;
static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3;
static int pause_flag = 0;
@@ -42,7 +42,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
bitmap_y += bitmap_vy;
- if (bitmap_x + GP_ContextW(bitmap) > win->context->w) {
+ if (bitmap_x + GP_PixmapW(bitmap) > win->pixmap->w) {
bitmap_vx = -bitmap_vx;
bitmap_x += bitmap_vx;
}
@@ -52,7 +52,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
}
- if (bitmap_y + GP_ContextH(bitmap) > win->context->h) {
+ if (bitmap_y + GP_PixmapH(bitmap) > win->pixmap->h) {
bitmap_vy = -bitmap_vy;
bitmap_y += bitmap_vy;
}
@@ -62,20 +62,20 @@ void redraw_screen(void)
bitmap_y += bitmap_vy;
}
- GP_FillRectXYWH(win->context, 20, 20, 300, 50, black);
+ GP_FillRectXYWH(win->pixmap, 20, 20, 300, 50, black);
- GP_Text(win->context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_Text(win->pixmap, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, text_buf);
- GP_Print(win->context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_Print(win->pixmap, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ',
bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' ');
- GP_Blit(bitmap, 0, 0, GP_ContextW(bitmap), GP_ContextH(bitmap),
- win->context, bitmap_x, bitmap_y);
+ GP_Blit(bitmap, 0, 0, GP_PixmapW(bitmap), GP_PixmapH(bitmap),
+ win->pixmap, bitmap_x, bitmap_y);
GP_BackendUpdateRectXYWH(win, bitmap_x, bitmap_y,
- GP_ContextW(bitmap), GP_ContextH(bitmap));
+ GP_PixmapW(bitmap), GP_PixmapH(bitmap));
GP_BackendUpdateRectXYWH(win, 20, 20, 400, 50);
}
@@ -88,7 +88,7 @@ static void change_bitmap(void)
snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'",
GP_PixelTypeName(bitmap->pixel_type),
- GP_PixelTypeName(win->context->pixel_type));
+ GP_PixelTypeName(win->pixmap->pixel_type));
}
void event_loop(void)
@@ -133,7 +133,7 @@ void event_loop(void)
break;
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(win);
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
GP_BackendFlip(win);
break;
}
@@ -175,14 +175,14 @@ int main(void)
return 1;
}
- bitmap_conv = GP_ContextConvertAlloc(bitmap_raw,
- win->context->pixel_type);
+ bitmap_conv = GP_PixmapConvertAlloc(bitmap_raw,
+ win->pixmap->pixel_type);
change_bitmap();
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
GP_BackendFlip(win);
for (;;) {
diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c
index 213baf8ecc68..7d26f17563f2 100644
--- a/demos/c_simple/convolution.c
+++ b/demos/c_simple/convolution.c
@@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
struct callback_priv priv;
GP_ProgressCallback callback = {.callback = progress_callback,
.priv = &priv};
diff --git a/demos/c_simple/debug_handler.c b/demos/c_simple/debug_handler.c
index 1744b0498ec1..5c472fd61e4f 100644
--- a/demos/c_simple/debug_handler.c
+++ b/demos/c_simple/debug_handler.c
@@ -65,11 +65,11 @@ int main(void)
/* Turn on verbose debug and call some library functions */
GP_SetDebugLevel(10);
- GP_Context *ctx = GP_ContextAlloc(1000, 1000, 1);
+ GP_Pixmap *pixmap = GP_PixmapAlloc(1000, 1000, 1);
- GP_FilterGaussianBlur(ctx, ctx, 10, 10, NULL);
+ GP_FilterGaussianBlur(pixmap, pixmap, 10, 10, NULL);
- GP_ContextFree(ctx);
+ GP_PixmapFree(pixmap);
return 0;
}
diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c
index e33a74a33338..d5c870b65f8c 100644
--- a/demos/c_simple/fileview.c
+++ b/demos/c_simple/fileview.c
@@ -29,7 +29,7 @@
#include <GP.h>
-static GP_Context *win;
+static GP_Pixmap *win;
static GP_Backend *backend;
static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel,
@@ -266,14 +266,14 @@ int main(int argc, char *argv[])
return 1;
}
- win = backend->context;
+ win = backend->pixmap;
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win);
- gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win);
- dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win);
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
+ gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win);
+ dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win);
redraw_screen();
GP_BackendFlip(backend);
diff --git a/demos/c_simple/filters_symmetry.c b/demos/c_simple/filters_symmetry.c
index 735be56668ec..926445354f9a 100644
--- a/demos/c_simple/filters_symmetry.c
+++ b/demos/c_simple/filters_symmetry.c
@@ -48,7 +48,7 @@ static void usage_and_exit(int ret)
int main(int argc, char *argv[])
{
- GP_Context *src, *res;
+ GP_Pixmap *src, *res;
const char *symmetry = NULL;
int opt, sym, debug = 0;
@@ -109,8 +109,8 @@ int main(int argc, char *argv[])
}
/* Cleanup */
- GP_ContextFree(src);
- GP_ContextFree(res);
+ GP_PixmapFree(src);
+ GP_PixmapFree(res);
return 0;
}
diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c
index 7d6a7ca073b8..e2e5dd6c2b82 100644
--- a/demos/c_simple/fonttest.c
+++ b/demos/c_simple/fonttest.c
@@ -101,7 +101,7 @@ static void print_font_properties(const GP_FontFace *font)
void redraw_screen(void)
{
- GP_Fill(win->context, black_pixel);
+ GP_Fill(win->pixmap, black_pixel);
GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
@@ -144,29 +144,29 @@ void redraw_screen(void)
style.pixel_yspace = 0;
style.char_xspace = tracking;
- GP_FillRectXYWH(win->context,
+ GP_FillRectXYWH(win->pixmap,
16, SPACING*i + 16,
GP_TextWidth(&style, test_string),
GP_FontHeight(style.font),
dark_gray_pixel);
- GP_RectXYWH(win->context,
+ GP_RectXYWH(win->pixmap,
15, SPACING*i + 15,
GP_TextMaxWidth(&style, strlen(test_string)) + 1,
GP_FontHeight(style.font) + 1,
blue_pixel);
- GP_Text(win->context, &style, 16, SPACING*i + 16, align,
+ GP_Text(win->pixmap, &style, 16, SPACING*i + 16, align,
white_pixel, dark_gray_pixel, test_string);
style.pixel_xmul = 2;
style.pixel_ymul = 2;
style.pixel_yspace = 1;
- GP_Text(win->context, &style, 34, SPACING * i + 44, align,
+ GP_Text(win->pixmap, &style, 34, SPACING * i + 44, align,
white_pixel, black_pixel, test_string);
- GP_RectXYWH(win->context, 33, SPACING * i + 43,
+ GP_RectXYWH(win->pixmap, 33, SPACING * i + 43,
GP_TextWidth(&style, test_string) + 1,
GP_TextHeight(&style) + 1, dark_gray_pixel);
@@ -184,7 +184,7 @@ void redraw_screen(void)
style.pixel_yspace = 2;
}
- GP_Text(win->context, &style, 64, SPACING*i + 88, align,
+ GP_Text(win->pixmap, &style, 64, SPACING*i + 88, align,
dark_gray_pixel, black_pixel, test_string);
}
}
@@ -287,12 +287,12 @@ int main(int argc, char *argv[])
return 1;
}
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win->context);
- dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context);
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win->pixmap);
+ dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap);
redraw_screen();
GP_BackendFlip(win);
diff --git a/demos/c_simple/gaussian_noise.c b/demos/c_simple/gaussian_noise.c
index 21425ce0bb79..8c0cb152ebc9 100644
--- a/demos/c_simple/gaussian_noise.c
+++ b/demos/c_simple/gaussian_noise.c
@@ -42,7 +42,7 @@ static void help(const char *app)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
float sigma = 0.1, mu = 0.1;
int opt;
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
return 1;
}
- GP_Context *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL);
+ GP_Pixmap *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL);
if (GP_SaveImage(res, argv[optind + 1], NULL)) {
fprintf(stderr, "Failed to save image '%s': %s",
diff --git a/demos/c_simple/gfx_koch.c b/demos/c_simple/gfx_koch.c
index c188f3adde71..615f2345ce9e 100644
--- a/demos/c_simple/gfx_koch.c
+++ b/demos/c_simple/gfx_koch.c
@@ -38,7 +38,7 @@ static int aa_flag = 0;
/*
* Generate color depending on distance from center
*
- * We could do this only and only because the context
+ * We could do this only and only because the pixmap
* pixel type is fixed to GP_PIXEL_RGB888.
*/
static GP_Pixel do_color(int xc, int yc, float x, float y)
@@ -66,7 +66,7 @@ static GP_Pixel do_color(int xc, int yc, float x, float y)
return bmask | (gmask<<8) | (rmask << 16);
}
-static void draw(GP_Context *img, int level, float x0, float y0, float x1, float y1)
+static void draw(GP_Pixmap *img, int level, float x0, float y0, float x1, float y1)
{
if (level == 0) {
GP_Pixel pixel;
@@ -106,13 +106,13 @@ static void draw(GP_Context *img, int level, float x0, float y0, float x1, float
int main(void)
{
- GP_Context *img;
+ GP_Pixmap *img;
/* Create RGB 24 bit image */
- img = GP_ContextAlloc(600, 600, GP_PIXEL_RGB888);
+ img = GP_PixmapAlloc(600, 600, GP_PIXEL_RGB888);
if (img == NULL) {
- fprintf(stderr, "Failed to allocate context");
+ fprintf(stderr, "Failed to allocate pixmap");
return 1;
}
@@ -129,7 +129,7 @@ int main(void)
}
/* Cleanup */
- GP_ContextFree(img);
+ GP_PixmapFree(img);
return 0;
}
diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c
index 3a294d23e1f8..5ac76d302a1f 100644
--- a/demos/c_simple/input_example.c
+++ b/demos/c_simple/input_example.c
@@ -29,7 +29,7 @@
#include "GP.h"
-static GP_Context *win;
+static GP_Pixmap *win;
static GP_Backend *backend;
static GP_Pixel red, green, white, black;
@@ -148,12 +148,12 @@ int main(int argc, char *argv[])
return 1;
}
- win = backend->context;
+ win = backend->pixmap;
- red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win);
- green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win);
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win);
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win);
+ red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
+ green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
GP_Fill(win, black);
GP_BackendFlip(backend);
diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c
index 27ce6744f8b0..b5558c06f9ab 100644
--- a/demos/c_simple/koch.c
+++ b/demos/c_simple/koch.c
@@ -40,7 +40,7 @@
#define sgn(x) ((x)>0 ? 1 : -1)
static GP_Backend *backend;
-static GP_Context *context;
+static GP_Pixmap *pixmap;
static int iter, l, way = 1, draw_edge = 1;
static GP_Pixel black, blue, gray, red;
@@ -49,11 +49,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
{
double x2, y2, x3, y3, x5, y5;
GP_Pixel pixel;
- pixel = GP_RGBToPixel(0, 0, 255-16*iter, context->pixel_type);
+ pixel = GP_RGBToPixel(0, 0, 255-16*iter, pixmap->pixel_type);
if (iter <= 0) {
if (draw_edge)
- GP_Line(context, x1, y1, x4, y4, black);
+ GP_Line(pixmap, x1, y1, x4, y4, black);
return;
}
@@ -66,11 +66,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
x5 = (x1+x4)/2 + (y2 - y3)*sqrt(3.00/4);
y5 = (y1+y4)/2 + (x3 - x2)*sqrt(3.00/4);
- GP_FillTriangle(context, x2, y2, x3, y3, x5, y5, pixel);
+ GP_FillTriangle(pixmap, x2, y2, x3, y3, x5, y5, pixel);
- GP_PutPixel(context, x2, y2, red);
- GP_PutPixel(context, x3, y3, red);
- GP_PutPixel(context, x5, y5, red);
+ GP_PutPixel(pixmap, x2, y2, red);
+ GP_PutPixel(pixmap, x3, y3, red);
+ GP_PutPixel(pixmap, x5, y5, red);
sierpinsky(x1, y1, x2, y2, iter - 1);
sierpinsky(x2, y2, x5, y5, iter - 1);
@@ -81,8 +81,8 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
static void draw(int x, int y, int l, int iter)
{
double x1, y1, x2, y2, x3, y3;
- int w = context->w;
- int h = context->h;
+ int w = pixmap->w;
+ int h = pixmap->h;
l = ((w < h ? w : h) - 20)/(5 - 1.00*iter/120);
@@ -95,9 +95,9 @@ static void draw(int x, int y, int l, int iter)
x3 = sin(1.00 * (iter+240)/57) * l + x;
y3 = cos(1.00 * (iter+240)/57) * l + y;
- GP_Fill(context, gray);
+ GP_Fill(pixmap, gray);
- GP_FillTriangle(context, x1, y1, x2, y2, x3, y3, blue);
+ GP_FillTriangle(pixmap, x1, y1, x2, y2, x3, y3, blue);
sierpinsky(x1, y1, x2, y2, iter/60%6);
sierpinsky(x2, y2, x3, y3, iter/60%6);
@@ -121,7 +121,7 @@ void redraw(void)
if (iter < 0)
way *= -1;
- draw(context->w/2, context->h/2, l, iter);
+ draw(pixmap->w/2, pixmap->h/2, l, iter);
}
int main(void)
@@ -136,15 +136,15 @@ int main(void)
return 1;
}
- context = backend->context;
+ pixmap = backend->pixmap;
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- blue = GP_RGBToContextPixel(0x00, 0x00, 0xff, context);
- gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, context);
- red = GP_RGBToContextPixel(0xff, 0x00, 0x00, context);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ blue = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap);
+ gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, pixmap);
+ red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap);
iter = 0;
- draw(context->w/2, context->h/2, l, iter);
+ draw(pixmap->w/2, pixmap->h/2, l, iter);
for (;;) {
GP_Event ev;
diff --git a/demos/c_simple/linetest.c b/demos/c_simple/linetest.c
index 19a0244dc932..7e535df94a61 100644
--- a/demos/c_simple/linetest.c
+++ b/demos/c_simple/linetest.c
@@ -41,12 +41,12 @@ void redraw_screen(void)
{
double angle;
int x, y;
- int w = win->context->w;
- int h = win->context->h;
+ int w = win->pixmap->w;
+ int h = win->pixmap->h;
int xcenter = w/2;
int ycenter = h/2;
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
for (angle = 0.0; angle < 2*M_PI; angle += 0.1) {
x = (int) (w/2 * cos(start_angle + angle));
@@ -56,22 +56,22 @@ void redraw_screen(void)
int b = 127.0 + 127.0 * sin(start_angle + angle);
GP_Pixel pixel;
- pixel = GP_RGBToPixel(r, 0, b, win->context->pixel_type);
+ pixel = GP_RGBToPixel(r, 0, b, win->pixmap->pixel_type);
if (aa_flag) {
- GP_LineAA_Raw(win->context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
+ GP_LineAA_Raw(win->pixmap, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel);
} else {
- GP_Line(win->context, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
- GP_Line(win->context, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
+ GP_Line(win->pixmap, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
+ GP_Line(win->pixmap, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
}
}
GP_BackendFlip(win);
/* axes */
-// GP_HLineXYW(&context, 0, ycenter, display->w, white);
-// GP_VLineXYH(&context, xcenter, 0, display->h, white);
+// GP_HLineXYW(&pixmap, 0, ycenter, display->w, white);
+// GP_VLineXYH(&pixmap, xcenter, 0, display->h, white);
}
void event_loop(void)
@@ -135,8 +135,8 @@ int main(int argc, char *argv[])
return 1;
}
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
redraw_screen();
diff --git a/demos/c_simple/loaders.c b/demos/c_simple/loaders.c
index 369ec488c149..e9a3a306c1c3 100644
--- a/demos/c_simple/loaders.c
+++ b/demos/c_simple/loaders.c
@@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
struct callback_priv priv;
GP_ProgressCallback callback = {.callback = progress_callback,
.priv = &priv};
diff --git a/demos/c_simple/loaders_example.c b/demos/c_simple/loaders_example.c
index 9c0a65ad4c94..b240aea952aa 100644
--- a/demos/c_simple/loaders_example.c
+++ b/demos/c_simple/loaders_example.c
@@ -34,7 +34,7 @@
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
/* Turn on debug messages */
GP_SetDebugLevel(10);
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c
index 5152d6b56e0b..4279c51f1014 100644
--- a/demos/c_simple/loaders_register.c
+++ b/demos/c_simple/loaders_register.c
@@ -37,7 +37,7 @@
/*
* Saves 2 bpp grayscale image as ASCII Art
*/
-static int write_data(const GP_Context *img, GP_IO *io,
+static int write_data(const GP_Pixmap *img, GP_IO *io,
GP_ProgressCallback *callback)
{
GP_IO *bio;
@@ -106,7 +106,7 @@ GP_Loader loader = {
int main(int argc, char *argv[])
{
- GP_Context *c, *gc;
+ GP_Pixmap *c, *gc;
GP_LoaderRegister(&loader);
diff --git a/demos/c_simple/memory_io.c b/demos/c_simple/memory_io.c
index 873b27c7f420..57d09174473f 100644
--- a/demos/c_simple/memory_io.c
+++ b/demos/c_simple/memory_io.c
@@ -56,7 +56,7 @@ static char pgm[] = {
int main(void)
{
GP_Backend *b;
- GP_Context *img;
+ GP_Pixmap *img;
GP_IO *io;
io = GP_IOMem(pgm, sizeof(pgm), NULL);
@@ -81,8 +81,8 @@ int main(void)
return 1;
}
- GP_Fill(b->context, 0);
- GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->context,
+ GP_Fill(b->pixmap, 0);
+ GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->pixmap,
(WIN_W - img->w)/2, (WIN_H - img->h)/2);
GP_BackendFlip(b);
diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c
index 82e9d084c918..ddd79bbacd25 100644
--- a/demos/c_simple/pretty_print.c
+++ b/demos/c_simple/pretty_print.c
@@ -22,7 +22,7 @@
/*
- Pretty print function for pixel and context.
+ Pretty print function for pixel and pixmap.
*/
@@ -30,14 +30,14 @@
int main(void)
{
- GP_Context *ctx = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888);
+ GP_Pixmap *pixmap = GP_PixmapAlloc(100, 100, GP_PIXEL_RGB888);
GP_Pixel pix = ~(GP_Pixel)0;
/* Pretty prints pixel values */
GP_PixelPrint(pix, GP_PIXEL_RGB888);
- /* Pretty prints context info */
- GP_ContextPrintInfo(ctx);
+ /* Pretty prints pixmap info */
+ GP_PixmapPrintInfo(pixmap);
return 0;
}
diff --git a/demos/c_simple/randomshapetest.c b/demos/c_simple/randomshapetest.c
index 6b970f0b5dae..766b48e5ee92 100644
--- a/demos/c_simple/randomshapetest.c
+++ b/demos/c_simple/randomshapetest.c
@@ -56,7 +56,7 @@ static int fill_flag = 1;
/* Do a clipping test? */
static int cliptest_flag = 0;
-void random_point(const GP_Context *c, int *x, int *y)
+void random_point(const GP_Pixmap *c, int *x, int *y)
{
if (cliptest_flag) {
*x = random() % (3*c->w) - c->w;
@@ -67,7 +67,7 @@ void random_point(const GP_Context *c, int *x, int *y)
}
}
-void random_point_AA(const GP_Context *c, int *x, int *y)
+void random_point_AA(const GP_Pixmap *c, int *x, int *y)
{
*x = random() % (c->w<<8);
*y = random() % (c->h<<8);
@@ -76,70 +76,70 @@ void random_point_AA(const GP_Context *c, int *x, int *y)
void draw_random_circle(GP_Pixel pixel)
{
int x, y;
- random_point(win->context, &x, &y);
+ random_point(win->pixmap, &x, &y);
int r = random() % 50;
if (fill_flag)
- GP_FillCircle(win->context, x, y, r, pixel);
+ GP_FillCircle(win->pixmap, x, y, r, pixel);
if (outline_flag)
- GP_Circle(win->context, x, y, r, white);
+ GP_Circle(win->pixmap, x, y, r, white);
}
void draw_random_ellipse(GP_Pixel pixel)
{
int x, y;
- random_point(win->context, &x, &y);
+ random_point(win->pixmap, &x, &y);
int rx = random() % 50;
int ry = random() % 50;
if (fill_flag)
- GP_FillEllipse(win->context, x, y, rx, ry, pixel);
+ GP_FillEllipse(win->pixmap, x, y, rx, ry, pixel);
if (outline_flag)
- GP_Ellipse(win->context, x, y, rx, ry, white);
+ GP_Ellipse(win->pixmap, x, y, rx, ry, white);
}
void draw_random_triangle(GP_Pixel pixel)
{
int x0, y0, x1, y1, x2, y2;
- random_point(win->context, &x0, &y0);
- random_point(win->context, &x1, &y1);
- random_point(win->context, &x2, &y2);
+ random_point(win->pixmap, &x0, &y0);
+ random_point(win->pixmap, &x1, &y1);
+ random_point(win->pixmap, &x2, &y2);
if (fill_flag)
- GP_FillTriangle(win->context, x0, y0, x1, y1, x2, y2, pixel);
+ GP_FillTriangle(win->pixmap, x0, y0, x1, y1, x2, y2, pixel);
if (outline_flag)
- GP_Triangle(win->context, x0, y0, x1, y1, x2, y2, white);
+ GP_Triangle(win->pixmap, x0, y0, x1, y1, x2, y2, white);
}
void draw_random_rectangle(GP_Pixel pixel)
{
int x0, y0, x1, y1;
- random_point(win->context, &x0, &y0);
- random_point(win->context, &x1, &y1);
+ random_point(win->pixmap, &x0, &y0);
+ random_point(win->pixmap, &x1, &y1);
if (fill_flag)
- GP_FillRect(win->context, x0, y0, x1, y1, pixel);
+ GP_FillRect(win->pixmap, x0, y0, x1, y1, pixel);
if (outline_flag)
- GP_Rect(win->context, x0, y0, x1, y1, white);
+ GP_Rect(win->pixmap, x0, y0, x1, y1, white);
}
void draw_random_tetragon(GP_Pixel pixel)
{
int x0, y0, x1, y1, x2, y2, x3, y3;
- random_point(win->context, &x0, &y0);
- random_point(win->context, &x1, &y1);
- random_point(win->context, &x2, &y2);
- random_point(win->context, &x3, &y3);
+ random_point(win->pixmap, &x0, &y0);
+ random_point(win->pixmap, &x1, &y1);
+ random_point(win->pixmap, &x2, &y2);
+ random_point(win->pixmap, &x3, &y3);
if (fill_flag)
- GP_FillTetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ GP_FillTetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
if (outline_flag)
- GP_Tetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ GP_Tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
}
void draw_random_polygon(GP_Pixel pixel)
@@ -148,15 +148,15 @@ void draw_random_polygon(GP_Pixel pixel)
int i;
for (i = 0; i < 5; i++) {
- random_point(win->context, xy + 2*i, xy + 2*i + 1);
+ random_point(win->pixmap, xy + 2*i, xy + 2*i + 1);
}
- GP_FillPolygon_Raw(win->context, 5, xy, pixel);
+ GP_FillPolygon_Raw(win->pixmap, 5, xy, pixel);
}
void clear_screen(void)
{
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
GP_BackendFlip(win);
}
@@ -168,7 +168,7 @@ void redraw_screen(void)
/* Pick a random color for drawing. */
GP_Pixel pixel;
pixel = GP_RGBToPixel(random() % 256, random() % 256,
- random() % 256, win->context->pixel_type);
+ random() % 256, win->pixmap->pixel_type);
switch (shape) {
case SHAPE_CIRCLE:
@@ -258,8 +258,8 @@ int main(void)
return 1;
}
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
for (;;) {
GP_BackendPoll(win);
diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c
index 14e832ce75ac..71d82c85af60 100644
--- a/demos/c_simple/shapetest.c
+++ b/demos/c_simple/shapetest.c
@@ -28,7 +28,7 @@
#include <GP.h>
-static GP_Context *win;
+static GP_Pixmap *win;
static GP_Backend *backend;
/* Basic colors in display-specific format. */
@@ -253,8 +253,8 @@ void redraw_screen(void)
if (show_axes) {
int w, h;
- w = GP_ContextW(win);
- h = GP_ContextH(win);
+ w = GP_PixmapW(win);
+ h = GP_PixmapH(win);
GP_HLine(win, 0, w, center_y, gray);
GP_HLine(win, 0, w, center_y-yradius, darkgray);
@@ -310,7 +310,7 @@ void redraw_screen(void)
static void xradius_add(int xradius_add)
{
if (xradius + xradius_add > 1 &&
- xradius + xradius_add < (int)GP_ContextW(win))
+ xradius + xradius_add < (int)GP_PixmapW(win))
xradius += xradius_add;
}
@@ -318,21 +318,21 @@ static void xradius_add(int xradius_add)
static void yradius_add(int yradius_add)
{
if (yradius + yradius_add > 1 &&
- yradius + yradius_add < (int)GP_ContextH(win))
+ yradius + yradius_add < (int)GP_PixmapH(win))
yradius += yradius_add;
}
static void xcenter_add(int xcenter_add)
{
if (center_x + xcenter_add > 1 &&
- center_x + xcenter_add < (int)GP_ContextW(win)/2)
+ center_x + xcenter_add < (int)GP_PixmapW(win)/2)
center_x += xcenter_add;
}
static void ycenter_add(int ycenter_add)
{
if (center_y + ycenter_add > 1 &&
- center_y + ycenter_add < (int)GP_ContextH(win)/2)
+ center_y + ycenter_add < (int)GP_PixmapH(win)/2)
center_y += ycenter_add;
}
@@ -364,8 +364,8 @@ void event_loop(void)
break;
case GP_KEY_R:
win->axes_swap = !win->axes_swap;
- center_x = GP_ContextW(win) / 2;
- center_y = GP_ContextH(win) / 2;
+ center_x = GP_PixmapW(win) / 2;
+ center_y = GP_PixmapH(win) / 2;
break;
case GP_KEY_F:
fill = !fill;
@@ -451,9 +451,9 @@ void event_loop(void)
break;
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(backend);
- win = backend->context;
- center_x = GP_ContextW(win) / 2;
- center_y = GP_ContextH(win) / 2;
+ win = backend->pixmap;
+ center_x = GP_PixmapW(win) / 2;
+ center_y = GP_PixmapH(win) / 2;
break;
}
break;
@@ -506,19 +506,19 @@ int main(int argc, char *argv[])
return 1;
}
- win = backend->context;
+ win = backend->pixmap;
center_x = win->w / 2;
center_y = win->h / 2;
/* Load colors compatible with the display */
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win);
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win);
- yellow = GP_RGBToContextPixel(0xff, 0xff, 0x00, win);
- green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win);
- red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win);
- gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win);
- darkgray = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
+ yellow = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win);
+ green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win);
+ red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
+ gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win);
+ darkgray = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win);
print_instructions();
redraw_screen();
diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c
index 4934d4cff423..4208b201c0b5 100644
--- a/demos/c_simple/showimage.c
+++ b/demos/c_simple/showimage.c
@@ -35,7 +35,7 @@
int main(int argc, char *argv[])
{
GP_Backend *backend;
- GP_Context *image;
+ GP_Pixmap *image;
if (argc != 2) {
fprintf(stderr, "Takes image as an argument\n");
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
}
/* Blit image into the window and show it */
- GP_Blit(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_Blit(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
GP_BackendFlip(backend);
/* Wait for events */
@@ -78,11 +78,11 @@ int main(int argc, char *argv[])
GP_BackendResizeAck(backend);
- cx = ((int)backend->context->w - (int)image->w) / 2;
- cy = ((int)backend->context->h - (int)image->h) / 2;
+ cx = ((int)backend->pixmap->w - (int)image->w) / 2;
+ cy = ((int)backend->pixmap->h - (int)image->h) / 2;
- GP_Fill(backend->context, 0);
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, cx, cy);
+ GP_Fill(backend->pixmap, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, cx, cy);
GP_BackendFlip(backend);
}
}
diff --git a/demos/c_simple/sin_AA.c b/demos/c_simple/sin_AA.c
index 20e320276f3f..0191918a2e80 100644
--- a/demos/c_simple/sin_AA.c
+++ b/demos/c_simple/sin_AA.c
@@ -32,35 +32,35 @@
#include <GP.h>
-static void redraw(GP_Context *context)
+static void redraw(GP_Pixmap *pixmap)
{
static float param = 1;
static float param2 = 0.01;
static int flag = 1;
- GP_Pixel b = GP_RGBToContextPixel(0xbe, 0xbe, 0x9e, context);
+ GP_Pixel b = GP_RGBToPixmapPixel(0xbe, 0xbe, 0x9e, pixmap);
unsigned int y;
- GP_Fill(context, b);
+ GP_Fill(pixmap, b);
- for (y = 0; y < context->w; y++) {
+ for (y = 0; y < pixmap->w; y++) {
GP_Coord x0, x1, l1, l2;
- x0 = (context->w)<<7;
- x1 = (context->w)<<7;
+ x0 = (pixmap->w)<<7;
+ x1 = (pixmap->w)<<7;
- l1 = (context->w)<<5;
- l2 = (context->w)<<3;
+ l1 = (pixmap->w)<<5;
+ l2 = (pixmap->w)<<3;
- GP_Pixel p = GP_RGBToContextPixel(120 - 3 * param, abs(40 * param), 0, context);
+ GP_Pixel p = GP_RGBToPixmapPixel(120 - 3 * param, abs(40 * param), 0, pixmap);
- l2 *= 4.00 * y / context->h;
+ l2 *= 4.00 * y / pixmap->h;
l1 *= param;
x0 += l1 * sin(param2 * y) + l2;
x1 -= l1 * cos(param2 * y) + l2;
- GP_HLineAA(context, x0, x1, y<<8, p);
+ GP_HLineAA(pixmap, x0, x1, y<<8, p);
}
if (flag) {
@@ -97,7 +97,7 @@ int main(void)
/* Wait for events */
for (;;) {
if (!pause_flag) {
- redraw(backend->context);
+ redraw(backend->pixmap);
GP_BackendFlip(backend);
}
diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c
index 0c08140ba9fa..9827ee6b96a0 100644
--- a/demos/c_simple/textaligntest.c
+++ b/demos/c_simple/textaligntest.c
@@ -41,11 +41,11 @@ static GP_Backend *win;
void redraw_screen(void)
{
- GP_Fill(win->context, black_pixel);
+ GP_Fill(win->pixmap, black_pixel);
/* draw axes intersecting in the middle, where text should be shown */
- GP_HLine(win->context, 0, X, Y/2, darkgray_pixel);
- GP_VLine(win->context, X/2, 0, Y, darkgray_pixel);
+ GP_HLine(win->pixmap, 0, X, Y/2, darkgray_pixel);
+ GP_VLine(win->pixmap, X/2, 0, Y, darkgray_pixel);
switch (font_flag) {
case 0:
@@ -68,17 +68,17 @@ void redraw_screen(void)
break;
}
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
yellow_pixel, black_pixel, "bottom left");
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
red_pixel, black_pixel, "bottom right");
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
blue_pixel, black_pixel, "top right");
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
green_pixel, black_pixel, "top left");
- GP_HLine(win->context, 0, X, Y/3, darkgray_pixel);
- GP_Text(win->context, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE,
+ GP_HLine(win->pixmap, 0, X, Y/3, darkgray_pixel);
+ GP_Text(win->pixmap, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE,
white_pixel, black_pixel, "x center y baseline");
}
@@ -96,13 +96,13 @@ static void event_loop(void)
switch (ev.val.key.key) {
case GP_KEY_X:
- win->context->x_swap = !win->context->x_swap;
+ win->pixmap->x_swap = !win->pixmap->x_swap;
break;
case GP_KEY_Y:
- win->context->y_swap = !win->context->y_swap;
+ win->pixmap->y_swap = !win->pixmap->y_swap;
break;
case GP_KEY_R:
- win->context->axes_swap = !win->context->axes_swap;
+ win->pixmap->axes_swap = !win->pixmap->axes_swap;
GP_SWAP(X, Y);
break;
case GP_KEY_SPACE:
@@ -146,8 +146,8 @@ static void event_loop(void)
break;
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(win);
- X = win->context->w;
- Y = win->context->h;
+ X = win->pixmap->w;
+ Y = win->pixmap->h;
break;
}
break;
@@ -186,13 +186,13 @@ int main(int argc, char *argv[])
return 1;
}
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context);
- green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, win->context);
- yellow_pixel = GP_RGBToContextPixel(0xff, 0xff, 0x00, win->context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap);
+ green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win->pixmap);
+ yellow_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win->pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap);
redraw_screen();
GP_BackendFlip(win);
diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c
index 443d6d4926cb..5f5dacf86c72 100644
--- a/demos/c_simple/v4l2_show.c
+++ b/demos/c_simple/v4l2_show.c
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
for (;;) {
if (GP_GrabberPoll(grabber) > 0) {
- GP_Context *res, *img = grabber->frame;
+ GP_Pixmap *res, *img = grabber->frame;
switch (mode) {
case 0:
@@ -113,14 +113,14 @@ int main(int argc, char *argv[])
break;
}
- unsigned int c_x = (backend->context->w - res->w) / 2;
- unsigned int c_y = (backend->context->h - res->h) / 2;
+ unsigned int c_x = (backend->pixmap->w - res->w) / 2;
+ unsigned int c_y = (backend->pixmap->h - res->h) / 2;
- GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, c_x, c_y);
+ GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->pixmap, c_x, c_y);
GP_BackendFlip(backend);
if (mode)
- GP_ContextFree(res);
+ GP_PixmapFree(res);
}
usleep(1000);
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
case GP_EV_SYS:
if (ev.code == GP_EV_SYS_RESIZE) {
GP_BackendResizeAck(backend);
- GP_Fill(backend->context, 0);
+ GP_Fill(backend->pixmap, 0);
}
break;
}
diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c
index f59f4ec384c1..b1d8199f5b89 100644
--- a/demos/c_simple/virtual_backend_example.c
+++ b/demos/c_simple/virtual_backend_example.c
@@ -35,48 +35,48 @@ static GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel;
static void redraw(GP_Backend *backend)
{
- GP_Context *context = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
/* Now draw some testing patters */
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, context);
- green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap);
+ green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, pixmap);
- GP_Fill(context, white_pixel);
+ GP_Fill(pixmap, white_pixel);
unsigned int i, j;
for (i = 0; i < 40; i++) {
- GP_HLineXYW(context, 0, i, i, black_pixel);
- GP_HLineXYW(context, 1, i + 40, i, black_pixel);
- GP_HLineXYW(context, 2, i + 80, i, black_pixel);
- GP_HLineXYW(context, 3, i + 120, i, black_pixel);
- GP_HLineXYW(context, 4, i + 160, i, black_pixel);
- GP_HLineXYW(context, 5, i + 200, i, black_pixel);
- GP_HLineXYW(context, 6, i + 240, i, black_pixel);
- GP_HLineXYW(context, 7, i + 280, i, black_pixel);
+ GP_HLineXYW(pixmap, 0, i, i, black_pixel);
+ GP_HLineXYW(pixmap, 1, i + 40, i, black_pixel);
+ GP_HLineXYW(pixmap, 2, i + 80, i, black_pixel);
+ GP_HLineXYW(pixmap, 3, i + 120, i, black_pixel);
+ GP_HLineXYW(pixmap, 4, i + 160, i, black_pixel);
+ GP_HLineXYW(pixmap, 5, i + 200, i, black_pixel);
+ GP_HLineXYW(pixmap, 6, i + 240, i, black_pixel);
+ GP_HLineXYW(pixmap, 7, i + 280, i, black_pixel);
}
for (i = 0; i < 256; i++) {
for (j = 0; j < 256; j++) {
uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5;
- GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context);
- GP_PutPixel(context, i + 60, j + 10, pix);
+ GP_Pixel pix = GP_RGBToPixmapPixel(i, j, val, pixmap);
+ GP_PutPixel(pixmap, i + 60, j + 10, pix);
}
}
- GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
black_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
red_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
green_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
blue_pixel, white_pixel, "Lorem Ipsum dolor sit...");
/* Update the backend screen */
diff --git a/demos/c_simple/weighted_median.c b/demos/c_simple/weighted_median.c
index a0b09fd4f946..dc481603f9d5 100644
--- a/demos/c_simple/weighted_median.c
+++ b/demos/c_simple/weighted_median.c
@@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
struct callback_priv priv;
GP_ProgressCallback callback = {.callback = progress_callback,
.priv = &priv};
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
priv.op = "Weighted Median";
- GP_Context *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback);
+ GP_Pixmap *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback);
printf("\n");
diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c
index aa37c7b20b67..da9d8d8b8041 100644
--- a/demos/c_simple/x11_windows.c
+++ b/demos/c_simple/x11_windows.c
@@ -29,16 +29,16 @@
#include <stdio.h>
#include <GP.h>
-static void redraw(struct GP_Context *context)
+static void redraw(struct GP_Pixmap *pixmap)
{
GP_Pixel white_pixel, black_pixel;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, black_pixel);
- GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel);
- GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel);
+ GP_Fill(pixmap, black_pixel);
+ GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
+ GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
}
static int ev_loop(struct GP_Backend *backend, const char *name)
@@ -68,7 +68,7 @@ static int ev_loop(struct GP_Backend *backend, const char *name)
switch (ev.code) {
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(backend);
- redraw(backend->context);
+ redraw(backend->pixmap);
GP_BackendFlip(backend);
break;
case GP_EV_SYS_QUIT:
@@ -99,8 +99,8 @@ int main(void)
}
/* Update the backend screen */
- redraw(win_1->context);
- redraw(win_2->context);
+ redraw(win_1->pixmap);
+ redraw(win_2->pixmap);
GP_BackendFlip(win_1);
GP_BackendFlip(win_2);
diff --git a/demos/c_simple/zip_container.c b/demos/c_simple/zip_container.c
index 1fe5e36fceca..4cf77fd9aef1 100644
--- a/demos/c_simple/zip_container.c
+++ b/demos/c_simple/zip_container.c
@@ -33,7 +33,7 @@
#include <GP.h>
static GP_Backend *backend;
-static GP_Context *image;
+static GP_Pixmap *image;
static GP_Container *container;
/*
@@ -45,20 +45,20 @@ static GP_Container *container;
*/
static void load_next(void)
{
- GP_ContextFree(image);
+ GP_PixmapFree(image);
image = GP_ContainerLoadNext(container, NULL);
if (image == NULL)
return;
- if (image->w != backend->context->w ||
- image->h != backend->context->h) {
+ if (image->w != backend->pixmap->w ||
+ image->h != backend->pixmap->h) {
GP_BackendResize(backend, image->w, image->h);
return;
}
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
GP_BackendFlip(backend);
}
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
}
/* Blit image into the window and show it */
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
GP_BackendFlip(backend);
/* Wait for events */
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
if (ev.code == GP_EV_SYS_RESIZE) {
GP_BackendResizeAck(backend);
GP_Blit_Clipped(image, 0, 0, image->w, image->h,
- backend->context, 0, 0);
+ backend->pixmap, 0, 0);
GP_BackendFlip(backend);
}
break;
diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c
index 8c798d4cd5a1..fe40e2529e2a 100644
--- a/demos/grinder/grinder.c
+++ b/demos/grinder/grinder.c
@@ -106,7 +106,7 @@ static struct param resize_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int resize(GP_Context **c, const char *params)
+static int resize(GP_Pixmap **c, const char *params)
{
int alg = 1;
float ratio = -1;
@@ -122,14 +122,14 @@ static int resize(GP_Context **c, const char *params)
GP_Size w = ratio * (*c)->w;
GP_Size h = ratio * (*c)->h;
- GP_Context *res = NULL;
+ GP_Pixmap *res = NULL;
res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback);
if (res == NULL)
return EINVAL;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
return 0;
@@ -164,7 +164,7 @@ static struct param scale_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int scale(GP_Context **c, const char *params)
+static int scale(GP_Pixmap **c, const char *params)
{
int alg = 1;
int w = -1;
@@ -185,14 +185,14 @@ static int scale(GP_Context **c, const char *params)
if (h == -1)
h = (*c)->h * (1.00 * w/(*c)->w) + 0.5;
- GP_Context *res = NULL;
+ GP_Pixmap *res = NULL;
res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback);
if (res == NULL)
return EINVAL;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
return 0;
@@ -211,7 +211,7 @@ static struct param rotate_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int rotate(GP_Context **c, const char *params)
+static int rotate(GP_Pixmap **c, const char *params)
{
int rot = -1;
@@ -223,7 +223,7 @@ static int rotate(GP_Context **c, const char *params)
return EINVAL;
}
- GP_Context *res = NULL;
+ GP_Pixmap *res = NULL;
switch (rot) {
case 0:
@@ -240,7 +240,7 @@ static int rotate(GP_Context **c, const char *params)
if (res == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
return 0;
@@ -254,7 +254,7 @@ static struct param mirror_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int mirror(GP_Context **c, const char *params)
+static int mirror(GP_Pixmap **c, const char *params)
{
int vert = 0, horiz = 0;
@@ -277,7 +277,7 @@ static struct param bright_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int bright(GP_Context **c, const char *params)
+static int bright(GP_Pixmap **c, const char *params)
{
float bright = 0;
@@ -296,7 +296,7 @@ static struct param contrast_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int contrast(GP_Context **c, const char *params)
+static int contrast(GP_Pixmap **c, const char *params)
{
float mul = 0;
@@ -319,7 +319,7 @@ static struct param invert_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int invert(GP_Context **c, const char *params)
+static int invert(GP_Pixmap **c, const char *params)
{
if (param_parse(params, invert_params, "invert", param_err))
return EINVAL;
@@ -338,7 +338,7 @@ static struct param blur_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int blur(GP_Context **c, const char *params)
+static int blur(GP_Pixmap **c, const char *params)
{
float sigma = 0;
float sigma_x = 0;
@@ -389,7 +389,7 @@ static struct param dither_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int dither(GP_Context **c, const char *params)
+static int dither(GP_Pixmap **c, const char *params)
{
int fmt = -1;
@@ -401,15 +401,15 @@ static int dither(GP_Context **c, const char *params)
return EINVAL;
}
- GP_Context *bw;
+ GP_Pixmap *bw;
bw = GP_FilterFloydSteinbergAlloc(*c, dither_pixel_types[fmt],
progress_callback);
- //TODO: so far we convert the context back to RGB888
+ //TODO: so far we convert the pixmap back to RGB888
//(so we can do further work with it)
- GP_Blit(bw, 0, 0, GP_ContextW(bw), GP_ContextH(bw), *c, 0, 0);
+ GP_Blit(bw, 0, 0, GP_PixmapW(bw), GP_PixmapH(bw), *c, 0, 0);
- GP_ContextFree(bw);
+ GP_PixmapFree(bw);
return 0;
}
@@ -421,7 +421,7 @@ static struct param save_jpg_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int save_jpg(GP_Context **c, const char *params)
+static int save_jpg(GP_Pixmap **c, const char *params)
{
char *file = NULL;
@@ -445,7 +445,7 @@ static struct param save_png_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int save_png(GP_Context **c, const char *params)
+static int save_png(GP_Pixmap **c, const char *params)
{
char *file = NULL;
@@ -471,7 +471,7 @@ static struct param median_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int median(GP_Context **c, const char *params)
+static int median(GP_Pixmap **c, const char *params)
{
int rad = -1, rad_x, rad_y;
@@ -486,12 +486,12 @@ static int median(GP_Context **c, const char *params)
if (rad_x < 0 || rad_y < 0)
return EINVAL;
- GP_Context *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback);
+ GP_Pixmap *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = ret;
return 0;
@@ -508,7 +508,7 @@ static struct param sigma_mean_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int sigma_mean(GP_Context **c, const char *params)
+static int sigma_mean(GP_Pixmap **c, const char *params)
{
int rad = -1, rad_x, rad_y, min = 0;
float sigma = 0.1;
@@ -527,12 +527,12 @@ static int sigma_mean(GP_Context **c, const char *params)
(*c)->gamma = GP_GammaAcquire((*c)->pixel_type, 1.2);
- GP_Context *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback);
+ GP_Pixmap *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = ret;
return 0;
@@ -545,19 +545,19 @@ static struct param sharpen_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int sharpen(GP_Context **c, const char *params)
+static int sharpen(GP_Pixmap **c, const char *params)
{
float weight = 0.1;
if (param_parse(params, sharpen_params, "sigma", param_err, &weight))
return EINVAL;
- GP_Context *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback);
+ GP_Pixmap *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = ret;
return 0;
@@ -571,7 +571,7 @@ static struct param gauss_noise_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int gauss_noise(GP_Context **c, const char *params)
+static int gauss_noise(GP_Pixmap **c, const char *params)
{
float sigma = 0.1;
float mu = 0;
@@ -601,7 +601,7 @@ static struct param arithmetic_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int arithmetic(GP_Context **c, const char *params)
+static int arithmetic(GP_Pixmap **c, const char *params)
{
char *file = NULL;
int op = -1;
@@ -614,7 +614,7 @@ static int arithmetic(GP_Context **c, const char *params)
return EINVAL;
}
- GP_Context *img, *res = NULL;
+ GP_Pixmap *img, *res = NULL;
if ((img = GP_LoadImage(file, progress_callback)) == NULL) {
print_error("arithmetic: Invalid image.");
@@ -642,7 +642,7 @@ static int arithmetic(GP_Context **c, const char *params)
if (res == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
@@ -656,7 +656,7 @@ static struct param histogram_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int histogram(GP_Context **c, const char *params)
+static int histogram(GP_Pixmap **c, const char *params)
{
char *file = "histogram.png";
@@ -678,7 +678,7 @@ struct filter {
const char *name;
const char *desc;
struct param *param_desc;
- int (*apply)(GP_Context **c, const char *params);
+ int (*apply)(GP_Pixmap **c, const char *params);
};
static struct filter filter_table[] = {
@@ -763,7 +763,7 @@ static void add_filter(char *params)
filter_params[filter_cnt++] = params;
}
-static void apply_filters(GP_Context **src)
+static void apply_filters(GP_Pixmap **src)
{
unsigned int i;
int ret;
@@ -845,7 +845,7 @@ static void check_fmt(const char *fmt)
exit(1);
}
-static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char *fmt)
+static void save_by_fmt(struct GP_Pixmap *bitmap, const char *name, const char *fmt)
{
int ret;
@@ -874,7 +874,7 @@ static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char
int main(int argc, char *argv[])
{
- GP_Context *bitmap;
+ GP_Pixmap *bitmap;
int opt, i;
const char *out_fmt = "ppm";
diff --git a/demos/grinder/histogram.c b/demos/grinder/histogram.c
index 9706315b0f99..d02f17518235 100644
--- a/demos/grinder/histogram.c
+++ b/demos/grinder/histogram.c
@@ -22,7 +22,7 @@
#include "histogram.h"
-void histogram_to_png(const GP_Context *src, const char *filename)
+void histogram_to_png(const GP_Pixmap *src, const char *filename)
{
GP_Histogram *hist;
@@ -36,7 +36,7 @@ void histogram_to_png(const GP_Context *src, const char *filename)
unsigned int i, j;
- GP_Context *res = GP_ContextAlloc(257*4, 256, GP_PIXEL_RGB888);
+ GP_Pixmap *res = GP_PixmapAlloc(257*4, 256, GP_PIXEL_RGB888);
GP_Fill(res, 0xffffff);
@@ -76,6 +76,6 @@ void histogram_to_png(const GP_Context *src, const char *filename)
GP_SavePNG(res, filename, NULL);
- GP_ContextFree(res);
+ GP_PixmapFree(res);
GP_HistogramFree(hist);
}
diff --git a/demos/grinder/histogram.h b/demos/grinder/histogram.h
index d6fdb4e5331f..e58dfd4c4527 100644
--- a/demos/grinder/histogram.h
+++ b/demos/grinder/histogram.h
@@ -25,6 +25,6 @@
#include <GP.h>
-void histogram_to_png(const GP_Context *src, const char *filename);
+void histogram_to_png(const GP_Pixmap *src, const char *filename);
#endif /* HISTOGRAM_H */
diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c
index 46fafe299887..e4226c27114b 100644
--- a/demos/particle/particle_demo.c
+++ b/demos/particle/particle_demo.c
@@ -37,7 +37,7 @@ static GP_Pixel black_pixel;
static GP_Pixel white_pixel;
static GP_Backend *backend = NULL;
-static GP_Context *context = NULL;
+static GP_Pixmap *pixmap = NULL;
static void sighandler(int signo)
{
@@ -88,16 +88,16 @@ int main(int argc, char *argv[])
init_backend(backend_opts);
- context = backend->context;
+ pixmap = backend->pixmap;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, black_pixel);
+ GP_Fill(pixmap, black_pixel);
GP_BackendFlip(backend);
struct space *space;
- space = space_create(particles, 10<<8, 10<<8, (context->w - 10)<<8, (context->h - 10)<<8);
+ space = space_create(particles, 10<<8, 10<<8, (pixmap->w - 10)<<8, (pixmap->h - 10)<<8);
for (;;) {
if (backend->Poll)
@@ -146,8 +146,8 @@ int main(int argc, char *argv[])
space_destroy(space);
space = space_create(particles,
10<<8, 10<<8,
- (context->w - 10)<<8,
- (context->h - 10)<<8);
+ (pixmap->w - 10)<<8,
+ (pixmap->h - 10)<<8);
break;
}
break;
@@ -156,7 +156,7 @@ int main(int argc, char *argv[])
if (!pause_flag) {
space_time_tick(space, 1);
- space_draw_particles(context, space);
+ space_draw_particles(pixmap, space);
GP_BackendFlip(backend);
}
}
diff --git a/demos/particle/space.c b/demos/particle/space.c
index c53b9e31b286..8dfc956d656a 100644
--- a/demos/particle/space.c
+++ b/demos/particle/space.c
@@ -67,11 +67,11 @@ void space_destroy(struct space *space)
#define SQUARE(x) ((x) * (x))
-void space_draw_particles(GP_Context *context, struct space *space)
+void space_draw_particles(GP_Pixmap *pixmap, struct space *space)
{
unsigned int i;
- GP_Fill(context, 0x000000);
+ GP_Fill(pixmap, 0x000000);
for (i = 0; i < space->particle_count; i++) {
GP_Pixel color;
@@ -88,9 +88,9 @@ void space_draw_particles(GP_Context *context, struct space *space)
}
*/
- color = GP_RGBToContextPixel(0xee, 0xee, 0xee, context);
+ color = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap);
- GP_PutPixelAA(context, x, y, color);
+ GP_PutPixelAA(pixmap, x, y, color);
int val = SQUARE(space->particles[i].vx) + SQUARE(space->particles[i].vy);
@@ -99,29 +99,29 @@ void space_draw_particles(GP_Context *context, struct space *space)
if (val > 255)
val = 255;
- color = GP_RGBToContextPixel(val, val, 0x40, context);
+ color = GP_RGBToPixmapPixel(val, val, 0x40, pixmap);
/* Hexagons */
- GP_LineAA(context, x - a2, y - a1, x + a2, y - a1, color);
- // GP_LineAA(context, x + a2, y - a1, x + a1, y - a2, color);
- GP_LineAA(context, x + a1, y - a2, x + a1, y + a2, color);
- // GP_LineAA(context, x + a1, y + a2, x + a2, y + a1, color);
- GP_LineAA(context, x + a2, y + a1, x - a2, y + a1, color);
- // GP_LineAA(context, x - a2, y + a1, x - a1, y + a2, color);
- GP_LineAA(context, x - a1, y + a2, x - a1, y - a2, color);
- // GP_LineAA(context, x - a1, y - a2, x - a2, y - a1, color);
+ GP_LineAA(pixmap, x - a2, y - a1, x + a2, y - a1, color);
+ // GP_LineAA(pixmap, x + a2, y - a1, x + a1, y - a2, color);
+ GP_LineAA(pixmap, x + a1, y - a2, x + a1, y + a2, color);
+ // GP_LineAA(pixmap, x + a1, y + a2, x + a2, y + a1, color);
+ GP_LineAA(pixmap, x + a2, y + a1, x - a2, y + a1, color);
+ // GP_LineAA(pixmap, x - a2, y + a1, x - a1, y + a2, color);
+ GP_LineAA(pixmap, x - a1, y + a2, x - a1, y - a2, color);
+ // GP_LineAA(pixmap, x - a1, y - a2, x - a2, y - a1, color);
/*
- GP_PutPixelAA(context, x + a2, y - a1, 0xffffff);
- GP_PutPixelAA(context, x + a1, y - a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a2, y - a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a1, y - a2, 0xffffff);
- GP_PutPixelAA(context, x + a1, y + a2, 0xffffff);
- GP_PutPixelAA(context, x + a2, y + a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a1, y + a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a2, y + a1, 0xffffff);
- GP_PutPixelAA(context, x - a2, y + a1, 0xffffff);
- GP_PutPixelAA(context, x - a1, y + a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a2, y + a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a1, y + a2, 0xffffff);
- GP_PutPixelAA(context, x - a1, y - a2, 0xffffff);
- GP_PutPixelAA(context, x - a2, y - a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a1, y - a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a2, y - a1, 0xffffff);
*/
}
}
diff --git a/demos/particle/space.h b/demos/particle/space.h
index 7878b11c2a69..021d615b36fc 100644
--- a/demos/particle/space.h
+++ b/demos/particle/space.h
@@ -69,7 +69,7 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h,
void space_destroy(struct space *space);
-void space_draw_particles(GP_Context *context, struct space *space);
+void space_draw_particles(GP_Pixmap *pixmap, struct space *space);
void space_time_tick(struct space *space, int time);
diff --git a/demos/py_simple/backends.py b/demos/py_simple/backends.py
index 31fb59d145d3..84715526aa2c 100755
--- a/demos/py_simple/backends.py
+++ b/demos/py_simple/backends.py
@@ -9,7 +9,7 @@ import gfxprim.text as text
import gfxprim.input as input
def redraw(bk):
- c = bk.context
+ c = bk.pixmap
black = c.RGBToPixel(0, 0, 0)
white = c.RGBToPixel(0xff, 0xff, 0xff)
diff --git a/demos/py_simple/blit.py b/demos/py_simple/blit.py
index 2b3a6943c507..e76b8c08e0aa 100755
--- a/demos/py_simple/blit.py
+++ b/demos/py_simple/blit.py
@@ -21,13 +21,13 @@ class Ball:
self.bg_img = bg_img
def draw(self, bk):
- self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h)
+ self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
def move(self, bk):
old_x = self.x;
old_y = self.y;
- self.bg_img.Blit(old_x, old_y, bk.context, old_x, old_y, self.ball.w, self.ball.h)
+ self.bg_img.Blit(old_x, old_y, bk.pixmap, old_x, old_y, self.ball.w, self.ball.h)
self.x += self.dx
self.y += self.dy
@@ -38,7 +38,7 @@ class Ball:
if (self.y <= 0 or self.y >= self.bg_img.h - self.ball.h):
self.dy = -self.dy
- self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h)
+ self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
bk.UpdateRect(min(old_x, self.x), min(self.y, old_y),
max(old_x, self.x) + self.ball.w - 1,
max(old_y, self.y) + self.ball.h - 1)
@@ -59,7 +59,7 @@ def main():
# Create X11 window
bk = backends.BackendX11Init(None, 0, 0, bg.w, bg.h, sys.argv[1], 0)
assert(bk)
- bg.Blit(0, 0, bk.context, 0, 0, bg.w, bg.h)
+ bg.Blit(0, 0, bk.pixmap, 0, 0, bg.w, bg.h)
bk.Flip()
diff --git a/demos/py_simple/cam_view.py b/demos/py_simple/cam_view.py
index 6692abb914bb..dd7bcc88286c 100755
--- a/demos/py_simple/cam_view.py
+++ b/demos/py_simple/cam_view.py
@@ -25,7 +25,7 @@ def main():
sleep(0.01)
if (grabber.Poll()):
- grabber.frame.Blit(0, 0, bk.context, 0, 0, grabber.frame.w, grabber.frame.h)
+ grabber.frame.Blit(0, 0, bk.pixmap, 0, 0, grabber.frame.w, grabber.frame.h)
bk.Flip()
ev = bk.PollEvent()
diff --git a/demos/py_simple/font_style.py b/demos/py_simple/font_style.py
index 47d8e2cbff8e..1799253d8a10 100755
--- a/demos/py_simple/font_style.py
+++ b/demos/py_simple/font_style.py
@@ -9,7 +9,7 @@ import gfxprim.input as input
import gfxprim.text as text
def redraw(win):
- c = win.context
+ c = win.pixmap
black = c.RGBToPixel(0, 0, 0)
white = c.RGBToPixel(0xff, 0xff, 0xff)
diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py
index c79d879e8600..0ee8dbe6517e 100755
--- a/demos/py_simple/gfx.py
+++ b/demos/py_simple/gfx.py
@@ -8,88 +8,88 @@ import gfxprim.backends as backends
import gfxprim.input as input
def fill(bk):
- color = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bk.context.gfx.Fill(color)
+ color = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bk.pixmap.gfx.Fill(color)
bk.Flip()
def hline(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
- for i in range(0, bk.context.h, 10):
- bk.context.gfx.HLine(0, bk.context.w, i, fg)
+ bk.pixmap.gfx.Fill(bg)
+ for i in range(0, bk.pixmap.h, 10):
+ bk.pixmap.gfx.HLine(0, bk.pixmap.w, i, fg)
bk.Flip()
def vline(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- for i in range(0, bk.context.w, 10):
- bk.context.gfx.VLine(i, 0, bk.context.h, fg)
+ for i in range(0, bk.pixmap.w, 10):
+ bk.pixmap.gfx.VLine(i, 0, bk.pixmap.h, fg)
bk.Flip()
def line(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- for i in range(0, 2 * max(bk.context.w, bk.context.h), 13):
- bk.context.gfx.Line(0, i, i, 0, fg)
+ for i in range(0, 2 * max(bk.pixmap.w, bk.pixmap.h), 13):
+ bk.pixmap.gfx.Line(0, i, i, 0, fg)
bk.Flip()
def rect(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
for i in range(10, 130, 10):
- bk.context.gfx.Rect(i, i, bk.context.w - i, bk.context.h - i, fg)
+ bk.pixmap.gfx.Rect(i, i, bk.pixmap.w - i, bk.pixmap.h - i, fg)
bk.Flip()
def triangle(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- w = bk.context.w
- h = bk.context.h
+ w = bk.pixmap.w
+ h = bk.pixmap.h
for i in range(10, 90, 10):
- bk.context.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg)
+ bk.pixmap.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg)
bk.Flip()
def tetragon(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- w = bk.context.w
- h = bk.context.h
+ w = bk.pixmap.w
+ h = bk.pixmap.h
for i in range(10, 70, 10):
- bk.context.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg)
+ bk.pixmap.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg)
bk.Flip()
def polygon(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- w = bk.context.w
- h = bk.context.h
+ w = bk.pixmap.w
+ h = bk.pixmap.h
polygon = [(10, 10), (10, (h-10)//3), ((w-10)//3, (h-10)//2),
(10, 2*(h-10)//3), (10, h-10), ((w-10)//3, h-10),
@@ -98,7 +98,7 @@ def polygon(bk):
(w-10, (h-10)//3), (w-10, 10), (2*(w-10)//3, 10),
((w-10)//2, (h-10)//3), ((w-10)//3, 10)]
- bk.context.gfx.Polygon(polygon, fg)
+ bk.pixmap.gfx.Polygon(polygon, fg)
bk.Flip()
diff --git a/demos/py_simple/gravplots_AA.py b/demos/py_simple/gravplots_AA.py
index 747774402344..5de7bcc6a0a7 100755
--- a/demos/py_simple/gravplots_AA.py
+++ b/demos/py_simple/gravplots_AA.py
@@ -72,7 +72,7 @@ def main():
print(bk)
print("Modify source for parameters,")
print("Kill to terminate ;-)")
- black = bk.context.RGBToPixel(0, 0, 0)
+ black = bk.pixmap.RGBToPixel(0, 0, 0)
es = [elem() for i in range(N)]
while True:
@@ -86,18 +86,18 @@ def main():
x = int((e.x % W) * 0x100)
y = int(e.y * 0x100)
if e.vx > 0.2:
- bk.context.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black)
+ bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black)
if e.vx < -0.2:
- bk.context.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black)
- bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(e.r, e.g, e.b))
+ bk.pixmap.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black)
+ bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b))
else:
x = int(e.x % W)
y = int(e.y)
if e.vx > 0.2:
- bk.context.gfx.VLine(x + 1, y - 2, y + 2, black)
+ bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black)
if e.vx < -0.2:
- bk.context.gfx.VLine(x - 1, y - 2, y + 2, black)
- bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(e.r, e.g, e.b))
+ bk.pixmap.gfx.VLine(x - 1, y - 2, y + 2, black)
+ bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b))
bk.Poll()
bk.Flip()
global TIMEOUT
@@ -106,7 +106,7 @@ def main():
if TIMEOUT == 0:
break
if SAVETO:
- bk.context.Save(SAVETO)
+ bk.pixmap.Save(SAVETO)
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py
index 6c5e97c572a3..07c54b41913a 100755
--- a/demos/py_simple/showimage.py
+++ b/demos/py_simple/showimage.py
@@ -18,7 +18,7 @@ def main():
# Create X11 window
bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0)
assert(bk)
- img.Blit(0, 0, bk.context, 0, 0, img.w, img.h)
+ img.Blit(0, 0, bk.pixmap, 0, 0, img.w, img.h)
bk.Flip()
# Event loop
diff --git a/demos/py_simple/sinplots_AA.py b/demos/py_simple/sinplots_AA.py
index e0933b562bd8..44afd21ecb7c 100755
--- a/demos/py_simple/sinplots_AA.py
+++ b/demos/py_simple/sinplots_AA.py
@@ -34,7 +34,7 @@ def main():
print(bk)
print("Modify source for parameters,")
print("Kill to terminate ;-)")
- black = bk.context.RGBToPixel(0, 0, 0)
+ black = bk.pixmap.RGBToPixel(0, 0, 0)
ps = [plotter() for i in range(N)]
t = random.uniform(0.0, 10.0 * W)
@@ -46,13 +46,13 @@ def main():
if AA:
x = int(x * 0x100)
y = int(y * 0x100)
- bk.context.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black)
- bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(int(r), int(g), int(b)))
+ bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black)
+ bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b)))
else:
x = int(x)
y = int(y)
- bk.context.gfx.VLine(x + 1, y - 2, y + 2, black)
- bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(int(r), int(g), int(b)))
+ bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black)
+ bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b)))
bk.Flip()
if __name__ == '__main__':
diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py
index 133be6e504b2..3c34ff7a941e 100755
--- a/demos/py_simple/x11_windows.py
+++ b/demos/py_simple/x11_windows.py
@@ -9,7 +9,7 @@ import gfxprim.input as input
import gfxprim.text as text
def redraw(bk, id):
- c = bk.context
+ c = bk.pixmap
black = c.RGBToPixel(0, 0, 0)
white = c.RGBToPixel(0xff, 0xff, 0xff)
diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c
index 5f270a8a6e88..28ea5bbbfc22 100644
--- a/demos/spiv/image_cache.c
+++ b/demos/spiv/image_cache.c
@@ -26,7 +26,7 @@
#include "image_cache.h"
struct image {
- GP_Context *ctx;
+ GP_Pixmap *pixmap;
GP_DataStorage *meta_data;
struct image *prev;
@@ -73,23 +73,23 @@ size_t image_cache_get_ram_size(void)
/*
* Reports correct image record size.
*/
-static size_t image_size2(GP_Context *ctx, GP_DataStorage *meta_data,
+static size_t image_size2(GP_Pixmap *pixmap, GP_DataStorage *meta_data,
const char *path)
{
size_t meta_data_size = 0;
- size_t context_size = ctx->bytes_per_row * ctx->h + sizeof(GP_Context);
+ size_t pixmap_size = pixmap->bytes_per_row * pixmap->h + sizeof(GP_Pixmap);
//TODO! 4096 is a size of single block, data storage may have more blocks
if (meta_data)
meta_data_size = 4096;
- return meta_data_size + context_size +
+ return meta_data_size + pixmap_size +
sizeof(struct image) + strlen(path) + 1;
}
static size_t image_size(struct image *img)
{
- return image_size2(img->ctx, NULL, img->path);
+ return image_size2(img->pixmap, NULL, img->path);
}
struct image_cache *image_cache_create(unsigned int max_size_kbytes)
@@ -135,7 +135,7 @@ static void remove_img_free(struct image_cache *self,
GP_DEBUG(2, "Freeing image '%s' size %zu", img->path, size);
remove_img(self, img, size);
- GP_ContextFree(img->ctx);
+ GP_PixmapFree(img->pixmap);
GP_DataStorageDestroy(img->meta_data);
free(img);
}
@@ -159,7 +159,7 @@ static void add_img(struct image_cache *self, struct image *img, size_t size)
self->end = img;
}
-int image_cache_get(struct image_cache *self, GP_Context **img,
+int image_cache_get(struct image_cache *self, GP_Pixmap **img,
GP_DataStorage **meta_data, int elevate, const char *key)
{
struct image *i;
@@ -189,7 +189,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img,
}
if (img)
- *img = i->ctx;
+ *img = i->pixmap;
if (meta_data)
*meta_data = i->meta_data;
@@ -197,7 +197,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img,
return 0;
}
-GP_Context *image_cache_get2(struct image_cache *self, int elevate,
+GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate,
const char *fmt, ...)
{
va_list va;
@@ -246,7 +246,7 @@ GP_Context *image_cache_get2(struct image_cache *self, int elevate,
if (len >= sizeof(buf))
free(key);
- return i ? i->ctx : NULL;
+ return i ? i->pixmap : NULL;
}
void image_cache_print(struct image_cache *self)
@@ -283,7 +283,7 @@ static int assert_size(struct image_cache *self, size_t size)
return 0;
}
-int image_cache_put(struct image_cache *self, GP_Context *ctx,
+int image_cache_put(struct image_cache *self, GP_Pixmap *pixmap,
GP_DataStorage *meta_data, const char *key)
{
size_t size;
@@ -291,7 +291,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx,
if (self == NULL)
return 1;
- size = image_size2(ctx, meta_data, key);
+ size = image_size2(pixmap, meta_data, key);
/*
* We try to create room for the image. If this fails we add the image
@@ -307,7 +307,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx,
return 1;
}
- img->ctx = ctx;
+ img->pixmap = pixmap;
img->meta_data = meta_data;
img->elevated = 0;
strcpy(img->path, key);
@@ -319,7 +319,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx,
return 0;
}
-int image_cache_put2(struct image_cache *self, GP_Context *ctx,
+int image_cache_put2(struct image_cache *self, GP_Pixmap *pixmap,
GP_DataStorage *meta_data, const char *fmt, ...)
{
size_t size, len;
@@ -333,7 +333,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx,
va_end(va);
//TODO: FIX THIS
- size = image_size2(ctx, meta_data, "") + len + 1;
+ size = image_size2(pixmap, meta_data, "") + len + 1;
/*
* We try to create room for the image. If this fails we add the image
@@ -349,7 +349,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx,
return 1;
}
- img->ctx = ctx;
+ img->pixmap = pixmap;
img->meta_data = meta_data;
img->elevated = 0;
diff --git a/demos/spiv/image_cache.h b/demos/spiv/image_cache.h
index f2ea1fa16e35..5aa40021ed7c 100644
--- a/demos/spiv/image_cache.h
+++ b/demos/spiv/image_cache.h
@@ -47,20 +47,20 @@ struct image_cache *image_cache_create(unsigned int max_size_kbytes);
* If elevate set and image is found, the image is elevated to the top so
* it has lesser chance of being freed.
*/
-int image_cache_get(struct image_cache *self, GP_Context **img,
+int image_cache_get(struct image_cache *self, GP_Pixmap **img,
GP_DataStorage **meta_data, int elevate,
const char *key);
-GP_Context *image_cache_get2(struct image_cache *self, int elevate,
+GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
/*
* Puts an image into a cache.
*/
-int image_cache_put(struct image_cache *self, GP_Context *img,
+int image_cache_put(struct image_cache *self, GP_Pixmap *img,
GP_DataStorage *meta_data, const char *key);
-int image_cache_put2(struct image_cache *self, GP_Context *img,
+int image_cache_put2(struct image_cache *self, GP_Pixmap *img,
GP_DataStorage *meta_data, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
diff --git a/demos/spiv/image_loader.c b/demos/spiv/image_loader.c
index c7e0f9ba66fc..8f86f92fc259 100644
--- a/demos/spiv/image_loader.c
+++ b/demos/spiv/image_loader.c
@@ -22,7 +22,7 @@
#include <errno.h>
-#include <core/GP_Context.h>
+#include <core/GP_Pixmap.h>
#include <core/GP_Debug.h>
#include <loaders/GP_Loaders.h>
@@ -34,7 +34,7 @@
static struct image_cache *img_cache;
static struct image_list *img_list;
-static GP_Context *cur_img;
+static GP_Pixmap *cur_img;
static GP_DataStorage *cur_meta_data;
static GP_Container *cur_cont;
@@ -57,11 +57,11 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes)
return 0;
}
-GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate)
+GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate)
{
struct cpu_timer timer;
const char *path;
- GP_Context *img;
+ GP_Pixmap *img;
int err, ret;
if (cur_img)
@@ -154,7 +154,7 @@ static void drop_cur_img(void)
* Currently loaded image is too big to be cached -> free it.
*/
if (image_cache_get(img_cache, NULL, NULL, 0, path)) {
- GP_ContextFree(cur_img);
+ GP_PixmapFree(cur_img);
GP_DataStorageDestroy(cur_meta_data);
}
diff --git a/demos/spiv/image_loader.h b/demos/spiv/image_loader.h
index 9992bca70e50..5d2223ee1c7f 100644
--- a/demos/spiv/image_loader.h
+++ b/demos/spiv/image_loader.h
@@ -31,7 +31,7 @@
#ifndef __IMAGE_LOADER_H__
#define __IMAGE_LOADER_H__
-#include <core/GP_Context.h>
+#include <core/GP_Pixmap.h>
#include <core/GP_ProgressCallback.h>
/*
@@ -46,7 +46,7 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes);
*
* Note that the callback may not be called when the image is cached.
*/
-GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate);
+GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate);
/*
* Retruns current image meta data or NULL there are none.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index 91b1a2a3c9e5..947390c964be 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -81,7 +81,7 @@ struct loader_params {
static int image_loader_callback(GP_ProgressCallback *self)
{
static GP_Size size = 0;
- GP_Context *c = backend->context;
+ GP_Pixmap *c = backend->pixmap;
if (abort_flag)
return 1;
@@ -114,7 +114,7 @@ static int image_loader_callback(GP_ProgressCallback *self)
return 0;
}
-static GP_Context *load_image(int elevate);
+static GP_Pixmap *load_image(int elevate);
static const char *img_name(const char *img_path)
{
@@ -140,9 +140,9 @@ static void set_caption(const char *path, float rat)
/*
* Loads image
*/
-static GP_Context *load_image(int elevate)
+static GP_Pixmap *load_image(int elevate)
{
- GP_Context *img;
+ GP_Pixmap *img;
GP_ProgressCallback callback = {.callback = image_loader_callback,
.priv = "Loading image"};
@@ -151,13 +151,13 @@ static GP_Context *load_image(int elevate)
if (img)
return img;
- GP_Context *ctx = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
- GP_Fill(ctx, black_pixel);
- GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 - 10,
+ GP_Fill(pixmap, black_pixel);
+ GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 - 10,
GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel,
"'%s'", image_loader_img_path());
- GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 + 10,
+ GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 + 10,
GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel,
"Failed to load image :( (%s)", strerror(errno));
GP_BackendFlip(backend);
@@ -166,16 +166,16 @@ static GP_Context *load_image(int elevate)
}
/*
- * Fill context with chessboard-like pattern.
+ * Fill pixmap with chessboard-like pattern.
*/
-static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0,
+static void pattern_fill(GP_Pixmap *pixmap, unsigned int x0, unsigned int y0,
unsigned int w, unsigned int h)
{
unsigned int x, y, i, j = 0;
GP_Pixel col[2];
- col[0] = GP_RGBToContextPixel(0x64, 0x64, 0x64, ctx);
- col[1] = GP_RGBToContextPixel(0x80, 0x80, 0x80, ctx);
+ col[0] = GP_RGBToPixmapPixel(0x64, 0x64, 0x64, pixmap);
+ col[1] = GP_RGBToPixmapPixel(0x80, 0x80, 0x80, pixmap);
unsigned int wm = w/20 < 5 ? 5 : w/20;
unsigned int hm = h/20 < 5 ? 5 : h/20;
@@ -184,18 +184,18 @@ static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0,
i = j;
j = !j;
for (x = 0; x < w; x += wm) {
- GP_FillRectXYWH(ctx, x0 + x, y0 + y, wm, hm, col[i]);
+ GP_FillRectXYWH(pixmap, x0 + x, y0 + y, wm, hm, col[i]);
i = !i;
}
}
}
-static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y,
+static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y,
const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
-static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y,
+static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y,
const char *fmt, ...)
{
va_list va, vac;
@@ -203,17 +203,17 @@ static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y,
va_start(va, fmt);
va_copy(vac, va);
- GP_VPrint(ctx, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
+ GP_VPrint(pixmap, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
black_pixel, white_pixel, fmt, vac);
va_end(vac);
- GP_VPrint(ctx, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
+ GP_VPrint(pixmap, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
white_pixel, black_pixel, fmt, va);
va_end(va);
}
-static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context,
+static unsigned int print_meta_data(GP_DataNode *node, GP_Pixmap *pixmap,
unsigned int th, unsigned int y, int level)
{
GP_DataNode *i;
@@ -224,21 +224,21 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context,
x = th * level + 10;
switch (i->type) {
case GP_DATA_INT:
- info_printf(context, x, y, "%s : %li", i->id, i->value.i);
+ info_printf(pixmap, x, y, "%s : %li", i->id, i->value.i);
break;
case GP_DATA_DOUBLE:
- info_printf(context, x, y, "%s : %lf", i->id, i->value.d);
+ info_printf(pixmap, x, y, "%s : %lf", i->id, i->value.d);
break;
case GP_DATA_STRING:
- info_printf(context, x, y, "%s : %s", i->id, i->value.str);
+ info_printf(pixmap, x, y, "%s : %s", i->id, i->value.str);
break;
case GP_DATA_RATIONAL:
- info_printf(context, x, y, "%s : %li/%li",
+ info_printf(pixmap, x, y, "%s : %li/%li",
i->id, i->value.rat.num, i->value.rat.den);
break;
case GP_DATA_DICT:
- info_printf(context, x, y, "%s", i->id);
- y = print_meta_data(i, context, th, y, level+1);
+ info_printf(pixmap, x, y, "%s", i->id);
+ y = print_meta_data(i, pixmap, th, y, level+1);
break;
}
}
@@ -246,10 +246,10 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context,
return y;
}
-static void show_info(struct loader_params *params, GP_Context *img,
- GP_Context *orig_img)
+static void show_info(struct loader_params *params, GP_Pixmap *img,
+ GP_Pixmap *orig_img)
{
- GP_Context *context = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
const char *img_path = image_loader_img_path();
set_caption(img_path, params->zoom_rat);
@@ -259,17 +259,17 @@ static void show_info(struct loader_params *params, GP_Context *img,
GP_Size th = GP_TextHeight(config.style), y = 10;
- info_printf(context, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s",
+ info_printf(pixmap, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s",
img->w, img->h, orig_img->w, orig_img->h, params->zoom_rat,
params->zoom_rat * 100, GP_PixelTypeName(img->pixel_type));
y += th + 2;
- info_printf(context, 10, y, "%s", img_name(img_path));
+ info_printf(pixmap, 10, y, "%s", img_name(img_path));
y += th + 2;
if (params->zoom_rat != 1.00) {
- info_printf(context, 10, y, "%s%s",
+ info_printf(pixmap, 10, y, "%s%s",
params->use_low_pass && params->zoom_rat < 1 ? "Gaussian LP + " : "",
GP_InterpolationTypeName(params->resampling_method));
y += th + 2;
@@ -278,14 +278,14 @@ static void show_info(struct loader_params *params, GP_Context *img,
unsigned int count = image_loader_count();
unsigned int pos = image_loader_pos() + 1;
- info_printf(context, 10, y, "%u of %u", pos, count);
+ info_printf(pixmap, 10, y, "%u of %u", pos, count);
y += th + 2;
if (image_loader_is_in_dir()) {
unsigned int dir_count = image_loader_dir_count();
unsigned int dir_pos = image_loader_dir_pos() + 1;
- info_printf(context, 10, y,
+ info_printf(pixmap, 10, y,
"%u of %u in directory", dir_pos, dir_count);
}
@@ -299,13 +299,13 @@ static void show_info(struct loader_params *params, GP_Context *img,
if (node->type != GP_DATA_DICT)
return;
- print_meta_data(node, context, th + 2, y + th, 0);
+ print_meta_data(node, pixmap, th + 2, y + th, 0);
}
-static void update_display(struct loader_params *params, GP_Context *img,
- GP_Context *orig_img)
+static void update_display(struct loader_params *params, GP_Pixmap *img,
+ GP_Pixmap *orig_img)
{
- GP_Context *context = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
struct cpu_timer timer;
GP_ProgressCallback callback = {.callback = image_loader_callback};
@@ -340,11 +340,11 @@ static void update_display(struct loader_params *params, GP_Context *img,
*/
if (config.win_strategy == ZOOM_WIN_FIXED) {
- if (img->w < context->w)
- cx = (context->w - img->w)/2;
+ if (img->w < pixmap->w)
+ cx = (pixmap->w - img->w)/2;
- if (img->h < context->h)
- cy = (context->h - img->h)/2;
+ if (img->h < pixmap->h)
+ cy = (pixmap->h - img->h)/2;
}
if (params->zoom_manual) {
@@ -352,49 +352,49 @@ static void update_display(struct loader_params *params, GP_Context *img,
cy = params->zoom_y_offset;
}
- GP_Context sub_display;
+ GP_Pixmap sub_display;
cpu_timer_start(&timer, "Blitting");
if (config.floyd_steinberg) {
callback.priv = "Dithering";
- GP_SubContext(context, &sub_display, cx, cy, img->w, img->h);
+ GP_SubPixmap(pixmap, &sub_display, cx, cy, img->w, img->h);
GP_FilterFloydSteinberg(img, &sub_display, NULL);
// GP_FilterHilbertPeano(img, &sub_display, NULL);
} else {
if (GP_PixelHasFlags(img->pixel_type, GP_PIXEL_HAS_ALPHA))
- pattern_fill(context, cx, cy, img->w, img->h);
- GP_Blit_Clipped(img, 0, 0, img->w, img->h, context, cx, cy);
+ pattern_fill(pixmap, cx, cy, img->w, img->h);
+ GP_Blit_Clipped(img, 0, 0, img->w, img->h, pixmap, cx, cy);
}
cpu_timer_stop(&timer);
/* clean up the rest of the display */
- GP_FillRectXYWH(context, 0, 0, cx, context->h, black_pixel);
- GP_FillRectXYWH(context, 0, 0, context->w, cy, black_pixel);
+ GP_FillRectXYWH(pixmap, 0, 0, cx, pixmap->h, black_pixel);
+ GP_FillRectXYWH(pixmap, 0, 0, pixmap->w, cy, black_pixel);
- int w = context->w - img->w - cx;
+ int w = pixmap->w - img->w - cx;
if (w > 0)
- GP_FillRectXYWH(context, img->w + cx, 0, w, context->h, black_pixel);
+ GP_FillRectXYWH(pixmap, img->w + cx, 0, w, pixmap->h, black_pixel);
- int h = context->h - img->h - cy;
+ int h = pixmap->h - img->h - cy;
if (h > 0)
- GP_FillRectXYWH(context, 0, img->h + cy, context->w, h, black_pixel);
+ GP_FillRectXYWH(pixmap, 0, img->h + cy, pixmap->w, h, black_pixel);
show_info(params, img, orig_img);
if (config.combined_orientation)
- GP_ContextFree(img);
+ GP_PixmapFree(img);
GP_BackendFlip(backend);
}
-GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h)
+GP_Pixmap *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h)
{
- GP_Context *img, *res = NULL;
+ GP_Pixmap *img, *res = NULL;
struct cpu_timer timer;
GP_ProgressCallback callback = {.callback = image_loader_callback};
@@ -414,10 +414,10 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
if (params->show_nn_first) {
/* Do simple interpolation and blit the result */
- GP_Context *nn = GP_FilterResizeNNAlloc(img, w, h, NULL);
+ GP_Pixmap *nn = GP_FilterResizeNNAlloc(img, w, h, NULL);
if (nn != NULL) {
update_display(params, nn, img);
- GP_ContextFree(nn);
+ GP_PixmapFree(nn);
}
}
@@ -441,7 +441,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
cpu_timer_start(&timer, "Resampling");
callback.priv = "Resampling Image";
- GP_Context *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback);
+ GP_Pixmap *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback);
img = i1;
cpu_timer_stop(&timer);
@@ -454,8 +454,8 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
}
*/
- /* Free low passed context if needed */
- GP_ContextFree(res);
+ /* Free low passed pixmap if needed */
+ GP_PixmapFree(res);
if (img == NULL)
return NULL;
@@ -593,7 +593,7 @@ static void *image_loader(void *ptr)
{
struct loader_params *params = ptr;
struct cpu_timer sum_timer;
- GP_Context *img, *orig_img, *context = backend->context;
+ GP_Pixmap *img, *orig_img, *pixmap = backend->pixmap;
cpu_timer_start(&sum_timer, "sum");
@@ -609,7 +609,7 @@ static void *image_loader(void *ptr)
GP_Size w, h;
params->zoom_rat = calc_img_size(params, orig_img->w, orig_img->h,
- context->w, context->h);
+ pixmap->w, pixmap->h);
w = orig_img->w * params->zoom_rat + 0.5;
h = orig_img->h * params->zoom_rat + 0.5;
@@ -788,7 +788,7 @@ static uint32_t timer_callback(GP_Timer *self)
int main(int argc, char *argv[])
{
- GP_Context *context = NULL;
+ GP_Pixmap *pixmap = NULL;
int shift_flag;
int opts;
@@ -853,13 +853,13 @@ int main(int argc, char *argv[])
GP_BACKEND_CALL_EXIT);
}
- context = backend->context;
+ pixmap = backend->pixmap;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
- gray_pixel = GP_RGBToContextPixel(0x33, 0x33, 0x33, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ gray_pixel = GP_RGBToPixmapPixel(0x33, 0x33, 0x33, pixmap);
- GP_Fill(context, black_pixel);
+ GP_Fill(pixmap, black_pixel);
GP_BackendFlip(backend);
params.show_progress_once = 1;
@@ -1115,7 +1115,7 @@ int main(int argc, char *argv[])
/* stop loader thread before resizing backend buffer */
stop_loader();
GP_BackendResizeAck(backend);
- GP_Fill(backend->context, 0);
+ GP_Fill(backend->pixmap, 0);
params.show_progress_once = 1;
show_image(¶ms);
break;
diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c
index 2d7eac9430d4..aad401055a93 100644
--- a/demos/spiv/spiv_help.c
+++ b/demos/spiv/spiv_help.c
@@ -234,9 +234,9 @@ static int last_line;
static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff)
{
- GP_Context *c = backend->context;
- GP_Pixel black = GP_RGBToContextPixel(0x00, 0x00, 0x00, c);
- GP_Pixel white = GP_RGBToContextPixel(0xff, 0xff, 0xff, c);
+ GP_Pixmap *c = backend->pixmap;
+ GP_Pixel black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, c);
+ GP_Pixel white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, c);
int i;
int spacing = GP_TextHeight(config.style)/10 + 2;
diff --git a/demos/ttf2img/ttf2img.c b/demos/ttf2img/ttf2img.c
index deaa37a48fab..0e75546a7ebd 100644
--- a/demos/ttf2img/ttf2img.c
+++ b/demos/ttf2img/ttf2img.c
@@ -74,23 +74,23 @@ int main(int argc, char *argv[])
GP_SetDebugLevel(debug_level);
- GP_Context *context = GP_ContextAlloc(img_w, img_h, GP_PIXEL_RGB888);
+ GP_Pixmap *pixmap = GP_PixmapAlloc(img_w, img_h, GP_PIXEL_RGB888);
- GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- GP_Pixel white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ GP_Pixel white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, white_pixel);
+ GP_Fill(pixmap, white_pixel);
GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
style.font = GP_FontFaceLoad(font_path, 27, 0);
- GP_Text(context, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER,
+ GP_Text(pixmap, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER,
black_pixel, white_pixel, string);
- GP_SavePNG(context, img_path, NULL);
+ GP_SavePNG(pixmap, img_path, NULL);
- GP_ContextFree(context);
+ GP_PixmapFree(pixmap);
return 0;
}
diff --git a/doc/Makefile b/doc/Makefile
index 9c1bcfb73242..5da5636ad7ec 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +1,7 @@
TOPDIR=..
include $(TOPDIR)/config.mk
-SOURCES=index.html about.txt context.txt loaders.txt filters.txt \
+SOURCES=index.html about.txt pixmap.txt loaders.txt filters.txt \
basic_types.txt gfx.txt backends.txt gamma.txt grabbers.txt \
environment_variables.txt debug.txt core.txt input.txt \
gen.txt pixels.txt coordinate_system.txt coding_style.txt \
diff --git a/doc/about.txt b/doc/about.txt
index 167425abe289..96f3652b7238 100644
--- a/doc/about.txt
+++ b/doc/about.txt
@@ -17,7 +17,7 @@ Core
Core of the library contains minimal amount of code to define interface that
is shared between all parts of the library.
-The most important part of the core is link:context.html[CP_Context] structure
+The most important part of the core is link:pixmap.html[GP_Pixmap] structure
that represents in-memory pixmap.
The Core also contains generated code for basic operations such as
diff --git a/doc/backends.txt b/doc/backends.txt
index 944c13f3e2db..a4834660817d 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -80,15 +80,15 @@ window resizable.
[source,c]
-------------------------------------------------------------------------------
-#include <backends/GP_SDL_Context.h>
+#include <backends/GP_SDL_Pixmap.h>
-int GP_ContextFromSDLSurface(GP_Context *c, const SDL_Surface *surf);
+int GP_PixmapFromSDLSurface(GP_Pixmap *c, const SDL_Surface *surf);
-------------------------------------------------------------------------------
This function allows you to mix 'SDL' and 'GFXprim' code.
-It initializes a 'GFXprim' context from the 'SDL' surface using the pixel
-buffer from surface as pixel buffer for the context.
+It initializes a 'GFXprim' pixmap from the 'SDL' surface using the pixel
+buffer from surface as pixel buffer for the pixmap.
Function returns zero on success and non-zero on failure (i.e. there is no
'GFXprim' pixel type to match given surface).
@@ -243,9 +243,9 @@ typdef struct GP_Backend {
const char *name;
/*
- * Pointer to context APP should draw to.
+ * Pointer to pixmap APP should draw to.
*/
- GP_Context *context;
+ GP_Pixmap *pixmap;
...
@@ -595,8 +595,8 @@ was successful (i.e. X server allowed us to resize the window) the resize
event will be send and should be handled in your event loop. You must respond
to it by the 'GP_BackendResizeAck()' described below.
-NOTE: The backend->context pointer may change upon calling this function and
- at least backend->context->pixels pointer will change.
+NOTE: The backend->pixmap pointer may change upon calling this function and
+ at least backend->pixmap->pixels pointer will change.
[[ResizeAck]]
@@ -613,10 +613,10 @@ int GP_BackendResizeAck(GP_Backend *self);
-------------------------------------------------------------------------------
If backend is resizable by user interaction (for example X Window) you will
-get resize event for each change of window size, however the backend context
+get resize event for each change of window size, however the backend pixmap
will not be resized until you call this function. This is useful in
multi-threaded application where one threads waits for events and others draws
-into the buffer so you can stop the drawing threads before the backend context
+into the buffer so you can stop the drawing threads before the backend pixmap
size change.
diff --git a/doc/backends_python.txt b/doc/backends_python.txt
index 183b4c183ba4..b53b6bd74f61 100644
--- a/doc/backends_python.txt
+++ b/doc/backends_python.txt
@@ -87,8 +87,8 @@ import gfxprim.backends as backends
# Assert that inicialization was successful
assert(bk)
- # Now you can draw into the backend via bk.context
- bk.context.gfx.Fill(bk.context.RGBToPixel(0, 0, 0));
+ # Now you can draw into the backend via bk.pixmap
+ bk.pixmap.gfx.Fill(bk.pixmap.RGBToPixel(0, 0, 0));
# If backend is buffered, changes are not propagated unless the screen is
# updated via Flip()
diff --git a/doc/blits.txt b/doc/blits.txt
index d2e4e372de37..5a5373767e02 100644
--- a/doc/blits.txt
+++ b/doc/blits.txt
@@ -24,17 +24,17 @@ into destination pixel type to speed up the blitting.
/* or */
#include <core/GP_Blit.h>
-void GP_Blit(const GP_Context *src,
+void GP_Blit(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
-void GP_BlitXYWH(const GP_Context *src,
+void GP_BlitXYWH(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
-void GP_BlitXYXY(const GP_Context *src,
+void GP_BlitXYXY(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1,
- GP_Context *dst, GP_Coord x2, GP_Coord y2);
+ GP_Pixmap *dst, GP_Coord x2, GP_Coord y2);
--------------------------------------------------------------------------------
Blit functions to copy rectangular area from source to destination.
@@ -54,18 +54,18 @@ WARNING: For these functions the behavior is undefined when you pass
/* or */
#include <core/GP_Blit.h>
-void GP_BlitXYXY_Clipped(const GP_Context *src,
+void GP_BlitXYXY_Clipped(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1,
- GP_Context *dst, GP_Coord x2, GP_Coord y2);
+ GP_Pixmap *dst, GP_Coord x2, GP_Coord y2);
-void GP_BlitXYWH_Clipped(const GP_Context *src,
+void GP_BlitXYWH_Clipped(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
-void GP_Blit_Clipped(const GP_Context *src,
+void GP_Blit_Clipped(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
--------------------------------------------------------------------------------
Blit functions to copy rectangular area from source to destination. Both
diff --git a/doc/coding_style.txt b/doc/coding_style.txt
index ebd0f3f11145..c23ad06bd524 100644
--- a/doc/coding_style.txt
+++ b/doc/coding_style.txt
@@ -108,14 +108,14 @@ GFXprim Specific Rules
* Library external API uses CamelCase
** Together with mandatory 'GP_' prefix.
-** For example 'GP_PixelType', 'GP_Context', etc.
+** For example 'GP_PixelType', 'GP_Pixmap', etc.
** We will not change that, get over it. (It could have been worse, trust me.)
* Basic library types are typedefed
** We have 'GP_Size' and 'GP_Coord' integer types to better distinguish
roles of function parameters.
-** The basic structures are also typedefed so you can wite 'GP_Context'
- instead of 'struct GP_Context'.
+** The basic structures are also typedefed so you can wite 'GP_Pixmap'
+ instead of 'struct GP_Pixmap'.
** Other uses of typedef are frowned upon.
* When you add an externally visible symbol, i.e. new API function
@@ -143,5 +143,5 @@ All constants are available in 'foo.C' submodules (i.e. 'core.C')
to avoid clutter.
Where this makes sense, functions should be available as methods of
-an object (i.e. 'Context.Copy()' rather than 'Copy(context)'). Be Pythonic.
+an object (i.e. 'Pixmap.Copy()' rather than 'Copy(pixmap)'). Be Pythonic.
diff --git a/doc/convert.txt b/doc/convert.txt
index f11f932a4c42..a534ecb56b5a 100644
--- a/doc/convert.txt
+++ b/doc/convert.txt
@@ -14,11 +14,11 @@ GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b, GP_PixelType type);
GP_Pixel GP_RGBAToPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
GP_PixelType type);
-GP_Pixel GP_RGBToContextPixel(uint8_t r, uint8_t g, uint8_t b,
- const GP_Context *context);
+GP_Pixel GP_RGBToPixmapPixel(uint8_t r, uint8_t g, uint8_t b,
+ const GP_Pixmap *pixmap);
-GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
- const GP_Context *context);
+GP_Pixel GP_RGBAToPixmapPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
+ const GP_Pixmap *pixmap);
-------------------------------------------------------------------------------
Simple functions to convert RGB or RGBA 8 bit values into the specific
diff --git a/doc/core.txt b/doc/core.txt
index 1ae253a6d293..439494a6021d 100644
--- a/doc/core.txt
+++ b/doc/core.txt
@@ -4,7 +4,7 @@ Library Core
Library core contains all basic data structures and functions that forms the
glue which holds the GFXprim libraries together.
-The most important data structure is a link:context.html[Context] which
+The most important data structure is a link:pixmap.html[Pixmap] which
describes in-memory pixmap which is used extensively in all parts of the
library.
@@ -20,7 +20,7 @@ or link:progress_callback.html[Progress callback].
[grid="rows"]
[options="autowidth"]
|=============================================================================
-| link:context.html[Context] | Describes in-memory pixmap
+| link:pixmap.html[Pixmap] | Describes in-memory pixmap
| link:basic_types.html[Basic types] | Types for size, lenght, pixel and
color
@@ -30,7 +30,7 @@ or link:progress_callback.html[Progress callback].
| link:get_put_pixel.html[GetPixel and PutPixel] | Macros and functions to
get and put pixels
-| link:blits.html[Blits] | Blits (copies) a rectangular area from one context to
+| link:blits.html[Blits] | Blits (copies) a rectangular area from one pixmap to
another as well as simple pixel format conversions
| link:progress_callback.html[Progress Callback] | Progress callback passed
diff --git a/doc/core_python.txt b/doc/core_python.txt
index 108c8594360c..0b960007a586 100644
--- a/doc/core_python.txt
+++ b/doc/core_python.txt
@@ -3,28 +3,28 @@ Python Core module
The python binding maps mostly to the C API with the 'GP_' prefix stripped.
-However structures as 'GP_Context' are not created by the 'GP_ContextAlloc()'
+However structures as 'GP_Pixmap' are not created by the 'GP_PixmapAlloc()'
function but have proper constructor and destructor to keep the Python
reference counting happy.
Then there are a bit more tricky solutions, such as 'GP_ProgressCallback'
which needs a proxy function to call the python callback from the C code.
-Context
+Pixmap
~~~~~~~
[source,python]
-------------------------------------------------------------------------------
import gfxprim.core as core
- # Create 100x100 RGB888 context
- c = core.Context(100, 100, core.C.PIXEL_RGB888)
+ # Create 100x100 RGB888 pixmap
+ c = core.Pixmap(100, 100, core.C.PIXEL_RGB888)
print("w={} h={} bpp={}".format(c.w, c.h, c.bpp))
-------------------------------------------------------------------------------
-Creates a context of a particular size and pixel type.
+Creates a pixmap of a particular size and pixel type.
First two parameters are 'width' and 'height' third is pixel type which is an
enumeration
@@ -41,7 +41,7 @@ enumeration
-------------------------------------------------------------------------------
import gfxprim.core as core
- pixel = context.GetPixel(x, y)
+ pixel = pixmap.GetPixel(x, y)
-------------------------------------------------------------------------------
@@ -52,7 +52,7 @@ returned.
-------------------------------------------------------------------------------
import gfxprim.core as core
- context.PutPixel(x, y, pixel)
+ pixmap.PutPixel(x, y, pixel)
-------------------------------------------------------------------------------
@@ -66,11 +66,11 @@ NOTE: You may want to see link:coordinate_system.html[coordinate system]
-------------------------------------------------------------------------------
import gfxprim.core as core
- grayscale = context.Convert(core.C.PIXEL_G8)
+ grayscale = pixmap.Convert(core.C.PIXEL_G8)
-------------------------------------------------------------------------------
-Returns context converted into the desired pixel format.
+Returns pixmap converted into the desired pixel format.
The conversion is naive i.e. the values are just divided/multiplied.
@@ -80,15 +80,15 @@ The conversion is naive i.e. the values are just divided/multiplied.
-------------------------------------------------------------------------------
import gfxprim.core as core
- # Blits context to target starting at
- # sx and sy in the source context
+ # Blits pixmap to target starting at
+ # sx and sy in the source pixmap
# tx and ty in in the target
- context.Blit(sx, sy, target, tx, ty, w, h)
+ pixmap.Blit(sx, sy, target, tx, ty, w, h)
# Alternatively the size can be described by
# coordinates in the source or target
- context.Blit(sx, sy, target, tx, ty, sx2=, sy2=)
- context.Blit(sx, sy, target, tx, ty, tx2=, ty2=)
+ pixmap.Blit(sx, sy, target, tx, ty, sx2=, sy2=)
+ pixmap.Blit(sx, sy, target, tx, ty, tx2=, ty2=)
-------------------------------------------------------------------------------
@@ -118,8 +118,8 @@ import gfxprim.core as core
# You can create a pixel from RGB and pixel type
black = core.RGBToPixel(0, 0, 0, core.C.PIXEL_G1)
- # Or using shortcut from context
- black = context.RGBToPixel(0, 0, 0)
+ # Or using shortcut from pixmap
+ black = pixmap.RGBToPixel(0, 0, 0)
-------------------------------------------------------------------------------
@@ -170,5 +170,5 @@ import gfxprim.core as core
Sets and gets the GFXprim debug level. See link:debug.html[debug messages]
description for more details.
-These are basic 'Context' methods from core module. Importing other modules
+These are basic 'Pixmap' methods from core module. Importing other modules
will add some other (for example gfx module adds all drawing functions).
diff --git a/doc/debug.txt b/doc/debug.txt
index 09c80aa0e560..b209b53a56c6 100644
--- a/doc/debug.txt
+++ b/doc/debug.txt
@@ -5,7 +5,7 @@ The GFXprim library includes a debug message infrastructure in order to ease
the debugging.
Many places of the library uses debug messages to report warnings, bugs, or
-generally important events (i.e. context has been allocated, filter function
+generally important events (i.e. pixmap has been allocated, filter function
has been called).
Debug messages are printed into the stderr and could be redirected to custom
diff --git a/doc/environment_variables.txt b/doc/environment_variables.txt
index 5ce7488a02f8..216f19f1e8a3 100644
--- a/doc/environment_variables.txt
+++ b/doc/environment_variables.txt
@@ -48,13 +48,13 @@ The output is, by default, written to stderr and will look like:
1: GP_Loader.c:loader_by_filename():222: Loading file by filename extension 'pgm'
1: GP_Loader.c:loader_by_extension():198: Found loader 'Netpbm portable Graymap'
1: GP_PNM.c:load_header():244: Have header P2 (ASCII encoded PGM) 24x7 depth=15
-1: GP_Context.c:GP_ContextAlloc():62: Allocating context 24 x 7 - G4
+1: GP_Pixmap.c:GP_PixmapAlloc():62: Allocating pixmap 24 x 7 - G4
4: GP_X11.c:x11_update_rect():71: Updating rect 222x458-418x479
4: GP_X11.c:x11_update_rect():71: Updating rect 214x458-426x479
2: GP_Blit.c:GP_BlitXYXY_Clipped():129: Blitting 23x6, available 332x244
2: GP_Blit.c:GP_BlitXYXY_Clipped():139: Blitting 0x0->23x6 in 24x7 to 308x236 in 640x480
3: GP_X11.c:x11_set_attributes():225: Setting window caption to 'Spiv ~ test.pgm 1:1.000'
- 4: GP_X11.c:x11_flip():91: Flipping context
-1: GP_Context.c:GP_ContextFree():102: Freeing context (0x7f5008000b60)
+ 4: GP_X11.c:x11_flip():91: Flipping pixmap
+1: GP_Pixmap.c:GP_PixmapFree():102: Freeing pixmap (0x7f5008000b60)
1: GP_X11_Conn.h:x11_close():72: Closing X11 display
------------------------------------------------------------------------------
diff --git a/doc/example_SDL_glue.txt b/doc/example_SDL_glue.txt
index 804898f4b74b..5e12aac6ce32 100644
--- a/doc/example_SDL_glue.txt
+++ b/doc/example_SDL_glue.txt
@@ -1,7 +1,7 @@
SDL Glue
--------
-You can easily mix SDL and GFXprim code using 'GP_ContextFromSDLSurface()'
+You can easily mix SDL and GFXprim code using 'GP_PixmapFromSDLSurface()'
function.
[source,c]
diff --git a/doc/filters.txt b/doc/filters.txt
index c0cc54666c31..da1cf5aa4f0d 100644
--- a/doc/filters.txt
+++ b/doc/filters.txt
@@ -1,12 +1,12 @@
-Context filters
+Pixmap filters
---------------
-Pixel filters for 'GP_Context'.
+Pixel filters for 'GP_Pixmap'.
-The context filter is basically a function that operates on context pixels.
+The pixmap filter is basically a function that operates on pixmap pixels.
The result may be stored into a new bitmap or placed to bitmap passed as
argument or, in some cases, the filter could be used 'in place' so the result
-is stored into the same context as the one passed as filter source.
+is stored into the same pixmap as the one passed as filter source.
Common filter API
~~~~~~~~~~~~~~~~~
@@ -22,21 +22,21 @@ For convenience, the filters API is unified:
* And the last argument is link:progress_callback.html[progress callback]
When using allocating version of the filter, pointer to the newly allocated
-context is returned, or in case of failure NULL is returned.
+pixmap is returned, or in case of failure NULL is returned.
If 'malloc()' has failed NULL is returned.
If filter has been interrupted by a callback, all allocated memory is freed,
and NULL is returned.
-When using non-allocating variant of the filter, the destination context must
+When using non-allocating variant of the filter, the destination pixmap must
have correct pixel type and the size must be big enough to store the result.
The return value from such filter is either zero, in case of success, or
non-zero when filter was interrupted by a callback.
For filters that work 'in-place' (which is explicitly said for each filter)
-the source and the destination could be the same context. Note that this is
-not expected to work if you do several overlapping sub-contexts and pass these
+the source and the destination could be the same pixmap. Note that this is
+not expected to work if you do several overlapping sub-pixmaps and pass these
as arguments.
[source,c]
@@ -44,11 +44,11 @@ as arguments.
/*
* Filter common API.
*/
-int GP_FilterFoo(const GP_Context *src, GP_Context *dst,
+int GP_FilterFoo(const GP_Pixmap *src, GP_Pixmap *dst,
foo params ...,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterFooAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterFooAlloc(const GP_Pixmap *src,
foo params ...,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -71,10 +71,10 @@ Invert
/* or */
#include <filters/GP_Point.h>
-int GP_FilterInvert(const GP_Context *src, GP_Context *dst,
+int GP_FilterInvert(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterInvertAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterInvertAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -91,10 +91,10 @@ Brightness
/* or */
#include <filters/GP_Point.h>
-int GP_FilterBrightness(const GP_Context *src, GP_Context *dst,
+int GP_FilterBrightness(const GP_Pixmap *src, GP_Pixmap *dst,
float p, GP_ProgressCallback *callback);
-GP_Context *GP_FilterBrightnessAlloc(const GP_Context *src, float p,
+GP_Pixmap *GP_FilterBrightnessAlloc(const GP_Pixmap *src, float p,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -111,10 +111,10 @@ Contrast
/* or */
#include <filters/GP_Point.h>
-int GP_FilterContrast(const GP_Context *src, GP_Context *dst,
+int GP_FilterContrast(const GP_Pixmap *src, GP_Pixmap *dst,
float p, GP_ProgressCallback *callback);
-GP_Context *GP_FilterContrastAlloc(const GP_Context *src, float p,
+GP_Pixmap *GP_FilterContrastAlloc(const GP_Pixmap *src, float p,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -131,11 +131,11 @@ BrightnessContrast
/* or */
#include <filters/GP_Point.h>
-int GP_FilterBrightnessContrast(const GP_Context *src, GP_Context *dst,
+int GP_FilterBrightnessContrast(const GP_Pixmap *src, GP_Pixmap *dst,
float b, float c,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterBrightnessContrastAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterBrightnessContrastAlloc(const GP_Pixmap *src,
float b, float c,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -153,10 +153,10 @@ Posterize
/* or */
#include <filters/GP_Point.h>
-int GP_FilterPosterize(const GP_Context *src, GP_Context *dst,
+int GP_FilterPosterize(const GP_Pixmap *src, GP_Pixmap *dst,
unsigned int levels, GP_ProgressCallback *callback);
-GP_Context *GP_FilterPosterizeAlloc(const GP_Context *src, unsigned int levels,
+GP_Pixmap *GP_FilterPosterizeAlloc(const GP_Pixmap *src, unsigned int levels,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -174,27 +174,27 @@ Gaussian additive noise filter
/* or */
#include <filters/GP_GaussianNoise.h>
-int GP_FilterGaussianNoiseAddEx(const GP_Context *src,
+int GP_FilterGaussianNoiseAddEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float sigma, float mu,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterGaussianNoiseAddExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterGaussianNoiseAddExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
float sigma, float mu,
GP_ProgressCallback *callback);
-static inline int GP_FilterGaussianNoiseAdd(const GP_Context *src,
- GP_Context *dst,
+static inline int GP_FilterGaussianNoiseAdd(const GP_Pixmap *src,
+ GP_Pixmap *dst,
float sigma, float mu,
GP_ProgressCallback *callback);
-static inline GP_Context *
-GP_FilterGaussianNoiseAddAlloc(const GP_Context *src,
+static inline GP_Pixmap *
+GP_FilterGaussianNoiseAddAlloc(const GP_Pixmap *src,
float sigma, float mu,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -210,12 +210,12 @@ include::images/gaussian_noise/images.txt[]
Arithmetic filters
~~~~~~~~~~~~~~~~~~
-Arithmetic filters do take two contexts as an input and combines them into one
-output context.
+Arithmetic filters do take two pixmaps as an input and combines them into one
+output pixmap.
-The pixel type of both input contexts must match.
+The pixel type of both input pixmaps must match.
-If size of the input contexts differs, minimum is used.
+If size of the input pixmaps differs, minimum is used.
[source,c]
-------------------------------------------------------------------------------
@@ -223,17 +223,17 @@ If size of the input contexts differs, minimum is used.
/* or */
#include <GP.h>
-int GP_FilterAddition(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterAddition(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterAdditionAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterAdditionAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Produces saturated (clamped) addition of two contexts.
+Produces saturated (clamped) addition of two pixmaps.
[source,c]
-------------------------------------------------------------------------------
@@ -241,17 +241,17 @@ Produces saturated (clamped) addition of two contexts.
/* or */
#include <GP.h>
-int GP_FilterMultiply(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterMultiply(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMultiplyAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterMultiplyAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Produces saturated (clamped) multiplication of two contexts.
+Produces saturated (clamped) multiplication of two pixmaps.
[source,c]
-------------------------------------------------------------------------------
@@ -259,13 +259,13 @@ Produces saturated (clamped) multiplication of two contexts.
/* or */
#include <GP.h>
-int GP_FilterDifference(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterDifference(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterDifferenceAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterDifferenceAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -278,22 +278,22 @@ Produces symmetric difference (i.e. abs(a - b)).
/* or */
#include <GP.h>
-int GP_FilterMax(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterMax(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMaxAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterMaxAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-int GP_FilterMin(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterMin(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMinAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterMinAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -308,14 +308,14 @@ Rotation and Symmetry filters
/* or */
#include <GP.h>
-int GP_FilterMirrorH(const GP_Context *src, GP_Context *dst,
+int GP_FilterMirrorH(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMirrorHAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMirrorHAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Mirrors context horizontally.
+Mirrors pixmap horizontally.
Works 'in-place'.
@@ -330,14 +330,14 @@ include::images/mirror_h/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterMirrorV(const GP_Context *src, GP_Context *dst,
+int GP_FilterMirrorV(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMirrorVAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMirrorVAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Mirrors context vertically.
+Mirrors pixmap vertically.
Works 'in-place'.
@@ -352,19 +352,19 @@ include::images/mirror_v/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterRotate90(const GP_Context *src, GP_Context *dst,
+int GP_FilterRotate90(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterRotate90Alloc(const GP_Context *src,
+GP_Pixmap *GP_FilterRotate90Alloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Rotate context by 90 degrees.
+Rotate pixmap by 90 degrees.
Doesn't work 'in-place' (yet).
The destination has to have the same pixel type and size must be large enough to
-fit rotated context (i.e. W and H are swapped).
+fit rotated pixmap (i.e. W and H are swapped).
include::images/rotate_90/images.txt[]
@@ -374,14 +374,14 @@ include::images/rotate_90/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterRotate180(const GP_Context *src, GP_Context *dst,
+int GP_FilterRotate180(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterRotate180Alloc(const GP_Context *src,
+GP_Pixmap *GP_FilterRotate180Alloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Rotate context by 180 degrees.
+Rotate pixmap by 180 degrees.
Doesn't work 'in-place' (yet).
@@ -396,19 +396,19 @@ include::images/rotate_180/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterRotate270(const GP_Context *src, GP_Context *dst,
+int GP_FilterRotate270(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterRotate270Alloc(const GP_Context *src,
+GP_Pixmap *GP_FilterRotate270Alloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Rotate context by 270 degrees.
+Rotate pixmap by 270 degrees.
Doesn't work 'in-place' (yet).
The destination has to have the same pixel type and destination size must be
-large enough to fit rotated context (i.e. W and H are swapped).
+large enough to fit rotated pixmap (i.e. W and H are swapped).
include::images/rotate_270/images.txt[]
@@ -428,11 +428,11 @@ typedef enum GP_FilterSymmetries {
GP_MIRROR_V,
} GP_FilterSymmetries;
-GP_Context *GP_FilterSymmetry(const GP_Context *src,
+GP_Pixmap *GP_FilterSymmetry(const GP_Pixmap *src,
GP_FilterSymmetries symmetry,
GP_ProgressCallback *callback);
-int GP_FilterSymmetry(const GP_Context *src, GP_Context *dst,
+int GP_FilterSymmetry(const GP_Pixmap *src, GP_Pixmap *dst,
GP_FilterSymmetries symmetry,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -481,10 +481,10 @@ ready-to-use filters.
/* or */
#include <GP.h>
-int GP_FilterLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float kernel[], uint32_t kw, uint32_t kh,
float kern_div, GP_ProgressCallback *callback);
@@ -493,10 +493,10 @@ int GP_FilterLinearConvolution_Raw(const GP_Context *src,
Internal generic convolution filter, this is a base for all linear convolution
filters with non-separable kernel.
-The src coordinate and sizes denotes rectangle in the source context that the
+The src coordinate and sizes denotes rectangle in the source pixmap that the
filter operates on.
-The dst coordinates defines offset into the dst context.
+The dst coordinates defines offset into the dst pixmap.
The kernel is two-dimensional array of a size kw * kh indexed as
kernel[x + y*kw].
@@ -539,26 +539,26 @@ include::images/convolution/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterHLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterHLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float kernel[], uint32_t kw, float kern_div,
GP_ProgressCallback *callback);
-int GP_FilterVLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterVLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float kernel[], uint32_t kh, float kern_div,
GP_ProgressCallback *callback);
-int GP_FilterVHLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterVHLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float hkernel[], uint32_t kw, float hkern_div,
float vkernel[], uint32_t kh, float vkern_div,
@@ -570,7 +570,7 @@ void GP_FilterKernelPrint_Raw(float kernel[], int kw, int kh, float kern_div);
Internal special functions for one dimensional vertical and horizontal
convolution these two functions are base for all separable convolution filters.
-The src coordinate and sizes denotes rectangle in the source context that the
+The src coordinate and sizes denotes rectangle in the source pixmap that the
filter operates on.
The dst coordinates are offset into the dst.
@@ -640,25 +640,25 @@ typedef struct GP_FilterKernel2D {
float *kernel;
} GP_FilterKernel2D;
-int GP_FilterConvolutionEx(const GP_Context *src,
+int GP_FilterConvolutionEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Coord h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterConvolutionExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterConvolutionExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
-int GP_FilterConvolution(const GP_Context *src, GP_Context *dst,
+int GP_FilterConvolution(const GP_Pixmap *src, GP_Pixmap *dst,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterConvolutionAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterConvolutionAlloc(const GP_Pixmap *src,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
@@ -690,7 +690,7 @@ WARNING: If filter is executed in-place the work cannot be distributed between
/*
* Example box smoothing filter.
*/
-static void box_smoothing(GP_Context *img)
+static void box_smoothing(GP_Pixmap *img)
{
float box_filter[] = {
1, 1, 1,
@@ -720,10 +720,10 @@ Laplace Filter
/* or */
#include <GP.h>
-int GP_FilterLaplace(const GP_Context *src, GP_Context *dst,
+int GP_FilterLaplace(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterLaplaceAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterLaplaceAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -767,10 +767,10 @@ Laplacian Edge Sharpening
/* or */
#include <GP.h>
-int GP_FilterEdgeSharpening(const GP_Context *src, GP_Context *dst,
+int GP_FilterEdgeSharpening(const GP_Pixmap *src, GP_Pixmap *dst,
float w, GP_ProgressCallback *callback);
-GP_Context *GP_FilterEdgeSharpeningAlloc(const GP_Context *src, float w,
+GP_Pixmap *GP_FilterEdgeSharpeningAlloc(const GP_Pixmap *src, float w,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -798,25 +798,25 @@ Gaussian Blur
/* or */
#include <GP.h>
-int GP_FilterGaussianBlurEx(const GP_Context *src,
+int GP_FilterGaussianBlurEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterGaussianBlurExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback);
-int GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst,
+int GP_FilterGaussianBlur(const GP_Pixmap *src, GP_Pixmap *dst,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback)
-GP_Context *GP_FilterGaussianBlurAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterGaussianBlurAlloc(const GP_Pixmap *src,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback)
-------------------------------------------------------------------------------
@@ -879,26 +879,26 @@ Median
/* or */
#include <GP.h>
-int GP_FilterMedianEx(const GP_Context *src,
+int GP_FilterMedianEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
int xmed, int ymed,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMedianExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMedianExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
int xmed, int ymed,
GP_ProgressCallback *callback);
-int GP_FilterMedian(const GP_Context *src,
- GP_Context *dst,
+int GP_FilterMedian(const GP_Pixmap *src,
+ GP_Pixmap *dst,
int xmed, int ymed,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMedianAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMedianAlloc(const GP_Pixmap *src,
int xmed, int ymed,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
diff --git a/doc/filters_dithering.txt b/doc/filters_dithering.txt
index 94c8203315bc..c7cf060b694a 100644
--- a/doc/filters_dithering.txt
+++ b/doc/filters_dithering.txt
@@ -27,11 +27,11 @@ And is throwed away at the image borders.
/* or */
#include <filters/GP_Dither.h>
-int GP_FilterFloydSteinberg(const GP_Context *src, GP_Context *dst,
+int GP_FilterFloydSteinberg(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Renders Floyd Steinberg dithering directly into passed context. The
+Renders Floyd Steinberg dithering directly into passed pixmap. The
destination must be at least as large as source.
If operation was aborted by a callback, non-zero is returned.
@@ -45,12 +45,12 @@ the function returns non-zero and sets errno to 'ENOSYS'.
/* or */
#include <filters/GP_Dither.h>
-GP_Context *GP_FilterFloydSteinbergAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterFloydSteinbergAlloc(const GP_Pixmap *src,
GP_PixelType pixel_type,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Returns pointer to allocated context of given pixel_type.
+Returns pointer to allocated pixmap of given pixel_type.
If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
returned.
@@ -75,11 +75,11 @@ edges tend to be less sharp.
/* or */
#include <filters/GP_Dither.h>
-int GP_FilterHilbertPeano(const GP_Context *src, GP_Context *dst,
+int GP_FilterHilbertPeano(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Renders Hilbert Peano dithering directly into passed context. The
+Renders Hilbert Peano dithering directly into passed pixmap. The
destination must be at least as large as source.
If operation was aborted by a callback, non-zero is returned.
@@ -93,12 +93,12 @@ the function returns NULL and sets errno to 'ENOSYS'.
/* or */
#include <filters/GP_Dither.h>
-GP_Context *GP_FilterHilbertPeanoAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterHilbertPeanoAlloc(const GP_Pixmap *src,
GP_PixelType pixel_type,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Returns pointer to allocated context of given pixel_type.
+Returns pointer to allocated pixmap of given pixel_type.
If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
returned.
diff --git a/doc/filters_resize.txt b/doc/filters_resize.txt
index 6cf656447e6b..349ad2a71590 100644
--- a/doc/filters_resize.txt
+++ b/doc/filters_resize.txt
@@ -21,17 +21,17 @@ typedef enum GP_InterpolationType {
const char *GP_InterpolationTypeName(enum GP_InterpolationType interp_type);
-int GP_FilterResize(const GP_Context *src, GP_Context *dst,
+int GP_FilterResize(const GP_Pixmap *src, GP_Pixmap *dst,
GP_InterpolationType type,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_InterpolationType type,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Interpolate (resize) the context.
+Interpolate (resize) the pixmap.
Resize image given size and interpolation type.
@@ -49,7 +49,7 @@ GP_FilterResizeAlloc
The +GP_FilterResizeAlloc()+ allocates the destination give it's size.
-Returns pointer to newly allocated context or NULL in case of failure and
+Returns pointer to newly allocated pixmap or NULL in case of failure and
errno is set.
Nearest Neighbour Interpolation
@@ -61,10 +61,10 @@ Nearest Neighbour Interpolation
/* or */
#include <filters/GP_ResizeNN.h>
-int GP_FilterResizeNN(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeNN(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-static inline GP_Context *GP_FilterResizeNNAlloc(const GP_Context *src,
+static inline GP_Pixmap *GP_FilterResizeNNAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -87,17 +87,17 @@ Bilinear Interpolation
/* or */
#include <filters/GP_ResizeLinear.h>
-int GP_FilterResizeLinearInt(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeLinearInt(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-int GP_FilterResizeLinearLFInt(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeLinearLFInt(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeLinearIntAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeLinearIntAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeLinearLFIntAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeLinearLFIntAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -115,17 +115,17 @@ Bicubic Interpolation
/* or */
#include <filters/GP_ResizeCubic.h>
-int GP_FilterResizeCubicInt(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeCubicInt(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-int GP_FilterResizeCubic(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeCubic(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeCubicIntAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeCubicIntAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeCubicAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeCubicAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
diff --git a/doc/gamma.txt b/doc/gamma.txt
index a38518bd2c76..521306a76962 100644
--- a/doc/gamma.txt
+++ b/doc/gamma.txt
@@ -38,7 +38,7 @@ and text still use legacy gamma support.)
Implementation
~~~~~~~~~~~~~~
-The 'GP_Gamma' structure defines per context, per channel, gamma tables.
+The 'GP_Gamma' structure defines per pixmap, per channel, gamma tables.
The tables for particular gamma are reference counted. There is only one table
for particular gamma value and bit depth in memory at a time.
diff --git a/doc/get_put_pixel.txt b/doc/get_put_pixel.txt
index 86d90c7f35f3..db9893f04e96 100644
--- a/doc/get_put_pixel.txt
+++ b/doc/get_put_pixel.txt
@@ -7,17 +7,17 @@ GetPixel and PutPixel
/* or */
#include <core/GP_GetPutPixel.h>
-GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y);
+GP_Pixel GP_GetPixel(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y);
-void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p);
+void GP_PutPixel(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p);
--------------------------------------------------------------------------------
Gets, puts a pixel value. GP_Pixel is a number which holds a pixel value.
-This functions are clipped, GetPixel outside of the context returns zero,
-PutPixel outside the context is no-op.
+This functions are clipped, GetPixel outside of the pixmap returns zero,
+PutPixel outside the pixmap is no-op.
-This functions honour link:context.html[context rotation flags].
+This functions honour link:pixmap.html[pixmap rotation flags].
Generally these function are safe to use but rather slow in innner cycles.
@@ -27,23 +27,23 @@ Generally these function are safe to use but rather slow in innner cycles.
/* or */
#include <core/GP_GetPutPixel.h>
-GP_Pixel GP_GetPixel_Raw(const GP_Context *context, GP_Coord x, GP_Coord y);
+GP_Pixel GP_GetPixel_Raw(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y);
-void GP_PutPixel_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p);
+void GP_PutPixel_Raw(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p);
/*
* Substitute {{ bpp }} for specific bits per pixel (1BPP_LE, 24BPP, ...)
*
* These macros are generated to core/GP_GetPutPixel.gen.h
*/
-GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Context *c, int x, int y);
+GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Pixmap *c, int x, int y);
-void GP_PutPixel_Raw_{{ bpp }}(GP_Context *c, GP_Coord x, GP_Coord y,
+void GP_PutPixel_Raw_{{ bpp }}(GP_Pixmap *c, GP_Coord x, GP_Coord y,
GP_Pixel p);
--------------------------------------------------------------------------------
-These functions are generally fast, but does not honour context rotation flags
-and do not check that coordinates are inside of the context.
+These functions are generally fast, but does not honour pixmap rotation flags
+and do not check that coordinates are inside of the pixmap.
They are intended as basic building blocks for other GFX primitives, filters,
etc.
diff --git a/doc/gfx.txt b/doc/gfx.txt
index 14cb7d8b2fa5..35f75d234303 100644
--- a/doc/gfx.txt
+++ b/doc/gfx.txt
@@ -11,7 +11,7 @@ See also RGB tripplet to pixel link:convert.html[conversions].
Rotation Flags
~~~~~~~~~~~~~~
-Drawing orientation is affected by the link:context.html[context rotation
+Drawing orientation is affected by the link:pixmap.html[pixmap rotation
flags]. The parameters passed to the functions are transformed accordingly to
the flags before the drawing, which allows for fast and transparent rotated or
mirrored rendering.
@@ -28,10 +28,10 @@ Fill
[source,c]
--------------------------------------------------------------------------------
-void GP_Fill(GP_Context *context, GP_Pixel pixel);
+void GP_Fill(GP_Pixmap *pixmap, GP_Pixel pixel);
--------------------------------------------------------------------------------
-Fills the whole context bitmap with the specified pixel value.
+Fills the whole pixmap bitmap with the specified pixel value.
NOTE: GP_Fill is implemented in the library Core rather than in GFX so that
it's available to all library parts.
@@ -41,10 +41,10 @@ Lines
[source,c]
--------------------------------------------------------------------------------
-void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
+void GP_HLineXXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord x1, GP_Coord y,
GP_Pixel pixel);
-void GP_HLine(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
+void GP_HLine(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord x1, GP_Coord y,
GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -55,7 +55,7 @@ x0, x1 can be specified in any order.
[source,c]
--------------------------------------------------------------------------------
-void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
+void GP_HLineXYW(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Size w,
GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -64,10 +64,10 @@ Draws a horizontal line from (x, y) to (x+w-1, y), inclusive.
[source,c]
--------------------------------------------------------------------------------
-void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1,
+void GP_VLineXYY(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y0, GP_Coord y1,
GP_Pixel pixel);
-void GP_VLine(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1,
+void GP_VLine(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y0, GP_Coord y1,
GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -78,7 +78,7 @@ y0, y1 can be specified in any order.
[source,c]
--------------------------------------------------------------------------------
-void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
+void GP_VLineXYH(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Size h,
GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -87,7 +87,7 @@ Draws a vertical line from (x, y) to (x, y+h-1), inclusive.
[source,c]
--------------------------------------------------------------------------------
-void GP_Line(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_Line(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -100,7 +100,7 @@ Circles
[source,c]
--------------------------------------------------------------------------------
-void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+void GP_Circle(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -111,7 +111,7 @@ specified by points (xcenter-r, ycenter-r, xcenter+r, ycenter+r), inclusive.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+void GP_FillCircle(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -125,7 +125,7 @@ Rings
~~~~~
[source,c]
--------------------------------------------------------------------------------
-void GP_Ring(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+void GP_Ring(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r1, GP_Size r2, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -136,7 +136,7 @@ and appropriate radii.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+void GP_FillRing(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r1, GP_Size r2, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -150,7 +150,7 @@ Ellipses
[source,c]
--------------------------------------------------------------------------------
-void GP_Ellipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+void GP_Ellipse(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
GP_Size a, GP_Size b, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -161,7 +161,7 @@ specified by points (xcenter-a, ycenter-b, xcenter+a, ycenter+b), inclusive.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+void GP_FillEllipse(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter,
GP_Size a, GP_Size b, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -172,7 +172,7 @@ Triangles
[source,c]
--------------------------------------------------------------------------------
-void GP_Triangle(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_Triangle(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2,
GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -181,7 +181,7 @@ Draws a triangle.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_FillTriangle(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2,
GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -193,13 +193,13 @@ Rects
[source,c]
--------------------------------------------------------------------------------
-void GP_RectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_RectXYXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-void GP_RectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
+void GP_RectXYWH(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y,
GP_Size w, GP_Size h, GP_Pixel pixel);
-void GP_Rect(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_Rect(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -211,13 +211,13 @@ The 'GP_Rect()' function is an alias for 'GP_RectXYXY()'.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_FillRectXYXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
+void GP_FillRectXYWH(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y,
GP_Size w, GP_Size h, GP_Pixel pixel);
-void GP_FillRect(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_FillRect(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -234,7 +234,7 @@ Tetragons
[source,c]
--------------------------------------------------------------------------------
-void GP_Tetragon(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_Tetragon(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2,
GP_Coord x3, GP_Coord y3, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -243,7 +243,7 @@ Draws a tetragon.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0,
+void GP_FillTetragon(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2,
GP_Coord x3, GP_Coord y3, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -255,7 +255,7 @@ Polygons
[source,c]
--------------------------------------------------------------------------------
-void GP_Polygon(GP_Context *context, unsigned int vertex_count,
+void GP_Polygon(GP_Pixmap *pixmap, unsigned int vertex_count,
const GP_Coord *xy, GP_Pixel pixel);
--------------------------------------------------------------------------------
@@ -263,7 +263,7 @@ Draws a polygon.
[source,c]
--------------------------------------------------------------------------------
-void GP_FillPolygon(GP_Context *context, unsigned int vertex_count,
+void GP_FillPolygon(GP_Pixmap *pixmap, unsigned int vertex_count,
const GP_Coord *xy, GP_Pixel pixel);
--------------------------------------------------------------------------------
diff --git a/doc/gfx_python.txt b/doc/gfx_python.txt
index 941b1f85b0d4..eda0951d80be 100644
--- a/doc/gfx_python.txt
+++ b/doc/gfx_python.txt
@@ -3,7 +3,7 @@ Python GFX module
The python binding maps mostly to the C API with the 'GP_' prefix stripped.
-The gfx module adds methods to the gfx context submodule.
+The gfx module adds methods to the gfx pixmap submodule.
NOTE: You may want to see the link:coordinate_system.html[coordinate system]
first.
@@ -13,9 +13,9 @@ Drawing functions
All drawing functions takes a 'pixel' value (to describe color) which
link:core_python.html#Colors_and_Pixels[can be obtained], for a particular
-pixel type (context), from a RGB triplet.
+pixel type (pixmap), from a RGB triplet.
-All drawing functions are clipped. Drawing outside of a context is no-op.
+All drawing functions are clipped. Drawing outside of a pixmap is no-op.
WARNING: Drawing functions takes strictly integer coordinates, make sure that
all divisions are integer divisions (i.e. use // instead of /) to
@@ -28,7 +28,7 @@ Line Based Primitives
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.HLine(x0, x1, y, pixel)
+ pixmap.gfx.HLine(x0, x1, y, pixel)
-------------------------------------------------------------------------------
@@ -38,7 +38,7 @@ Draws a horizontal line from 'x0' to 'x1' at 'y'.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.VLine(x, y0, y1, pixel)
+ pixmap.gfx.VLine(x, y0, y1, pixel)
-------------------------------------------------------------------------------
@@ -49,7 +49,7 @@ Draws a vertical line from 'y0' to 'y1' at 'x'.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Line(x0, y0, x1, y1, pixel)
+ pixmap.gfx.Line(x0, y0, x1, y1, pixel)
-------------------------------------------------------------------------------
@@ -59,7 +59,7 @@ Draws a line from x0, y0 to x1, y1.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Rect(x0, y0, x1, y1, pixel)
+ pixmap.gfx.Rect(x0, y0, x1, y1, pixel)
-------------------------------------------------------------------------------
@@ -69,7 +69,7 @@ Draws a rectangle defined by two points.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Triangle(x0, y0, x1, y1, x1, y2, pixel)
+ pixmap.gfx.Triangle(x0, y0, x1, y1, x1, y2, pixel)
-------------------------------------------------------------------------------
@@ -79,7 +79,7 @@ Draws a triangle defined by three points.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Tetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel)
+ pixmap.gfx.Tetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel)
-------------------------------------------------------------------------------
@@ -89,9 +89,9 @@ Draws a tetragon defined by four points.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Polygon([x0, y0, x1, y1, ...], pixel)
+ pixmap.gfx.Polygon([x0, y0, x1, y1, ...], pixel)
- context.gfx.Polygon([(x0, y0), (x1, y1), ...], pixel)
+ pixmap.gfx.Polygon([(x0, y0), (x1, y1), ...], pixel)
-------------------------------------------------------------------------------
@@ -102,7 +102,7 @@ integers or list of N tuples.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Circle(x, y, r, pixel)
+ pixmap.gfx.Circle(x, y, r, pixel)
-------------------------------------------------------------------------------
@@ -112,7 +112,7 @@ Draws a circle.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Ellipse(x, y, a, b, pixel)
+ pixmap.gfx.Ellipse(x, y, a, b, pixel)
-------------------------------------------------------------------------------
@@ -122,7 +122,7 @@ Draws an ellipse.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Ring(x, y, r1, r2, pixel)
+ pixmap.gfx.Ring(x, y, r1, r2, pixel)
-------------------------------------------------------------------------------
@@ -135,17 +135,17 @@ Filled Primitives
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.Fill(pixel)
+ pixmap.gfx.Fill(pixel)
-------------------------------------------------------------------------------
-Fills context with particular 'pixel' value.
+Fills pixmap with particular 'pixel' value.
[source,python]
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillRect(x0, y0, x1, y1, pixel)
+ pixmap.gfx.FillRect(x0, y0, x1, y1, pixel)
-------------------------------------------------------------------------------
@@ -155,7 +155,7 @@ Fills a rectangle defined by two points.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillTriangle(x0, y0, x1, y1, x1, y2, pixel)
+ pixmap.gfx.FillTriangle(x0, y0, x1, y1, x1, y2, pixel)
-------------------------------------------------------------------------------
@@ -165,7 +165,7 @@ Draws a filled triangle defined by three points.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillTetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel)
+ pixmap.gfx.FillTetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel)
-------------------------------------------------------------------------------
@@ -175,9 +175,9 @@ Draws a filled tetragon defined by four points.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillPolygon([x0, y0, x1, y1, ...], pixel)
+ pixmap.gfx.FillPolygon([x0, y0, x1, y1, ...], pixel)
- context.gfx.FillPolygon([(x0, y0), (x1, y1), ...], pixel)
+ pixmap.gfx.FillPolygon([(x0, y0), (x1, y1), ...], pixel)
-------------------------------------------------------------------------------
@@ -188,7 +188,7 @@ integers or list of N tuples.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillCircle(x, y, r, pixel)
+ pixmap.gfx.FillCircle(x, y, r, pixel)
-------------------------------------------------------------------------------
@@ -198,7 +198,7 @@ Fills a circle.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillEllipse(x, y, a, b, pixel)
+ pixmap.gfx.FillEllipse(x, y, a, b, pixel)
-------------------------------------------------------------------------------
@@ -208,7 +208,7 @@ Fills an ellipse.
-------------------------------------------------------------------------------
import gfxprim.gfx as gfx
- context.gfx.FillRing(x, y, r1, r2, pixel)
+ pixmap.gfx.FillRing(x, y, r1, r2, pixel)
-------------------------------------------------------------------------------
diff --git a/doc/grabbers.txt b/doc/grabbers.txt
index 212859219078..871cfdca287c 100644
--- a/doc/grabbers.txt
+++ b/doc/grabbers.txt
@@ -25,7 +25,7 @@ typdef struct GP_Grabber {
/*
* Currently loaded frame.
*/
- GP_Context *frame;
+ GP_Pixmap *frame;
/*
* Connection fd usable for select() or poll().
@@ -100,7 +100,7 @@ grabber 'fd' is not -1 it's preferable to call it when select() or poll()
returns that data are available on the 'fd'.
This function returns non-zero if new frame was received and stored into the
-'frame' context. Otherwise zero is returned.
+'frame' pixmap. Otherwise zero is returned.
Grabber Initializations
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/images/regen.py b/doc/images/regen.py
index ba540aa7058f..0dabd6c687e7 100755
--- a/doc/images/regen.py
+++ b/doc/images/regen.py
@@ -33,10 +33,10 @@ def to_str(x, to_str):
return res
-def convert(ctx):
- if (ctx.pixel_type == core.C.PIXEL_RGB332):
- return ctx.Convert(core.C.PIXEL_RGB888)
- return ctx
+def convert(pixmap):
+ if (pixmap.pixel_type == core.C.PIXEL_RGB332):
+ return pixmap.Convert(core.C.PIXEL_RGB888)
+ return pixmap
class ImgGen:
def __init__(self, orig_path):
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 0b83df55eb04..a01d4a32e2ff 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -1,4 +1,4 @@
-Context loaders
+Pixmap loaders
---------------
This part of GFXprim library implements API to load and save images for common
image file formats.
@@ -19,8 +19,8 @@ to a file and one that reads data from an link:loaders_io.html[IO stream].
All loading functions returns a pointer to newly allocated and loaded image or
upon a failure NULL and errno is set.
-The link:context.html[Context] returned by the loaders should be later freed
-with link:context.html#ContextFree[GP_ContextFree()].
+The link:pixmap.html[Pixmap] returned by the loaders should be later freed
+with link:pixmap.html#PixmapFree[GP_PixmapFree()].
All saving functions returns zero on success and non-zero on failure. If image
saving is aborted by a callback, the opened file is closed and removed from a
@@ -57,7 +57,7 @@ General interface
/* or */
#include <GP.h>
-GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
+GP_Pixmap *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Loads an image from a file.
@@ -75,8 +75,8 @@ signature is recognized, image loader it is called and the result is returned.
If file extension disagrees with file signature (which is quite common on the
internet) a warning is printed into the stderr.
-The resulting link:context.html[Context] should be later freed with
-link:context.html#ContextFree[GP_ContextFree()].
+The resulting link:pixmap.html[Pixmap] should be later freed with
+link:pixmap.html#PixmapFree[GP_PixmapFree()].
[[Save_Image]]
[source,c]
@@ -85,11 +85,11 @@ link:context.html#ContextFree[GP_ContextFree()].
/* or */
#include <GP.h>
-int GP_SaveImage(GP_Context *src, const char *dst_path,
+int GP_SaveImage(GP_Pixmap *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves a link:context.html[Context] into a file.
+Saves a link:pixmap.html[Pixmap] into a file.
The file format is matched accordingly to the file extension.
@@ -99,7 +99,7 @@ If extension was found but support for saving the image format is not
implemented errno is set to 'ENOSYS' (this may happen in case that GFXprim
wasn't compiled with support for this image type).
-If context pixel type is not supported by the format errno is set to
+If pixmap pixel type is not supported by the format errno is set to
'EINVAL'.
[[Register_Loader]]
@@ -112,17 +112,17 @@ typedef struct GP_Loader {
/*
* Reads an image from an IO stream.
*
- * Returns newly allocated context cotaining the loaded image or in
+ * Returns newly allocated pixmap cotaining the loaded image or in
* case of failure NULL and errno is set.
*/
- GP_Context *(*Read)(GP_IO *io, GP_ProgressCallback *callback);
+ GP_Pixmap *(*Read)(GP_IO *io, GP_ProgressCallback *callback);
/*
* Save an image.
*
* Returns zero on success, non-zero on failure and errno must be set.
*/
- int (*Save)(const GP_Context *src, const char *dst_path,
+ int (*Save)(const GP_Pixmap *src, const char *dst_path,
GP_ProgressCallback *callback);
/*
@@ -224,7 +224,7 @@ against extensions defined by loaders.
/* or */
#include <GP.h>
-GP_Context *GP_LoaderLoadImage(const GP_Loader *self, const char *src_path,
+GP_Pixmap *GP_LoaderLoadImage(const GP_Loader *self, const char *src_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -247,17 +247,17 @@ link:http://www.libpng.org/[libpng library].
/* or */
#include <GP.h>
-GP_Context *GP_ReadPNG(GP_IO *io, GP_ProgressCallback *callback);
+GP_Pixmap *GP_ReadPNG(GP_IO *io, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Reads a 'PNG' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'PNG' file signature.
-Returns newly allocated context (containing decompressed image) or in case of
+Returns newly allocated pixmap (containing decompressed image) or in case of
failure NULL and errno is set.
-The resulting link:context.html[Context] should be later freed with
-link:context.html#ContextFree[GP_ContextFree()].
+The resulting link:pixmap.html[Pixmap] should be later freed with
+link:pixmap.html#PixmapFree[GP_PixmapFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -265,7 +265,7 @@ link:context.html#ContextFree[GP_ContextFree()].
/* or */
#include <GP.h>
-GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback);
+GP_Pixmap *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Loads a 'PNG' image from a file.
@@ -273,8 +273,8 @@ Loads a 'PNG' image from a file.
Returns a pointer to newly allocated loaded image, or in case of failure
NULL and errno is set.
-The resulting link:context.html[Context] should be later freed with
-link:context.html#ContextFree[GP_ContextFree()].
+The resulting link:pixmap.html[Pixmap] should be later freed with
+link:pixmap.html#PixmapFree[GP_PixmapFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -282,11 +282,11 @@ link:context.html#ContextFree[GP_ContextFree()].
/* or */
#include <GP.h>
-int GP_SavePNG(const GP_Context *src, const char *dst_path,
+int GP_SavePNG(const GP_Pixmap *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves a link:context.html[Context] as a 'PNG' image, in case particular pixel
+Saves a link:pixmap.html[Pixmap] as a 'PNG' image, in case particular pixel
type is not supported non-zero is returned and errno is set to 'ENOSYS'.
Supports 'G1', 'G2', 'G4', 'G8', 'G16', and 8-bit 'RGB' and 'RGBA' pixel
@@ -314,17 +314,17 @@ The 'JPEG' image support is implemented by the jpeg library.
/* or */
#include <GP.h>
-GP_Context *GP_ReadJPG(GP_IO *io, GP_ProgressCallback *callback);
+GP_Pixmap *GP_ReadJPG(GP_IO *io, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Reads a 'JPEG' image from readable 'GP_IO'. The link:loaders_io.html[IO
stream] is expected to start exactly at the 'JPEG' file signature.
-Returns newly allocated context (containing decompressed image) or in case of
+Returns newly allocated pixmap (containing decompressed image) or in case of
failure NULL and errno is set.
-The resulting link:context.html[Context] should be later freed with
-link:context.html#ContextFree[GP_ContextFree()].
+The resulting link:pixmap.html[Pixmap] should be later freed with
+link:pixmap.html#PixmapFree[GP_PixmapFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -332,7 +332,7 @@ link:context.html#ContextFree[GP_ContextFree()].
/* or */
#include <GP.h>
-GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback);
+GP_Pixmap *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Loads a 'JPEG' image from a file.
@@ -340,8 +340,8 @@ Loads a 'JPEG' image from a file.
Returns a pointer to newly allocated loaded image, or in case of failure
NULL and errno is set.
-The resulting link:context.html[Context] should be later freed with
-link:context.html#ContextFree[GP_ContextFree()].
+The resulting link:pixmap.html[Pixmap] should be later freed with
+link:pixmap.html#PixmapFree[GP_PixmapFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -349,11 +349,11 @@ link:context.html#ContextFree[GP_ContextFree()].
/* or */
#include <GP.h>
-int GP_SaveJPG(const GP_Context *src, const char *dst_path,
+int GP_SaveJPG(const GP_Pixmap *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves a link:context.html[Context] as a 'JPEG' image.
+Saves a link:pixmap.html[Pixmap] as a 'JPEG' image.
The 'JPEG' format could store either 'G8' or 8-bit 'RGB' pixel-types.
@@ -380,17 +380,17 @@ The 'JPEG 2000' image support is implemented using the openjpeg library.
/* or */
#include <GP.h>
-GP_Context *GP_ReadJP2(GP_IO *io, GP_ProgressCallback *callback);
+GP_Pixmap *GP_ReadJP2(GP_IO *io, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Reads a 'JPEG2000' image from readable 'GP_IO'. The link:loaders_io.html[IO
stream] is expected to start exactly at the 'JPEG2000' file signature.
-Returns newly allocated context (containing decompressed image) or in case of
+Returns newly allocated pixmap (containing decompressed image) or in case of
failure NULL and errno is set.
-The resulting link:context.html[Context] should be later freed with
-link:context.html#ContextFree[GP_ContextFree()].
+The resulting link:pixmap.html[Pixmap] should be later freed with
...e-mail trimmed, has been too large.
1
0
29 Sep '17
This is an automated email generated because a ref change occurred in the
git repository for project gfxprim.git.
The branch, master has been updated
via 68ca236236dffbd3fbb303802e6824f747d3cc50 (commit)
via c97efe2001dac56f7f16079c6ae1ada635262ff2 (commit)
via e0e66873d593fa879e90c19fb6c521f4bfc63ca2 (commit)
via 112167d6829f8dd4d26491ff63e0a8c4887061df (commit)
via 5f21803a755338b573dc6e1519779df8bc7fc78f (commit)
via 63deea8aff7c8198f4ffb3e566f3390747150c46 (commit)
via 69925ef2de2657916d62381ea95842d622f5b742 (commit)
from 3bd8980e057fc508b4a9a77d2bd0c225258cb62b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 68ca236236dffbd3fbb303802e6824f747d3cc50
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 10:51:05 +0200
URL: <http://repo.or.cz/gfxprim.git/68ca236236dffbd3>
demos: Add termini libvterm based terminal
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
configure | 3 +
demos/Makefile | 4 +
demos/termini/.gitignore | 1 +
demos/termini/Makefile | 17 ++
demos/termini/runtest.sh | 9 +
demos/termini/termini.c | 527 +++++++++++++++++++++++++++++++++++++++
6 files changed, 561 insertions(+)
create mode 100644 demos/termini/.gitignore
create mode 100644 demos/termini/Makefile
create mode 100755 demos/termini/runtest.sh
create mode 100644 demos/termini/termini.c
diff --git a/configure b/configure
index 7d7a3c056d4a..a01830e050d8 100755
--- a/configure
+++ b/configure
@@ -404,6 +404,9 @@ if __name__ == '__main__':
["V4L2",
"Video for linux 2",
[header_exists, "linux/videodev2.h"], "", "", ["grabbers"]],
+ ["libvterm",
+ "Implementation of a VT220/xterm/ECMA-48 terminal emulator",
+ [header_exists, "vterm.h"], "", "", [""]],
["pthread",
"Posix Threads",
[header_exists, "pthread.h"], "-pthread", "-pthread", ["core"]],
diff --git a/demos/Makefile b/demos/Makefile
index 1943f919b785..bf71c075d541 100644
--- a/demos/Makefile
+++ b/demos/Makefile
@@ -1,3 +1,7 @@
TOPDIR=..
+include $(TOPDIR)/config.gen.mk
SUBDIRS=grinder spiv particle ttf2img c_simple bogoman
+ifeq ($(HAVE_LIBVTERM),yes)
+SUBDIRS+=termini
+endif
include $(TOPDIR)/post.mk
diff --git a/demos/termini/.gitignore b/demos/termini/.gitignore
new file mode 100644
index 000000000000..23409a7d1275
--- /dev/null
+++ b/demos/termini/.gitignore
@@ -0,0 +1 @@
+termini
diff --git a/demos/termini/Makefile b/demos/termini/Makefile
new file mode 100644
index 000000000000..f54364741e4d
--- /dev/null
+++ b/demos/termini/Makefile
@@ -0,0 +1,17 @@
+TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
+CSOURCES=$(shell echo *.c)
+
+INCLUDE=
+LDFLAGS+=-L$(TOPDIR)/build/
+
+LDLIBS+=-lgfxprim-backends -lgfxprim -lvterm -lutil
+
+APPS=termini
+
+INSTALL_BIN=termini
+
+include $(TOPDIR)/app.mk
+include $(TOPDIR)/install.mk
+include $(TOPDIR)/post.mk
diff --git a/demos/termini/runtest.sh b/demos/termini/runtest.sh
new file mode 100755
index 000000000000..dac7bc8b8671
--- /dev/null
+++ b/demos/termini/runtest.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Run dynamically linked test.
+#
+
+PROG="$1"
+shift
+
+LD_LIBRARY_PATH=../../build/ ./$PROG "$@"
diff --git a/demos/termini/termini.c b/demos/termini/termini.c
new file mode 100644
index 000000000000..ddbd4db54189
--- /dev/null
+++ b/demos/termini/termini.c
@@ -0,0 +1,527 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2017 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+ /*
+
+ TERMINI -- minimal terminal emulator.
+
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <pty.h>
+#include <vterm.h>
+#include <GP.h>
+
+static GP_Backend *backend;
+
+static VTerm *vt;
+static VTermScreen *vts;
+
+static unsigned int cols;
+static unsigned int rows;
+static unsigned int char_width;
+static unsigned int char_height;
+static GP_TextStyle *text_style;
+
+/* delay before we repaint merged damage */
+static int repaint_sleep_ms = -1;
+
+/* HACK to draw frames */
+static void draw_utf8_frames(int x, int y, uint32_t val, GP_Pixel fg)
+{
+ switch (val) {
+ case 0x2500: /* Horizontal line */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width, fg);
+ break;
+ case 0x2502: /* Vertical line */
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg);
+ break;
+ case 0x250c: /* Upper left corner */
+ GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg);
+ break;
+ case 0x2510: /* Upper right corner */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg);
+ break;
+ case 0x2514: /* Bottom left corner */
+ GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2, fg);
+ break;
+ case 0x2518: /* Bottom right corner */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2+1, fg);
+ break;
+ case 0x251c: /* Left vertical tee */
+ GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg);
+ break;
+ case 0x2524: /* Right vertical tee */
+ GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg);
+ GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg);
+ break;
+ default:
+ fprintf(stderr, "WARN: unhandled utf8 char %x\n", val);
+ }
+}
+
+static void draw_cell(VTermPos pos)
+{
+ VTermScreenCell c;
+
+ vterm_screen_get_cell(vts, pos, &c);
+
+ GP_Pixel bg = GP_RGBToPixmapPixel(c.bg.red, c.bg.green, c.bg.blue, backend->pixmap);
+ GP_Pixel fg = GP_RGBToPixmapPixel(c.fg.red, c.fg.green, c.fg.blue, backend->pixmap);
+
+ if (c.attrs.reverse)
+ GP_SWAP(bg, fg);
+
+ char buf[2] = {c.chars[0], 0};
+
+ int x = pos.col * char_width;
+ int y = pos.row * char_height;
+
+ GP_FillRectXYWH(backend->pixmap, x, y, char_width, char_height, bg);
+
+ //fprintf(stderr, "Drawing %x %c %02i %02i\n", buf[0], buf[0], pos.row, pos.col);
+
+ if (c.width > 1)
+ fprintf(stderr, "%i\n", c.width);
+
+ if (c.chars[0] > 0x7f)
+ draw_utf8_frames(x, y, c.chars[0], fg);
+ else
+ GP_Text(backend->pixmap, text_style, x, y, GP_ALIGN_RIGHT | GP_VALIGN_BELOW, fg, bg, buf);
+
+ if (c.attrs.bold)
+ GP_Text(backend->pixmap, text_style, x+1, y, GP_ALIGN_RIGHT | GP_VALIGN_BELOW, fg, bg, buf);
+}
+
+static void update_rect(VTermRect rect)
+{
+ int x = rect.start_col * char_width;
+ int y = rect.start_row * char_height;
+ int w = rect.end_col * char_width;
+ int h = rect.end_row * char_height;
+
+ GP_BackendUpdateRectXYXY(backend, x, y, w, h);
+}
+
+static VTermRect damaged;
+static int damage_repainted = 1;
+
+static void merge_damage(VTermRect rect)
+{
+ if (damage_repainted) {
+ damaged = rect;
+ damage_repainted = 0;
+ return;
+ }
+
+ damaged.start_col = GP_MIN(damaged.start_col, rect.start_col);
+ damaged.end_col = GP_MAX(damaged.end_col, rect.end_col);
+
+ damaged.start_row = GP_MIN(damaged.start_row, rect.start_row);
+ damaged.end_row = GP_MAX(damaged.end_row, rect.end_row);
+
+}
+
+static void repaint_damage(void)
+{
+ int row, col;
+
+ for (row = damaged.start_row; row < damaged.end_row; row++) {
+ for (col = damaged.start_col; col < damaged.end_col; col++) {
+ VTermPos pos = {.row = row, .col = col};
+ draw_cell(pos);
+ }
+ }
+
+ update_rect(damaged);
+ damage_repainted = 1;
+ repaint_sleep_ms = -1;
+}
+
+
+static int term_damage(VTermRect rect, void *user_data)
+{
+ (void)user_data;
+
+ merge_damage(rect);
+// fprintf(stderr, "rect: %i %i %i %i\n", rect.start_row, rect.end_row, rect.start_col, rect.end_col);
+ repaint_sleep_ms = 1;
+
+ return 1;
+}
+
+static int term_moverect(VTermRect dest, VTermRect src, void *user_data)
+{
+ (void)dest;
+ (void)src;
+ (void)user_data;
+ fprintf(stderr, "Move rect!\n");
+
+ return 0;
+}
+
+static int term_movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user_data)
+{
+ (void)user_data;
+ unsigned int x = oldpos.col * char_width;
+ unsigned int y = oldpos.row * char_height;
+
+ draw_cell(oldpos);
+ GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height);
+
+ x = pos.col * char_width;
+ y = pos.row * char_height;
+
+ GP_RectXYWH(backend->pixmap, x, y, char_width, char_height, 0xffffff);
+ GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height);
+
+ //fprintf(stderr, "Move cursor %i %i -> %i %i!\n", oldpos.col, oldpos.row, pos.col, pos.row);
+
+ //vterm_screen_flush_damage(vts);
+
+ return 1;
+}
+
+static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data)
+{
+ (void)user_data;
+
+ switch (prop) {
+ case VTERM_PROP_TITLE:
+ fprintf(stderr, "caption %s\n", val->string);
+ GP_BackendSetCaption(backend, val->string);
+ return 1;
+ case VTERM_PROP_ALTSCREEN:
+ fprintf(stderr, "altscreen\n");
+ return 0;
+ case VTERM_PROP_ICONNAME:
+ fprintf(stderr, "iconname %s\n", val->string);
+ return 0;
+ case VTERM_PROP_CURSORSHAPE:
+ fprintf(stderr, "cursorshape %i\n", val->number);
+ return 0;
+ case VTERM_PROP_REVERSE:
+ fprintf(stderr, "reverse %i\n", val->boolean);
+ return 0;
+ case VTERM_PROP_CURSORVISIBLE:
+ fprintf(stderr, "cursorvisible %i\n", val->boolean);
+ return 0;
+ case VTERM_PROP_CURSORBLINK:
+ fprintf(stderr, "blink %i\n", val->boolean);
+ return 0;
+ case VTERM_PROP_MOUSE:
+ fprintf(stderr, "mouse %i\n", val->number);
+ return 0;
+ default:
+ break;
+ }
+
+ fprintf(stderr, "Set term prop!\n");
+
+ return 0;
+}
+
+static int term_screen_resize(int new_rows, int new_cols, void *user)
+{
+ (void)new_rows;
+ (void)new_cols;
+ (void)user;
+
+ fprintf(stderr, "Resize %i %i\n", new_rows, new_cols);
+
+ return 1;
+}
+
+static int term_bell(void *user)
+{
+ (void)user;
+ fprintf(stderr, "Bell!\n");
+
+ return 1;
+}
+
+static int term_sb_pushline(int cols, const VTermScreenCell *cells, void *user)
+{
+ (void)cols;
+ (void)cells;
+ (void)user;
+
+ fprintf(stderr, "Pushline!\n");
+
+ return 0;
+}
+
+static VTermScreenCallbacks screen_callbacks = {
+ .damage = term_damage,
+// .moverect = term_moverect,
+ .movecursor = term_movecursor,
+ .settermprop = term_settermprop,
+ .bell = term_bell,
+// .sb_pushline = term_sb_pushline,
+ .resize = term_screen_resize,
+// .sb_popline = term_sb_popline,
+};
+
+static void term_init(void)
+{
+ vt = vterm_new(rows, cols);
+ vterm_set_utf8(vt, 1);
+
+ vts = vterm_obtain_screen(vt);
+ vterm_screen_enable_altscreen(vts,1);
+ vterm_screen_set_callbacks(vts, &screen_callbacks, NULL);
+ VTermState *vs = vterm_obtain_state(vt);
+ vterm_state_set_bold_highbright(vs,1);
+ vterm_screen_reset(vts, 1);
+// vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_SCROLL);
+ //vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_ROW);
+}
+
+/*
+ * Forks and runs a shell, returns master fd.
+ */
+static int open_console(void)
+{
+ int fd, pid, flags;
+
+ pid = forkpty(&fd, NULL, NULL, NULL);
+ if (pid < 0)
+ return -1;
+
+ if (pid == 0) {
+ char *shell = getenv("SHELL");
+
+ if (!shell)
+ shell = "/bin/sh";
+
+ putenv("TERM=xterm");
+
+ execl(shell, shell, NULL);
+ }
+
+ flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+
+ return fd;
+}
+
+static void close_console(int fd)
+{
+ close(fd);
+}
+
+static int console_read(int fd)
+{
+ char buf[1024];
+ int len;
+
+ len = read(fd, buf, sizeof(buf));
+
+ if (len > 0)
+ vterm_input_write(vt, buf, len);
+
+ return len;
+}
+
+static void console_write(int fd, char *buf, int buf_len)
+{
+ write(fd, buf, buf_len);
+}
+
+static void console_resize(int fd, int cols, int rows)
+{
+ struct winsize size = {rows, cols, 0, 0};
+ ioctl(fd, TIOCSWINSZ, &size);
+}
+
+static void do_exit(int fd)
+{
+ close_console(fd);
+ GP_BackendExit(backend);
+ vterm_free(vt);
+}
+
+static void event_to_console(GP_Event *ev, int fd)
+{
+ int ctrl = GP_EventGetKey(ev, GP_KEY_RIGHT_CTRL) ||
+ GP_EventGetKey(ev, GP_KEY_LEFT_CTRL);
+
+ if (ctrl) {
+ if (ev->val.key.ascii >= 'a' && ev->val.key.ascii <= 'z') {
+ char buf = ev->val.key.ascii - 'a' + 1;
+ console_write(fd, &buf, 1);
+ }
+ return;
+ }
+
+ if (ev->val.key.ascii) {
+ write(fd, &ev->val.key.ascii, 1);
+ return;
+ }
+
+ switch (ev->val.key.key) {
+ case GP_KEY_UP:
+ console_write(fd, "\eOA", 3);
+ break;
+ case GP_KEY_DOWN:
+ console_write(fd, "\eOB", 3);
+ break;
+ case GP_KEY_RIGHT:
+ console_write(fd, "\eOC", 3);
+ break;
+ case GP_KEY_LEFT:
+ console_write(fd, "\eOD", 3);
+ break;
+ case GP_KEY_DELETE:
+ console_write(fd, "\e[3~", 4);
+ break;
+ case GP_KEY_PAGE_UP:
+ console_write(fd, "\e[5~", 4);
+ break;
+ case GP_KEY_PAGE_DOWN:
+ console_write(fd, "\e[6~", 4);
+ break;
+ case GP_KEY_HOME:
+ console_write(fd, "\e[7~", 4);
+ break;
+ case GP_KEY_END:
+ console_write(fd, "\e[8~", 4);
+ break;
+ case GP_KEY_F1:
+ console_write(fd, "\e[11~", 5);
+ break;
+ case GP_KEY_F2:
+ console_write(fd, "\e[12~", 5);
+ break;
+ case GP_KEY_F3:
+ console_write(fd, "\e[13~", 5);
+ break;
+ case GP_KEY_F4:
+ console_write(fd, "\e[14~", 5);
+ break;
+ case GP_KEY_F5:
+ console_write(fd, "\e[15~", 5);
+ break;
+ case GP_KEY_F6:
+ console_write(fd, "\e[17~", 5);
+ break;
+ case GP_KEY_F7:
+ console_write(fd, "\e[18~", 5);
+ break;
+ case GP_KEY_F8:
+ console_write(fd, "\e[19~", 5);
+ break;
+ case GP_KEY_F9:
+ console_write(fd, "\e[20~", 5);
+ break;
+ case GP_KEY_F10:
+ console_write(fd, "\e[21~", 5);
+ break;
+ case GP_KEY_F11:
+ console_write(fd, "\e[23~", 5);
+ break;
+ case GP_KEY_F12:
+ console_write(fd, "\e[24~", 5);
+ break;
+ }
+}
+
+extern struct GP_FontFace *GP_FontFoo;
+
+int main(int argc, char *argv[])
+{
+ backend = GP_BackendInit("X11", "Termini");
+ if (backend == NULL) {
+ fprintf(stderr, "Failed to initalize backend\n");
+ exit(1);
+ }
+
+ GP_TextStyle style = {.font = GP_FontFoo,
+ //.font = &GP_DefaultConsoleFont,
+ .pixel_xmul = 1,
+ .pixel_ymul = 1,
+ };
+ text_style = &style;
+
+ char_width = GP_TextMaxWidth(text_style, 1);
+ char_height = GP_TextHeight(text_style);
+
+ cols = GP_PixmapW(backend->pixmap)/char_width;
+ rows = GP_PixmapH(backend->pixmap)/char_height;
+
+ fprintf(stderr, "Cols %i Rows %i\n", cols, rows);
+
+ term_init();
+ int fd = open_console();
+
+ struct pollfd fds[2] = {
+ {.fd = fd, .events = POLLIN},
+ {.fd = backend->fd, .events = POLLIN}
+ };
+
+ for (;;) {
+ GP_Event ev;
+
+ if (poll(fds, 2, repaint_sleep_ms) == 0)
+ repaint_damage();
+
+ while (GP_BackendPollEvent(backend, &ev)) {
+ switch (ev.type) {
+ case GP_EV_KEY:
+ if (ev.code == GP_EV_KEY_UP)
+ break;
+
+ event_to_console(&ev, fd);
+ break;
+ case GP_EV_SYS:
+ switch (ev.code) {
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(backend);
+ cols = ev.val.sys.w/char_width;
+ rows = ev.val.sys.h/char_height;
+ vterm_set_size(vt, rows, cols);
+ console_resize(fd, cols, rows);
+ GP_Fill(backend->pixmap, 0);
+ VTermRect rect = {.start_row = 0, .start_col = 0, .end_row = rows, .end_col = cols};
+ term_damage(rect, NULL);
+ //TODO cursor
+ break;
+ case GP_EV_SYS_QUIT:
+ do_exit(fd);
+ break;
+ }
+ break;
+ }
+ }
+
+ console_read(fd);
+ }
+
+ return 0;
+}
commit c97efe2001dac56f7f16079c6ae1ada635262ff2
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 11:09:42 +0200
URL: <http://repo.or.cz/gfxprim.git/c97efe2001dac56f>
text/GP_Text.gen.c.t: Optimize 1BPP font drawing
Calling a HLine() function from the inner loop was a bad idea after all.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/text/GP_Text.gen.c.t | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t
index 209d00defd07..189cf7f2f031 100644
--- a/libs/text/GP_Text.gen.c.t
+++ b/libs/text/GP_Text.gen.c.t
@@ -38,7 +38,7 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle *
if (glyph == NULL)
glyph = GP_GetGlyphBitmap(style->font, ' ');
- int i, j, k;
+ int i, j, k, l;
unsigned int x_mul = style->pixel_xmul + style->pixel_xspace;
unsigned int y_mul = style->pixel_ymul + style->pixel_yspace;
@@ -51,17 +51,25 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle *
for (i = 0; i < glyph->width; i++) {
uint8_t bit = (glyph->bitmap[i/8 + j * bpp]) & (0x80>>(i%8));
- unsigned int x_start = x + (i + glyph->bearing_x) * x_mul;
+ if (!bit)
+ continue;
+
+ int start_x = x + (i + glyph->bearing_x) * x_mul;
if (p == str)
- x_start -= glyph->bearing_x * x_mul;
+ start_x -= glyph->bearing_x * x_mul;
- if (!bit)
- continue;
+ int start_y = y - (glyph->bearing_y - style->font->ascend) * y_mul;
- for (k = 0; k < style->pixel_ymul; k++)
- GP_HLine(pixmap, x_start, x_start + style->pixel_xmul - 1,
- y - (glyph->bearing_y - style->font->ascend) * y_mul + k, fg);
+ for (k = start_y; k < start_y + style->pixel_ymul; k++) {
+ for (l = start_x; l < start_x + style->pixel_xmul; l++) {
+ int px = l;
+ int py = k;
+ GP_TRANSFORM_POINT(pixmap, px, py);
+ if (!GP_PIXEL_IS_CLIPPED(pixmap, px, py))
+ GP_PutPixel_Raw_{{ pt.pixelsize.suffix }}(pixmap, px, py, fg);
+ }
+ }
}
y += style->pixel_ymul + style->pixel_yspace;
commit e0e66873d593fa879e90c19fb6c521f4bfc63ca2
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 11:08:49 +0200
URL: <http://repo.or.cz/gfxprim.git/e0e66873d593fa87>
fonts/GP_DefaultFont: Whitespace cleanup.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
libs/text/GP_DefaultFont.c | 876 ++++++++++++++++++-------------------
1 file changed, 438 insertions(+), 438 deletions(-)
rewrite libs/text/GP_DefaultFont.c (82%)
diff --git a/libs/text/GP_DefaultFont.c b/libs/text/GP_DefaultFont.c
dissimilarity index 82%
index d67fa99e9e9b..5dd67b182890 100644
--- a/libs/text/GP_DefaultFont.c
+++ b/libs/text/GP_DefaultFont.c
@@ -1,438 +1,438 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include "GP_Font.h"
-
-static int8_t default_console_glyphs[] = {
- /* ' ' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '!' */ 7, 11, 0, 9, 8,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
- /* '"' */ 7, 11, 0, 9, 8,
- 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '#' */ 7, 11, 0, 9, 8,
- 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00,
- /* '$' */ 7, 11, 0, 9, 8,
- 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
- /* '%' */ 7, 11, 0, 9, 8,
- 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
- /* '&' */ 7, 11, 0, 9, 8,
- 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
- /* ''' */ 7, 11, 0, 9, 8,
- 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '(' */ 7, 11, 0, 9, 8,
- 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00,
- /* ')' */ 7, 11, 0, 9, 8,
- 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
- /* '*' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00,
- /* '+' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- /* ',' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00,
- /* '-' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '.' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- /* '/' */ 7, 11, 0, 9, 8,
- 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00,
- /* '0' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
- /* '1' */ 7, 11, 1, 9, 8,
- 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
- /* '2' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
- /* '3' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '4' */ 7, 11, 1, 9, 8,
- 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
- /* '5' */ 7, 11, 1, 9, 8,
- 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '6' */ 7, 11, 1, 9, 8,
- 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '7' */ 7, 11, 1, 9, 8,
- 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* '8' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '9' */ 7, 11, 1, 9, 8,
- 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
- /* ':' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- /* ';' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00,
- /* '<' */ 7, 11, 0, 9, 8,
- 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
- /* '=' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
- /* '>' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00,
- /* '?' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
- /* '@' */ 8, 11, 0, 9, 8,
- 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
- /* 'A' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'B' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
- /* 'C' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
- /* 'D' */ 7, 11, 0, 9, 8,
- 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
- /* 'E' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
- /* 'F' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'G' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'H' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'I' */ 7, 11, 0, 9, 8,
- 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
- /* 'J' */ 7, 11, 0, 9, 8,
- 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'K' */ 7, 11, 0, 9, 8,
- 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'L' */ 7, 11, 0, 9, 8,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
- /* 'M' */ 7, 11, 0, 9, 8,
- 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'N' */ 7, 11, 0, 9, 8,
- 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
- /* 'O' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'P' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'Q' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
- /* 'R' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'S' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'T' */ 7, 11, 0, 9, 8,
- 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'U' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'V' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
- /* 'W' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
- /* 'X' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
- /* 'Y' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'Z' */ 7, 11, 0, 9, 8,
- 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
- /* '[' */ 7, 11, 0, 9, 8,
- 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00,
- /* '\' */ 7, 11, 0, 9, 8,
- 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00,
- /* ']' */ 7, 11, 0, 9, 8,
- 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00,
- /* '^' */ 7, 11, 0, 9, 8,
- 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '_' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
- /* '`' */ 7, 11, 0, 9, 8,
- 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* 'a' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00,
- /* 'b' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00,
- /* 'c' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00,
- /* 'd' */ 7, 11, 0, 9, 8,
- 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
- /* 'e' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00,
- /* 'f' */ 7, 11, 0, 9, 8,
- 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
- /* 'g' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
- /* 'h' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
- /* 'i' */ 7, 11, 0, 9, 8,
- 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00,
- /* 'j' */ 7, 11, 0, 9, 8,
- 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70,
- /* 'k' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
- /* 'l' */ 7, 11, 0, 9, 8,
- 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
- /* 'm' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
- /* 'n' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
- /* 'o' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00,
- /* 'p' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40,
- /* 'q' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02,
- /* 'r' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
- /* 's' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
- /* 't' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
- /* 'u' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
- /* 'v' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
- /* 'w' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
- /* 'x' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00,
- /* 'y' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
- /* 'z' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00,
- /* '{' */ 7, 11, 0, 9, 8,
- 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00,
- /* '|' */ 7, 11, 0, 9, 8,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
- /* '}' */ 7, 11, 0, 9, 8,
- 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00,
- /* '~' */ 7, 11, 0, 9, 8,
- 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-struct GP_FontFace GP_DefaultConsoleFont = {
- .family_name = "Gfxprim",
- .style_name = "Mono",
- .charset = GP_CHARSET_7BIT,
- .ascend = 9,
- .descend = 2,
- .max_glyph_width = 8,
- .max_glyph_advance = 8,
- .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
- .glyphs = default_console_glyphs,
- .glyph_offsets = {16},
-};
-
-static uint8_t default_proportional_glyphs[] = {
- /* ' ' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '!' */ 4, 11, 0, 9, 6,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00,
- /* '"' */ 8, 11, 0, 9, 9,
- 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '#' */ 8, 11, 0, 9, 9,
- 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00,
- /* '$' */ 7, 11, 0, 9, 8,
- 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
- /* '%' */ 7, 11, 0, 9, 8,
- 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
- /* '&' */ 7, 11, 0, 9, 8,
- 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
- /* ''' */ 4, 11, 0, 9, 5,
- 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '(' */ 2, 11, 0, 9, 4,
- 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00,
- /* ')' */ 2, 11, 0, 9, 4,
- 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00,
- /* '*' */ 5, 11, 0, 9, 6,
- 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00,
- /* '+' */ 7, 11, 0, 9, 8,
- 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- /* ',' */ 4, 11, 0, 9, 6,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00,
- /* '-' */ 4, 11, 0, 9, 6,
- 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '.' */ 4, 11, 0, 9, 6,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- /* '/' */ 5, 11, 0, 9, 6,
- 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00,
- /* '0' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
- /* '1' */ 6, 11, 0, 9, 7,
- 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
- /* '2' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
- /* '3' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '4' */ 6, 11, 0, 9, 7,
- 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
- /* '5' */ 6, 11, 0, 9, 7,
- 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '6' */ 6, 11, 0, 9, 7,
- 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '7' */ 6, 11, 0, 9, 7,
- 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* '8' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* '9' */ 6, 11, 0, 9, 7,
- 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
- /* ':' */ 4, 11, 0, 9, 5,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
- /* ';' */ 4, 11, 0, 9, 5,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00,
- /* '<' */ 4, 11, 0, 9, 6,
- 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00,
- /* '=' */ 5, 11, 0, 9, 6,
- 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
- /* '>' */ 4, 11, 0, 9, 6,
- 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
- /* '?' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
- /* '@' */ 8, 11, 0, 9, 9,
- 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
- /* 'A' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'B' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
- /* 'C' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
- /* 'D' */ 7, 11, 0, 9, 8,
- 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
- /* 'E' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
- /* 'F' */ 7, 11, 0, 9, 8,
- 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'G' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'H' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'I' */ 1, 11, 0, 9, 2,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'J' */ 7, 11, 0, 9, 8,
- 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'K' */ 7, 11, 0, 9, 8,
- 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'L' */ 6, 11, 0, 9, 7,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00,
- /* 'M' */ 7, 11, 0, 9, 8,
- 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
- /* 'N' */ 7, 11, 0, 9, 8,
- 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
- /* 'O' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'P' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 'Q' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
- /* 'R' */ 7, 11, 0, 9, 8,
- 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
- /* 'S' */ 7, 11, 0, 9, 8,
- 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
- /* 'T' */ 7, 11, 0, 9, 8,
- 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'U' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
- /* 'V' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
- /* 'W' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
- /* 'X' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
- /* 'Y' */ 7, 11, 0, 9, 8,
- 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
- /* 'Z' */ 7, 11, 0, 9, 8,
- 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
- /* '[' */ 3, 11, 0, 9, 4,
- 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00,
- /* '\' */ 5, 11, 0, 9, 6,
- 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00,
- /* ']' */ 3, 11, 0, 9, 4,
- 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00,
- /* '^' */ 8, 11, 0, 9, 9,
- 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* '_' */ 8, 11, 0, 9, 9,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
- /* '`' */ 2, 11, 0, 9, 3,
- 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* 'a' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00,
- /* 'b' */ 6, 11, 0, 9, 7,
- 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00,
- /* 'c' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00,
- /* 'd' */ 6, 11, 0, 9, 7,
- 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
- /* 'e' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00,
- /* 'f' */ 6, 11, 0, 9, 7,
- 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
- /* 'g' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
- /* 'h' */ 6, 11, 0, 9, 7,
- 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
- /* 'i' */ 2, 11, 0, 9, 4,
- 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
- /* 'j' */ 3, 11, 0, 9, 4,
- 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0,
- /* 'k' */ 7, 11, 0, 9, 8,
- 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
- /* 'l' */ 4, 11, 0, 9, 5,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00,
- /* 'm' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
- /* 'n' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
- /* 'o' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
- /* 'p' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80,
- /* 'q' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04,
- /* 'r' */ 5, 11, 0, 9, 6,
- 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* 's' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
- /* 't' */ 6, 11, 0, 9, 7,
- 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00,
- /* 'u' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
- /* 'v' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00,
- /* 'w' */ 7, 11, 0, 9, 8,
- 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
- /* 'x' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00,
- /* 'y' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
- /* 'z' */ 6, 11, 0, 9, 7,
- 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00,
- /* '{' */ 5, 11, 0, 9, 6,
- 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00,
- /* '|' */ 1, 11, 0, 9, 2,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
- /* '}' */ 5, 11, 0, 9, 6,
- 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
- /* '~' */ 6, 11, 0, 9, 7,
- 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-struct GP_FontFace GP_DefaultProportionalFont = {
- .family_name = "Gfxprim",
- .style_name = "Proportional",
- .charset = GP_CHARSET_7BIT,
- .ascend = 9,
- .descend = 2,
- .max_glyph_width = 9,
- .max_glyph_advance = 9,
- .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
- .glyphs = default_proportional_glyphs,
- .glyph_offsets = {16},
-};
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * <jiri.bluebear.dluhos(a)gmail.com> *
+ * *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include "GP_Font.h"
+
+static int8_t default_console_glyphs[] = {
+ /* ' ' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '!' */ 7, 11, 0, 9, 8,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
+ /* '"' */ 7, 11, 0, 9, 8,
+ 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '#' */ 7, 11, 0, 9, 8,
+ 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00,
+ /* '$' */ 7, 11, 0, 9, 8,
+ 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
+ /* '%' */ 7, 11, 0, 9, 8,
+ 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
+ /* '&' */ 7, 11, 0, 9, 8,
+ 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
+ /* ''' */ 7, 11, 0, 9, 8,
+ 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '(' */ 7, 11, 0, 9, 8,
+ 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00,
+ /* ')' */ 7, 11, 0, 9, 8,
+ 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00,
+ /* '*' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00,
+ /* '+' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* ',' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00,
+ /* '-' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '.' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+ /* '/' */ 7, 11, 0, 9, 8,
+ 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00,
+ /* '0' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
+ /* '1' */ 7, 11, 1, 9, 8,
+ 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+ /* '2' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* '3' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '4' */ 7, 11, 1, 9, 8,
+ 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
+ /* '5' */ 7, 11, 1, 9, 8,
+ 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '6' */ 7, 11, 1, 9, 8,
+ 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '7' */ 7, 11, 1, 9, 8,
+ 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* '8' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '9' */ 7, 11, 1, 9, 8,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
+ /* ':' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+ /* ';' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00,
+ /* '<' */ 7, 11, 0, 9, 8,
+ 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
+ /* '=' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
+ /* '>' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00,
+ /* '?' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
+ /* '@' */ 8, 11, 0, 9, 8,
+ 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
+ /* 'A' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'B' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
+ /* 'C' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
+ /* 'D' */ 7, 11, 0, 9, 8,
+ 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
+ /* 'E' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'F' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'G' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'H' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'I' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+ /* 'J' */ 7, 11, 0, 9, 8,
+ 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'K' */ 7, 11, 0, 9, 8,
+ 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'L' */ 7, 11, 0, 9, 8,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'M' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'N' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
+ /* 'O' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'P' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'Q' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
+ /* 'R' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'S' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'T' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'U' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'V' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
+ /* 'W' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
+ /* 'X' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
+ /* 'Y' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'Z' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
+ /* '[' */ 7, 11, 0, 9, 8,
+ 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00,
+ /* '\' */ 7, 11, 0, 9, 8,
+ 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00,
+ /* ']' */ 7, 11, 0, 9, 8,
+ 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00,
+ /* '^' */ 7, 11, 0, 9, 8,
+ 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '_' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
+ /* '`' */ 7, 11, 0, 9, 8,
+ 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* 'a' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00,
+ /* 'b' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00,
+ /* 'c' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00,
+ /* 'd' */ 7, 11, 0, 9, 8,
+ 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
+ /* 'e' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00,
+ /* 'f' */ 7, 11, 0, 9, 8,
+ 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
+ /* 'g' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
+ /* 'h' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
+ /* 'i' */ 7, 11, 0, 9, 8,
+ 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00,
+ /* 'j' */ 7, 11, 0, 9, 8,
+ 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70,
+ /* 'k' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
+ /* 'l' */ 7, 11, 0, 9, 8,
+ 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
+ /* 'm' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
+ /* 'n' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00,
+ /* 'o' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00,
+ /* 'p' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40,
+ /* 'q' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02,
+ /* 'r' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
+ /* 's' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
+ /* 't' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
+ /* 'u' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00,
+ /* 'v' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
+ /* 'w' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
+ /* 'x' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00,
+ /* 'y' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c,
+ /* 'z' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00,
+ /* '{' */ 7, 11, 0, 9, 8,
+ 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00,
+ /* '|' */ 7, 11, 0, 9, 8,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
+ /* '}' */ 7, 11, 0, 9, 8,
+ 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00,
+ /* '~' */ 7, 11, 0, 9, 8,
+ 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+struct GP_FontFace GP_DefaultConsoleFont = {
+ .family_name = "Gfxprim",
+ .style_name = "Mono",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 9,
+ .descend = 2,
+ .max_glyph_width = 8,
+ .max_glyph_advance = 8,
+ .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
+ .glyphs = default_console_glyphs,
+ .glyph_offsets = {16},
+};
+
+static uint8_t default_proportional_glyphs[] = {
+ /* ' ' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '!' */ 4, 11, 0, 9, 6,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00,
+ /* '"' */ 8, 11, 0, 9, 9,
+ 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '#' */ 8, 11, 0, 9, 9,
+ 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00,
+ /* '$' */ 7, 11, 0, 9, 8,
+ 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00,
+ /* '%' */ 7, 11, 0, 9, 8,
+ 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00,
+ /* '&' */ 7, 11, 0, 9, 8,
+ 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00,
+ /* ''' */ 4, 11, 0, 9, 5,
+ 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '(' */ 2, 11, 0, 9, 4,
+ 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00,
+ /* ')' */ 2, 11, 0, 9, 4,
+ 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00,
+ /* '*' */ 5, 11, 0, 9, 6,
+ 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00,
+ /* '+' */ 7, 11, 0, 9, 8,
+ 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
+ /* ',' */ 4, 11, 0, 9, 6,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00,
+ /* '-' */ 4, 11, 0, 9, 6,
+ 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '.' */ 4, 11, 0, 9, 6,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
+ /* '/' */ 5, 11, 0, 9, 6,
+ 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00,
+ /* '0' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00,
+ /* '1' */ 6, 11, 0, 9, 7,
+ 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00,
+ /* '2' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* '3' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '4' */ 6, 11, 0, 9, 7,
+ 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00,
+ /* '5' */ 6, 11, 0, 9, 7,
+ 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '6' */ 6, 11, 0, 9, 7,
+ 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '7' */ 6, 11, 0, 9, 7,
+ 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* '8' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* '9' */ 6, 11, 0, 9, 7,
+ 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00,
+ /* ':' */ 4, 11, 0, 9, 5,
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
+ /* ';' */ 4, 11, 0, 9, 5,
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00,
+ /* '<' */ 4, 11, 0, 9, 6,
+ 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00,
+ /* '=' */ 5, 11, 0, 9, 6,
+ 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
+ /* '>' */ 4, 11, 0, 9, 6,
+ 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
+ /* '?' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
+ /* '@' */ 8, 11, 0, 9, 9,
+ 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00,
+ /* 'A' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'B' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00,
+ /* 'C' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00,
+ /* 'D' */ 7, 11, 0, 9, 8,
+ 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00,
+ /* 'E' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00,
+ /* 'F' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'G' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'H' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'I' */ 1, 11, 0, 9, 2,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'J' */ 7, 11, 0, 9, 8,
+ 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'K' */ 7, 11, 0, 9, 8,
+ 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'L' */ 6, 11, 0, 9, 7,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00,
+ /* 'M' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
+ /* 'N' */ 7, 11, 0, 9, 8,
+ 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00,
+ /* 'O' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'P' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 'Q' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00,
+ /* 'R' */ 7, 11, 0, 9, 8,
+ 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00,
+ /* 'S' */ 7, 11, 0, 9, 8,
+ 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00,
+ /* 'T' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'U' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00,
+ /* 'V' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00,
+ /* 'W' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00,
+ /* 'X' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00,
+ /* 'Y' */ 7, 11, 0, 9, 8,
+ 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
+ /* 'Z' */ 7, 11, 0, 9, 8,
+ 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00,
+ /* '[' */ 3, 11, 0, 9, 4,
+ 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00,
+ /* '\' */ 5, 11, 0, 9, 6,
+ 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00,
+ /* ']' */ 3, 11, 0, 9, 4,
+ 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00,
+ /* '^' */ 8, 11, 0, 9, 9,
+ 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* '_' */ 8, 11, 0, 9, 9,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00,
+ /* '`' */ 2, 11, 0, 9, 3,
+ 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* 'a' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00,
+ /* 'b' */ 6, 11, 0, 9, 7,
+ 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00,
+ /* 'c' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00,
+ /* 'd' */ 6, 11, 0, 9, 7,
+ 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
+ /* 'e' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00,
+ /* 'f' */ 6, 11, 0, 9, 7,
+ 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
+ /* 'g' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
+ /* 'h' */ 6, 11, 0, 9, 7,
+ 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
+ /* 'i' */ 2, 11, 0, 9, 4,
+ 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
+ /* 'j' */ 3, 11, 0, 9, 4,
+ 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0,
+ /* 'k' */ 7, 11, 0, 9, 8,
+ 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00,
+ /* 'l' */ 4, 11, 0, 9, 5,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00,
+ /* 'm' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
+ /* 'n' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
+ /* 'o' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00,
+ /* 'p' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80,
+ /* 'q' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04,
+ /* 'r' */ 5, 11, 0, 9, 6,
+ 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* 's' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00,
+ /* 't' */ 6, 11, 0, 9, 7,
+ 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00,
+ /* 'u' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00,
+ /* 'v' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00,
+ /* 'w' */ 7, 11, 0, 9, 8,
+ 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00,
+ /* 'x' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00,
+ /* 'y' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78,
+ /* 'z' */ 6, 11, 0, 9, 7,
+ 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00,
+ /* '{' */ 5, 11, 0, 9, 6,
+ 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00,
+ /* '|' */ 1, 11, 0, 9, 2,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
+ /* '}' */ 5, 11, 0, 9, 6,
+ 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00,
+ /* '~' */ 6, 11, 0, 9, 7,
+ 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+struct GP_FontFace GP_DefaultProportionalFont = {
+ .family_name = "Gfxprim",
+ .style_name = "Proportional",
+ .charset = GP_CHARSET_7BIT,
+ .ascend = 9,
+ .descend = 2,
+ .max_glyph_width = 9,
+ .max_glyph_advance = 9,
+ .glyph_bitmap_format = GP_FONT_BITMAP_1BPP,
+ .glyphs = default_proportional_glyphs,
+ .glyph_offsets = {16},
+};
commit 112167d6829f8dd4d26491ff63e0a8c4887061df
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat, 23 Sep 2017 10:54:22 +0200
URL: <http://repo.or.cz/gfxprim.git/112167d6829f8dd4>
Rename GP_Context -> GP_Pixmap
This should have been done long long time ago.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
---
build/syms/Backend_symbols.txt | 2 +-
build/syms/Core_symbols.txt | 26 +-
demos/bogoman/bogoman.c | 14 +-
demos/bogoman/bogoman_render.c | 98 +++---
demos/bogoman/bogoman_render.h | 6 +-
demos/c_simple/SDL_glue.c | 18 +-
demos/c_simple/backend_example.c | 12 +-
demos/c_simple/backend_timers_example.c | 6 +-
demos/c_simple/blittest.c | 32 +-
demos/c_simple/convolution.c | 2 +-
demos/c_simple/debug_handler.c | 6 +-
demos/c_simple/fileview.c | 16 +-
demos/c_simple/filters_symmetry.c | 6 +-
demos/c_simple/fonttest.c | 26 +-
demos/c_simple/gaussian_noise.c | 4 +-
demos/c_simple/gfx_koch.c | 12 +-
demos/c_simple/input_example.c | 12 +-
demos/c_simple/koch.c | 36 +-
demos/c_simple/linetest.c | 22 +-
demos/c_simple/loaders.c | 2 +-
demos/c_simple/loaders_example.c | 2 +-
demos/c_simple/loaders_register.c | 4 +-
demos/c_simple/memory_io.c | 6 +-
demos/c_simple/pretty_print.c | 8 +-
demos/c_simple/randomshapetest.c | 58 ++--
demos/c_simple/shapetest.c | 40 +--
demos/c_simple/showimage.c | 12 +-
demos/c_simple/sin_AA.c | 24 +-
demos/c_simple/textaligntest.c | 42 +--
demos/c_simple/v4l2_show.c | 12 +-
demos/c_simple/virtual_backend_example.c | 42 +--
demos/c_simple/weighted_median.c | 4 +-
demos/c_simple/x11_windows.c | 18 +-
demos/c_simple/zip_container.c | 14 +-
demos/grinder/grinder.c | 78 ++---
demos/grinder/histogram.c | 6 +-
demos/grinder/histogram.h | 2 +-
demos/particle/particle_demo.c | 18 +-
demos/particle/space.c | 42 +--
demos/particle/space.h | 2 +-
demos/py_simple/backends.py | 2 +-
demos/py_simple/blit.py | 8 +-
demos/py_simple/cam_view.py | 2 +-
demos/py_simple/font_style.py | 2 +-
demos/py_simple/gfx.py | 78 ++---
demos/py_simple/gravplots_AA.py | 16 +-
demos/py_simple/showimage.py | 2 +-
demos/py_simple/sinplots_AA.py | 10 +-
demos/py_simple/x11_windows.py | 2 +-
demos/spiv/image_cache.c | 32 +-
demos/spiv/image_cache.h | 8 +-
demos/spiv/image_loader.c | 10 +-
demos/spiv/image_loader.h | 4 +-
demos/spiv/spiv.c | 134 ++++----
demos/spiv/spiv_help.c | 6 +-
demos/ttf2img/ttf2img.c | 14 +-
doc/Makefile | 2 +-
doc/about.txt | 2 +-
doc/backends.txt | 20 +-
doc/backends_python.txt | 4 +-
doc/blits.txt | 24 +-
doc/coding_style.txt | 8 +-
doc/context.txt | 309 ------------------
doc/convert.txt | 8 +-
doc/core.txt | 6 +-
doc/core_python.txt | 34 +-
doc/debug.txt | 2 +-
doc/environment_variables.txt | 6 +-
doc/example_SDL_glue.txt | 2 +-
doc/filters.txt | 218 ++++++------
doc/filters_dithering.txt | 16 +-
doc/filters_resize.txt | 28 +-
doc/gamma.txt | 2 +-
doc/get_put_pixel.txt | 22 +-
doc/gfx.txt | 56 ++--
doc/gfx_python.txt | 48 +--
doc/grabbers.txt | 4 +-
doc/images/regen.py | 8 +-
doc/loaders.txt | 200 ++++++------
doc/loaders_python.txt | 2 +-
doc/text.txt | 6 +-
include/backends/GP_Backend.h | 14 +-
.../{GP_SDL_Context.h => GP_SDL_Pixmap.h} | 18 +-
include/core/GP_Blit.h | 36 +-
include/core/GP_Convert.gen.h.t | 2 +-
include/core/GP_Convert.h | 26 +-
include/core/GP_Core.h | 4 +-
include/core/GP_Debug.h | 2 +-
include/core/GP_Fill.h | 4 +-
include/core/GP_FnPerBpp.h | 20 +-
include/core/GP_Gamma.h | 4 +-
include/core/GP_GammaCorrection.h | 2 +-
include/core/GP_GammaPixel.gen.h.t | 2 +-
include/core/GP_GetPutPixel.gen.h.t | 16 +-
include/core/GP_GetPutPixel.h | 36 +-
include/core/GP_MixPixels.gen.h.t | 26 +-
include/core/GP_Pixel.gen.h.t | 4 +-
include/core/GP_Pixel.h | 4 +-
include/core/{GP_Context.h => GP_Pixmap.h} | 136 ++++----
include/core/GP_Transform.h | 90 ++---
include/filters/GP_ApplyTables.h | 10 +-
include/filters/GP_Arithmetic.h | 50 +--
include/filters/GP_Blur.h | 10 +-
include/filters/GP_Convolution.h | 12 +-
include/filters/GP_Dither.h | 12 +-
include/filters/GP_EdgeDetection.h | 8 +-
include/filters/GP_Filter.h | 2 +-
include/filters/GP_Filters.h | 2 +-
include/filters/GP_GaussianNoise.h | 14 +-
include/filters/GP_Laplace.h | 8 +-
include/filters/GP_Linear.h | 22 +-
include/filters/GP_Median.h | 12 +-
include/filters/GP_MultiTone.h | 12 +-
include/filters/GP_Point.h | 56 ++--
include/filters/GP_Resize.h | 8 +-
include/filters/GP_ResizeCubic.h | 8 +-
include/filters/GP_ResizeLinear.h | 8 +-
include/filters/GP_ResizeNN.h | 4 +-
include/filters/GP_Rotate.h | 38 +--
include/filters/GP_Sepia.h | 12 +-
include/filters/GP_Sigma.h | 12 +-
include/filters/GP_Stats.h | 2 +-
include/filters/GP_WeightedMedian.h | 12 +-
include/gfx/GP_Arc.h | 6 +-
include/gfx/GP_Circle.h | 18 +-
include/gfx/GP_CircleSeg.h | 10 +-
include/gfx/GP_Ellipse.h | 10 +-
include/gfx/GP_Gfx.h | 2 +-
include/gfx/GP_HLine.gen.h.t | 2 +-
include/gfx/GP_HLine.h | 18 +-
include/gfx/GP_HLineAA.h | 10 +-
include/gfx/GP_Line.h | 6 +-
include/gfx/GP_LineAA.h | 10 +-
include/gfx/GP_Polygon.h | 10 +-
include/gfx/GP_PutPixelAA.h | 14 +-
include/gfx/GP_Rect.h | 34 +-
include/gfx/GP_Tetragon.h | 10 +-
include/gfx/GP_Triangle.h | 10 +-
include/gfx/GP_VLine.gen.h.t | 2 +-
include/gfx/GP_VLine.h | 18 +-
include/gfx/GP_VLineAA.h | 10 +-
include/grabbers/GP_Grabber.h | 6 +-
include/loaders/GP_BMP.h | 12 +-
include/loaders/GP_Container.h | 14 +-
include/loaders/GP_GIF.h | 6 +-
include/loaders/GP_JP2.h | 8 +-
include/loaders/GP_JPG.h | 12 +-
include/loaders/GP_Loader.h | 30 +-
include/loaders/GP_Loaders.h | 2 +-
include/loaders/GP_PCX.h | 8 +-
include/loaders/GP_PNG.h | 14 +-
include/loaders/GP_PNM.h | 32 +-
include/loaders/GP_PSD.h | 8 +-
include/loaders/GP_PSP.h | 10 +-
include/loaders/GP_TIFF.h | 12 +-
include/loaders/GP_ZIP.h | 2 +-
include/text/GP_Text.h | 20 +-
libs/backends/GP_AALib.c | 14 +-
libs/backends/GP_Backend.c | 14 +-
libs/backends/GP_BackendVirtual.c | 30 +-
libs/backends/GP_LinuxFB.c | 40 +--
libs/backends/GP_SDL.c | 38 +--
libs/backends/GP_X11.c | 46 +--
libs/backends/GP_X11_Win.h | 2 +-
libs/core/GP_Blit.c | 66 ++--
libs/core/GP_Blit.gen.c.t | 38 +--
libs/core/GP_Context.c | 220 ++++++-------
libs/core/GP_Fill.gen.c.t | 8 +-
libs/core/GP_GetPutPixel.c | 16 +-
libs/filters/GP_ApplyTables.c | 10 +-
libs/filters/GP_ApplyTables.gen.c.t | 10 +-
libs/filters/GP_Blur.c | 16 +-
libs/filters/GP_Convolution.c | 10 +-
libs/filters/GP_Edge.c | 30 +-
libs/filters/GP_FloydSteinberg.gen.c.t | 16 +-
libs/filters/GP_GaussianNoise.gen.c.t | 20 +-
libs/filters/GP_HilbertPeano.gen.c.t | 16 +-
libs/filters/GP_Histogram.gen.c.t | 8 +-
libs/filters/GP_Laplace.c | 16 +-
libs/filters/GP_LinearConvolution.c | 6 +-
libs/filters/GP_LinearConvolution.gen.c.t | 26 +-
libs/filters/GP_Median.c | 16 +-
libs/filters/GP_MirrorH.gen.c.t | 18 +-
libs/filters/GP_MultiTone.gen.c.t | 18 +-
libs/filters/GP_Resize.c | 12 +-
libs/filters/GP_ResizeCubic.gen.c.t | 10 +-
libs/filters/GP_ResizeCubicFloat.c | 4 +-
libs/filters/GP_ResizeLinear.gen.c.t | 14 +-
libs/filters/GP_ResizeNN.gen.c.t | 8 +-
libs/filters/GP_Rotate.c | 16 +-
libs/filters/GP_Rotate.gen.c.t | 48 +--
libs/filters/GP_Sepia.c | 6 +-
libs/filters/GP_Sigma.c | 16 +-
libs/filters/GP_WeightedMedian.c | 16 +-
libs/filters/arithmetic_filter.t | 22 +-
libs/filters/point_filter.t | 10 +-
libs/gfx/GP_Arc.c | 16 +-
libs/gfx/GP_Circle.c | 42 +--
libs/gfx/GP_CircleSeg.c | 38 +--
libs/gfx/GP_Ellipse.c | 16 +-
libs/gfx/GP_FillCircle.gen.c.t | 22 +-
libs/gfx/GP_FillEllipse.gen.c.t | 24 +-
libs/gfx/GP_HLine.c | 36 +-
libs/gfx/GP_HLine.gen.c.t | 10 +-
libs/gfx/GP_HLineAA.c | 28 +-
libs/gfx/GP_HLineAA.gen.c.t | 16 +-
libs/gfx/GP_Line.gen.c.t | 38 +--
libs/gfx/GP_LineAA.c | 16 +-
libs/gfx/GP_LineAA.gen.c.t | 40 +--
libs/gfx/GP_PartialEllipse.c | 16 +-
libs/gfx/GP_Polygon.c | 24 +-
libs/gfx/GP_PutPixelAA.gen.c.t | 22 +-
libs/gfx/GP_Rect.c | 54 +--
libs/gfx/GP_Tetragon.c | 44 +--
libs/gfx/GP_Triangle.c | 36 +-
libs/gfx/GP_VLine.c | 42 +--
libs/gfx/GP_VLine.gen.c.t | 4 +-
libs/gfx/GP_VLineAA.c | 28 +-
libs/gfx/GP_VLineAA.gen.c.t | 16 +-
libs/gfx/algo/Arc.algo.h | 24 +-
libs/gfx/algo/Circle.algo.h | 26 +-
libs/gfx/algo/CircleSeg.algo.h | 26 +-
libs/gfx/algo/Ellipse.algo.h | 28 +-
libs/gfx/algo/FillRing.algo.h | 20 +-
libs/gfx/algo/FillTriangle.algo.h | 10 +-
libs/gfx/algo/PartialEllipse.algo.h | 16 +-
libs/grabbers/GP_V4L2.c | 8 +-
libs/loaders/GP_BMP.c | 48 +--
libs/loaders/GP_BMP_RLE.h | 12 +-
libs/loaders/GP_Container.c | 2 +-
libs/loaders/GP_GIF.c | 16 +-
libs/loaders/GP_JP2.c | 14 +-
libs/loaders/GP_JPG.c | 30 +-
libs/loaders/GP_Loader.c | 28 +-
libs/loaders/GP_PCX.c | 24 +-
libs/loaders/GP_PNG.c | 26 +-
libs/loaders/GP_PNM.c | 188 +++++------
libs/loaders/GP_PSD.c | 32 +-
libs/loaders/GP_PSP.c | 10 +-
libs/loaders/GP_TIFF.c | 30 +-
libs/loaders/GP_ZIP.c | 12 +-
libs/text/GP_Text.c | 22 +-
libs/text/GP_Text.gen.c.t | 46 +--
pylib/gfxprim/__init__.py | 6 +-
pylib/gfxprim/backends/__init__.py | 2 +-
pylib/gfxprim/backends/_extend_backend.py | 2 +-
pylib/gfxprim/core/__init__.py | 124 +++----
pylib/gfxprim/core/core.i | 86 ++---
pylib/gfxprim/filters/__init__.py | 12 +-
pylib/gfxprim/gfx/__init__.py | 16 +-
pylib/gfxprim/gfx/gfx.i | 8 +-
pylib/gfxprim/loaders/__init__.py | 6 +-
pylib/gfxprim/text/__init__.py | 12 +-
tests/afl/loaders.c | 4 +-
tests/core/.gitignore | 2 +-
tests/core/BlitClipped.c | 14 +-
tests/core/BlitConv.gen.c.t | 26 +-
tests/core/GetPutPixel.gen.c.t | 28 +-
tests/core/Makefile | 4 +-
tests/core/{Context.c => Pixmap.c} | 142 ++++----
tests/core/runtest.sh | 2 +-
tests/core/test_list.txt | 2 +-
tests/drivers/framebuffer_test.c | 34 +-
tests/filters/APICoverage.gen.c.t | 100 +++---
tests/filters/FilterMirrorH.c | 30 +-
tests/filters/FiltersCompare.gen.c.t | 22 +-
tests/filters/LinearConvolution.c | 10 +-
tests/filters/common.c | 4 +-
tests/filters/common.h | 6 +-
tests/gfx/APICoverage.gen.c.t | 42 +--
tests/gfx/Circle.c | 8 +-
tests/gfx/CircleSeg.c | 8 +-
tests/gfx/Ellipse.c | 8 +-
tests/gfx/FillCircle.c | 8 +-
tests/gfx/FillEllipse.c | 8 +-
tests/gfx/FillRect.c | 28 +-
tests/gfx/HLine.c | 8 +-
tests/gfx/HLineAA.c | 8 +-
tests/gfx/Line.c | 8 +-
tests/gfx/LineAA.c | 8 +-
tests/gfx/Polygon.c | 8 +-
tests/gfx/PutPixelAA.c | 8 +-
tests/gfx/VLine.c | 8 +-
tests/gfx/common.c | 4 +-
tests/gfx/common.h | 6 +-
tests/gfx/gfx_benchmark.c | 6 +-
tests/loaders/GIF.c | 6 +-
tests/loaders/JPG.c | 22 +-
tests/loaders/Loader.h | 44 +--
tests/loaders/PBM.c | 2 +-
tests/loaders/PCX.c | 12 +-
tests/loaders/PGM.c | 2 +-
tests/loaders/PNG.c | 28 +-
tests/loaders/PNM.c | 2 +-
tests/loaders/PPM.c | 2 +-
tests/loaders/SaveAbort.gen.c.t | 12 +-
tests/loaders/SaveLoad.gen.c.t | 18 +-
tests/loaders/ZIP.c | 8 +-
tests/loaders/loaders_suite.c | 44 +--
tests/pylib/test_core.py | 76 ++---
tests/pylib/test_gfx.py | 26 +-
tests/pylib/testutils.py | 16 +-
302 files changed, 3254 insertions(+), 3563 deletions(-)
delete mode 100644 doc/context.txt
rename include/backends/{GP_SDL_Context.h => GP_SDL_Pixmap.h} (82%)
rename include/core/{GP_Context.h => GP_Pixmap.h} (59%)
rename tests/core/{Context.c => Pixmap.c} (60%)
diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt
index 4c830bf39987..24bbc8b6f2c6 100644
--- a/build/syms/Backend_symbols.txt
+++ b/build/syms/Backend_symbols.txt
@@ -9,7 +9,7 @@ GP_BackendIsX11
GP_BackendX11RequestFullscreen
GP_BackendSDLInit
-GP_ContextFromSDLSurface
+GP_PixmapFromSDLSurface
GP_BackendAALibInit
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt
index 47acec59d1db..7ee4ff213aff 100644
--- a/build/syms/Core_symbols.txt
+++ b/build/syms/Core_symbols.txt
@@ -1,19 +1,19 @@
GP_PixelTypes
GP_PixelHasFlags
-GP_ContextAlloc
-GP_ContextResize
-GP_ContextConvertAlloc
-GP_ContextPrintInfo
-GP_ContextRotateCCW
-GP_SubContextAlloc
-GP_ContextConvert
-GP_ContextRotateCW
-GP_ContextFree
-GP_ContextInit
-GP_SubContext
-GP_ContextCopy
-GP_ContextEqual
+GP_PixmapAlloc
+GP_PixmapResize
+GP_PixmapConvertAlloc
+GP_PixmapPrintInfo
+GP_PixmapRotateCCW
+GP_SubPixmapAlloc
+GP_PixmapConvert
+GP_PixmapRotateCW
+GP_PixmapFree
+GP_PixmapInit
+GP_SubPixmap
+GP_PixmapCopy
+GP_PixmapEqual
GP_PixelAddrOffset
GP_GammaRelease
diff --git a/demos/bogoman/bogoman.c b/demos/bogoman/bogoman.c
index 36402c845038..cd0def6c3a67 100644
--- a/demos/bogoman/bogoman.c
+++ b/demos/bogoman/bogoman.c
@@ -32,29 +32,29 @@
static void save_png(struct bogoman_map *map, unsigned int elem_size,
const char *filename)
{
- GP_Context *ctx;
+ GP_Pixmap *pixmap;
unsigned int rx, ry;
rx = elem_size * map->w;
ry = elem_size * map->h;
- ctx = GP_ContextAlloc(rx, ry, GP_PIXEL_RGB888);
+ pixmap = GP_PixmapAlloc(rx, ry, GP_PIXEL_RGB888);
- if (ctx == NULL)
+ if (pixmap == NULL)
return;
struct bogoman_render render = {
.map = map,
.map_x_offset = 0,
.map_y_offset = 0,
- .ctx = ctx,
+ .pixmap = pixmap,
.map_elem_size = elem_size,
};
bogoman_render(&render, BOGOMAN_RENDER_ALL);
- GP_SavePNG(ctx, filename, NULL);
- GP_ContextFree(ctx);
+ GP_SavePNG(pixmap, filename, NULL);
+ GP_PixmapFree(pixmap);
}
static struct GP_Backend *backend;
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
.map = map,
.map_x_offset = 0,
.map_y_offset = 0,
- .ctx = backend->context,
+ .pixmap = backend->pixmap,
.backend = backend,
.map_elem_size = ELEM_SIZE,
};
diff --git a/demos/bogoman/bogoman_render.c b/demos/bogoman/bogoman_render.c
index bc47f7d22530..c045b541935b 100644
--- a/demos/bogoman/bogoman_render.c
+++ b/demos/bogoman/bogoman_render.c
@@ -56,17 +56,17 @@ struct render_colors {
static struct render_colors colors;
-static void init_colors(GP_Context *ctx, struct render_colors *colors)
+static void init_colors(GP_Pixmap *pixmap, struct render_colors *colors)
{
- colors->bg = GP_RGBToContextPixel(0xee, 0xee, 0xee, ctx);
- colors->player = GP_RGBToContextPixel(0x00, 0xee, 0x00, ctx);
- colors->frames = GP_RGBToContextPixel(0x00, 0x00, 0x00, ctx);
- colors->diamond = GP_RGBToContextPixel(0x00, 0x00, 0xee, ctx);
- colors->wall = GP_RGBToContextPixel(0x66, 0x66, 0x66, ctx);
- colors->moveable = GP_RGBToContextPixel(0xff, 0xff, 0x60, ctx);
- colors->edible = GP_RGBToContextPixel(0xff, 0x7f, 0x50, ctx);
- colors->particle = GP_RGBToContextPixel(0xff, 0xff, 0x00, ctx);
- colors->particle_dir = GP_RGBToContextPixel(0xff, 0x44, 0x00, ctx);
+ colors->bg = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap);
+ colors->player = GP_RGBToPixmapPixel(0x00, 0xee, 0x00, pixmap);
+ colors->frames = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ colors->diamond = GP_RGBToPixmapPixel(0x00, 0x00, 0xee, pixmap);
+ colors->wall = GP_RGBToPixmapPixel(0x66, 0x66, 0x66, pixmap);
+ colors->moveable = GP_RGBToPixmapPixel(0xff, 0xff, 0x60, pixmap);
+ colors->edible = GP_RGBToPixmapPixel(0xff, 0x7f, 0x50, pixmap);
+ colors->particle = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, pixmap);
+ colors->particle_dir = GP_RGBToPixmapPixel(0xff, 0x44, 0x00, pixmap);
}
static void render_none(struct bogoman_render *render,
@@ -77,7 +77,7 @@ static void render_none(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
}
static void render_player(struct bogoman_render *render,
@@ -88,10 +88,10 @@ static void render_player(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
- GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2 - 1, colors.player);
- GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
+ GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2 - 1, colors.player);
+ GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
}
static void render_wall(struct bogoman_render *render,
@@ -100,26 +100,26 @@ static void render_wall(struct bogoman_render *render,
{
unsigned int w = render->map_elem_size;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.wall);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.wall);
if (!(elem->flags & BOGOMAN_LEFT)) {
- GP_VLineXYH(render->ctx, x, y, w, colors.frames);
- GP_VLineXYH(render->ctx, x+1, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x+1, y, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_RIGHT)) {
- GP_VLineXYH(render->ctx, x + w - 1, y, w, colors.frames);
- GP_VLineXYH(render->ctx, x + w - 2, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x + w - 1, y, w, colors.frames);
+ GP_VLineXYH(render->pixmap, x + w - 2, y, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_UP)) {
- GP_HLineXYW(render->ctx, x, y, w, colors.frames);
- GP_HLineXYW(render->ctx, x, y+1, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y+1, w, colors.frames);
}
if (!(elem->flags & BOGOMAN_DOWN)) {
- GP_HLineXYW(render->ctx, x, y + w - 1, w, colors.frames);
- GP_HLineXYW(render->ctx, x, y + w - 2, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y + w - 1, w, colors.frames);
+ GP_HLineXYW(render->pixmap, x, y + w - 2, w, colors.frames);
}
}
@@ -129,16 +129,16 @@ static void render_diamond(struct bogoman_render *render,
{
unsigned int w = render->map_elem_size;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
(void) elem;
- GP_FillTetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2,
+ GP_FillTetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
x + w/2, y + w - 1, x, y + w/2, colors.diamond);
- GP_Tetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2,
+ GP_Tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2,
x + w/2, y + w - 1, x, y + w/2, colors.frames);
- GP_Tetragon(render->ctx, x + w/2, y+1, x + w - 2, y + w/2,
+ GP_Tetragon(render->pixmap, x + w/2, y+1, x + w - 2, y + w/2,
x + w/2, y + w - 2, x+1, y + w/2, colors.frames);
}
@@ -150,11 +150,11 @@ static void render_moveable(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
- GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.moveable);
- GP_RectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.frames);
- GP_RectXYWH(render->ctx, x + 2, y + 2, w - 4, w - 4, colors.frames);
+ GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.moveable);
+ GP_RectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.frames);
+ GP_RectXYWH(render->pixmap, x + 2, y + 2, w - 4, w - 4, colors.frames);
}
static void render_edible(struct bogoman_render *render,
@@ -165,9 +165,9 @@ static void render_edible(struct bogoman_render *render,
(void) elem;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
- GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.edible);
+ GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.edible);
}
static void render_particle(struct bogoman_render *render,
@@ -177,43 +177,43 @@ static void render_particle(struct bogoman_render *render,
unsigned int w = render->map_elem_size;
int dir = elem->flags & BOGOMAN_DIRECTION_MASK;
- GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
+ GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg);
switch (elem->flags & ~BOGOMAN_DIRECTION_MASK) {
case BOGOMAN_PARTICLE_ROUND:
- GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2-1, colors.particle);
- GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
+ GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2-1, colors.particle);
+ GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames);
break;
case BOGOMAN_PARTICLE_SQUARE:
- GP_FillRectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.particle);
- GP_RectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.frames);
- GP_RectXYWH(render->ctx, x+2, y+2, w-4, w-4, colors.frames);
+ GP_FillRectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.particle);
+ GP_RectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.frames);
+ GP_RectXYWH(render->pixmap, x+2, y+2, w-4, w-4, colors.frames);
break;
}
switch (dir) {
case BOGOMAN_LEFT:
- GP_FillTriangle(render->ctx, x + w/4, y + w/2,
+ GP_FillTriangle(render->pixmap, x + w/4, y + w/2,
x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.particle_dir);
- GP_Triangle(render->ctx, x + w/4, y + w/2,
+ GP_Triangle(render->pixmap, x + w/4, y + w/2,
x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.frames);
break;
case BOGOMAN_RIGHT:
- GP_FillTriangle(render->ctx, x + 3*w/4, y + w/2,
+ GP_FillTriangle(render->pixmap, x + 3*w/4, y + w/2,
x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.particle_dir);
- GP_Triangle(render->ctx, x + 3*w/4, y + w/2,
+ GP_Triangle(render->pixmap, x + 3*w/4, y + w/2,
x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.frames);
break;
case BOGOMAN_UP:
- GP_FillTriangle(render->ctx, x + w/2, y + w/4,
+ GP_FillTriangle(render->pixmap, x + w/2, y + w/4,
x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.particle_dir);
- GP_Triangle(render->ctx, x + w/2, y + w/4,
+ GP_Triangle(render->pixmap, x + w/2, y + w/4,
x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.frames);
break;
case BOGOMAN_DOWN:
- GP_FillTriangle(render->ctx, x + w/2, y + 3*w/4,
+ GP_FillTriangle(render->pixmap, x + w/2, y + 3*w/4,
x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.particle_dir);
- GP_Triangle(render->ctx, x + w/2, y + 3*w/4,
+ GP_Triangle(render->pixmap, x + w/2, y + 3*w/4,
x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.frames);
break;
}
@@ -268,10 +268,10 @@ void bogoman_render(struct bogoman_render *render, int flags)
unsigned int x, y;
//TODO: Hack
- init_colors(render->ctx, &colors);
+ init_colors(render->pixmap, &colors);
if (flags & BOGOMAN_RENDER_ALL)
- GP_Fill(render->ctx, colors.bg);
+ GP_Fill(render->pixmap, colors.bg);
for (y = render->map_x_offset; y < render->map->h; y++) {
for (x = render->map_x_offset; x < render->map->w; x++)
diff --git a/demos/bogoman/bogoman_render.h b/demos/bogoman/bogoman_render.h
index e27744e2b064..38b7f0d59722 100644
--- a/demos/bogoman/bogoman_render.h
+++ b/demos/bogoman/bogoman_render.h
@@ -24,7 +24,7 @@
#define __BOGOMAN_RENDER_H__
struct bogoman_map;
-struct GP_Context;
+struct GP_Pixmap;
struct bogoman_render {
/* both in map elements */
@@ -34,8 +34,8 @@ struct bogoman_render {
/* current map */
struct bogoman_map *map;
- /* context to be used for rendering */
- struct GP_Context *ctx;
+ /* pixmap to be used for rendering */
+ struct GP_Pixmap *pixmap;
/* if not NULL is used to update screen */
struct GP_Backend *backend;
diff --git a/demos/c_simple/SDL_glue.c b/demos/c_simple/SDL_glue.c
index 8e9e2162db29..ef360e0b0e84 100644
--- a/demos/c_simple/SDL_glue.c
+++ b/demos/c_simple/SDL_glue.c
@@ -33,13 +33,13 @@
#include <stdlib.h>
#include <SDL/SDL.h>
#include <GP.h>
-#include <backends/GP_SDL_Context.h>
+#include <backends/GP_SDL_Pixmap.h>
#define W 320
#define H 240
static SDL_Surface *display = NULL;
-static GP_Context context;
+static GP_Pixmap pixmap;
static GP_Pixel black_pixel, darkgray_pixel;
@@ -47,13 +47,13 @@ void redraw_screen(void)
{
SDL_LockSurface(display);
- GP_Fill(&context, black_pixel);
+ GP_Fill(&pixmap, black_pixel);
- GP_Text(&context, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW,
+ GP_Text(&pixmap, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW,
darkgray_pixel, black_pixel, "GFXprim SDL Demo");
- GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel);
- GP_Line(&context, 0, H-1, W-1, 0, darkgray_pixel);
+ GP_Line(&pixmap, 0, 0, W-1, H-1, darkgray_pixel);
+ GP_Line(&pixmap, 0, H-1, W-1, 0, darkgray_pixel);
SDL_UnlockSurface(display);
}
@@ -100,10 +100,10 @@ int main(void)
return 1;
}
- GP_ContextFromSDLSurface(&context, display);
+ GP_PixmapFromSDLSurface(&pixmap, display);
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, &context);
- darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, &context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, &pixmap);
+ darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, &pixmap);
redraw_screen();
SDL_Flip(display);
diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c
index 5e87ff18f178..6c8288347871 100644
--- a/demos/c_simple/backend_example.c
+++ b/demos/c_simple/backend_example.c
@@ -31,15 +31,15 @@
static void redraw(GP_Backend *self)
{
- GP_Context *context = self->context;
+ GP_Pixmap *pixmap = self->pixmap;
GP_Pixel white_pixel, black_pixel;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, black_pixel);
- GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel);
- GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel);
+ GP_Fill(pixmap, black_pixel);
+ GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
+ GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
/* Update the backend screen */
GP_BackendFlip(self);
diff --git a/demos/c_simple/backend_timers_example.c b/demos/c_simple/backend_timers_example.c
index 7b7aae2a06fd..16912fb592df 100644
--- a/demos/c_simple/backend_timers_example.c
+++ b/demos/c_simple/backend_timers_example.c
@@ -31,10 +31,10 @@
static void redraw(GP_Backend *self)
{
- GP_Context *context = self->context;
- GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
+ GP_Pixmap *pixmap = self->pixmap;
+ GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
- GP_Fill(context, black_pixel);
+ GP_Fill(pixmap, black_pixel);
/* Update the backend screen */
GP_BackendFlip(self);
diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c
index 362ef8b09cc2..c12c8fe70b35 100644
--- a/demos/c_simple/blittest.c
+++ b/demos/c_simple/blittest.c
@@ -31,7 +31,7 @@ static GP_Pixel white;
static GP_Backend *win;
-static GP_Context *bitmap, *bitmap_raw, *bitmap_conv;
+static GP_Pixmap *bitmap, *bitmap_raw, *bitmap_conv;
static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3;
static int pause_flag = 0;
@@ -42,7 +42,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
bitmap_y += bitmap_vy;
- if (bitmap_x + GP_ContextW(bitmap) > win->context->w) {
+ if (bitmap_x + GP_PixmapW(bitmap) > win->pixmap->w) {
bitmap_vx = -bitmap_vx;
bitmap_x += bitmap_vx;
}
@@ -52,7 +52,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
}
- if (bitmap_y + GP_ContextH(bitmap) > win->context->h) {
+ if (bitmap_y + GP_PixmapH(bitmap) > win->pixmap->h) {
bitmap_vy = -bitmap_vy;
bitmap_y += bitmap_vy;
}
@@ -62,20 +62,20 @@ void redraw_screen(void)
bitmap_y += bitmap_vy;
}
- GP_FillRectXYWH(win->context, 20, 20, 300, 50, black);
+ GP_FillRectXYWH(win->pixmap, 20, 20, 300, 50, black);
- GP_Text(win->context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_Text(win->pixmap, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, text_buf);
- GP_Print(win->context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_Print(win->pixmap, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ',
bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' ');
- GP_Blit(bitmap, 0, 0, GP_ContextW(bitmap), GP_ContextH(bitmap),
- win->context, bitmap_x, bitmap_y);
+ GP_Blit(bitmap, 0, 0, GP_PixmapW(bitmap), GP_PixmapH(bitmap),
+ win->pixmap, bitmap_x, bitmap_y);
GP_BackendUpdateRectXYWH(win, bitmap_x, bitmap_y,
- GP_ContextW(bitmap), GP_ContextH(bitmap));
+ GP_PixmapW(bitmap), GP_PixmapH(bitmap));
GP_BackendUpdateRectXYWH(win, 20, 20, 400, 50);
}
@@ -88,7 +88,7 @@ static void change_bitmap(void)
snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'",
GP_PixelTypeName(bitmap->pixel_type),
- GP_PixelTypeName(win->context->pixel_type));
+ GP_PixelTypeName(win->pixmap->pixel_type));
}
void event_loop(void)
@@ -133,7 +133,7 @@ void event_loop(void)
break;
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(win);
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
GP_BackendFlip(win);
break;
}
@@ -175,14 +175,14 @@ int main(void)
return 1;
}
- bitmap_conv = GP_ContextConvertAlloc(bitmap_raw,
- win->context->pixel_type);
+ bitmap_conv = GP_PixmapConvertAlloc(bitmap_raw,
+ win->pixmap->pixel_type);
change_bitmap();
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
GP_BackendFlip(win);
for (;;) {
diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c
index 213baf8ecc68..7d26f17563f2 100644
--- a/demos/c_simple/convolution.c
+++ b/demos/c_simple/convolution.c
@@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
struct callback_priv priv;
GP_ProgressCallback callback = {.callback = progress_callback,
.priv = &priv};
diff --git a/demos/c_simple/debug_handler.c b/demos/c_simple/debug_handler.c
index 1744b0498ec1..5c472fd61e4f 100644
--- a/demos/c_simple/debug_handler.c
+++ b/demos/c_simple/debug_handler.c
@@ -65,11 +65,11 @@ int main(void)
/* Turn on verbose debug and call some library functions */
GP_SetDebugLevel(10);
- GP_Context *ctx = GP_ContextAlloc(1000, 1000, 1);
+ GP_Pixmap *pixmap = GP_PixmapAlloc(1000, 1000, 1);
- GP_FilterGaussianBlur(ctx, ctx, 10, 10, NULL);
+ GP_FilterGaussianBlur(pixmap, pixmap, 10, 10, NULL);
- GP_ContextFree(ctx);
+ GP_PixmapFree(pixmap);
return 0;
}
diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c
index e33a74a33338..d5c870b65f8c 100644
--- a/demos/c_simple/fileview.c
+++ b/demos/c_simple/fileview.c
@@ -29,7 +29,7 @@
#include <GP.h>
-static GP_Context *win;
+static GP_Pixmap *win;
static GP_Backend *backend;
static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel,
@@ -266,14 +266,14 @@ int main(int argc, char *argv[])
return 1;
}
- win = backend->context;
+ win = backend->pixmap;
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win);
- gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win);
- dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win);
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
+ gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win);
+ dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win);
redraw_screen();
GP_BackendFlip(backend);
diff --git a/demos/c_simple/filters_symmetry.c b/demos/c_simple/filters_symmetry.c
index 735be56668ec..926445354f9a 100644
--- a/demos/c_simple/filters_symmetry.c
+++ b/demos/c_simple/filters_symmetry.c
@@ -48,7 +48,7 @@ static void usage_and_exit(int ret)
int main(int argc, char *argv[])
{
- GP_Context *src, *res;
+ GP_Pixmap *src, *res;
const char *symmetry = NULL;
int opt, sym, debug = 0;
@@ -109,8 +109,8 @@ int main(int argc, char *argv[])
}
/* Cleanup */
- GP_ContextFree(src);
- GP_ContextFree(res);
+ GP_PixmapFree(src);
+ GP_PixmapFree(res);
return 0;
}
diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c
index 7d6a7ca073b8..e2e5dd6c2b82 100644
--- a/demos/c_simple/fonttest.c
+++ b/demos/c_simple/fonttest.c
@@ -101,7 +101,7 @@ static void print_font_properties(const GP_FontFace *font)
void redraw_screen(void)
{
- GP_Fill(win->context, black_pixel);
+ GP_Fill(win->pixmap, black_pixel);
GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
@@ -144,29 +144,29 @@ void redraw_screen(void)
style.pixel_yspace = 0;
style.char_xspace = tracking;
- GP_FillRectXYWH(win->context,
+ GP_FillRectXYWH(win->pixmap,
16, SPACING*i + 16,
GP_TextWidth(&style, test_string),
GP_FontHeight(style.font),
dark_gray_pixel);
- GP_RectXYWH(win->context,
+ GP_RectXYWH(win->pixmap,
15, SPACING*i + 15,
GP_TextMaxWidth(&style, strlen(test_string)) + 1,
GP_FontHeight(style.font) + 1,
blue_pixel);
- GP_Text(win->context, &style, 16, SPACING*i + 16, align,
+ GP_Text(win->pixmap, &style, 16, SPACING*i + 16, align,
white_pixel, dark_gray_pixel, test_string);
style.pixel_xmul = 2;
style.pixel_ymul = 2;
style.pixel_yspace = 1;
- GP_Text(win->context, &style, 34, SPACING * i + 44, align,
+ GP_Text(win->pixmap, &style, 34, SPACING * i + 44, align,
white_pixel, black_pixel, test_string);
- GP_RectXYWH(win->context, 33, SPACING * i + 43,
+ GP_RectXYWH(win->pixmap, 33, SPACING * i + 43,
GP_TextWidth(&style, test_string) + 1,
GP_TextHeight(&style) + 1, dark_gray_pixel);
@@ -184,7 +184,7 @@ void redraw_screen(void)
style.pixel_yspace = 2;
}
- GP_Text(win->context, &style, 64, SPACING*i + 88, align,
+ GP_Text(win->pixmap, &style, 64, SPACING*i + 88, align,
dark_gray_pixel, black_pixel, test_string);
}
}
@@ -287,12 +287,12 @@ int main(int argc, char *argv[])
return 1;
}
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win->context);
- dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context);
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win->pixmap);
+ dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap);
redraw_screen();
GP_BackendFlip(win);
diff --git a/demos/c_simple/gaussian_noise.c b/demos/c_simple/gaussian_noise.c
index 21425ce0bb79..8c0cb152ebc9 100644
--- a/demos/c_simple/gaussian_noise.c
+++ b/demos/c_simple/gaussian_noise.c
@@ -42,7 +42,7 @@ static void help(const char *app)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
float sigma = 0.1, mu = 0.1;
int opt;
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
return 1;
}
- GP_Context *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL);
+ GP_Pixmap *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL);
if (GP_SaveImage(res, argv[optind + 1], NULL)) {
fprintf(stderr, "Failed to save image '%s': %s",
diff --git a/demos/c_simple/gfx_koch.c b/demos/c_simple/gfx_koch.c
index c188f3adde71..615f2345ce9e 100644
--- a/demos/c_simple/gfx_koch.c
+++ b/demos/c_simple/gfx_koch.c
@@ -38,7 +38,7 @@ static int aa_flag = 0;
/*
* Generate color depending on distance from center
*
- * We could do this only and only because the context
+ * We could do this only and only because the pixmap
* pixel type is fixed to GP_PIXEL_RGB888.
*/
static GP_Pixel do_color(int xc, int yc, float x, float y)
@@ -66,7 +66,7 @@ static GP_Pixel do_color(int xc, int yc, float x, float y)
return bmask | (gmask<<8) | (rmask << 16);
}
-static void draw(GP_Context *img, int level, float x0, float y0, float x1, float y1)
+static void draw(GP_Pixmap *img, int level, float x0, float y0, float x1, float y1)
{
if (level == 0) {
GP_Pixel pixel;
@@ -106,13 +106,13 @@ static void draw(GP_Context *img, int level, float x0, float y0, float x1, float
int main(void)
{
- GP_Context *img;
+ GP_Pixmap *img;
/* Create RGB 24 bit image */
- img = GP_ContextAlloc(600, 600, GP_PIXEL_RGB888);
+ img = GP_PixmapAlloc(600, 600, GP_PIXEL_RGB888);
if (img == NULL) {
- fprintf(stderr, "Failed to allocate context");
+ fprintf(stderr, "Failed to allocate pixmap");
return 1;
}
@@ -129,7 +129,7 @@ int main(void)
}
/* Cleanup */
- GP_ContextFree(img);
+ GP_PixmapFree(img);
return 0;
}
diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c
index 3a294d23e1f8..5ac76d302a1f 100644
--- a/demos/c_simple/input_example.c
+++ b/demos/c_simple/input_example.c
@@ -29,7 +29,7 @@
#include "GP.h"
-static GP_Context *win;
+static GP_Pixmap *win;
static GP_Backend *backend;
static GP_Pixel red, green, white, black;
@@ -148,12 +148,12 @@ int main(int argc, char *argv[])
return 1;
}
- win = backend->context;
+ win = backend->pixmap;
- red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win);
- green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win);
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win);
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win);
+ red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
+ green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
GP_Fill(win, black);
GP_BackendFlip(backend);
diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c
index 27ce6744f8b0..b5558c06f9ab 100644
--- a/demos/c_simple/koch.c
+++ b/demos/c_simple/koch.c
@@ -40,7 +40,7 @@
#define sgn(x) ((x)>0 ? 1 : -1)
static GP_Backend *backend;
-static GP_Context *context;
+static GP_Pixmap *pixmap;
static int iter, l, way = 1, draw_edge = 1;
static GP_Pixel black, blue, gray, red;
@@ -49,11 +49,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
{
double x2, y2, x3, y3, x5, y5;
GP_Pixel pixel;
- pixel = GP_RGBToPixel(0, 0, 255-16*iter, context->pixel_type);
+ pixel = GP_RGBToPixel(0, 0, 255-16*iter, pixmap->pixel_type);
if (iter <= 0) {
if (draw_edge)
- GP_Line(context, x1, y1, x4, y4, black);
+ GP_Line(pixmap, x1, y1, x4, y4, black);
return;
}
@@ -66,11 +66,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
x5 = (x1+x4)/2 + (y2 - y3)*sqrt(3.00/4);
y5 = (y1+y4)/2 + (x3 - x2)*sqrt(3.00/4);
- GP_FillTriangle(context, x2, y2, x3, y3, x5, y5, pixel);
+ GP_FillTriangle(pixmap, x2, y2, x3, y3, x5, y5, pixel);
- GP_PutPixel(context, x2, y2, red);
- GP_PutPixel(context, x3, y3, red);
- GP_PutPixel(context, x5, y5, red);
+ GP_PutPixel(pixmap, x2, y2, red);
+ GP_PutPixel(pixmap, x3, y3, red);
+ GP_PutPixel(pixmap, x5, y5, red);
sierpinsky(x1, y1, x2, y2, iter - 1);
sierpinsky(x2, y2, x5, y5, iter - 1);
@@ -81,8 +81,8 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
static void draw(int x, int y, int l, int iter)
{
double x1, y1, x2, y2, x3, y3;
- int w = context->w;
- int h = context->h;
+ int w = pixmap->w;
+ int h = pixmap->h;
l = ((w < h ? w : h) - 20)/(5 - 1.00*iter/120);
@@ -95,9 +95,9 @@ static void draw(int x, int y, int l, int iter)
x3 = sin(1.00 * (iter+240)/57) * l + x;
y3 = cos(1.00 * (iter+240)/57) * l + y;
- GP_Fill(context, gray);
+ GP_Fill(pixmap, gray);
- GP_FillTriangle(context, x1, y1, x2, y2, x3, y3, blue);
+ GP_FillTriangle(pixmap, x1, y1, x2, y2, x3, y3, blue);
sierpinsky(x1, y1, x2, y2, iter/60%6);
sierpinsky(x2, y2, x3, y3, iter/60%6);
@@ -121,7 +121,7 @@ void redraw(void)
if (iter < 0)
way *= -1;
- draw(context->w/2, context->h/2, l, iter);
+ draw(pixmap->w/2, pixmap->h/2, l, iter);
}
int main(void)
@@ -136,15 +136,15 @@ int main(void)
return 1;
}
- context = backend->context;
+ pixmap = backend->pixmap;
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- blue = GP_RGBToContextPixel(0x00, 0x00, 0xff, context);
- gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, context);
- red = GP_RGBToContextPixel(0xff, 0x00, 0x00, context);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ blue = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap);
+ gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, pixmap);
+ red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap);
iter = 0;
- draw(context->w/2, context->h/2, l, iter);
+ draw(pixmap->w/2, pixmap->h/2, l, iter);
for (;;) {
GP_Event ev;
diff --git a/demos/c_simple/linetest.c b/demos/c_simple/linetest.c
index 19a0244dc932..7e535df94a61 100644
--- a/demos/c_simple/linetest.c
+++ b/demos/c_simple/linetest.c
@@ -41,12 +41,12 @@ void redraw_screen(void)
{
double angle;
int x, y;
- int w = win->context->w;
- int h = win->context->h;
+ int w = win->pixmap->w;
+ int h = win->pixmap->h;
int xcenter = w/2;
int ycenter = h/2;
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
for (angle = 0.0; angle < 2*M_PI; angle += 0.1) {
x = (int) (w/2 * cos(start_angle + angle));
@@ -56,22 +56,22 @@ void redraw_screen(void)
int b = 127.0 + 127.0 * sin(start_angle + angle);
GP_Pixel pixel;
- pixel = GP_RGBToPixel(r, 0, b, win->context->pixel_type);
+ pixel = GP_RGBToPixel(r, 0, b, win->pixmap->pixel_type);
if (aa_flag) {
- GP_LineAA_Raw(win->context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
+ GP_LineAA_Raw(win->pixmap, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel);
} else {
- GP_Line(win->context, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
- GP_Line(win->context, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
+ GP_Line(win->pixmap, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
+ GP_Line(win->pixmap, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
}
}
GP_BackendFlip(win);
/* axes */
-// GP_HLineXYW(&context, 0, ycenter, display->w, white);
-// GP_VLineXYH(&context, xcenter, 0, display->h, white);
+// GP_HLineXYW(&pixmap, 0, ycenter, display->w, white);
+// GP_VLineXYH(&pixmap, xcenter, 0, display->h, white);
}
void event_loop(void)
@@ -135,8 +135,8 @@ int main(int argc, char *argv[])
return 1;
}
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
redraw_screen();
diff --git a/demos/c_simple/loaders.c b/demos/c_simple/loaders.c
index 369ec488c149..e9a3a306c1c3 100644
--- a/demos/c_simple/loaders.c
+++ b/demos/c_simple/loaders.c
@@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
struct callback_priv priv;
GP_ProgressCallback callback = {.callback = progress_callback,
.priv = &priv};
diff --git a/demos/c_simple/loaders_example.c b/demos/c_simple/loaders_example.c
index 9c0a65ad4c94..b240aea952aa 100644
--- a/demos/c_simple/loaders_example.c
+++ b/demos/c_simple/loaders_example.c
@@ -34,7 +34,7 @@
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
/* Turn on debug messages */
GP_SetDebugLevel(10);
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c
index 5152d6b56e0b..4279c51f1014 100644
--- a/demos/c_simple/loaders_register.c
+++ b/demos/c_simple/loaders_register.c
@@ -37,7 +37,7 @@
/*
* Saves 2 bpp grayscale image as ASCII Art
*/
-static int write_data(const GP_Context *img, GP_IO *io,
+static int write_data(const GP_Pixmap *img, GP_IO *io,
GP_ProgressCallback *callback)
{
GP_IO *bio;
@@ -106,7 +106,7 @@ GP_Loader loader = {
int main(int argc, char *argv[])
{
- GP_Context *c, *gc;
+ GP_Pixmap *c, *gc;
GP_LoaderRegister(&loader);
diff --git a/demos/c_simple/memory_io.c b/demos/c_simple/memory_io.c
index 873b27c7f420..57d09174473f 100644
--- a/demos/c_simple/memory_io.c
+++ b/demos/c_simple/memory_io.c
@@ -56,7 +56,7 @@ static char pgm[] = {
int main(void)
{
GP_Backend *b;
- GP_Context *img;
+ GP_Pixmap *img;
GP_IO *io;
io = GP_IOMem(pgm, sizeof(pgm), NULL);
@@ -81,8 +81,8 @@ int main(void)
return 1;
}
- GP_Fill(b->context, 0);
- GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->context,
+ GP_Fill(b->pixmap, 0);
+ GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->pixmap,
(WIN_W - img->w)/2, (WIN_H - img->h)/2);
GP_BackendFlip(b);
diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c
index 82e9d084c918..ddd79bbacd25 100644
--- a/demos/c_simple/pretty_print.c
+++ b/demos/c_simple/pretty_print.c
@@ -22,7 +22,7 @@
/*
- Pretty print function for pixel and context.
+ Pretty print function for pixel and pixmap.
*/
@@ -30,14 +30,14 @@
int main(void)
{
- GP_Context *ctx = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888);
+ GP_Pixmap *pixmap = GP_PixmapAlloc(100, 100, GP_PIXEL_RGB888);
GP_Pixel pix = ~(GP_Pixel)0;
/* Pretty prints pixel values */
GP_PixelPrint(pix, GP_PIXEL_RGB888);
- /* Pretty prints context info */
- GP_ContextPrintInfo(ctx);
+ /* Pretty prints pixmap info */
+ GP_PixmapPrintInfo(pixmap);
return 0;
}
diff --git a/demos/c_simple/randomshapetest.c b/demos/c_simple/randomshapetest.c
index 6b970f0b5dae..766b48e5ee92 100644
--- a/demos/c_simple/randomshapetest.c
+++ b/demos/c_simple/randomshapetest.c
@@ -56,7 +56,7 @@ static int fill_flag = 1;
/* Do a clipping test? */
static int cliptest_flag = 0;
-void random_point(const GP_Context *c, int *x, int *y)
+void random_point(const GP_Pixmap *c, int *x, int *y)
{
if (cliptest_flag) {
*x = random() % (3*c->w) - c->w;
@@ -67,7 +67,7 @@ void random_point(const GP_Context *c, int *x, int *y)
}
}
-void random_point_AA(const GP_Context *c, int *x, int *y)
+void random_point_AA(const GP_Pixmap *c, int *x, int *y)
{
*x = random() % (c->w<<8);
*y = random() % (c->h<<8);
@@ -76,70 +76,70 @@ void random_point_AA(const GP_Context *c, int *x, int *y)
void draw_random_circle(GP_Pixel pixel)
{
int x, y;
- random_point(win->context, &x, &y);
+ random_point(win->pixmap, &x, &y);
int r = random() % 50;
if (fill_flag)
- GP_FillCircle(win->context, x, y, r, pixel);
+ GP_FillCircle(win->pixmap, x, y, r, pixel);
if (outline_flag)
- GP_Circle(win->context, x, y, r, white);
+ GP_Circle(win->pixmap, x, y, r, white);
}
void draw_random_ellipse(GP_Pixel pixel)
{
int x, y;
- random_point(win->context, &x, &y);
+ random_point(win->pixmap, &x, &y);
int rx = random() % 50;
int ry = random() % 50;
if (fill_flag)
- GP_FillEllipse(win->context, x, y, rx, ry, pixel);
+ GP_FillEllipse(win->pixmap, x, y, rx, ry, pixel);
if (outline_flag)
- GP_Ellipse(win->context, x, y, rx, ry, white);
+ GP_Ellipse(win->pixmap, x, y, rx, ry, white);
}
void draw_random_triangle(GP_Pixel pixel)
{
int x0, y0, x1, y1, x2, y2;
- random_point(win->context, &x0, &y0);
- random_point(win->context, &x1, &y1);
- random_point(win->context, &x2, &y2);
+ random_point(win->pixmap, &x0, &y0);
+ random_point(win->pixmap, &x1, &y1);
+ random_point(win->pixmap, &x2, &y2);
if (fill_flag)
- GP_FillTriangle(win->context, x0, y0, x1, y1, x2, y2, pixel);
+ GP_FillTriangle(win->pixmap, x0, y0, x1, y1, x2, y2, pixel);
if (outline_flag)
- GP_Triangle(win->context, x0, y0, x1, y1, x2, y2, white);
+ GP_Triangle(win->pixmap, x0, y0, x1, y1, x2, y2, white);
}
void draw_random_rectangle(GP_Pixel pixel)
{
int x0, y0, x1, y1;
- random_point(win->context, &x0, &y0);
- random_point(win->context, &x1, &y1);
+ random_point(win->pixmap, &x0, &y0);
+ random_point(win->pixmap, &x1, &y1);
if (fill_flag)
- GP_FillRect(win->context, x0, y0, x1, y1, pixel);
+ GP_FillRect(win->pixmap, x0, y0, x1, y1, pixel);
if (outline_flag)
- GP_Rect(win->context, x0, y0, x1, y1, white);
+ GP_Rect(win->pixmap, x0, y0, x1, y1, white);
}
void draw_random_tetragon(GP_Pixel pixel)
{
int x0, y0, x1, y1, x2, y2, x3, y3;
- random_point(win->context, &x0, &y0);
- random_point(win->context, &x1, &y1);
- random_point(win->context, &x2, &y2);
- random_point(win->context, &x3, &y3);
+ random_point(win->pixmap, &x0, &y0);
+ random_point(win->pixmap, &x1, &y1);
+ random_point(win->pixmap, &x2, &y2);
+ random_point(win->pixmap, &x3, &y3);
if (fill_flag)
- GP_FillTetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ GP_FillTetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
if (outline_flag)
- GP_Tetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ GP_Tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
}
void draw_random_polygon(GP_Pixel pixel)
@@ -148,15 +148,15 @@ void draw_random_polygon(GP_Pixel pixel)
int i;
for (i = 0; i < 5; i++) {
- random_point(win->context, xy + 2*i, xy + 2*i + 1);
+ random_point(win->pixmap, xy + 2*i, xy + 2*i + 1);
}
- GP_FillPolygon_Raw(win->context, 5, xy, pixel);
+ GP_FillPolygon_Raw(win->pixmap, 5, xy, pixel);
}
void clear_screen(void)
{
- GP_Fill(win->context, black);
+ GP_Fill(win->pixmap, black);
GP_BackendFlip(win);
}
@@ -168,7 +168,7 @@ void redraw_screen(void)
/* Pick a random color for drawing. */
GP_Pixel pixel;
pixel = GP_RGBToPixel(random() % 256, random() % 256,
- random() % 256, win->context->pixel_type);
+ random() % 256, win->pixmap->pixel_type);
switch (shape) {
case SHAPE_CIRCLE:
@@ -258,8 +258,8 @@ int main(void)
return 1;
}
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
for (;;) {
GP_BackendPoll(win);
diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c
index 14e832ce75ac..71d82c85af60 100644
--- a/demos/c_simple/shapetest.c
+++ b/demos/c_simple/shapetest.c
@@ -28,7 +28,7 @@
#include <GP.h>
-static GP_Context *win;
+static GP_Pixmap *win;
static GP_Backend *backend;
/* Basic colors in display-specific format. */
@@ -253,8 +253,8 @@ void redraw_screen(void)
if (show_axes) {
int w, h;
- w = GP_ContextW(win);
- h = GP_ContextH(win);
+ w = GP_PixmapW(win);
+ h = GP_PixmapH(win);
GP_HLine(win, 0, w, center_y, gray);
GP_HLine(win, 0, w, center_y-yradius, darkgray);
@@ -310,7 +310,7 @@ void redraw_screen(void)
static void xradius_add(int xradius_add)
{
if (xradius + xradius_add > 1 &&
- xradius + xradius_add < (int)GP_ContextW(win))
+ xradius + xradius_add < (int)GP_PixmapW(win))
xradius += xradius_add;
}
@@ -318,21 +318,21 @@ static void xradius_add(int xradius_add)
static void yradius_add(int yradius_add)
{
if (yradius + yradius_add > 1 &&
- yradius + yradius_add < (int)GP_ContextH(win))
+ yradius + yradius_add < (int)GP_PixmapH(win))
yradius += yradius_add;
}
static void xcenter_add(int xcenter_add)
{
if (center_x + xcenter_add > 1 &&
- center_x + xcenter_add < (int)GP_ContextW(win)/2)
+ center_x + xcenter_add < (int)GP_PixmapW(win)/2)
center_x += xcenter_add;
}
static void ycenter_add(int ycenter_add)
{
if (center_y + ycenter_add > 1 &&
- center_y + ycenter_add < (int)GP_ContextH(win)/2)
+ center_y + ycenter_add < (int)GP_PixmapH(win)/2)
center_y += ycenter_add;
}
@@ -364,8 +364,8 @@ void event_loop(void)
break;
case GP_KEY_R:
win->axes_swap = !win->axes_swap;
- center_x = GP_ContextW(win) / 2;
- center_y = GP_ContextH(win) / 2;
+ center_x = GP_PixmapW(win) / 2;
+ center_y = GP_PixmapH(win) / 2;
break;
case GP_KEY_F:
fill = !fill;
@@ -451,9 +451,9 @@ void event_loop(void)
break;
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(backend);
- win = backend->context;
- center_x = GP_ContextW(win) / 2;
- center_y = GP_ContextH(win) / 2;
+ win = backend->pixmap;
+ center_x = GP_PixmapW(win) / 2;
+ center_y = GP_PixmapH(win) / 2;
break;
}
break;
@@ -506,19 +506,19 @@ int main(int argc, char *argv[])
return 1;
}
- win = backend->context;
+ win = backend->pixmap;
center_x = win->w / 2;
center_y = win->h / 2;
/* Load colors compatible with the display */
- black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win);
- white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win);
- yellow = GP_RGBToContextPixel(0xff, 0xff, 0x00, win);
- green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win);
- red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win);
- gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win);
- darkgray = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win);
+ black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win);
+ white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win);
+ yellow = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win);
+ green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win);
+ red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win);
+ gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win);
+ darkgray = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win);
print_instructions();
redraw_screen();
diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c
index 4934d4cff423..4208b201c0b5 100644
--- a/demos/c_simple/showimage.c
+++ b/demos/c_simple/showimage.c
@@ -35,7 +35,7 @@
int main(int argc, char *argv[])
{
GP_Backend *backend;
- GP_Context *image;
+ GP_Pixmap *image;
if (argc != 2) {
fprintf(stderr, "Takes image as an argument\n");
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
}
/* Blit image into the window and show it */
- GP_Blit(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_Blit(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
GP_BackendFlip(backend);
/* Wait for events */
@@ -78,11 +78,11 @@ int main(int argc, char *argv[])
GP_BackendResizeAck(backend);
- cx = ((int)backend->context->w - (int)image->w) / 2;
- cy = ((int)backend->context->h - (int)image->h) / 2;
+ cx = ((int)backend->pixmap->w - (int)image->w) / 2;
+ cy = ((int)backend->pixmap->h - (int)image->h) / 2;
- GP_Fill(backend->context, 0);
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, cx, cy);
+ GP_Fill(backend->pixmap, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, cx, cy);
GP_BackendFlip(backend);
}
}
diff --git a/demos/c_simple/sin_AA.c b/demos/c_simple/sin_AA.c
index 20e320276f3f..0191918a2e80 100644
--- a/demos/c_simple/sin_AA.c
+++ b/demos/c_simple/sin_AA.c
@@ -32,35 +32,35 @@
#include <GP.h>
-static void redraw(GP_Context *context)
+static void redraw(GP_Pixmap *pixmap)
{
static float param = 1;
static float param2 = 0.01;
static int flag = 1;
- GP_Pixel b = GP_RGBToContextPixel(0xbe, 0xbe, 0x9e, context);
+ GP_Pixel b = GP_RGBToPixmapPixel(0xbe, 0xbe, 0x9e, pixmap);
unsigned int y;
- GP_Fill(context, b);
+ GP_Fill(pixmap, b);
- for (y = 0; y < context->w; y++) {
+ for (y = 0; y < pixmap->w; y++) {
GP_Coord x0, x1, l1, l2;
- x0 = (context->w)<<7;
- x1 = (context->w)<<7;
+ x0 = (pixmap->w)<<7;
+ x1 = (pixmap->w)<<7;
- l1 = (context->w)<<5;
- l2 = (context->w)<<3;
+ l1 = (pixmap->w)<<5;
+ l2 = (pixmap->w)<<3;
- GP_Pixel p = GP_RGBToContextPixel(120 - 3 * param, abs(40 * param), 0, context);
+ GP_Pixel p = GP_RGBToPixmapPixel(120 - 3 * param, abs(40 * param), 0, pixmap);
- l2 *= 4.00 * y / context->h;
+ l2 *= 4.00 * y / pixmap->h;
l1 *= param;
x0 += l1 * sin(param2 * y) + l2;
x1 -= l1 * cos(param2 * y) + l2;
- GP_HLineAA(context, x0, x1, y<<8, p);
+ GP_HLineAA(pixmap, x0, x1, y<<8, p);
}
if (flag) {
@@ -97,7 +97,7 @@ int main(void)
/* Wait for events */
for (;;) {
if (!pause_flag) {
- redraw(backend->context);
+ redraw(backend->pixmap);
GP_BackendFlip(backend);
}
diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c
index 0c08140ba9fa..9827ee6b96a0 100644
--- a/demos/c_simple/textaligntest.c
+++ b/demos/c_simple/textaligntest.c
@@ -41,11 +41,11 @@ static GP_Backend *win;
void redraw_screen(void)
{
- GP_Fill(win->context, black_pixel);
+ GP_Fill(win->pixmap, black_pixel);
/* draw axes intersecting in the middle, where text should be shown */
- GP_HLine(win->context, 0, X, Y/2, darkgray_pixel);
- GP_VLine(win->context, X/2, 0, Y, darkgray_pixel);
+ GP_HLine(win->pixmap, 0, X, Y/2, darkgray_pixel);
+ GP_VLine(win->pixmap, X/2, 0, Y, darkgray_pixel);
switch (font_flag) {
case 0:
@@ -68,17 +68,17 @@ void redraw_screen(void)
break;
}
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
yellow_pixel, black_pixel, "bottom left");
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
red_pixel, black_pixel, "bottom right");
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
blue_pixel, black_pixel, "top right");
- GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
+ GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
green_pixel, black_pixel, "top left");
- GP_HLine(win->context, 0, X, Y/3, darkgray_pixel);
- GP_Text(win->context, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE,
+ GP_HLine(win->pixmap, 0, X, Y/3, darkgray_pixel);
+ GP_Text(win->pixmap, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE,
white_pixel, black_pixel, "x center y baseline");
}
@@ -96,13 +96,13 @@ static void event_loop(void)
switch (ev.val.key.key) {
case GP_KEY_X:
- win->context->x_swap = !win->context->x_swap;
+ win->pixmap->x_swap = !win->pixmap->x_swap;
break;
case GP_KEY_Y:
- win->context->y_swap = !win->context->y_swap;
+ win->pixmap->y_swap = !win->pixmap->y_swap;
break;
case GP_KEY_R:
- win->context->axes_swap = !win->context->axes_swap;
+ win->pixmap->axes_swap = !win->pixmap->axes_swap;
GP_SWAP(X, Y);
break;
case GP_KEY_SPACE:
@@ -146,8 +146,8 @@ static void event_loop(void)
break;
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(win);
- X = win->context->w;
- Y = win->context->h;
+ X = win->pixmap->w;
+ Y = win->pixmap->h;
break;
}
break;
@@ -186,13 +186,13 @@ int main(int argc, char *argv[])
return 1;
}
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context);
- green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, win->context);
- yellow_pixel = GP_RGBToContextPixel(0xff, 0xff, 0x00, win->context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
- darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap);
+ green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win->pixmap);
+ yellow_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win->pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap);
+ darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap);
redraw_screen();
GP_BackendFlip(win);
diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c
index 443d6d4926cb..5f5dacf86c72 100644
--- a/demos/c_simple/v4l2_show.c
+++ b/demos/c_simple/v4l2_show.c
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
for (;;) {
if (GP_GrabberPoll(grabber) > 0) {
- GP_Context *res, *img = grabber->frame;
+ GP_Pixmap *res, *img = grabber->frame;
switch (mode) {
case 0:
@@ -113,14 +113,14 @@ int main(int argc, char *argv[])
break;
}
- unsigned int c_x = (backend->context->w - res->w) / 2;
- unsigned int c_y = (backend->context->h - res->h) / 2;
+ unsigned int c_x = (backend->pixmap->w - res->w) / 2;
+ unsigned int c_y = (backend->pixmap->h - res->h) / 2;
- GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, c_x, c_y);
+ GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->pixmap, c_x, c_y);
GP_BackendFlip(backend);
if (mode)
- GP_ContextFree(res);
+ GP_PixmapFree(res);
}
usleep(1000);
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
case GP_EV_SYS:
if (ev.code == GP_EV_SYS_RESIZE) {
GP_BackendResizeAck(backend);
- GP_Fill(backend->context, 0);
+ GP_Fill(backend->pixmap, 0);
}
break;
}
diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c
index f59f4ec384c1..b1d8199f5b89 100644
--- a/demos/c_simple/virtual_backend_example.c
+++ b/demos/c_simple/virtual_backend_example.c
@@ -35,48 +35,48 @@ static GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel;
static void redraw(GP_Backend *backend)
{
- GP_Context *context = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
/* Now draw some testing patters */
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, context);
- green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap);
+ blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap);
+ green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, pixmap);
- GP_Fill(context, white_pixel);
+ GP_Fill(pixmap, white_pixel);
unsigned int i, j;
for (i = 0; i < 40; i++) {
- GP_HLineXYW(context, 0, i, i, black_pixel);
- GP_HLineXYW(context, 1, i + 40, i, black_pixel);
- GP_HLineXYW(context, 2, i + 80, i, black_pixel);
- GP_HLineXYW(context, 3, i + 120, i, black_pixel);
- GP_HLineXYW(context, 4, i + 160, i, black_pixel);
- GP_HLineXYW(context, 5, i + 200, i, black_pixel);
- GP_HLineXYW(context, 6, i + 240, i, black_pixel);
- GP_HLineXYW(context, 7, i + 280, i, black_pixel);
+ GP_HLineXYW(pixmap, 0, i, i, black_pixel);
+ GP_HLineXYW(pixmap, 1, i + 40, i, black_pixel);
+ GP_HLineXYW(pixmap, 2, i + 80, i, black_pixel);
+ GP_HLineXYW(pixmap, 3, i + 120, i, black_pixel);
+ GP_HLineXYW(pixmap, 4, i + 160, i, black_pixel);
+ GP_HLineXYW(pixmap, 5, i + 200, i, black_pixel);
+ GP_HLineXYW(pixmap, 6, i + 240, i, black_pixel);
+ GP_HLineXYW(pixmap, 7, i + 280, i, black_pixel);
}
for (i = 0; i < 256; i++) {
for (j = 0; j < 256; j++) {
uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5;
- GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context);
- GP_PutPixel(context, i + 60, j + 10, pix);
+ GP_Pixel pix = GP_RGBToPixmapPixel(i, j, val, pixmap);
+ GP_PutPixel(pixmap, i + 60, j + 10, pix);
}
}
- GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
black_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
red_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
green_pixel, white_pixel, "Lorem Ipsum dolor sit...");
- GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ GP_Text(pixmap, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
blue_pixel, white_pixel, "Lorem Ipsum dolor sit...");
/* Update the backend screen */
diff --git a/demos/c_simple/weighted_median.c b/demos/c_simple/weighted_median.c
index a0b09fd4f946..dc481603f9d5 100644
--- a/demos/c_simple/weighted_median.c
+++ b/demos/c_simple/weighted_median.c
@@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self)
int main(int argc, char *argv[])
{
- GP_Context *img;
+ GP_Pixmap *img;
struct callback_priv priv;
GP_ProgressCallback callback = {.callback = progress_callback,
.priv = &priv};
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
priv.op = "Weighted Median";
- GP_Context *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback);
+ GP_Pixmap *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback);
printf("\n");
diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c
index aa37c7b20b67..da9d8d8b8041 100644
--- a/demos/c_simple/x11_windows.c
+++ b/demos/c_simple/x11_windows.c
@@ -29,16 +29,16 @@
#include <stdio.h>
#include <GP.h>
-static void redraw(struct GP_Context *context)
+static void redraw(struct GP_Pixmap *pixmap)
{
GP_Pixel white_pixel, black_pixel;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, black_pixel);
- GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel);
- GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel);
+ GP_Fill(pixmap, black_pixel);
+ GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel);
+ GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel);
}
static int ev_loop(struct GP_Backend *backend, const char *name)
@@ -68,7 +68,7 @@ static int ev_loop(struct GP_Backend *backend, const char *name)
switch (ev.code) {
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(backend);
- redraw(backend->context);
+ redraw(backend->pixmap);
GP_BackendFlip(backend);
break;
case GP_EV_SYS_QUIT:
@@ -99,8 +99,8 @@ int main(void)
}
/* Update the backend screen */
- redraw(win_1->context);
- redraw(win_2->context);
+ redraw(win_1->pixmap);
+ redraw(win_2->pixmap);
GP_BackendFlip(win_1);
GP_BackendFlip(win_2);
diff --git a/demos/c_simple/zip_container.c b/demos/c_simple/zip_container.c
index 1fe5e36fceca..4cf77fd9aef1 100644
--- a/demos/c_simple/zip_container.c
+++ b/demos/c_simple/zip_container.c
@@ -33,7 +33,7 @@
#include <GP.h>
static GP_Backend *backend;
-static GP_Context *image;
+static GP_Pixmap *image;
static GP_Container *container;
/*
@@ -45,20 +45,20 @@ static GP_Container *container;
*/
static void load_next(void)
{
- GP_ContextFree(image);
+ GP_PixmapFree(image);
image = GP_ContainerLoadNext(container, NULL);
if (image == NULL)
return;
- if (image->w != backend->context->w ||
- image->h != backend->context->h) {
+ if (image->w != backend->pixmap->w ||
+ image->h != backend->pixmap->h) {
GP_BackendResize(backend, image->w, image->h);
return;
}
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
GP_BackendFlip(backend);
}
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
}
/* Blit image into the window and show it */
- GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0);
GP_BackendFlip(backend);
/* Wait for events */
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
if (ev.code == GP_EV_SYS_RESIZE) {
GP_BackendResizeAck(backend);
GP_Blit_Clipped(image, 0, 0, image->w, image->h,
- backend->context, 0, 0);
+ backend->pixmap, 0, 0);
GP_BackendFlip(backend);
}
break;
diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c
index 8c798d4cd5a1..fe40e2529e2a 100644
--- a/demos/grinder/grinder.c
+++ b/demos/grinder/grinder.c
@@ -106,7 +106,7 @@ static struct param resize_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int resize(GP_Context **c, const char *params)
+static int resize(GP_Pixmap **c, const char *params)
{
int alg = 1;
float ratio = -1;
@@ -122,14 +122,14 @@ static int resize(GP_Context **c, const char *params)
GP_Size w = ratio * (*c)->w;
GP_Size h = ratio * (*c)->h;
- GP_Context *res = NULL;
+ GP_Pixmap *res = NULL;
res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback);
if (res == NULL)
return EINVAL;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
return 0;
@@ -164,7 +164,7 @@ static struct param scale_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int scale(GP_Context **c, const char *params)
+static int scale(GP_Pixmap **c, const char *params)
{
int alg = 1;
int w = -1;
@@ -185,14 +185,14 @@ static int scale(GP_Context **c, const char *params)
if (h == -1)
h = (*c)->h * (1.00 * w/(*c)->w) + 0.5;
- GP_Context *res = NULL;
+ GP_Pixmap *res = NULL;
res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback);
if (res == NULL)
return EINVAL;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
return 0;
@@ -211,7 +211,7 @@ static struct param rotate_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int rotate(GP_Context **c, const char *params)
+static int rotate(GP_Pixmap **c, const char *params)
{
int rot = -1;
@@ -223,7 +223,7 @@ static int rotate(GP_Context **c, const char *params)
return EINVAL;
}
- GP_Context *res = NULL;
+ GP_Pixmap *res = NULL;
switch (rot) {
case 0:
@@ -240,7 +240,7 @@ static int rotate(GP_Context **c, const char *params)
if (res == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
return 0;
@@ -254,7 +254,7 @@ static struct param mirror_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int mirror(GP_Context **c, const char *params)
+static int mirror(GP_Pixmap **c, const char *params)
{
int vert = 0, horiz = 0;
@@ -277,7 +277,7 @@ static struct param bright_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int bright(GP_Context **c, const char *params)
+static int bright(GP_Pixmap **c, const char *params)
{
float bright = 0;
@@ -296,7 +296,7 @@ static struct param contrast_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int contrast(GP_Context **c, const char *params)
+static int contrast(GP_Pixmap **c, const char *params)
{
float mul = 0;
@@ -319,7 +319,7 @@ static struct param invert_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int invert(GP_Context **c, const char *params)
+static int invert(GP_Pixmap **c, const char *params)
{
if (param_parse(params, invert_params, "invert", param_err))
return EINVAL;
@@ -338,7 +338,7 @@ static struct param blur_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int blur(GP_Context **c, const char *params)
+static int blur(GP_Pixmap **c, const char *params)
{
float sigma = 0;
float sigma_x = 0;
@@ -389,7 +389,7 @@ static struct param dither_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int dither(GP_Context **c, const char *params)
+static int dither(GP_Pixmap **c, const char *params)
{
int fmt = -1;
@@ -401,15 +401,15 @@ static int dither(GP_Context **c, const char *params)
return EINVAL;
}
- GP_Context *bw;
+ GP_Pixmap *bw;
bw = GP_FilterFloydSteinbergAlloc(*c, dither_pixel_types[fmt],
progress_callback);
- //TODO: so far we convert the context back to RGB888
+ //TODO: so far we convert the pixmap back to RGB888
//(so we can do further work with it)
- GP_Blit(bw, 0, 0, GP_ContextW(bw), GP_ContextH(bw), *c, 0, 0);
+ GP_Blit(bw, 0, 0, GP_PixmapW(bw), GP_PixmapH(bw), *c, 0, 0);
- GP_ContextFree(bw);
+ GP_PixmapFree(bw);
return 0;
}
@@ -421,7 +421,7 @@ static struct param save_jpg_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int save_jpg(GP_Context **c, const char *params)
+static int save_jpg(GP_Pixmap **c, const char *params)
{
char *file = NULL;
@@ -445,7 +445,7 @@ static struct param save_png_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int save_png(GP_Context **c, const char *params)
+static int save_png(GP_Pixmap **c, const char *params)
{
char *file = NULL;
@@ -471,7 +471,7 @@ static struct param median_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int median(GP_Context **c, const char *params)
+static int median(GP_Pixmap **c, const char *params)
{
int rad = -1, rad_x, rad_y;
@@ -486,12 +486,12 @@ static int median(GP_Context **c, const char *params)
if (rad_x < 0 || rad_y < 0)
return EINVAL;
- GP_Context *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback);
+ GP_Pixmap *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = ret;
return 0;
@@ -508,7 +508,7 @@ static struct param sigma_mean_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int sigma_mean(GP_Context **c, const char *params)
+static int sigma_mean(GP_Pixmap **c, const char *params)
{
int rad = -1, rad_x, rad_y, min = 0;
float sigma = 0.1;
@@ -527,12 +527,12 @@ static int sigma_mean(GP_Context **c, const char *params)
(*c)->gamma = GP_GammaAcquire((*c)->pixel_type, 1.2);
- GP_Context *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback);
+ GP_Pixmap *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = ret;
return 0;
@@ -545,19 +545,19 @@ static struct param sharpen_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int sharpen(GP_Context **c, const char *params)
+static int sharpen(GP_Pixmap **c, const char *params)
{
float weight = 0.1;
if (param_parse(params, sharpen_params, "sigma", param_err, &weight))
return EINVAL;
- GP_Context *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback);
+ GP_Pixmap *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback);
if (ret == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = ret;
return 0;
@@ -571,7 +571,7 @@ static struct param gauss_noise_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int gauss_noise(GP_Context **c, const char *params)
+static int gauss_noise(GP_Pixmap **c, const char *params)
{
float sigma = 0.1;
float mu = 0;
@@ -601,7 +601,7 @@ static struct param arithmetic_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int arithmetic(GP_Context **c, const char *params)
+static int arithmetic(GP_Pixmap **c, const char *params)
{
char *file = NULL;
int op = -1;
@@ -614,7 +614,7 @@ static int arithmetic(GP_Context **c, const char *params)
return EINVAL;
}
- GP_Context *img, *res = NULL;
+ GP_Pixmap *img, *res = NULL;
if ((img = GP_LoadImage(file, progress_callback)) == NULL) {
print_error("arithmetic: Invalid image.");
@@ -642,7 +642,7 @@ static int arithmetic(GP_Context **c, const char *params)
if (res == NULL)
return ENOMEM;
- GP_ContextFree(*c);
+ GP_PixmapFree(*c);
*c = res;
@@ -656,7 +656,7 @@ static struct param histogram_params[] = {
{NULL, 0, NULL, NULL, NULL}
};
-static int histogram(GP_Context **c, const char *params)
+static int histogram(GP_Pixmap **c, const char *params)
{
char *file = "histogram.png";
@@ -678,7 +678,7 @@ struct filter {
const char *name;
const char *desc;
struct param *param_desc;
- int (*apply)(GP_Context **c, const char *params);
+ int (*apply)(GP_Pixmap **c, const char *params);
};
static struct filter filter_table[] = {
@@ -763,7 +763,7 @@ static void add_filter(char *params)
filter_params[filter_cnt++] = params;
}
-static void apply_filters(GP_Context **src)
+static void apply_filters(GP_Pixmap **src)
{
unsigned int i;
int ret;
@@ -845,7 +845,7 @@ static void check_fmt(const char *fmt)
exit(1);
}
-static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char *fmt)
+static void save_by_fmt(struct GP_Pixmap *bitmap, const char *name, const char *fmt)
{
int ret;
@@ -874,7 +874,7 @@ static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char
int main(int argc, char *argv[])
{
- GP_Context *bitmap;
+ GP_Pixmap *bitmap;
int opt, i;
const char *out_fmt = "ppm";
diff --git a/demos/grinder/histogram.c b/demos/grinder/histogram.c
index 9706315b0f99..d02f17518235 100644
--- a/demos/grinder/histogram.c
+++ b/demos/grinder/histogram.c
@@ -22,7 +22,7 @@
#include "histogram.h"
-void histogram_to_png(const GP_Context *src, const char *filename)
+void histogram_to_png(const GP_Pixmap *src, const char *filename)
{
GP_Histogram *hist;
@@ -36,7 +36,7 @@ void histogram_to_png(const GP_Context *src, const char *filename)
unsigned int i, j;
- GP_Context *res = GP_ContextAlloc(257*4, 256, GP_PIXEL_RGB888);
+ GP_Pixmap *res = GP_PixmapAlloc(257*4, 256, GP_PIXEL_RGB888);
GP_Fill(res, 0xffffff);
@@ -76,6 +76,6 @@ void histogram_to_png(const GP_Context *src, const char *filename)
GP_SavePNG(res, filename, NULL);
- GP_ContextFree(res);
+ GP_PixmapFree(res);
GP_HistogramFree(hist);
}
diff --git a/demos/grinder/histogram.h b/demos/grinder/histogram.h
index d6fdb4e5331f..e58dfd4c4527 100644
--- a/demos/grinder/histogram.h
+++ b/demos/grinder/histogram.h
@@ -25,6 +25,6 @@
#include <GP.h>
-void histogram_to_png(const GP_Context *src, const char *filename);
+void histogram_to_png(const GP_Pixmap *src, const char *filename);
#endif /* HISTOGRAM_H */
diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c
index 46fafe299887..e4226c27114b 100644
--- a/demos/particle/particle_demo.c
+++ b/demos/particle/particle_demo.c
@@ -37,7 +37,7 @@ static GP_Pixel black_pixel;
static GP_Pixel white_pixel;
static GP_Backend *backend = NULL;
-static GP_Context *context = NULL;
+static GP_Pixmap *pixmap = NULL;
static void sighandler(int signo)
{
@@ -88,16 +88,16 @@ int main(int argc, char *argv[])
init_backend(backend_opts);
- context = backend->context;
+ pixmap = backend->pixmap;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, black_pixel);
+ GP_Fill(pixmap, black_pixel);
GP_BackendFlip(backend);
struct space *space;
- space = space_create(particles, 10<<8, 10<<8, (context->w - 10)<<8, (context->h - 10)<<8);
+ space = space_create(particles, 10<<8, 10<<8, (pixmap->w - 10)<<8, (pixmap->h - 10)<<8);
for (;;) {
if (backend->Poll)
@@ -146,8 +146,8 @@ int main(int argc, char *argv[])
space_destroy(space);
space = space_create(particles,
10<<8, 10<<8,
- (context->w - 10)<<8,
- (context->h - 10)<<8);
+ (pixmap->w - 10)<<8,
+ (pixmap->h - 10)<<8);
break;
}
break;
@@ -156,7 +156,7 @@ int main(int argc, char *argv[])
if (!pause_flag) {
space_time_tick(space, 1);
- space_draw_particles(context, space);
+ space_draw_particles(pixmap, space);
GP_BackendFlip(backend);
}
}
diff --git a/demos/particle/space.c b/demos/particle/space.c
index c53b9e31b286..8dfc956d656a 100644
--- a/demos/particle/space.c
+++ b/demos/particle/space.c
@@ -67,11 +67,11 @@ void space_destroy(struct space *space)
#define SQUARE(x) ((x) * (x))
-void space_draw_particles(GP_Context *context, struct space *space)
+void space_draw_particles(GP_Pixmap *pixmap, struct space *space)
{
unsigned int i;
- GP_Fill(context, 0x000000);
+ GP_Fill(pixmap, 0x000000);
for (i = 0; i < space->particle_count; i++) {
GP_Pixel color;
@@ -88,9 +88,9 @@ void space_draw_particles(GP_Context *context, struct space *space)
}
*/
- color = GP_RGBToContextPixel(0xee, 0xee, 0xee, context);
+ color = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap);
- GP_PutPixelAA(context, x, y, color);
+ GP_PutPixelAA(pixmap, x, y, color);
int val = SQUARE(space->particles[i].vx) + SQUARE(space->particles[i].vy);
@@ -99,29 +99,29 @@ void space_draw_particles(GP_Context *context, struct space *space)
if (val > 255)
val = 255;
- color = GP_RGBToContextPixel(val, val, 0x40, context);
+ color = GP_RGBToPixmapPixel(val, val, 0x40, pixmap);
/* Hexagons */
- GP_LineAA(context, x - a2, y - a1, x + a2, y - a1, color);
- // GP_LineAA(context, x + a2, y - a1, x + a1, y - a2, color);
- GP_LineAA(context, x + a1, y - a2, x + a1, y + a2, color);
- // GP_LineAA(context, x + a1, y + a2, x + a2, y + a1, color);
- GP_LineAA(context, x + a2, y + a1, x - a2, y + a1, color);
- // GP_LineAA(context, x - a2, y + a1, x - a1, y + a2, color);
- GP_LineAA(context, x - a1, y + a2, x - a1, y - a2, color);
- // GP_LineAA(context, x - a1, y - a2, x - a2, y - a1, color);
+ GP_LineAA(pixmap, x - a2, y - a1, x + a2, y - a1, color);
+ // GP_LineAA(pixmap, x + a2, y - a1, x + a1, y - a2, color);
+ GP_LineAA(pixmap, x + a1, y - a2, x + a1, y + a2, color);
+ // GP_LineAA(pixmap, x + a1, y + a2, x + a2, y + a1, color);
+ GP_LineAA(pixmap, x + a2, y + a1, x - a2, y + a1, color);
+ // GP_LineAA(pixmap, x - a2, y + a1, x - a1, y + a2, color);
+ GP_LineAA(pixmap, x - a1, y + a2, x - a1, y - a2, color);
+ // GP_LineAA(pixmap, x - a1, y - a2, x - a2, y - a1, color);
/*
- GP_PutPixelAA(context, x + a2, y - a1, 0xffffff);
- GP_PutPixelAA(context, x + a1, y - a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a2, y - a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a1, y - a2, 0xffffff);
- GP_PutPixelAA(context, x + a1, y + a2, 0xffffff);
- GP_PutPixelAA(context, x + a2, y + a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a1, y + a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x + a2, y + a1, 0xffffff);
- GP_PutPixelAA(context, x - a2, y + a1, 0xffffff);
- GP_PutPixelAA(context, x - a1, y + a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a2, y + a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a1, y + a2, 0xffffff);
- GP_PutPixelAA(context, x - a1, y - a2, 0xffffff);
- GP_PutPixelAA(context, x - a2, y - a1, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a1, y - a2, 0xffffff);
+ GP_PutPixelAA(pixmap, x - a2, y - a1, 0xffffff);
*/
}
}
diff --git a/demos/particle/space.h b/demos/particle/space.h
index 7878b11c2a69..021d615b36fc 100644
--- a/demos/particle/space.h
+++ b/demos/particle/space.h
@@ -69,7 +69,7 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h,
void space_destroy(struct space *space);
-void space_draw_particles(GP_Context *context, struct space *space);
+void space_draw_particles(GP_Pixmap *pixmap, struct space *space);
void space_time_tick(struct space *space, int time);
diff --git a/demos/py_simple/backends.py b/demos/py_simple/backends.py
index 31fb59d145d3..84715526aa2c 100755
--- a/demos/py_simple/backends.py
+++ b/demos/py_simple/backends.py
@@ -9,7 +9,7 @@ import gfxprim.text as text
import gfxprim.input as input
def redraw(bk):
- c = bk.context
+ c = bk.pixmap
black = c.RGBToPixel(0, 0, 0)
white = c.RGBToPixel(0xff, 0xff, 0xff)
diff --git a/demos/py_simple/blit.py b/demos/py_simple/blit.py
index 2b3a6943c507..e76b8c08e0aa 100755
--- a/demos/py_simple/blit.py
+++ b/demos/py_simple/blit.py
@@ -21,13 +21,13 @@ class Ball:
self.bg_img = bg_img
def draw(self, bk):
- self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h)
+ self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
def move(self, bk):
old_x = self.x;
old_y = self.y;
- self.bg_img.Blit(old_x, old_y, bk.context, old_x, old_y, self.ball.w, self.ball.h)
+ self.bg_img.Blit(old_x, old_y, bk.pixmap, old_x, old_y, self.ball.w, self.ball.h)
self.x += self.dx
self.y += self.dy
@@ -38,7 +38,7 @@ class Ball:
if (self.y <= 0 or self.y >= self.bg_img.h - self.ball.h):
self.dy = -self.dy
- self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h)
+ self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h)
bk.UpdateRect(min(old_x, self.x), min(self.y, old_y),
max(old_x, self.x) + self.ball.w - 1,
max(old_y, self.y) + self.ball.h - 1)
@@ -59,7 +59,7 @@ def main():
# Create X11 window
bk = backends.BackendX11Init(None, 0, 0, bg.w, bg.h, sys.argv[1], 0)
assert(bk)
- bg.Blit(0, 0, bk.context, 0, 0, bg.w, bg.h)
+ bg.Blit(0, 0, bk.pixmap, 0, 0, bg.w, bg.h)
bk.Flip()
diff --git a/demos/py_simple/cam_view.py b/demos/py_simple/cam_view.py
index 6692abb914bb..dd7bcc88286c 100755
--- a/demos/py_simple/cam_view.py
+++ b/demos/py_simple/cam_view.py
@@ -25,7 +25,7 @@ def main():
sleep(0.01)
if (grabber.Poll()):
- grabber.frame.Blit(0, 0, bk.context, 0, 0, grabber.frame.w, grabber.frame.h)
+ grabber.frame.Blit(0, 0, bk.pixmap, 0, 0, grabber.frame.w, grabber.frame.h)
bk.Flip()
ev = bk.PollEvent()
diff --git a/demos/py_simple/font_style.py b/demos/py_simple/font_style.py
index 47d8e2cbff8e..1799253d8a10 100755
--- a/demos/py_simple/font_style.py
+++ b/demos/py_simple/font_style.py
@@ -9,7 +9,7 @@ import gfxprim.input as input
import gfxprim.text as text
def redraw(win):
- c = win.context
+ c = win.pixmap
black = c.RGBToPixel(0, 0, 0)
white = c.RGBToPixel(0xff, 0xff, 0xff)
diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py
index c79d879e8600..0ee8dbe6517e 100755
--- a/demos/py_simple/gfx.py
+++ b/demos/py_simple/gfx.py
@@ -8,88 +8,88 @@ import gfxprim.backends as backends
import gfxprim.input as input
def fill(bk):
- color = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bk.context.gfx.Fill(color)
+ color = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bk.pixmap.gfx.Fill(color)
bk.Flip()
def hline(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
- for i in range(0, bk.context.h, 10):
- bk.context.gfx.HLine(0, bk.context.w, i, fg)
+ bk.pixmap.gfx.Fill(bg)
+ for i in range(0, bk.pixmap.h, 10):
+ bk.pixmap.gfx.HLine(0, bk.pixmap.w, i, fg)
bk.Flip()
def vline(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- for i in range(0, bk.context.w, 10):
- bk.context.gfx.VLine(i, 0, bk.context.h, fg)
+ for i in range(0, bk.pixmap.w, 10):
+ bk.pixmap.gfx.VLine(i, 0, bk.pixmap.h, fg)
bk.Flip()
def line(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- for i in range(0, 2 * max(bk.context.w, bk.context.h), 13):
- bk.context.gfx.Line(0, i, i, 0, fg)
+ for i in range(0, 2 * max(bk.pixmap.w, bk.pixmap.h), 13):
+ bk.pixmap.gfx.Line(0, i, i, 0, fg)
bk.Flip()
def rect(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
for i in range(10, 130, 10):
- bk.context.gfx.Rect(i, i, bk.context.w - i, bk.context.h - i, fg)
+ bk.pixmap.gfx.Rect(i, i, bk.pixmap.w - i, bk.pixmap.h - i, fg)
bk.Flip()
def triangle(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- w = bk.context.w
- h = bk.context.h
+ w = bk.pixmap.w
+ h = bk.pixmap.h
for i in range(10, 90, 10):
- bk.context.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg)
+ bk.pixmap.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg)
bk.Flip()
def tetragon(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- w = bk.context.w
- h = bk.context.h
+ w = bk.pixmap.w
+ h = bk.pixmap.h
for i in range(10, 70, 10):
- bk.context.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg)
+ bk.pixmap.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg)
bk.Flip()
def polygon(bk):
- fg = bk.context.RGBToPixel(0xee, 0xee, 0xee)
- bg = bk.context.RGBToPixel(0, 0, 0);
+ fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee)
+ bg = bk.pixmap.RGBToPixel(0, 0, 0);
- bk.context.gfx.Fill(bg)
+ bk.pixmap.gfx.Fill(bg)
- w = bk.context.w
- h = bk.context.h
+ w = bk.pixmap.w
+ h = bk.pixmap.h
polygon = [(10, 10), (10, (h-10)//3), ((w-10)//3, (h-10)//2),
(10, 2*(h-10)//3), (10, h-10), ((w-10)//3, h-10),
@@ -98,7 +98,7 @@ def polygon(bk):
(w-10, (h-10)//3), (w-10, 10), (2*(w-10)//3, 10),
((w-10)//2, (h-10)//3), ((w-10)//3, 10)]
- bk.context.gfx.Polygon(polygon, fg)
+ bk.pixmap.gfx.Polygon(polygon, fg)
bk.Flip()
diff --git a/demos/py_simple/gravplots_AA.py b/demos/py_simple/gravplots_AA.py
index 747774402344..5de7bcc6a0a7 100755
--- a/demos/py_simple/gravplots_AA.py
+++ b/demos/py_simple/gravplots_AA.py
@@ -72,7 +72,7 @@ def main():
print(bk)
print("Modify source for parameters,")
print("Kill to terminate ;-)")
- black = bk.context.RGBToPixel(0, 0, 0)
+ black = bk.pixmap.RGBToPixel(0, 0, 0)
es = [elem() for i in range(N)]
while True:
@@ -86,18 +86,18 @@ def main():
x = int((e.x % W) * 0x100)
y = int(e.y * 0x100)
if e.vx > 0.2:
- bk.context.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black)
+ bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black)
if e.vx < -0.2:
- bk.context.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black)
- bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(e.r, e.g, e.b))
+ bk.pixmap.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black)
+ bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b))
else:
x = int(e.x % W)
y = int(e.y)
if e.vx > 0.2:
- bk.context.gfx.VLine(x + 1, y - 2, y + 2, black)
+ bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black)
if e.vx < -0.2:
- bk.context.gfx.VLine(x - 1, y - 2, y + 2, black)
- bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(e.r, e.g, e.b))
+ bk.pixmap.gfx.VLine(x - 1, y - 2, y + 2, black)
+ bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b))
bk.Poll()
bk.Flip()
global TIMEOUT
@@ -106,7 +106,7 @@ def main():
if TIMEOUT == 0:
break
if SAVETO:
- bk.context.Save(SAVETO)
+ bk.pixmap.Save(SAVETO)
if __name__ == '__main__':
main()
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py
index 6c5e97c572a3..07c54b41913a 100755
--- a/demos/py_simple/showimage.py
+++ b/demos/py_simple/showimage.py
@@ -18,7 +18,7 @@ def main():
# Create X11 window
bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0)
assert(bk)
- img.Blit(0, 0, bk.context, 0, 0, img.w, img.h)
+ img.Blit(0, 0, bk.pixmap, 0, 0, img.w, img.h)
bk.Flip()
# Event loop
diff --git a/demos/py_simple/sinplots_AA.py b/demos/py_simple/sinplots_AA.py
index e0933b562bd8..44afd21ecb7c 100755
--- a/demos/py_simple/sinplots_AA.py
+++ b/demos/py_simple/sinplots_AA.py
@@ -34,7 +34,7 @@ def main():
print(bk)
print("Modify source for parameters,")
print("Kill to terminate ;-)")
- black = bk.context.RGBToPixel(0, 0, 0)
+ black = bk.pixmap.RGBToPixel(0, 0, 0)
ps = [plotter() for i in range(N)]
t = random.uniform(0.0, 10.0 * W)
@@ -46,13 +46,13 @@ def main():
if AA:
x = int(x * 0x100)
y = int(y * 0x100)
- bk.context.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black)
- bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(int(r), int(g), int(b)))
+ bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black)
+ bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b)))
else:
x = int(x)
y = int(y)
- bk.context.gfx.VLine(x + 1, y - 2, y + 2, black)
- bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(int(r), int(g), int(b)))
+ bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black)
+ bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b)))
bk.Flip()
if __name__ == '__main__':
diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py
index 133be6e504b2..3c34ff7a941e 100755
--- a/demos/py_simple/x11_windows.py
+++ b/demos/py_simple/x11_windows.py
@@ -9,7 +9,7 @@ import gfxprim.input as input
import gfxprim.text as text
def redraw(bk, id):
- c = bk.context
+ c = bk.pixmap
black = c.RGBToPixel(0, 0, 0)
white = c.RGBToPixel(0xff, 0xff, 0xff)
diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c
index 5f270a8a6e88..28ea5bbbfc22 100644
--- a/demos/spiv/image_cache.c
+++ b/demos/spiv/image_cache.c
@@ -26,7 +26,7 @@
#include "image_cache.h"
struct image {
- GP_Context *ctx;
+ GP_Pixmap *pixmap;
GP_DataStorage *meta_data;
struct image *prev;
@@ -73,23 +73,23 @@ size_t image_cache_get_ram_size(void)
/*
* Reports correct image record size.
*/
-static size_t image_size2(GP_Context *ctx, GP_DataStorage *meta_data,
+static size_t image_size2(GP_Pixmap *pixmap, GP_DataStorage *meta_data,
const char *path)
{
size_t meta_data_size = 0;
- size_t context_size = ctx->bytes_per_row * ctx->h + sizeof(GP_Context);
+ size_t pixmap_size = pixmap->bytes_per_row * pixmap->h + sizeof(GP_Pixmap);
//TODO! 4096 is a size of single block, data storage may have more blocks
if (meta_data)
meta_data_size = 4096;
- return meta_data_size + context_size +
+ return meta_data_size + pixmap_size +
sizeof(struct image) + strlen(path) + 1;
}
static size_t image_size(struct image *img)
{
- return image_size2(img->ctx, NULL, img->path);
+ return image_size2(img->pixmap, NULL, img->path);
}
struct image_cache *image_cache_create(unsigned int max_size_kbytes)
@@ -135,7 +135,7 @@ static void remove_img_free(struct image_cache *self,
GP_DEBUG(2, "Freeing image '%s' size %zu", img->path, size);
remove_img(self, img, size);
- GP_ContextFree(img->ctx);
+ GP_PixmapFree(img->pixmap);
GP_DataStorageDestroy(img->meta_data);
free(img);
}
@@ -159,7 +159,7 @@ static void add_img(struct image_cache *self, struct image *img, size_t size)
self->end = img;
}
-int image_cache_get(struct image_cache *self, GP_Context **img,
+int image_cache_get(struct image_cache *self, GP_Pixmap **img,
GP_DataStorage **meta_data, int elevate, const char *key)
{
struct image *i;
@@ -189,7 +189,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img,
}
if (img)
- *img = i->ctx;
+ *img = i->pixmap;
if (meta_data)
*meta_data = i->meta_data;
@@ -197,7 +197,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img,
return 0;
}
-GP_Context *image_cache_get2(struct image_cache *self, int elevate,
+GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate,
const char *fmt, ...)
{
va_list va;
@@ -246,7 +246,7 @@ GP_Context *image_cache_get2(struct image_cache *self, int elevate,
if (len >= sizeof(buf))
free(key);
- return i ? i->ctx : NULL;
+ return i ? i->pixmap : NULL;
}
void image_cache_print(struct image_cache *self)
@@ -283,7 +283,7 @@ static int assert_size(struct image_cache *self, size_t size)
return 0;
}
-int image_cache_put(struct image_cache *self, GP_Context *ctx,
+int image_cache_put(struct image_cache *self, GP_Pixmap *pixmap,
GP_DataStorage *meta_data, const char *key)
{
size_t size;
@@ -291,7 +291,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx,
if (self == NULL)
return 1;
- size = image_size2(ctx, meta_data, key);
+ size = image_size2(pixmap, meta_data, key);
/*
* We try to create room for the image. If this fails we add the image
@@ -307,7 +307,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx,
return 1;
}
- img->ctx = ctx;
+ img->pixmap = pixmap;
img->meta_data = meta_data;
img->elevated = 0;
strcpy(img->path, key);
@@ -319,7 +319,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx,
return 0;
}
-int image_cache_put2(struct image_cache *self, GP_Context *ctx,
+int image_cache_put2(struct image_cache *self, GP_Pixmap *pixmap,
GP_DataStorage *meta_data, const char *fmt, ...)
{
size_t size, len;
@@ -333,7 +333,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx,
va_end(va);
//TODO: FIX THIS
- size = image_size2(ctx, meta_data, "") + len + 1;
+ size = image_size2(pixmap, meta_data, "") + len + 1;
/*
* We try to create room for the image. If this fails we add the image
@@ -349,7 +349,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx,
return 1;
}
- img->ctx = ctx;
+ img->pixmap = pixmap;
img->meta_data = meta_data;
img->elevated = 0;
diff --git a/demos/spiv/image_cache.h b/demos/spiv/image_cache.h
index f2ea1fa16e35..5aa40021ed7c 100644
--- a/demos/spiv/image_cache.h
+++ b/demos/spiv/image_cache.h
@@ -47,20 +47,20 @@ struct image_cache *image_cache_create(unsigned int max_size_kbytes);
* If elevate set and image is found, the image is elevated to the top so
* it has lesser chance of being freed.
*/
-int image_cache_get(struct image_cache *self, GP_Context **img,
+int image_cache_get(struct image_cache *self, GP_Pixmap **img,
GP_DataStorage **meta_data, int elevate,
const char *key);
-GP_Context *image_cache_get2(struct image_cache *self, int elevate,
+GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
/*
* Puts an image into a cache.
*/
-int image_cache_put(struct image_cache *self, GP_Context *img,
+int image_cache_put(struct image_cache *self, GP_Pixmap *img,
GP_DataStorage *meta_data, const char *key);
-int image_cache_put2(struct image_cache *self, GP_Context *img,
+int image_cache_put2(struct image_cache *self, GP_Pixmap *img,
GP_DataStorage *meta_data, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
diff --git a/demos/spiv/image_loader.c b/demos/spiv/image_loader.c
index c7e0f9ba66fc..8f86f92fc259 100644
--- a/demos/spiv/image_loader.c
+++ b/demos/spiv/image_loader.c
@@ -22,7 +22,7 @@
#include <errno.h>
-#include <core/GP_Context.h>
+#include <core/GP_Pixmap.h>
#include <core/GP_Debug.h>
#include <loaders/GP_Loaders.h>
@@ -34,7 +34,7 @@
static struct image_cache *img_cache;
static struct image_list *img_list;
-static GP_Context *cur_img;
+static GP_Pixmap *cur_img;
static GP_DataStorage *cur_meta_data;
static GP_Container *cur_cont;
@@ -57,11 +57,11 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes)
return 0;
}
-GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate)
+GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate)
{
struct cpu_timer timer;
const char *path;
- GP_Context *img;
+ GP_Pixmap *img;
int err, ret;
if (cur_img)
@@ -154,7 +154,7 @@ static void drop_cur_img(void)
* Currently loaded image is too big to be cached -> free it.
*/
if (image_cache_get(img_cache, NULL, NULL, 0, path)) {
- GP_ContextFree(cur_img);
+ GP_PixmapFree(cur_img);
GP_DataStorageDestroy(cur_meta_data);
}
diff --git a/demos/spiv/image_loader.h b/demos/spiv/image_loader.h
index 9992bca70e50..5d2223ee1c7f 100644
--- a/demos/spiv/image_loader.h
+++ b/demos/spiv/image_loader.h
@@ -31,7 +31,7 @@
#ifndef __IMAGE_LOADER_H__
#define __IMAGE_LOADER_H__
-#include <core/GP_Context.h>
+#include <core/GP_Pixmap.h>
#include <core/GP_ProgressCallback.h>
/*
@@ -46,7 +46,7 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes);
*
* Note that the callback may not be called when the image is cached.
*/
-GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate);
+GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate);
/*
* Retruns current image meta data or NULL there are none.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index 91b1a2a3c9e5..947390c964be 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -81,7 +81,7 @@ struct loader_params {
static int image_loader_callback(GP_ProgressCallback *self)
{
static GP_Size size = 0;
- GP_Context *c = backend->context;
+ GP_Pixmap *c = backend->pixmap;
if (abort_flag)
return 1;
@@ -114,7 +114,7 @@ static int image_loader_callback(GP_ProgressCallback *self)
return 0;
}
-static GP_Context *load_image(int elevate);
+static GP_Pixmap *load_image(int elevate);
static const char *img_name(const char *img_path)
{
@@ -140,9 +140,9 @@ static void set_caption(const char *path, float rat)
/*
* Loads image
*/
-static GP_Context *load_image(int elevate)
+static GP_Pixmap *load_image(int elevate)
{
- GP_Context *img;
+ GP_Pixmap *img;
GP_ProgressCallback callback = {.callback = image_loader_callback,
.priv = "Loading image"};
@@ -151,13 +151,13 @@ static GP_Context *load_image(int elevate)
if (img)
return img;
- GP_Context *ctx = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
- GP_Fill(ctx, black_pixel);
- GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 - 10,
+ GP_Fill(pixmap, black_pixel);
+ GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 - 10,
GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel,
"'%s'", image_loader_img_path());
- GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 + 10,
+ GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 + 10,
GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel,
"Failed to load image :( (%s)", strerror(errno));
GP_BackendFlip(backend);
@@ -166,16 +166,16 @@ static GP_Context *load_image(int elevate)
}
/*
- * Fill context with chessboard-like pattern.
+ * Fill pixmap with chessboard-like pattern.
*/
-static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0,
+static void pattern_fill(GP_Pixmap *pixmap, unsigned int x0, unsigned int y0,
unsigned int w, unsigned int h)
{
unsigned int x, y, i, j = 0;
GP_Pixel col[2];
- col[0] = GP_RGBToContextPixel(0x64, 0x64, 0x64, ctx);
- col[1] = GP_RGBToContextPixel(0x80, 0x80, 0x80, ctx);
+ col[0] = GP_RGBToPixmapPixel(0x64, 0x64, 0x64, pixmap);
+ col[1] = GP_RGBToPixmapPixel(0x80, 0x80, 0x80, pixmap);
unsigned int wm = w/20 < 5 ? 5 : w/20;
unsigned int hm = h/20 < 5 ? 5 : h/20;
@@ -184,18 +184,18 @@ static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0,
i = j;
j = !j;
for (x = 0; x < w; x += wm) {
- GP_FillRectXYWH(ctx, x0 + x, y0 + y, wm, hm, col[i]);
+ GP_FillRectXYWH(pixmap, x0 + x, y0 + y, wm, hm, col[i]);
i = !i;
}
}
}
-static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y,
+static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y,
const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
-static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y,
+static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y,
const char *fmt, ...)
{
va_list va, vac;
@@ -203,17 +203,17 @@ static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y,
va_start(va, fmt);
va_copy(vac, va);
- GP_VPrint(ctx, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
+ GP_VPrint(pixmap, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
black_pixel, white_pixel, fmt, vac);
va_end(vac);
- GP_VPrint(ctx, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
+ GP_VPrint(pixmap, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG,
white_pixel, black_pixel, fmt, va);
va_end(va);
}
-static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context,
+static unsigned int print_meta_data(GP_DataNode *node, GP_Pixmap *pixmap,
unsigned int th, unsigned int y, int level)
{
GP_DataNode *i;
@@ -224,21 +224,21 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context,
x = th * level + 10;
switch (i->type) {
case GP_DATA_INT:
- info_printf(context, x, y, "%s : %li", i->id, i->value.i);
+ info_printf(pixmap, x, y, "%s : %li", i->id, i->value.i);
break;
case GP_DATA_DOUBLE:
- info_printf(context, x, y, "%s : %lf", i->id, i->value.d);
+ info_printf(pixmap, x, y, "%s : %lf", i->id, i->value.d);
break;
case GP_DATA_STRING:
- info_printf(context, x, y, "%s : %s", i->id, i->value.str);
+ info_printf(pixmap, x, y, "%s : %s", i->id, i->value.str);
break;
case GP_DATA_RATIONAL:
- info_printf(context, x, y, "%s : %li/%li",
+ info_printf(pixmap, x, y, "%s : %li/%li",
i->id, i->value.rat.num, i->value.rat.den);
break;
case GP_DATA_DICT:
- info_printf(context, x, y, "%s", i->id);
- y = print_meta_data(i, context, th, y, level+1);
+ info_printf(pixmap, x, y, "%s", i->id);
+ y = print_meta_data(i, pixmap, th, y, level+1);
break;
}
}
@@ -246,10 +246,10 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context,
return y;
}
-static void show_info(struct loader_params *params, GP_Context *img,
- GP_Context *orig_img)
+static void show_info(struct loader_params *params, GP_Pixmap *img,
+ GP_Pixmap *orig_img)
{
- GP_Context *context = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
const char *img_path = image_loader_img_path();
set_caption(img_path, params->zoom_rat);
@@ -259,17 +259,17 @@ static void show_info(struct loader_params *params, GP_Context *img,
GP_Size th = GP_TextHeight(config.style), y = 10;
- info_printf(context, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s",
+ info_printf(pixmap, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s",
img->w, img->h, orig_img->w, orig_img->h, params->zoom_rat,
params->zoom_rat * 100, GP_PixelTypeName(img->pixel_type));
y += th + 2;
- info_printf(context, 10, y, "%s", img_name(img_path));
+ info_printf(pixmap, 10, y, "%s", img_name(img_path));
y += th + 2;
if (params->zoom_rat != 1.00) {
- info_printf(context, 10, y, "%s%s",
+ info_printf(pixmap, 10, y, "%s%s",
params->use_low_pass && params->zoom_rat < 1 ? "Gaussian LP + " : "",
GP_InterpolationTypeName(params->resampling_method));
y += th + 2;
@@ -278,14 +278,14 @@ static void show_info(struct loader_params *params, GP_Context *img,
unsigned int count = image_loader_count();
unsigned int pos = image_loader_pos() + 1;
- info_printf(context, 10, y, "%u of %u", pos, count);
+ info_printf(pixmap, 10, y, "%u of %u", pos, count);
y += th + 2;
if (image_loader_is_in_dir()) {
unsigned int dir_count = image_loader_dir_count();
unsigned int dir_pos = image_loader_dir_pos() + 1;
- info_printf(context, 10, y,
+ info_printf(pixmap, 10, y,
"%u of %u in directory", dir_pos, dir_count);
}
@@ -299,13 +299,13 @@ static void show_info(struct loader_params *params, GP_Context *img,
if (node->type != GP_DATA_DICT)
return;
- print_meta_data(node, context, th + 2, y + th, 0);
+ print_meta_data(node, pixmap, th + 2, y + th, 0);
}
-static void update_display(struct loader_params *params, GP_Context *img,
- GP_Context *orig_img)
+static void update_display(struct loader_params *params, GP_Pixmap *img,
+ GP_Pixmap *orig_img)
{
- GP_Context *context = backend->context;
+ GP_Pixmap *pixmap = backend->pixmap;
struct cpu_timer timer;
GP_ProgressCallback callback = {.callback = image_loader_callback};
@@ -340,11 +340,11 @@ static void update_display(struct loader_params *params, GP_Context *img,
*/
if (config.win_strategy == ZOOM_WIN_FIXED) {
- if (img->w < context->w)
- cx = (context->w - img->w)/2;
+ if (img->w < pixmap->w)
+ cx = (pixmap->w - img->w)/2;
- if (img->h < context->h)
- cy = (context->h - img->h)/2;
+ if (img->h < pixmap->h)
+ cy = (pixmap->h - img->h)/2;
}
if (params->zoom_manual) {
@@ -352,49 +352,49 @@ static void update_display(struct loader_params *params, GP_Context *img,
cy = params->zoom_y_offset;
}
- GP_Context sub_display;
+ GP_Pixmap sub_display;
cpu_timer_start(&timer, "Blitting");
if (config.floyd_steinberg) {
callback.priv = "Dithering";
- GP_SubContext(context, &sub_display, cx, cy, img->w, img->h);
+ GP_SubPixmap(pixmap, &sub_display, cx, cy, img->w, img->h);
GP_FilterFloydSteinberg(img, &sub_display, NULL);
// GP_FilterHilbertPeano(img, &sub_display, NULL);
} else {
if (GP_PixelHasFlags(img->pixel_type, GP_PIXEL_HAS_ALPHA))
- pattern_fill(context, cx, cy, img->w, img->h);
- GP_Blit_Clipped(img, 0, 0, img->w, img->h, context, cx, cy);
+ pattern_fill(pixmap, cx, cy, img->w, img->h);
+ GP_Blit_Clipped(img, 0, 0, img->w, img->h, pixmap, cx, cy);
}
cpu_timer_stop(&timer);
/* clean up the rest of the display */
- GP_FillRectXYWH(context, 0, 0, cx, context->h, black_pixel);
- GP_FillRectXYWH(context, 0, 0, context->w, cy, black_pixel);
+ GP_FillRectXYWH(pixmap, 0, 0, cx, pixmap->h, black_pixel);
+ GP_FillRectXYWH(pixmap, 0, 0, pixmap->w, cy, black_pixel);
- int w = context->w - img->w - cx;
+ int w = pixmap->w - img->w - cx;
if (w > 0)
- GP_FillRectXYWH(context, img->w + cx, 0, w, context->h, black_pixel);
+ GP_FillRectXYWH(pixmap, img->w + cx, 0, w, pixmap->h, black_pixel);
- int h = context->h - img->h - cy;
+ int h = pixmap->h - img->h - cy;
if (h > 0)
- GP_FillRectXYWH(context, 0, img->h + cy, context->w, h, black_pixel);
+ GP_FillRectXYWH(pixmap, 0, img->h + cy, pixmap->w, h, black_pixel);
show_info(params, img, orig_img);
if (config.combined_orientation)
- GP_ContextFree(img);
+ GP_PixmapFree(img);
GP_BackendFlip(backend);
}
-GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h)
+GP_Pixmap *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h)
{
- GP_Context *img, *res = NULL;
+ GP_Pixmap *img, *res = NULL;
struct cpu_timer timer;
GP_ProgressCallback callback = {.callback = image_loader_callback};
@@ -414,10 +414,10 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
if (params->show_nn_first) {
/* Do simple interpolation and blit the result */
- GP_Context *nn = GP_FilterResizeNNAlloc(img, w, h, NULL);
+ GP_Pixmap *nn = GP_FilterResizeNNAlloc(img, w, h, NULL);
if (nn != NULL) {
update_display(params, nn, img);
- GP_ContextFree(nn);
+ GP_PixmapFree(nn);
}
}
@@ -441,7 +441,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
cpu_timer_start(&timer, "Resampling");
callback.priv = "Resampling Image";
- GP_Context *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback);
+ GP_Pixmap *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback);
img = i1;
cpu_timer_stop(&timer);
@@ -454,8 +454,8 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
}
*/
- /* Free low passed context if needed */
- GP_ContextFree(res);
+ /* Free low passed pixmap if needed */
+ GP_PixmapFree(res);
if (img == NULL)
return NULL;
@@ -593,7 +593,7 @@ static void *image_loader(void *ptr)
{
struct loader_params *params = ptr;
struct cpu_timer sum_timer;
- GP_Context *img, *orig_img, *context = backend->context;
+ GP_Pixmap *img, *orig_img, *pixmap = backend->pixmap;
cpu_timer_start(&sum_timer, "sum");
@@ -609,7 +609,7 @@ static void *image_loader(void *ptr)
GP_Size w, h;
params->zoom_rat = calc_img_size(params, orig_img->w, orig_img->h,
- context->w, context->h);
+ pixmap->w, pixmap->h);
w = orig_img->w * params->zoom_rat + 0.5;
h = orig_img->h * params->zoom_rat + 0.5;
@@ -788,7 +788,7 @@ static uint32_t timer_callback(GP_Timer *self)
int main(int argc, char *argv[])
{
- GP_Context *context = NULL;
+ GP_Pixmap *pixmap = NULL;
int shift_flag;
int opts;
@@ -853,13 +853,13 @@ int main(int argc, char *argv[])
GP_BACKEND_CALL_EXIT);
}
- context = backend->context;
+ pixmap = backend->pixmap;
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
- gray_pixel = GP_RGBToContextPixel(0x33, 0x33, 0x33, context);
+ black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
+ gray_pixel = GP_RGBToPixmapPixel(0x33, 0x33, 0x33, pixmap);
- GP_Fill(context, black_pixel);
+ GP_Fill(pixmap, black_pixel);
GP_BackendFlip(backend);
params.show_progress_once = 1;
@@ -1115,7 +1115,7 @@ int main(int argc, char *argv[])
/* stop loader thread before resizing backend buffer */
stop_loader();
GP_BackendResizeAck(backend);
- GP_Fill(backend->context, 0);
+ GP_Fill(backend->pixmap, 0);
params.show_progress_once = 1;
show_image(¶ms);
break;
diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c
index 2d7eac9430d4..aad401055a93 100644
--- a/demos/spiv/spiv_help.c
+++ b/demos/spiv/spiv_help.c
@@ -234,9 +234,9 @@ static int last_line;
static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff)
{
- GP_Context *c = backend->context;
- GP_Pixel black = GP_RGBToContextPixel(0x00, 0x00, 0x00, c);
- GP_Pixel white = GP_RGBToContextPixel(0xff, 0xff, 0xff, c);
+ GP_Pixmap *c = backend->pixmap;
+ GP_Pixel black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, c);
+ GP_Pixel white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, c);
int i;
int spacing = GP_TextHeight(config.style)/10 + 2;
diff --git a/demos/ttf2img/ttf2img.c b/demos/ttf2img/ttf2img.c
index deaa37a48fab..0e75546a7ebd 100644
--- a/demos/ttf2img/ttf2img.c
+++ b/demos/ttf2img/ttf2img.c
@@ -74,23 +74,23 @@ int main(int argc, char *argv[])
GP_SetDebugLevel(debug_level);
- GP_Context *context = GP_ContextAlloc(img_w, img_h, GP_PIXEL_RGB888);
+ GP_Pixmap *pixmap = GP_PixmapAlloc(img_w, img_h, GP_PIXEL_RGB888);
- GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- GP_Pixel white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap);
+ GP_Pixel white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap);
- GP_Fill(context, white_pixel);
+ GP_Fill(pixmap, white_pixel);
GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
style.font = GP_FontFaceLoad(font_path, 27, 0);
- GP_Text(context, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER,
+ GP_Text(pixmap, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER,
black_pixel, white_pixel, string);
- GP_SavePNG(context, img_path, NULL);
+ GP_SavePNG(pixmap, img_path, NULL);
- GP_ContextFree(context);
+ GP_PixmapFree(pixmap);
return 0;
}
diff --git a/doc/Makefile b/doc/Makefile
index 9c1bcfb73242..5da5636ad7ec 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +1,7 @@
TOPDIR=..
include $(TOPDIR)/config.mk
-SOURCES=index.html about.txt context.txt loaders.txt filters.txt \
+SOURCES=index.html about.txt pixmap.txt loaders.txt filters.txt \
basic_types.txt gfx.txt backends.txt gamma.txt grabbers.txt \
environment_variables.txt debug.txt core.txt input.txt \
gen.txt pixels.txt coordinate_system.txt coding_style.txt \
diff --git a/doc/about.txt b/doc/about.txt
index 167425abe289..96f3652b7238 100644
--- a/doc/about.txt
+++ b/doc/about.txt
@@ -17,7 +17,7 @@ Core
Core of the library contains minimal amount of code to define interface that
is shared between all parts of the library.
-The most important part of the core is link:context.html[CP_Context] structure
+The most important part of the core is link:pixmap.html[GP_Pixmap] structure
that represents in-memory pixmap.
The Core also contains generated code for basic operations such as
diff --git a/doc/backends.txt b/doc/backends.txt
index 944c13f3e2db..a4834660817d 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -80,15 +80,15 @@ window resizable.
[source,c]
-------------------------------------------------------------------------------
-#include <backends/GP_SDL_Context.h>
+#include <backends/GP_SDL_Pixmap.h>
-int GP_ContextFromSDLSurface(GP_Context *c, const SDL_Surface *surf);
+int GP_PixmapFromSDLSurface(GP_Pixmap *c, const SDL_Surface *surf);
-------------------------------------------------------------------------------
This function allows you to mix 'SDL' and 'GFXprim' code.
-It initializes a 'GFXprim' context from the 'SDL' surface using the pixel
-buffer from surface as pixel buffer for the context.
+It initializes a 'GFXprim' pixmap from the 'SDL' surface using the pixel
+buffer from surface as pixel buffer for the pixmap.
Function returns zero on success and non-zero on failure (i.e. there is no
'GFXprim' pixel type to match given surface).
@@ -243,9 +243,9 @@ typdef struct GP_Backend {
const char *name;
/*
- * Pointer to context APP should draw to.
+ * Pointer to pixmap APP should draw to.
*/
- GP_Context *context;
+ GP_Pixmap *pixmap;
...
@@ -595,8 +595,8 @@ was successful (i.e. X server allowed us to resize the window) the resize
event will be send and should be handled in your event loop. You must respond
to it by the 'GP_BackendResizeAck()' described below.
-NOTE: The backend->context pointer may change upon calling this function and
- at least backend->context->pixels pointer will change.
+NOTE: The backend->pixmap pointer may change upon calling this function and
+ at least backend->pixmap->pixels pointer will change.
[[ResizeAck]]
@@ -613,10 +613,10 @@ int GP_BackendResizeAck(GP_Backend *self);
-------------------------------------------------------------------------------
If backend is resizable by user interaction (for example X Window) you will
-get resize event for each change of window size, however the backend context
+get resize event for each change of window size, however the backend pixmap
will not be resized until you call this function. This is useful in
multi-threaded application where one threads waits for events and others draws
-into the buffer so you can stop the drawing threads before the backend context
+into the buffer so you can stop the drawing threads before the backend pixmap
size change.
diff --git a/doc/backends_python.txt b/doc/backends_python.txt
index 183b4c183ba4..b53b6bd74f61 100644
--- a/doc/backends_python.txt
+++ b/doc/backends_python.txt
@@ -87,8 +87,8 @@ import gfxprim.backends as backends
# Assert that inicialization was successful
assert(bk)
- # Now you can draw into the backend via bk.context
- bk.context.gfx.Fill(bk.context.RGBToPixel(0, 0, 0));
+ # Now you can draw into the backend via bk.pixmap
+ bk.pixmap.gfx.Fill(bk.pixmap.RGBToPixel(0, 0, 0));
# If backend is buffered, changes are not propagated unless the screen is
# updated via Flip()
diff --git a/doc/blits.txt b/doc/blits.txt
index d2e4e372de37..5a5373767e02 100644
--- a/doc/blits.txt
+++ b/doc/blits.txt
@@ -24,17 +24,17 @@ into destination pixel type to speed up the blitting.
/* or */
#include <core/GP_Blit.h>
-void GP_Blit(const GP_Context *src,
+void GP_Blit(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
-void GP_BlitXYWH(const GP_Context *src,
+void GP_BlitXYWH(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
-void GP_BlitXYXY(const GP_Context *src,
+void GP_BlitXYXY(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1,
- GP_Context *dst, GP_Coord x2, GP_Coord y2);
+ GP_Pixmap *dst, GP_Coord x2, GP_Coord y2);
--------------------------------------------------------------------------------
Blit functions to copy rectangular area from source to destination.
@@ -54,18 +54,18 @@ WARNING: For these functions the behavior is undefined when you pass
/* or */
#include <core/GP_Blit.h>
-void GP_BlitXYXY_Clipped(const GP_Context *src,
+void GP_BlitXYXY_Clipped(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1,
- GP_Context *dst, GP_Coord x2, GP_Coord y2);
+ GP_Pixmap *dst, GP_Coord x2, GP_Coord y2);
-void GP_BlitXYWH_Clipped(const GP_Context *src,
+void GP_BlitXYWH_Clipped(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
-void GP_Blit_Clipped(const GP_Context *src,
+void GP_Blit_Clipped(const GP_Pixmap *src,
GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
- GP_Context *dst, GP_Coord x1, GP_Coord y1);
+ GP_Pixmap *dst, GP_Coord x1, GP_Coord y1);
--------------------------------------------------------------------------------
Blit functions to copy rectangular area from source to destination. Both
diff --git a/doc/coding_style.txt b/doc/coding_style.txt
index ebd0f3f11145..c23ad06bd524 100644
--- a/doc/coding_style.txt
+++ b/doc/coding_style.txt
@@ -108,14 +108,14 @@ GFXprim Specific Rules
* Library external API uses CamelCase
** Together with mandatory 'GP_' prefix.
-** For example 'GP_PixelType', 'GP_Context', etc.
+** For example 'GP_PixelType', 'GP_Pixmap', etc.
** We will not change that, get over it. (It could have been worse, trust me.)
* Basic library types are typedefed
** We have 'GP_Size' and 'GP_Coord' integer types to better distinguish
roles of function parameters.
-** The basic structures are also typedefed so you can wite 'GP_Context'
- instead of 'struct GP_Context'.
+** The basic structures are also typedefed so you can wite 'GP_Pixmap'
+ instead of 'struct GP_Pixmap'.
** Other uses of typedef are frowned upon.
* When you add an externally visible symbol, i.e. new API function
@@ -143,5 +143,5 @@ All constants are available in 'foo.C' submodules (i.e. 'core.C')
to avoid clutter.
Where this makes sense, functions should be available as methods of
-an object (i.e. 'Context.Copy()' rather than 'Copy(context)'). Be Pythonic.
+an object (i.e. 'Pixmap.Copy()' rather than 'Copy(pixmap)'). Be Pythonic.
diff --git a/doc/context.txt b/doc/context.txt
deleted file mode 100644
index 37287f7e8669..000000000000
--- a/doc/context.txt
+++ /dev/null
@@ -1,309 +0,0 @@
-Drawing Context
----------------
-
-The 'GP_Context' structure describes an 'in memory' pixmap. The structure
-contains all metadata needed for drawing, loaders and filters.
-
-Data Structure
-~~~~~~~~~~~~~~
-
-[source,c]
--------------------------------------------------------------------------------
-typedef struct GP_Context {
- uint8_t *pixels; /* pointer to image pixels */
- uint8_t bpp; /* pixel length in bits */
- uint32_t bytes_per_row;
- uint32_t w; /* width in pixels */
- uint32_t h; /* height in pixels */
- /*
- * Row bit offset. The offset is ignored for byte aligned pixels.
- * Basically it's used for non aligned pixels with combination
- * with subcontextes.
- */
- uint8_t offset;
-
- enum GP_PixelType pixel_type; /* pixel format */
-
- /*
- * Pointer to optional Gamma correction tables.
- */
- struct GP_Gamma *gamma;
-
- uint8_t axes_swap:1; /* swap axes */
- uint8_t x_swap:1; /* mirror x */
- uint8_t y_swap:1; /* mirror y */
- uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
- uint8_t free_pixels:1; /* if set GP_ContextFree() calls free on context->pixels */
-} GP_Context;
--------------------------------------------------------------------------------
-
-The 'pixels' field points to the image data.
-
-The 'pixels' are stored as a one-dimensional array consisting of byte-aligned
-lines (i.e. each image line starts at whole byte and ends at whole byte).
-
-The 'pixels' array starts exactly at upper left corner of the image and is
-stored in horizontal lines (each line contains 'w' pixels and there is 'h'
-lines). Each line is 'bytes_per_row' bytes long (which equals to 'w * bpp /
-8' rouned up to the whole bytes). The first pixel may actually start at
-'offset' bit in the first byte in each line (but only for some
-<<Sub_Context,subcontexts>> for pixel types that are not byte aligned).
-
-The link:pixels.html[pixel_type enumeration] defines in which format and how
-are pixel data stored in the 'pixels' buffer, i.e. organization and function
-of the pixel channels.
-
-The optional pointer to link:gamma.html[gamma tables] describes per-channel
-gamma correction. Unfortunatelly very few parts of the library use it at the
-moment (this will be fixed in subsequent releases).
-
-The bitfield at the the end of the structure describes image orientation (see
-below) and a flag that tell if 'pixels' data should be freed, which is
-usefull for example for <<Sub_Context, subcontexts>>.
-
-Rotation
-^^^^^^^^
-
-The orientation flags affects the gfx and text drawing functions and blits. If
-some of the flags is changed the origin and direction of the drawing is
-changed accordingly. Note that the image pixels are not affected by this at
-all only the coordinates passed to drawing functions are transformed.
-
-If you don't need this functionality just don't touch the flags the as
-overhead of these transformations is not measurable.
-
-If you really need drawing primitives that do not use the orientation flags,
-you could use variants with _Raw suffix (although this is not recommended).
-
-There are various helper macros for transforming coordinates and sizes in
-'core/GP_Transform.h'. And context helper functions to "rotate" the flags
-clock wise and counter clock wise as well as functions to get the context size
-when taking into the account the width and height.
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Transform.h>
-/* or */
-#include <GP.h>
-
-/* Transforms point user coordinates to bitmap coordinates */
-GP_TRANSFORM_POINT(context, x, y)
-
-/* Transforms rectangular area coordinates and size */
-GP_TRANSFORM_RECT(context, x, y, w, h)
-
-/* Inverse transformation, bitmap coordinates to user coordinates */
-GP_RETRANSFORM_POINT(context, x, y)
--------------------------------------------------------------------------------
-
-[source,c]
-------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-/*
- * Rotate context flags clock wise.
- */
-void GP_ContextRotateCW(GP_Context *context);
-
-/*
- * Rotate context flags counter clock wise.
- */
-void GP_ContextRotateCCW(GP_Context *context);
-
-/*
- * Retruns 1 if rotation flags are equal.
- */
-int GP_ContextRotationEqual(const GP_Context *c1, const GP_Context *c2);
-
-/*
- * Sets context rotation flags.
- */
-void GP_ContextSetRotation(GP_Context *dst, int axes_swap,
- int x_swap, int y_swap);
-
-/*
- * Copies rotation flags.
- */
-void GP_ContextCopyRotation(const GP_Context *src, GP_Context *dst);
-
-/*
- * Returns context width and height taking the rotation flags into the account.
- */
-GP_Size GP_ContextW(const GP_Context *context);
-GP_Size GP_ContextH(const GP_Context *context);
--------------------------------------------------------------------------------
-
-Basic context functions
-~~~~~~~~~~~~~~~~~~~~~~~
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-GP_Context *GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h,
- GP_PixelType type, void *pixels);
--------------------------------------------------------------------------------
-
-Initialize given context accordingly to parameters, the rest of context
-parameters are set to the default values (i.e. rotation flags are all set to
-zero, 'free_pixels' flag is not set). Number of bits per pixel and
-bytes per row are computed from the given pixel type and size.
-
-The 'pixels' pointer can be NULL and can be changed later manually (the call
-will *not* try to allocate the pixel memory automatically).
-
-The function returns a pointer to the initialized context (i.e. the same
-pointer you passed as second argument).
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type);
--------------------------------------------------------------------------------
-
-The 'GP_ContextAlloc()' allocates and initializes a context.
-
-The orientation flags are all set to zero, the 'free_pixels' flag is set and the
-rest of the metadata are calculated accordingly to width, height and
-pixel_type.The 'pixels' pointer will point to a newly allocated bitmap with
-appropriate size; the initial contents of the bitmap are undefined.
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-enum GP_ContextCopyFlags {
- /*
- * Copy bitmap pixels too. If not set pixels are uninitialized.
- */
- GP_COPY_WITH_PIXELS = 0x01,
- /*
- * Copy image rotation flags. If not set flags are set to (0, 0, 0).
- */
- GP_COPY_WITH_ROTATION = 0x02,
-};
-
-GP_Context *GP_ContextCopy(const GP_Context *src, int flags);
--------------------------------------------------------------------------------
-
-The 'GP_ContextCopy()' allocates and initializes a copy of the context passed
-as arguments.
-
-The call returns pointer to newly allocated context or in case of 'malloc()'
-failure NULL.
-
-If 'GP_COPY_WITH_PIXELS' is set, the bitmap contents ('src->pixels') are also
-copied; otherwise the copy will have the same dimensions but undefined
-contents.
-
-If 'GP_COPY_WITH_ROTATION' is set rotation flags are copied; otherwise rotation
-flags are set to zero.
-
-The 'free_pixels' flag for the resulting context is set.
-
-[[ContextFree]]
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-void GP_ContextFree(GP_Context *context);
--------------------------------------------------------------------------------
-
-Frees the context memory.
-
-If 'free_pixels' flag is set, the pixels buffer is freed too.
-
-If gamma pointer is not NULL the 'GP_GammaRelease()' is called.
-
-[[Sub_Context]]
-Subcontext
-~~~~~~~~~~
-
-A subcontext is a context that refers to a rectangular area within another
-context. Subcontexts can be used as any other contexts (including subcontext
-creation).
-
-WARNING: If you create overlaping subcontexts the result is undefined.
-
-Calling 'GP_ContextFree()' on a allocated subcontext is safe; the bitmap is
-not freed as it belongs to another context; it will be freed when the parent
-context is freed (i.e. the 'free_pixels' flag is not set when creating
-subcontext).
-
-CAUTION: The subcontext doesn't hold a reference to the original context, so
- once the parent context is freed the subcontext pixels pointer is not
- valid anymore.
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-GP_Context *GP_SubContext(const GP_Context *context, GP_Context *subcontext,
- GP_Coord x, GP_Coord y, GP_Size w, GP_Size h);
-
-GP_Context *GP_SubContextAlloc(const GP_Context *context,
- GP_Coord x, GP_Coord y, GP_Size w, GP_Size h);
--------------------------------------------------------------------------------
-
-Creates subcontext of a context. The rectangular area must fit into the parent
-context.
-
-The 'GP_SubContext()' function initializes the passed pointer as a subcontext
-of a context and returns pointer to the initialized subcontext (i.e. the same
-pointer you passed as the subcontext parameter).
-
-The 'GP_SubContextAlloc()' function allocates 'GP_Context' structure and
-initializes it as a subcontext. This function may return NULL in case of
-'malloc()' failure and the newly created context should be later freed with
-'GP_ContextFree()'.
-
-Conversions
-~~~~~~~~~~~
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-GP_Context *GP_ContextConvertAlloc(const GP_Context *src,
- GP_PixelType dst_pixel_type);
-
-GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst);
-
--------------------------------------------------------------------------------
-
-Converts a context to different pixel type.
-
-This is naive implementation that only multiplies/divides the pixel values.
-
-To get a better result use link:filters.html#Dithering[dithering filters] instead.
-
-Misc
-~~~~
-
-[source,c]
--------------------------------------------------------------------------------
-#include <core/GP_Context.h>
-/* or */
-#include <GP.h>
-
-void GP_ContextPrintInfo(const GP_Context *self);
--------------------------------------------------------------------------------
-
-This function prints the content of a 'GP_Context' structure, in a readable
-format, into the stdout.
-
diff --git a/doc/convert.txt b/doc/convert.txt
index f11f932a4c42..a534ecb56b5a 100644
--- a/doc/convert.txt
+++ b/doc/convert.txt
@@ -14,11 +14,11 @@ GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b, GP_PixelType type);
GP_Pixel GP_RGBAToPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
GP_PixelType type);
-GP_Pixel GP_RGBToContextPixel(uint8_t r, uint8_t g, uint8_t b,
- const GP_Context *context);
+GP_Pixel GP_RGBToPixmapPixel(uint8_t r, uint8_t g, uint8_t b,
+ const GP_Pixmap *pixmap);
-GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
- const GP_Context *context);
+GP_Pixel GP_RGBAToPixmapPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
+ const GP_Pixmap *pixmap);
-------------------------------------------------------------------------------
Simple functions to convert RGB or RGBA 8 bit values into the specific
diff --git a/doc/core.txt b/doc/core.txt
index 1ae253a6d293..439494a6021d 100644
--- a/doc/core.txt
+++ b/doc/core.txt
@@ -4,7 +4,7 @@ Library Core
Library core contains all basic data structures and functions that forms the
glue which holds the GFXprim libraries together.
-The most important data structure is a link:context.html[Context] which
+The most important data structure is a link:pixmap.html[Pixmap] which
describes in-memory pixmap which is used extensively in all parts of the
library.
@@ -20,7 +20,7 @@ or link:progress_callback.html[Progress callback].
[grid="rows"]
[options="autowidth"]
|=============================================================================
-| link:context.html[Context] | Describes in-memory pixmap
+| link:pixmap.html[Pixmap] | Describes in-memory pixmap
| link:basic_types.html[Basic types] | Types for size, lenght, pixel and
color
@@ -30,7 +30,7 @@ or link:progress_callback.html[Progress callback].
| link:get_put_pixel.html[GetPixel and PutPixel] | Macros and functions to
get and put pixels
-| link:blits.html[Blits] | Blits (copies) a rectangular area from one context to
+| link:blits.html[Blits] | Blits (copies) a rectangular area from one pixmap to
another as well as simple pixel format conversions
| link:progress_callback.html[Progress Callback] | Progress callback passed
diff --git a/doc/core_python.txt b/doc/core_python.txt
index 108c8594360c..0b960007a586 100644
--- a/doc/core_python.txt
+++ b/doc/core_python.txt
@@ -3,28 +3,28 @@ Python Core module
The python binding maps mostly to the C API with the 'GP_' prefix stripped.
-However structures as 'GP_Context' are not created by the 'GP_ContextAlloc()'
+However structures as 'GP_Pixmap' are not created by the 'GP_PixmapAlloc()'
function but have proper constructor and destructor to keep the Python
reference counting happy.
Then there are a bit more tricky solutions, such as 'GP_ProgressCallback'
which needs a proxy function to call the python callback from the C code.
-Context
+Pixmap
~~~~~~~
[source,python]
-------------------------------------------------------------------------------
import gfxprim.core as core
- # Create 100x100 RGB888 context
- c = core.Context(100, 100, core.C.PIXEL_RGB888)
+ # Create 100x100 RGB888 pixmap
+ c = core.Pixmap(100, 100, core.C.PIXEL_RGB888)
print("w={} h={} bpp={}".format(c.w, c.h, c.bpp))
-------------------------------------------------------------------------------
-Creates a context of a particular size and pixel type.
+Creates a pixmap of a particular size and pixel type.
First two parameters are 'width' and 'height' third is pixel type which is an
enumeration
@@ -41,7 +41,7 @@ enumeration
-------------------------------------------------------------------------------
import gfxprim.core as core
- pixel = context.GetPixel(x, y)
+ pixel = pixmap.GetPixel(x, y)
-------------------------------------------------------------------------------
@@ -52,7 +52,7 @@ returned.
-------------------------------------------------------------------------------
import gfxprim.core as core
- context.PutPixel(x, y, pixel)
+ pixmap.PutPixel(x, y, pixel)
-------------------------------------------------------------------------------
@@ -66,11 +66,11 @@ NOTE: You may want to see link:coordinate_system.html[coordinate system]
-------------------------------------------------------------------------------
import gfxprim.core as core
- grayscale = context.Convert(core.C.PIXEL_G8)
+ grayscale = pixmap.Convert(core.C.PIXEL_G8)
-------------------------------------------------------------------------------
-Returns context converted into the desired pixel format.
+Returns pixmap converted into the desired pixel format.
The conversion is naive i.e. the values are just divided/multiplied.
@@ -80,15 +80,15 @@ The conversion is naive i.e. the values are just divided/multiplied.
-------------------------------------------------------------------------------
import gfxprim.core as core
- # Blits context to target starting at
- # sx and sy in the source context
+ # Blits pixmap to target starting at
+ # sx and sy in the source pixmap
# tx and ty in in the target
- context.Blit(sx, sy, target, tx, ty, w, h)
+ pixmap.Blit(sx, sy, target, tx, ty, w, h)
# Alternatively the size can be described by
# coordinates in the source or target
- context.Blit(sx, sy, target, tx, ty, sx2=, sy2=)
- context.Blit(sx, sy, target, tx, ty, tx2=, ty2=)
+ pixmap.Blit(sx, sy, target, tx, ty, sx2=, sy2=)
+ pixmap.Blit(sx, sy, target, tx, ty, tx2=, ty2=)
-------------------------------------------------------------------------------
@@ -118,8 +118,8 @@ import gfxprim.core as core
# You can create a pixel from RGB and pixel type
black = core.RGBToPixel(0, 0, 0, core.C.PIXEL_G1)
- # Or using shortcut from context
- black = context.RGBToPixel(0, 0, 0)
+ # Or using shortcut from pixmap
+ black = pixmap.RGBToPixel(0, 0, 0)
-------------------------------------------------------------------------------
@@ -170,5 +170,5 @@ import gfxprim.core as core
Sets and gets the GFXprim debug level. See link:debug.html[debug messages]
description for more details.
-These are basic 'Context' methods from core module. Importing other modules
+These are basic 'Pixmap' methods from core module. Importing other modules
will add some other (for example gfx module adds all drawing functions).
diff --git a/doc/debug.txt b/doc/debug.txt
index 09c80aa0e560..b209b53a56c6 100644
--- a/doc/debug.txt
+++ b/doc/debug.txt
@@ -5,7 +5,7 @@ The GFXprim library includes a debug message infrastructure in order to ease
the debugging.
Many places of the library uses debug messages to report warnings, bugs, or
-generally important events (i.e. context has been allocated, filter function
+generally important events (i.e. pixmap has been allocated, filter function
has been called).
Debug messages are printed into the stderr and could be redirected to custom
diff --git a/doc/environment_variables.txt b/doc/environment_variables.txt
index 5ce7488a02f8..216f19f1e8a3 100644
--- a/doc/environment_variables.txt
+++ b/doc/environment_variables.txt
@@ -48,13 +48,13 @@ The output is, by default, written to stderr and will look like:
1: GP_Loader.c:loader_by_filename():222: Loading file by filename extension 'pgm'
1: GP_Loader.c:loader_by_extension():198: Found loader 'Netpbm portable Graymap'
1: GP_PNM.c:load_header():244: Have header P2 (ASCII encoded PGM) 24x7 depth=15
-1: GP_Context.c:GP_ContextAlloc():62: Allocating context 24 x 7 - G4
+1: GP_Pixmap.c:GP_PixmapAlloc():62: Allocating pixmap 24 x 7 - G4
4: GP_X11.c:x11_update_rect():71: Updating rect 222x458-418x479
4: GP_X11.c:x11_update_rect():71: Updating rect 214x458-426x479
2: GP_Blit.c:GP_BlitXYXY_Clipped():129: Blitting 23x6, available 332x244
2: GP_Blit.c:GP_BlitXYXY_Clipped():139: Blitting 0x0->23x6 in 24x7 to 308x236 in 640x480
3: GP_X11.c:x11_set_attributes():225: Setting window caption to 'Spiv ~ test.pgm 1:1.000'
- 4: GP_X11.c:x11_flip():91: Flipping context
-1: GP_Context.c:GP_ContextFree():102: Freeing context (0x7f5008000b60)
+ 4: GP_X11.c:x11_flip():91: Flipping pixmap
+1: GP_Pixmap.c:GP_PixmapFree():102: Freeing pixmap (0x7f5008000b60)
1: GP_X11_Conn.h:x11_close():72: Closing X11 display
------------------------------------------------------------------------------
diff --git a/doc/example_SDL_glue.txt b/doc/example_SDL_glue.txt
index 804898f4b74b..5e12aac6ce32 100644
--- a/doc/example_SDL_glue.txt
+++ b/doc/example_SDL_glue.txt
@@ -1,7 +1,7 @@
SDL Glue
--------
-You can easily mix SDL and GFXprim code using 'GP_ContextFromSDLSurface()'
+You can easily mix SDL and GFXprim code using 'GP_PixmapFromSDLSurface()'
function.
[source,c]
diff --git a/doc/filters.txt b/doc/filters.txt
index c0cc54666c31..da1cf5aa4f0d 100644
--- a/doc/filters.txt
+++ b/doc/filters.txt
@@ -1,12 +1,12 @@
-Context filters
+Pixmap filters
---------------
-Pixel filters for 'GP_Context'.
+Pixel filters for 'GP_Pixmap'.
-The context filter is basically a function that operates on context pixels.
+The pixmap filter is basically a function that operates on pixmap pixels.
The result may be stored into a new bitmap or placed to bitmap passed as
argument or, in some cases, the filter could be used 'in place' so the result
-is stored into the same context as the one passed as filter source.
+is stored into the same pixmap as the one passed as filter source.
Common filter API
~~~~~~~~~~~~~~~~~
@@ -22,21 +22,21 @@ For convenience, the filters API is unified:
* And the last argument is link:progress_callback.html[progress callback]
When using allocating version of the filter, pointer to the newly allocated
-context is returned, or in case of failure NULL is returned.
+pixmap is returned, or in case of failure NULL is returned.
If 'malloc()' has failed NULL is returned.
If filter has been interrupted by a callback, all allocated memory is freed,
and NULL is returned.
-When using non-allocating variant of the filter, the destination context must
+When using non-allocating variant of the filter, the destination pixmap must
have correct pixel type and the size must be big enough to store the result.
The return value from such filter is either zero, in case of success, or
non-zero when filter was interrupted by a callback.
For filters that work 'in-place' (which is explicitly said for each filter)
-the source and the destination could be the same context. Note that this is
-not expected to work if you do several overlapping sub-contexts and pass these
+the source and the destination could be the same pixmap. Note that this is
+not expected to work if you do several overlapping sub-pixmaps and pass these
as arguments.
[source,c]
@@ -44,11 +44,11 @@ as arguments.
/*
* Filter common API.
*/
-int GP_FilterFoo(const GP_Context *src, GP_Context *dst,
+int GP_FilterFoo(const GP_Pixmap *src, GP_Pixmap *dst,
foo params ...,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterFooAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterFooAlloc(const GP_Pixmap *src,
foo params ...,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -71,10 +71,10 @@ Invert
/* or */
#include <filters/GP_Point.h>
-int GP_FilterInvert(const GP_Context *src, GP_Context *dst,
+int GP_FilterInvert(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterInvertAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterInvertAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -91,10 +91,10 @@ Brightness
/* or */
#include <filters/GP_Point.h>
-int GP_FilterBrightness(const GP_Context *src, GP_Context *dst,
+int GP_FilterBrightness(const GP_Pixmap *src, GP_Pixmap *dst,
float p, GP_ProgressCallback *callback);
-GP_Context *GP_FilterBrightnessAlloc(const GP_Context *src, float p,
+GP_Pixmap *GP_FilterBrightnessAlloc(const GP_Pixmap *src, float p,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -111,10 +111,10 @@ Contrast
/* or */
#include <filters/GP_Point.h>
-int GP_FilterContrast(const GP_Context *src, GP_Context *dst,
+int GP_FilterContrast(const GP_Pixmap *src, GP_Pixmap *dst,
float p, GP_ProgressCallback *callback);
-GP_Context *GP_FilterContrastAlloc(const GP_Context *src, float p,
+GP_Pixmap *GP_FilterContrastAlloc(const GP_Pixmap *src, float p,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -131,11 +131,11 @@ BrightnessContrast
/* or */
#include <filters/GP_Point.h>
-int GP_FilterBrightnessContrast(const GP_Context *src, GP_Context *dst,
+int GP_FilterBrightnessContrast(const GP_Pixmap *src, GP_Pixmap *dst,
float b, float c,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterBrightnessContrastAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterBrightnessContrastAlloc(const GP_Pixmap *src,
float b, float c,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -153,10 +153,10 @@ Posterize
/* or */
#include <filters/GP_Point.h>
-int GP_FilterPosterize(const GP_Context *src, GP_Context *dst,
+int GP_FilterPosterize(const GP_Pixmap *src, GP_Pixmap *dst,
unsigned int levels, GP_ProgressCallback *callback);
-GP_Context *GP_FilterPosterizeAlloc(const GP_Context *src, unsigned int levels,
+GP_Pixmap *GP_FilterPosterizeAlloc(const GP_Pixmap *src, unsigned int levels,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -174,27 +174,27 @@ Gaussian additive noise filter
/* or */
#include <filters/GP_GaussianNoise.h>
-int GP_FilterGaussianNoiseAddEx(const GP_Context *src,
+int GP_FilterGaussianNoiseAddEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float sigma, float mu,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterGaussianNoiseAddExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterGaussianNoiseAddExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
float sigma, float mu,
GP_ProgressCallback *callback);
-static inline int GP_FilterGaussianNoiseAdd(const GP_Context *src,
- GP_Context *dst,
+static inline int GP_FilterGaussianNoiseAdd(const GP_Pixmap *src,
+ GP_Pixmap *dst,
float sigma, float mu,
GP_ProgressCallback *callback);
-static inline GP_Context *
-GP_FilterGaussianNoiseAddAlloc(const GP_Context *src,
+static inline GP_Pixmap *
+GP_FilterGaussianNoiseAddAlloc(const GP_Pixmap *src,
float sigma, float mu,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -210,12 +210,12 @@ include::images/gaussian_noise/images.txt[]
Arithmetic filters
~~~~~~~~~~~~~~~~~~
-Arithmetic filters do take two contexts as an input and combines them into one
-output context.
+Arithmetic filters do take two pixmaps as an input and combines them into one
+output pixmap.
-The pixel type of both input contexts must match.
+The pixel type of both input pixmaps must match.
-If size of the input contexts differs, minimum is used.
+If size of the input pixmaps differs, minimum is used.
[source,c]
-------------------------------------------------------------------------------
@@ -223,17 +223,17 @@ If size of the input contexts differs, minimum is used.
/* or */
#include <GP.h>
-int GP_FilterAddition(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterAddition(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterAdditionAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterAdditionAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Produces saturated (clamped) addition of two contexts.
+Produces saturated (clamped) addition of two pixmaps.
[source,c]
-------------------------------------------------------------------------------
@@ -241,17 +241,17 @@ Produces saturated (clamped) addition of two contexts.
/* or */
#include <GP.h>
-int GP_FilterMultiply(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterMultiply(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMultiplyAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterMultiplyAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Produces saturated (clamped) multiplication of two contexts.
+Produces saturated (clamped) multiplication of two pixmaps.
[source,c]
-------------------------------------------------------------------------------
@@ -259,13 +259,13 @@ Produces saturated (clamped) multiplication of two contexts.
/* or */
#include <GP.h>
-int GP_FilterDifference(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterDifference(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterDifferenceAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterDifferenceAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -278,22 +278,22 @@ Produces symmetric difference (i.e. abs(a - b)).
/* or */
#include <GP.h>
-int GP_FilterMax(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterMax(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMaxAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterMaxAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-int GP_FilterMin(const GP_Context *src_a,
- const GP_Context *src_b,
- GP_Context *dst,
+int GP_FilterMin(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
+ GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMinAlloc(const GP_Context *src_a,
- const GP_Context *src_b,
+GP_Pixmap *GP_FilterMinAlloc(const GP_Pixmap *src_a,
+ const GP_Pixmap *src_b,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -308,14 +308,14 @@ Rotation and Symmetry filters
/* or */
#include <GP.h>
-int GP_FilterMirrorH(const GP_Context *src, GP_Context *dst,
+int GP_FilterMirrorH(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMirrorHAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMirrorHAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Mirrors context horizontally.
+Mirrors pixmap horizontally.
Works 'in-place'.
@@ -330,14 +330,14 @@ include::images/mirror_h/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterMirrorV(const GP_Context *src, GP_Context *dst,
+int GP_FilterMirrorV(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMirrorVAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMirrorVAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Mirrors context vertically.
+Mirrors pixmap vertically.
Works 'in-place'.
@@ -352,19 +352,19 @@ include::images/mirror_v/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterRotate90(const GP_Context *src, GP_Context *dst,
+int GP_FilterRotate90(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterRotate90Alloc(const GP_Context *src,
+GP_Pixmap *GP_FilterRotate90Alloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Rotate context by 90 degrees.
+Rotate pixmap by 90 degrees.
Doesn't work 'in-place' (yet).
The destination has to have the same pixel type and size must be large enough to
-fit rotated context (i.e. W and H are swapped).
+fit rotated pixmap (i.e. W and H are swapped).
include::images/rotate_90/images.txt[]
@@ -374,14 +374,14 @@ include::images/rotate_90/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterRotate180(const GP_Context *src, GP_Context *dst,
+int GP_FilterRotate180(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterRotate180Alloc(const GP_Context *src,
+GP_Pixmap *GP_FilterRotate180Alloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Rotate context by 180 degrees.
+Rotate pixmap by 180 degrees.
Doesn't work 'in-place' (yet).
@@ -396,19 +396,19 @@ include::images/rotate_180/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterRotate270(const GP_Context *src, GP_Context *dst,
+int GP_FilterRotate270(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterRotate270Alloc(const GP_Context *src,
+GP_Pixmap *GP_FilterRotate270Alloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Rotate context by 270 degrees.
+Rotate pixmap by 270 degrees.
Doesn't work 'in-place' (yet).
The destination has to have the same pixel type and destination size must be
-large enough to fit rotated context (i.e. W and H are swapped).
+large enough to fit rotated pixmap (i.e. W and H are swapped).
include::images/rotate_270/images.txt[]
@@ -428,11 +428,11 @@ typedef enum GP_FilterSymmetries {
GP_MIRROR_V,
} GP_FilterSymmetries;
-GP_Context *GP_FilterSymmetry(const GP_Context *src,
+GP_Pixmap *GP_FilterSymmetry(const GP_Pixmap *src,
GP_FilterSymmetries symmetry,
GP_ProgressCallback *callback);
-int GP_FilterSymmetry(const GP_Context *src, GP_Context *dst,
+int GP_FilterSymmetry(const GP_Pixmap *src, GP_Pixmap *dst,
GP_FilterSymmetries symmetry,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -481,10 +481,10 @@ ready-to-use filters.
/* or */
#include <GP.h>
-int GP_FilterLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float kernel[], uint32_t kw, uint32_t kh,
float kern_div, GP_ProgressCallback *callback);
@@ -493,10 +493,10 @@ int GP_FilterLinearConvolution_Raw(const GP_Context *src,
Internal generic convolution filter, this is a base for all linear convolution
filters with non-separable kernel.
-The src coordinate and sizes denotes rectangle in the source context that the
+The src coordinate and sizes denotes rectangle in the source pixmap that the
filter operates on.
-The dst coordinates defines offset into the dst context.
+The dst coordinates defines offset into the dst pixmap.
The kernel is two-dimensional array of a size kw * kh indexed as
kernel[x + y*kw].
@@ -539,26 +539,26 @@ include::images/convolution/images.txt[]
/* or */
#include <GP.h>
-int GP_FilterHLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterHLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float kernel[], uint32_t kw, float kern_div,
GP_ProgressCallback *callback);
-int GP_FilterVLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterVLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float kernel[], uint32_t kh, float kern_div,
GP_ProgressCallback *callback);
-int GP_FilterVHLinearConvolution_Raw(const GP_Context *src,
+int GP_FilterVHLinearConvolution_Raw(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float hkernel[], uint32_t kw, float hkern_div,
float vkernel[], uint32_t kh, float vkern_div,
@@ -570,7 +570,7 @@ void GP_FilterKernelPrint_Raw(float kernel[], int kw, int kh, float kern_div);
Internal special functions for one dimensional vertical and horizontal
convolution these two functions are base for all separable convolution filters.
-The src coordinate and sizes denotes rectangle in the source context that the
+The src coordinate and sizes denotes rectangle in the source pixmap that the
filter operates on.
The dst coordinates are offset into the dst.
@@ -640,25 +640,25 @@ typedef struct GP_FilterKernel2D {
float *kernel;
} GP_FilterKernel2D;
-int GP_FilterConvolutionEx(const GP_Context *src,
+int GP_FilterConvolutionEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Coord h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterConvolutionExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterConvolutionExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
-int GP_FilterConvolution(const GP_Context *src, GP_Context *dst,
+int GP_FilterConvolution(const GP_Pixmap *src, GP_Pixmap *dst,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterConvolutionAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterConvolutionAlloc(const GP_Pixmap *src,
const GP_FilterKernel2D *kernel,
GP_ProgressCallback *callback);
@@ -690,7 +690,7 @@ WARNING: If filter is executed in-place the work cannot be distributed between
/*
* Example box smoothing filter.
*/
-static void box_smoothing(GP_Context *img)
+static void box_smoothing(GP_Pixmap *img)
{
float box_filter[] = {
1, 1, 1,
@@ -720,10 +720,10 @@ Laplace Filter
/* or */
#include <GP.h>
-int GP_FilterLaplace(const GP_Context *src, GP_Context *dst,
+int GP_FilterLaplace(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterLaplaceAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterLaplaceAlloc(const GP_Pixmap *src,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -767,10 +767,10 @@ Laplacian Edge Sharpening
/* or */
#include <GP.h>
-int GP_FilterEdgeSharpening(const GP_Context *src, GP_Context *dst,
+int GP_FilterEdgeSharpening(const GP_Pixmap *src, GP_Pixmap *dst,
float w, GP_ProgressCallback *callback);
-GP_Context *GP_FilterEdgeSharpeningAlloc(const GP_Context *src, float w,
+GP_Pixmap *GP_FilterEdgeSharpeningAlloc(const GP_Pixmap *src, float w,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -798,25 +798,25 @@ Gaussian Blur
/* or */
#include <GP.h>
-int GP_FilterGaussianBlurEx(const GP_Context *src,
+int GP_FilterGaussianBlurEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterGaussianBlurExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback);
-int GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst,
+int GP_FilterGaussianBlur(const GP_Pixmap *src, GP_Pixmap *dst,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback)
-GP_Context *GP_FilterGaussianBlurAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterGaussianBlurAlloc(const GP_Pixmap *src,
float x_sigma, float y_sigma,
GP_ProgressCallback *callback)
-------------------------------------------------------------------------------
@@ -879,26 +879,26 @@ Median
/* or */
#include <GP.h>
-int GP_FilterMedianEx(const GP_Context *src,
+int GP_FilterMedianEx(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- GP_Context *dst,
+ GP_Pixmap *dst,
GP_Coord x_dst, GP_Coord y_dst,
int xmed, int ymed,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMedianExAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMedianExAlloc(const GP_Pixmap *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
int xmed, int ymed,
GP_ProgressCallback *callback);
-int GP_FilterMedian(const GP_Context *src,
- GP_Context *dst,
+int GP_FilterMedian(const GP_Pixmap *src,
+ GP_Pixmap *dst,
int xmed, int ymed,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterMedianAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterMedianAlloc(const GP_Pixmap *src,
int xmed, int ymed,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
diff --git a/doc/filters_dithering.txt b/doc/filters_dithering.txt
index 94c8203315bc..c7cf060b694a 100644
--- a/doc/filters_dithering.txt
+++ b/doc/filters_dithering.txt
@@ -27,11 +27,11 @@ And is throwed away at the image borders.
/* or */
#include <filters/GP_Dither.h>
-int GP_FilterFloydSteinberg(const GP_Context *src, GP_Context *dst,
+int GP_FilterFloydSteinberg(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Renders Floyd Steinberg dithering directly into passed context. The
+Renders Floyd Steinberg dithering directly into passed pixmap. The
destination must be at least as large as source.
If operation was aborted by a callback, non-zero is returned.
@@ -45,12 +45,12 @@ the function returns non-zero and sets errno to 'ENOSYS'.
/* or */
#include <filters/GP_Dither.h>
-GP_Context *GP_FilterFloydSteinbergAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterFloydSteinbergAlloc(const GP_Pixmap *src,
GP_PixelType pixel_type,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Returns pointer to allocated context of given pixel_type.
+Returns pointer to allocated pixmap of given pixel_type.
If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
returned.
@@ -75,11 +75,11 @@ edges tend to be less sharp.
/* or */
#include <filters/GP_Dither.h>
-int GP_FilterHilbertPeano(const GP_Context *src, GP_Context *dst,
+int GP_FilterHilbertPeano(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Renders Hilbert Peano dithering directly into passed context. The
+Renders Hilbert Peano dithering directly into passed pixmap. The
destination must be at least as large as source.
If operation was aborted by a callback, non-zero is returned.
@@ -93,12 +93,12 @@ the function returns NULL and sets errno to 'ENOSYS'.
/* or */
#include <filters/GP_Dither.h>
-GP_Context *GP_FilterHilbertPeanoAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterHilbertPeanoAlloc(const GP_Pixmap *src,
GP_PixelType pixel_type,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Returns pointer to allocated context of given pixel_type.
+Returns pointer to allocated pixmap of given pixel_type.
If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
returned.
diff --git a/doc/filters_resize.txt b/doc/filters_resize.txt
index 6cf656447e6b..349ad2a71590 100644
--- a/doc/filters_resize.txt
+++ b/doc/filters_resize.txt
@@ -21,17 +21,17 @@ typedef enum GP_InterpolationType {
const char *GP_InterpolationTypeName(enum GP_InterpolationType interp_type);
-int GP_FilterResize(const GP_Context *src, GP_Context *dst,
+int GP_FilterResize(const GP_Pixmap *src, GP_Pixmap *dst,
GP_InterpolationType type,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_InterpolationType type,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Interpolate (resize) the context.
+Interpolate (resize) the pixmap.
Resize image given size and interpolation type.
@@ -49,7 +49,7 @@ GP_FilterResizeAlloc
The +GP_FilterResizeAlloc()+ allocates the destination give it's size.
-Returns pointer to newly allocated context or NULL in case of failure and
+Returns pointer to newly allocated pixmap or NULL in case of failure and
errno is set.
Nearest Neighbour Interpolation
@@ -61,10 +61,10 @@ Nearest Neighbour Interpolation
/* or */
#include <filters/GP_ResizeNN.h>
-int GP_FilterResizeNN(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeNN(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-static inline GP_Context *GP_FilterResizeNNAlloc(const GP_Context *src,
+static inline GP_Pixmap *GP_FilterResizeNNAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -87,17 +87,17 @@ Bilinear Interpolation
/* or */
#include <filters/GP_ResizeLinear.h>
-int GP_FilterResizeLinearInt(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeLinearInt(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-int GP_FilterResizeLinearLFInt(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeLinearLFInt(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeLinearIntAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeLinearIntAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeLinearLFIntAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeLinearLFIntAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
@@ -115,17 +115,17 @@ Bicubic Interpolation
/* or */
#include <filters/GP_ResizeCubic.h>
-int GP_FilterResizeCubicInt(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeCubicInt(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-int GP_FilterResizeCubic(const GP_Context *src, GP_Context *dst,
+int GP_FilterResizeCubic(const GP_Pixmap *src, GP_Pixmap *dst,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeCubicIntAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeCubicIntAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-GP_Context *GP_FilterResizeCubicAlloc(const GP_Context *src,
+GP_Pixmap *GP_FilterResizeCubicAlloc(const GP_Pixmap *src,
GP_Size w, GP_Size h,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
diff --git a/doc/gamma.txt b/doc/gamma.txt
index a38518bd2c76..521306a76962 100644
--- a/doc/gamma.txt
+++ b/doc/gamma.txt
@@ -38,7 +38,7 @@ and text still use legacy gamma support.)
Implementation
~~~~~~~~~~~~~~
-The 'GP_Gamma' structure defines per context, per channel, gamma tables.
+The 'GP_Gamma' structure defines per pixmap, per channel, gamma tables.
The tables for particular gamma are reference counted. There is only one table
for particular gamma value and bit depth in memory at a time.
diff --git a/doc/get_put_pixel.txt b/doc/get_put_pixel.txt
index 86d90c7f35f3..db9893f04e96 100644
--- a/doc/get_put_pixel.txt
+++ b/doc/get_put_pixel.txt
@@ -7,17 +7,17 @@ GetPixel and PutPixel
/* or */
#include <core/GP_GetPutPixel.h>
-GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y);
+GP_Pixel GP_GetPixel(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y);
-void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p);
+void GP_PutPixel(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p);
--------------------------------------------------------------------------------
Gets, puts a pixel value. GP_Pixel is a number which holds a pixel value.
-This functions are clipped, GetPixel outside of the context returns zero,
-PutPixel outside the context is no-op.
+This functions are clipped, GetPixel outside of the pixmap returns zero,
+PutPixel outside the pixmap is no-op.
-This functions honour link:context.html[context rotation flags].
+This functions honour link:pixmap.html[pixmap rotation flags].
Generally these function are safe to use but rather slow in innner cycles.
@@ -27,23 +27,23 @@ Generally these function are safe to use but rather slow in innner cycles.
/* or */
#include <core/GP_GetPutPixel.h>
-GP_Pixel GP_GetPixel_Raw(const GP_Context *context, GP_Coord x, GP_Coord y);
+GP_Pixel GP_GetPixel_Raw(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y);
-void GP_PutPixel_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p);
+void GP_PutPixel_Raw(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p);
/*
* Substitute {{ bpp }} for specific bits per pixel (1BPP_LE, 24BPP, ...)
*
* These macros are generated to core/GP_GetPutPixel.gen.h
*/
-GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Context *c, int x, int y);
+GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Pixmap *c, int x, int y);
-void GP_PutPixel_Raw_{{ bpp }}(GP_Context *c, GP_Coord x, GP_Coord y,
+void GP_PutPixel_Raw_{{ bpp }}(GP_Pixmap *c, GP_Coord x, GP_Coord y,
GP_Pixel p);
--------------------------------------------------------------------------------
-These functions are generally fast, but does not honour context rotation flags
-and do not check that coordinates are inside of the context.
+These functions are generally fast, but does not honour pixmap rotation flags
+and do not check that coordinates are inside of the pixmap.
They are intended as basic building blocks for other GFX primitives, filters,
etc.
diff --git a/doc/gfx.txt b/doc/gfx.txt
index 14cb7d8b2fa5..35f75d234303 100644
--- a/doc/gfx.txt
+++ b/doc/gfx.txt
@@ -11,7 +11,7 @@ See also RGB tripplet to pixel link:convert.html[conversions].
Rotation Flags
~~~~~~~~~~~~~~
-Drawing orientation is affected by the link:context.html[context rotation
+Drawing orientation is affected by the link:pixmap.html[pixmap rotation
flags]. The parameters passed to the functions are transformed accordingly to
the flags before the drawing, which allows for fast and transparent rotated or
mirrored rendering.
@@ -28,10 +28,10 @@ Fill
[source,c]
--------------------------------------------------------------------------------
-void GP_Fill(GP_Context *context, GP_Pixel pixel);
+void GP_Fill(GP_Pixmap *pixmap, GP_Pixel pixel);
--------------------------------------------------------------------------------
-Fills the whole context bitmap with the specified pixel value.
+Fills the whole pixmap bitmap with the specified pixel value.
NOTE: GP_Fill is implemented in the library Core rather than in GFX so that
it's available to all library parts.
@@ -41,10 +41,10 @@ Lines
[source,c]
--------------------------------------------------------------------------------
-void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
+void GP_HLineXXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord x1, GP_Coord y,
GP_Pixel pixel);
...e-mail trimmed, has been too large.
1
0
29 Feb '16
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 3bd8980e057fc508b4a9a77d2bd0c225258cb62b (commit)
from 9e95a6d7dbef8989e1d78061312a28f906e8d685 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/gfxprim.git/commit/3bd8980e057fc508b4a9a77d2bd0c225258cb6…
commit 3bd8980e057fc508b4a9a77d2bd0c225258cb62b
Author: Michal Demin <michaldemin(a)gmail.com>
Date: Fri Feb 26 22:17:41 2016 +0100
text/GP_Text.gen.c.t: Fix prototype inconsistency.
Fix prototype inconsistency between header and generated GP_Text_Raw
function and include GP_Text.h.
Signed-off-by: Michal Demin <michaldemin(a)gmail.com>
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t
index 6a03486..e8f2dbd 100644
--- a/libs/text/GP_Text.gen.c.t
+++ b/libs/text/GP_Text.gen.c.t
@@ -11,11 +11,12 @@
#include "core/GP_MixPixels.gen.h"
#include "gfx/GP_HLine.h"
#include "GP_TextStyle.h"
+#include "GP_Text.h"
#include "GP_Font.h"
#define WIDTH_TO_1BPP_BPP(width) ((width)/8 + ((width)%8 != 0))
-static int get_width(GP_TextStyle *style, int width)
+static int get_width(const GP_TextStyle *style, int width)
{
return width * style->pixel_xmul + (width - 1) * style->pixel_xspace;
}
@@ -23,7 +24,7 @@ static int get_width(GP_TextStyle *style, int width)
@ for pt in pixeltypes:
@ if not pt.is_unknown():
-static void text_draw_1BPP_{{ pt.name }}(GP_Context *context, GP_TextStyle *style,
+static void text_draw_1BPP_{{ pt.name }}(GP_Context *context, const GP_TextStyle *style,
GP_Coord x, GP_Coord y,
GP_Pixel fg, const char *str)
{
@@ -75,7 +76,7 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Context *context, GP_TextStyle *styl
@ end
-static void text_draw_1BPP(GP_Context *context, GP_TextStyle *style, int x, int y,
+static void text_draw_1BPP(GP_Context *context, const GP_TextStyle *style, int x, int y,
GP_Pixel fg, const char *str)
{
switch (context->pixel_type) {
@@ -153,14 +154,14 @@ static void text_draw_1BPP(GP_Context *context, GP_TextStyle *style, int x, int
@ for pt in pixeltypes:
@ if not pt.is_unknown():
-static void text_8BPP_bg_{{ pt.name }}(GP_Context *context, GP_TextStyle *style,
+static void text_8BPP_bg_{{ pt.name }}(GP_Context *context, const GP_TextStyle *style,
GP_Coord x, GP_Coord y,
GP_Pixel fg, GP_Pixel bg, const char *str)
{
@ text_8BPP(pt, True)
}
-static void text_8BPP_{{ pt.name }}(GP_Context *context, GP_TextStyle *style,
+static void text_8BPP_{{ pt.name }}(GP_Context *context, const GP_TextStyle *style,
GP_Coord x, GP_Coord y,
GP_Pixel fg, const char *str)
{
@@ -169,7 +170,7 @@ static void text_8BPP_{{ pt.name }}(GP_Context *context, GP_TextStyle *style,
@ end
-static void text_8BPP_bg(GP_Context *context, GP_TextStyle *style,
+static void text_8BPP_bg(GP_Context *context, const GP_TextStyle *style,
GP_Coord x, GP_Coord y,
GP_Pixel fg, GP_Pixel bg, const char *str)
{
@@ -185,7 +186,7 @@ static void text_8BPP_bg(GP_Context *context, GP_TextStyle *style,
}
}
-static void text_8BPP(GP_Context *context, GP_TextStyle *style,
+static void text_8BPP(GP_Context *context, const GP_TextStyle *style,
GP_Coord x, GP_Coord y,
GP_Pixel fg, const char *str)
{
@@ -201,7 +202,7 @@ static void text_8BPP(GP_Context *context, GP_TextStyle *style,
}
}
-void GP_Text_Raw(GP_Context *context, GP_TextStyle *style,
+void GP_Text_Raw(GP_Context *context, const GP_TextStyle *style,
GP_Coord x, GP_Coord y, uint8_t flags,
GP_Pixel fg, GP_Pixel bg, const char *str)
{
-----------------------------------------------------------------------
Summary of changes:
libs/text/GP_Text.gen.c.t | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
19 Dec '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 9e95a6d7dbef8989e1d78061312a28f906e8d685 (commit)
via cbce1e498c7c03fa90abd5fd8ade80388efc1f3f (commit)
via def0e21e1d79b55757534896fd810dbdd4019d95 (commit)
via c5eee130375dd816b5e5a94ac24d9b2b5a4bf168 (commit)
via 619a12314f7dee80aff4bdcdcabd4918300af001 (commit)
via 05404f10c561c4820f7ade3ac02489baaedb33ea (commit)
via d34bd097e24e5ed2ff2f741e0dd939c0450b7963 (commit)
via 5df4db8d8a90ee2b6dc54b7648e6f410e3a77815 (commit)
from 9910a9b5e922bd0493e5c76efb27474c4310ca34 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/gfxprim.git/commit/9e95a6d7dbef8989e1d78061312a28f906e8d6…
commit 9e95a6d7dbef8989e1d78061312a28f906e8d685
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 23:01:38 2015 +0100
demos: c_simple: x11_windows: Fix SYS_RESIZE handling
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c
index 1c5b2d0..aa37c7b 100644
--- a/demos/c_simple/x11_windows.c
+++ b/demos/c_simple/x11_windows.c
@@ -68,6 +68,8 @@ static int ev_loop(struct GP_Backend *backend, const char *name)
switch (ev.code) {
case GP_EV_SYS_RESIZE:
GP_BackendResizeAck(backend);
+ redraw(backend->context);
+ GP_BackendFlip(backend);
break;
case GP_EV_SYS_QUIT:
GP_BackendExit(backend);
http://repo.or.cz/gfxprim.git/commit/cbce1e498c7c03fa90abd5fd8ade80388efc1f…
commit cbce1e498c7c03fa90abd5fd8ade80388efc1f3f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:58:04 2015 +0100
demos: c_simple: virtual_backend_example: Handle SYS_RESIZE
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c
index 5ef5a8e..f59f4ec 100644
--- a/demos/c_simple/virtual_backend_example.c
+++ b/demos/c_simple/virtual_backend_example.c
@@ -31,11 +31,61 @@
#include <GP.h>
+static GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel;
+
+static void redraw(GP_Backend *backend)
+{
+ GP_Context *context = backend->context;
+
+ /* Now draw some testing patters */
+ black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
+ white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
+ red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, context);
+ blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, context);
+ green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, context);
+
+ GP_Fill(context, white_pixel);
+
+ unsigned int i, j;
+ for (i = 0; i < 40; i++) {
+ GP_HLineXYW(context, 0, i, i, black_pixel);
+ GP_HLineXYW(context, 1, i + 40, i, black_pixel);
+ GP_HLineXYW(context, 2, i + 80, i, black_pixel);
+ GP_HLineXYW(context, 3, i + 120, i, black_pixel);
+ GP_HLineXYW(context, 4, i + 160, i, black_pixel);
+ GP_HLineXYW(context, 5, i + 200, i, black_pixel);
+ GP_HLineXYW(context, 6, i + 240, i, black_pixel);
+ GP_HLineXYW(context, 7, i + 280, i, black_pixel);
+ }
+
+ for (i = 0; i < 256; i++) {
+ for (j = 0; j < 256; j++) {
+ uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5;
+
+ GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context);
+ GP_PutPixel(context, i + 60, j + 10, pix);
+ }
+ }
+
+ GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ black_pixel, white_pixel, "Lorem Ipsum dolor sit...");
+
+ GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ red_pixel, white_pixel, "Lorem Ipsum dolor sit...");
+
+ GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ green_pixel, white_pixel, "Lorem Ipsum dolor sit...");
+
+ GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
+ blue_pixel, white_pixel, "Lorem Ipsum dolor sit...");
+
+ /* Update the backend screen */
+ GP_BackendFlip(backend);
+}
+
int main(int argc, char *argv[])
{
GP_Backend *backend;
- GP_Context *context;
- GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel;
const char *backend_opts = "X11:350x350";
int opt;
GP_PixelType emul_type = GP_PIXEL_UNKNOWN;
@@ -90,52 +140,7 @@ int main(int argc, char *argv[])
backend = emul;
}
- context = backend->context;
-
- /* Now draw some testing patters */
- black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context);
- white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context);
- red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, context);
- blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, context);
- green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, context);
-
- GP_Fill(context, white_pixel);
-
- unsigned int i, j;
- for (i = 0; i < 40; i++) {
- GP_HLineXYW(context, 0, i, i, black_pixel);
- GP_HLineXYW(context, 1, i + 40, i, black_pixel);
- GP_HLineXYW(context, 2, i + 80, i, black_pixel);
- GP_HLineXYW(context, 3, i + 120, i, black_pixel);
- GP_HLineXYW(context, 4, i + 160, i, black_pixel);
- GP_HLineXYW(context, 5, i + 200, i, black_pixel);
- GP_HLineXYW(context, 6, i + 240, i, black_pixel);
- GP_HLineXYW(context, 7, i + 280, i, black_pixel);
- }
-
- for (i = 0; i < 256; i++) {
- for (j = 0; j < 256; j++) {
- uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5;
-
- GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context);
- GP_PutPixel(context, i + 60, j + 10, pix);
- }
- }
-
- GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
- black_pixel, white_pixel, "Lorem Ipsum dolor sit...");
-
- GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
- red_pixel, white_pixel, "Lorem Ipsum dolor sit...");
-
- GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
- green_pixel, white_pixel, "Lorem Ipsum dolor sit...");
-
- GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT,
- blue_pixel, white_pixel, "Lorem Ipsum dolor sit...");
-
- /* Update the backend screen */
- GP_BackendFlip(backend);
+ redraw(backend);
for (;;) {
if (backend->Poll)
@@ -159,6 +164,15 @@ int main(int argc, char *argv[])
return 0;
break;
}
+ break;
+ case GP_EV_SYS:
+ switch(ev.code) {
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(backend);
+ redraw(backend);
+ break;
+ }
+ break;
}
}
}
http://repo.or.cz/gfxprim.git/commit/def0e21e1d79b55757534896fd810dbdd4019d…
commit def0e21e1d79b55757534896fd810dbdd4019d95
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:53:03 2015 +0100
demos: c_simple: textaligntest: Handle SYS_RESIZE
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c
index 5e2fbd6..0c08140 100644
--- a/demos/c_simple/textaligntest.c
+++ b/demos/c_simple/textaligntest.c
@@ -144,6 +144,11 @@ static void event_loop(void)
GP_BackendExit(win);
exit(0);
break;
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(win);
+ X = win->context->w;
+ Y = win->context->h;
+ break;
}
break;
}
http://repo.or.cz/gfxprim.git/commit/c5eee130375dd816b5e5a94ac24d9b2b5a4bf1…
commit c5eee130375dd816b5e5a94ac24d9b2b5a4bf168
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:49:43 2015 +0100
demos: c_simple: showimage: Handle SYS_RESIZE
Adds SYS_RESIZE event handling and centers the image in the window.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c
index c78cff0..4934d4c 100644
--- a/demos/c_simple/showimage.c
+++ b/demos/c_simple/showimage.c
@@ -72,6 +72,19 @@ int main(int argc, char *argv[])
GP_BackendExit(backend);
return 0;
}
+
+ if (ev.type == GP_EV_SYS && ev.code == GP_EV_SYS_RESIZE) {
+ int cx, cy;
+
+ GP_BackendResizeAck(backend);
+
+ cx = ((int)backend->context->w - (int)image->w) / 2;
+ cy = ((int)backend->context->h - (int)image->h) / 2;
+
+ GP_Fill(backend->context, 0);
+ GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, cx, cy);
+ GP_BackendFlip(backend);
+ }
}
return 0;
http://repo.or.cz/gfxprim.git/commit/619a12314f7dee80aff4bdcdcabd4918300af0…
commit 619a12314f7dee80aff4bdcdcabd4918300af001
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:41:27 2015 +0100
demos: c_simple: fonttest: Handle SYS_RESIZE
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c
index 9a3aff1..7d6a7ca 100644
--- a/demos/c_simple/fonttest.c
+++ b/demos/c_simple/fonttest.c
@@ -244,6 +244,16 @@ void event_loop(void)
exit(0);
break;
}
+ break;
+ case GP_EV_SYS:
+ switch(ev.code) {
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(win);
+ redraw_screen();
+ GP_BackendFlip(win);
+ break;
+ }
+ break;
}
}
}
http://repo.or.cz/gfxprim.git/commit/05404f10c561c4820f7ade3ac02489baaedb33…
commit 05404f10c561c4820f7ade3ac02489baaedb33ea
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:39:38 2015 +0100
demos: c_simple: fileview: Handle SYS_RESIZE
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c
index 972514b..e33a74a 100644
--- a/demos/c_simple/fileview.c
+++ b/demos/c_simple/fileview.c
@@ -198,6 +198,11 @@ void event_loop(void)
GP_BackendExit(backend);
exit(0);
break;
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(backend);
+ redraw_screen();
+ GP_BackendFlip(backend);
+ break;
}
break;
}
http://repo.or.cz/gfxprim.git/commit/d34bd097e24e5ed2ff2f741e0dd939c0450b79…
commit d34bd097e24e5ed2ff2f741e0dd939c0450b7963
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:36:42 2015 +0100
demos: c_simple: blittest: Handle SYS_RESIZE
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c
index ecdb39a..362ef8b 100644
--- a/demos/c_simple/blittest.c
+++ b/demos/c_simple/blittest.c
@@ -131,6 +131,11 @@ void event_loop(void)
GP_BackendExit(win);
exit(0);
break;
+ case GP_EV_SYS_RESIZE:
+ GP_BackendResizeAck(win);
+ GP_Fill(win->context, black);
+ GP_BackendFlip(win);
+ break;
}
break;
}
http://repo.or.cz/gfxprim.git/commit/5df4db8d8a90ee2b6dc54b7648e6f410e3a778…
commit 5df4db8d8a90ee2b6dc54b7648e6f410e3a77815
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:33:15 2015 +0100
demos: c_simple: koch: Handle SYS_RESIZE
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c
index 5bb1538..27ce674 100644
--- a/demos/c_simple/koch.c
+++ b/demos/c_simple/koch.c
@@ -33,7 +33,7 @@
#include <GP.h>
-#define TIMER_TICK 10000
+#define TIMER_TICK 20000
#define DISPLAY_W 640
#define DISPLAY_H 480
#define sqr(x) ((x)*(x))
@@ -173,6 +173,10 @@ int main(void)
return 0;
break;
}
+ break;
+ case GP_EV_SYS:
+ if (ev.code == GP_EV_SYS_RESIZE)
+ GP_BackendResizeAck(backend);
}
}
usleep(TIMER_TICK);
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/blittest.c | 5 ++
demos/c_simple/fileview.c | 5 ++
demos/c_simple/fonttest.c | 10 +++
demos/c_simple/koch.c | 6 +-
demos/c_simple/showimage.c | 13 ++++
demos/c_simple/textaligntest.c | 5 ++
demos/c_simple/virtual_backend_example.c | 110 +++++++++++++++++--------------
demos/c_simple/x11_windows.c | 2 +
8 files changed, 107 insertions(+), 49 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
19 Dec '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 9910a9b5e922bd0493e5c76efb27474c4310ca34 (commit)
from e9d8edec450a97a0b8741273bb5d5e90fb94c821 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/gfxprim.git/commit/9910a9b5e922bd0493e5c76efb27474c4310ca…
commit 9910a9b5e922bd0493e5c76efb27474c4310ca34
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 19 22:28:16 2015 +0100
demos: c_simple: v4l2_show: Handle SYS_RESIZE
Adds SYS_RESIZE event handling and centers the image in the window.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c
index 97467b5..443d6d4 100644
--- a/demos/c_simple/v4l2_show.c
+++ b/demos/c_simple/v4l2_show.c
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
GP_Backend *backend;
GP_Grabber *grabber;
const char *v4l2_device = "/dev/video0";
- unsigned int w = 320, h = 240;
+ unsigned int w = 640, h = 480;
int mode = 0;
int opt;
@@ -113,7 +113,10 @@ int main(int argc, char *argv[])
break;
}
- GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, 0, 0);
+ unsigned int c_x = (backend->context->w - res->w) / 2;
+ unsigned int c_y = (backend->context->h - res->h) / 2;
+
+ GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, c_x, c_y);
GP_BackendFlip(backend);
if (mode)
@@ -150,6 +153,13 @@ int main(int argc, char *argv[])
mode = 0;
break;
}
+ break;
+ case GP_EV_SYS:
+ if (ev.code == GP_EV_SYS_RESIZE) {
+ GP_BackendResizeAck(backend);
+ GP_Fill(backend->context, 0);
+ }
+ break;
}
}
}
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/v4l2_show.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
09 Dec '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via e9d8edec450a97a0b8741273bb5d5e90fb94c821 (commit)
via ffbfb62987085873f5996218fdf3fbb7ae0390e4 (commit)
from 01cb569b20ec2962ccb1f4b845d2f396ad8b08df (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/gfxprim.git/commit/e9d8edec450a97a0b8741273bb5d5e90fb94c8…
commit e9d8edec450a97a0b8741273bb5d5e90fb94c821
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 9 14:47:15 2015 +0100
loaders: JPG: Fix read callback
Apparently when I/O read callback returns buffer of size 0 the libjpeg
segfaults. So we now return FALSE from the callback even when read
returns 0, which means end of the file when the underlying I/O is file
based.
Special thanks to the american fuzzy lop (afl).
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c
index 4921f24..9ac4630 100644
--- a/libs/loaders/GP_JPG.c
+++ b/libs/loaders/GP_JPG.c
@@ -156,8 +156,8 @@ static boolean fill_input_buffer(struct jpeg_decompress_struct *cinfo)
ret = GP_IORead(src->io, src->buffer, src->size);
- if (ret < 0) {
- GP_WARN("Failed to fill buffer");
+ if (ret <= 0) {
+ GP_WARN("Failed to fill buffer, IORead returned %i", ret);
return FALSE;
}
http://repo.or.cz/gfxprim.git/commit/ffbfb62987085873f5996218fdf3fbb7ae0390…
commit ffbfb62987085873f5996218fdf3fbb7ae0390e4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 9 14:11:17 2015 +0100
loaders: PCX: Make sure w < bytes_per_line * 8 / bpp
Fixes crash on inconsistent header where w > bytes_per_line * 8 / bpp.
Special thanks to the american fuzzy lop (afl).
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_PCX.c b/libs/loaders/GP_PCX.c
index 20c6b20..2304bbd 100644
--- a/libs/loaders/GP_PCX.c
+++ b/libs/loaders/GP_PCX.c
@@ -292,7 +292,7 @@ static int read_16_palette(GP_IO *io, struct pcx_header *header,
unsigned int i;
uint8_t b[header->bytes_per_line];
GP_Pixel palette[16];
- uint8_t idx=0, mask, mod;
+ uint8_t idx = 0, mask, mod;
for (i = 0; i < 16; i++) {
palette[i] = (GP_Pixel)header->palette[3*i] << 16;
@@ -543,6 +543,14 @@ int GP_ReadPCXEx(GP_IO *io, GP_Context **img, GP_DataStorage *storage,
w = header.xe - header.xs + 1;
h = header.ye - header.ys + 1;
+ uint32_t max_w = ((uint32_t)header.bytes_per_line * 8) / header.bpp;
+
+ if (w > max_w) {
+ GP_WARN("Truncating image width (%u) to "
+ "bytes_per_line * 8 / bpp (%"PRIu32")", w, max_w);
+ w = max_w;
+ }
+
res = GP_ContextAlloc(w, h, pixel_type);
if (!res) {
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_JPG.c | 4 ++--
libs/loaders/GP_PCX.c | 10 +++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0