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@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@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@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@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@gmail.com * - * * - * Copyright (C) 2009-2013 Cyril Hrubis metan@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@gmail.com * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@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@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@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/%5Blibpng 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.