ucw.cz
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
List overview
Download
Gfxprim
September 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
gfxprim@ucw.cz
1 participants
3 discussions
Start a n
N
ew thread
[repo.or.cz] gfxprim.git branch master updated: 1.0.0-rc1-183-gda4d05501970
by metan
29 Sep '17
29 Sep '17
This is an automated email generated because a ref change occurred in the git repository for project gfxprim.git. The branch, master has been updated via da4d05501970c57531ab9243239873c733993690 (commit) via 7d4836a776c798bab9ba8cb8a367c12d07d98ae7 (commit) from edf5e7cc9c3fece148b15f59939164d9017de42f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit da4d05501970c57531ab9243239873c733993690 Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 10:51:05 +0200 URL: <
http://repo.or.cz/gfxprim.git/da4d05501970c575
> demos: Add termini libvterm based terminal Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- configure | 3 + demos/Makefile | 4 + demos/termini/.gitignore | 1 + demos/termini/Makefile | 17 ++ demos/termini/runtest.sh | 9 + demos/termini/termini.c | 612 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 646 insertions(+) create mode 100644 demos/termini/.gitignore create mode 100644 demos/termini/Makefile create mode 100755 demos/termini/runtest.sh create mode 100644 demos/termini/termini.c diff --git a/configure b/configure index 7d7a3c056d4a..a01830e050d8 100755 --- a/configure +++ b/configure @@ -404,6 +404,9 @@ if __name__ == '__main__': ["V4L2", "Video for linux 2", [header_exists, "linux/videodev2.h"], "", "", ["grabbers"]], + ["libvterm", + "Implementation of a VT220/xterm/ECMA-48 terminal emulator", + [header_exists, "vterm.h"], "", "", [""]], ["pthread", "Posix Threads", [header_exists, "pthread.h"], "-pthread", "-pthread", ["core"]], diff --git a/demos/Makefile b/demos/Makefile index 1943f919b785..bf71c075d541 100644 --- a/demos/Makefile +++ b/demos/Makefile @@ -1,3 +1,7 @@ TOPDIR=.. +include $(TOPDIR)/config.gen.mk SUBDIRS=grinder spiv particle ttf2img c_simple bogoman +ifeq ($(HAVE_LIBVTERM),yes) +SUBDIRS+=termini +endif include $(TOPDIR)/post.mk diff --git a/demos/termini/.gitignore b/demos/termini/.gitignore new file mode 100644 index 000000000000..23409a7d1275 --- /dev/null +++ b/demos/termini/.gitignore @@ -0,0 +1 @@ +termini diff --git a/demos/termini/Makefile b/demos/termini/Makefile new file mode 100644 index 000000000000..f54364741e4d --- /dev/null +++ b/demos/termini/Makefile @@ -0,0 +1,17 @@ +TOPDIR=../.. +include $(TOPDIR)/pre.mk + +CSOURCES=$(shell echo *.c) + +INCLUDE= +LDFLAGS+=-L$(TOPDIR)/build/ + +LDLIBS+=-lgfxprim-backends -lgfxprim -lvterm -lutil + +APPS=termini + +INSTALL_BIN=termini + +include $(TOPDIR)/app.mk +include $(TOPDIR)/install.mk +include $(TOPDIR)/post.mk diff --git a/demos/termini/runtest.sh b/demos/termini/runtest.sh new file mode 100755 index 000000000000..dac7bc8b8671 --- /dev/null +++ b/demos/termini/runtest.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Run dynamically linked test. +# + +PROG="$1" +shift + +LD_LIBRARY_PATH=../../build/ ./$PROG "$@" diff --git a/demos/termini/termini.c b/demos/termini/termini.c new file mode 100644 index 000000000000..488bd8f73d4e --- /dev/null +++ b/demos/termini/termini.c @@ -0,0 +1,612 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2017 Cyril Hrubis <metan(a)ucw.cz> * + * * + *****************************************************************************/ + + /* + + TERMINI -- minimal terminal emulator. + + */ + +#include <stdio.h> +#include <fcntl.h> +#include <poll.h> +#include <pty.h> +#include <vterm.h> +#include <GP.h> + +static GP_Backend *backend; + +static VTerm *vt; +static VTermScreen *vts; + +static unsigned int cols; +static unsigned int rows; +static unsigned int char_width; +static unsigned int char_height; +static GP_TextStyle *text_style; +static GP_TextStyle *text_style_bold; + +static GP_Pixel colors[16]; + +/* delay before we repaint merged damage */ +static int repaint_sleep_ms = -1; + +/* HACK to draw frames */ +static void draw_utf8_frames(int x, int y, uint32_t val, GP_Pixel fg) +{ + switch (val) { + case 0x2500: /* Horizontal line */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width, fg); + break; + case 0x2502: /* Vertical line */ + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg); + break; + case 0x250c: /* Upper left corner */ + GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg); + break; + case 0x2510: /* Upper right corner */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg); + break; + case 0x2514: /* Bottom left corner */ + GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2, fg); + break; + case 0x2518: /* Bottom right corner */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2+1, fg); + break; + case 0x251c: /* Left vertical tee */ + GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg); + break; + case 0x2524: /* Right vertical tee */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg); + break; + default: + fprintf(stderr, "WARN: unhandled utf8 char %x\n", val); + } +} + +static void draw_cell(VTermPos pos) +{ + VTermScreenCell c; + + vterm_screen_get_cell(vts, pos, &c); + + GP_Pixel bg = colors[c.bg.red]; + GP_Pixel fg = colors[c.fg.red]; + + if (c.attrs.reverse) + GP_SWAP(bg, fg); + + char buf[2] = {c.chars[0], 0}; + + int x = pos.col * char_width; + int y = pos.row * char_height; + + GP_FillRectXYWH(backend->pixmap, x, y, char_width, char_height, bg); + + //fprintf(stderr, "Drawing %x %c %02i %02i\n", buf[0], buf[0], pos.row, pos.col); + + if (c.width > 1) + fprintf(stderr, "%i\n", c.width); + + if (c.chars[0] > 0x7f) { + draw_utf8_frames(x, y, c.chars[0], fg); + return; + } + + GP_TextStyle *style = c.attrs.bold ? text_style_bold : text_style; + + GP_Text(backend->pixmap, style, x, y, GP_ALIGN_RIGHT | GP_VALIGN_BELOW, fg, bg, buf); +} + +static void update_rect(VTermRect rect) +{ + int x = rect.start_col * char_width; + int y = rect.start_row * char_height; + int w = rect.end_col * char_width; + int h = rect.end_row * char_height; + + GP_BackendUpdateRectXYXY(backend, x, y, w, h); +} + +static VTermRect damaged; +static int damage_repainted = 1; + +static void merge_damage(VTermRect rect) +{ + if (damage_repainted) { + damaged = rect; + damage_repainted = 0; + return; + } + + damaged.start_col = GP_MIN(damaged.start_col, rect.start_col); + damaged.end_col = GP_MAX(damaged.end_col, rect.end_col); + + damaged.start_row = GP_MIN(damaged.start_row, rect.start_row); + damaged.end_row = GP_MAX(damaged.end_row, rect.end_row); + +} + +static void repaint_damage(void) +{ + int row, col; + + for (row = damaged.start_row; row < damaged.end_row; row++) { + for (col = damaged.start_col; col < damaged.end_col; col++) { + VTermPos pos = {.row = row, .col = col}; + draw_cell(pos); + } + } + + update_rect(damaged); + damage_repainted = 1; + repaint_sleep_ms = -1; +} + + +static int term_damage(VTermRect rect, void *user_data) +{ + (void)user_data; + + merge_damage(rect); +// fprintf(stderr, "rect: %i %i %i %i\n", rect.start_row, rect.end_row, rect.start_col, rect.end_col); + repaint_sleep_ms = 1; + + return 1; +} + +static int term_moverect(VTermRect dest, VTermRect src, void *user_data) +{ + (void)dest; + (void)src; + (void)user_data; + fprintf(stderr, "Move rect!\n"); + + return 0; +} + +static int term_movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user_data) +{ + (void)user_data; + unsigned int x = oldpos.col * char_width; + unsigned int y = oldpos.row * char_height; + + draw_cell(oldpos); + GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height); + + x = pos.col * char_width; + y = pos.row * char_height; + + GP_RectXYWH(backend->pixmap, x, y, char_width, char_height, 0xffffff); + GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height); + + //fprintf(stderr, "Move cursor %i %i -> %i %i!\n", oldpos.col, oldpos.row, pos.col, pos.row); + + //vterm_screen_flush_damage(vts); + + return 1; +} + +static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) +{ + (void)user_data; + + switch (prop) { + case VTERM_PROP_TITLE: + fprintf(stderr, "caption %s\n", val->string); + GP_BackendSetCaption(backend, val->string); + return 1; + case VTERM_PROP_ALTSCREEN: + fprintf(stderr, "altscreen\n"); + return 0; + case VTERM_PROP_ICONNAME: + fprintf(stderr, "iconname %s\n", val->string); + return 0; + case VTERM_PROP_CURSORSHAPE: + fprintf(stderr, "cursorshape %i\n", val->number); + return 0; + case VTERM_PROP_REVERSE: + fprintf(stderr, "reverse %i\n", val->boolean); + return 0; + case VTERM_PROP_CURSORVISIBLE: + fprintf(stderr, "cursorvisible %i\n", val->boolean); + return 0; + case VTERM_PROP_CURSORBLINK: + fprintf(stderr, "blink %i\n", val->boolean); + return 0; + case VTERM_PROP_MOUSE: + fprintf(stderr, "mouse %i\n", val->number); + return 0; + default: + break; + } + + fprintf(stderr, "Set term prop!\n"); + + return 0; +} + +static int term_screen_resize(int new_rows, int new_cols, void *user) +{ + (void)new_rows; + (void)new_cols; + (void)user; + + fprintf(stderr, "Resize %i %i\n", new_rows, new_cols); + + return 1; +} + +static int term_bell(void *user) +{ + (void)user; + fprintf(stderr, "Bell!\n"); + + return 1; +} + +static int term_sb_pushline(int cols, const VTermScreenCell *cells, void *user) +{ + (void)cols; + (void)cells; + (void)user; + + fprintf(stderr, "Pushline!\n"); + + return 0; +} + +static VTermScreenCallbacks screen_callbacks = { + .damage = term_damage, +// .moverect = term_moverect, + .movecursor = term_movecursor, + .settermprop = term_settermprop, + .bell = term_bell, +// .sb_pushline = term_sb_pushline, + .resize = term_screen_resize, +// .sb_popline = term_sb_popline, +}; + +static void term_init(void) +{ + int i; + + vt = vterm_new(rows, cols); + vterm_set_utf8(vt, 1); + + vts = vterm_obtain_screen(vt); + vterm_screen_enable_altscreen(vts, 1); + vterm_screen_set_callbacks(vts, &screen_callbacks, NULL); + VTermState *vs = vterm_obtain_state(vt); + vterm_state_set_bold_highbright(vs, 1); + + //vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_SCROLL); + //vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_ROW); + + /* We use the vterm color as an array index */ + for (i = 0; i < 16; i++) { + VTermColor col = {i, i, i}; + vterm_state_set_palette_color(vs, i, &col); + } + + VTermColor bg = {0, 0, 0}; + VTermColor fg = {7, 7, 7}; + + vterm_state_set_default_colors(vs, &fg, &bg); + + vterm_screen_reset(vts, 1); +} + +/* + * Forks and runs a shell, returns master fd. + */ +static int open_console(void) +{ + int fd, pid, flags; + + pid = forkpty(&fd, NULL, NULL, NULL); + if (pid < 0) + return -1; + + if (pid == 0) { + char *shell = getenv("SHELL"); + + if (!shell) + shell = "/bin/sh"; + + putenv("TERM=xterm"); + + execl(shell, shell, NULL); + } + + flags = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); + + return fd; +} + +static void close_console(int fd) +{ + close(fd); +} + +static int console_read(int fd) +{ + char buf[1024]; + int len; + + len = read(fd, buf, sizeof(buf)); + + if (len > 0) + vterm_input_write(vt, buf, len); + + return len; +} + +static void console_write(int fd, char *buf, int buf_len) +{ + write(fd, buf, buf_len); +} + +static void console_resize(int fd, int cols, int rows) +{ + struct winsize size = {rows, cols, 0, 0}; + ioctl(fd, TIOCSWINSZ, &size); +} + +static void do_exit(int fd) +{ + close_console(fd); + GP_BackendExit(backend); + vterm_free(vt); +} + +static void event_to_console(GP_Event *ev, int fd) +{ + int ctrl = GP_EventGetKey(ev, GP_KEY_RIGHT_CTRL) || + GP_EventGetKey(ev, GP_KEY_LEFT_CTRL); + + if (ctrl) { + if (ev->val.key.ascii >= 'a' && ev->val.key.ascii <= 'z') { + char buf = ev->val.key.ascii - 'a' + 1; + console_write(fd, &buf, 1); + } + return; + } + + if (ev->val.key.ascii) { + write(fd, &ev->val.key.ascii, 1); + return; + } + + switch (ev->val.key.key) { + case GP_KEY_UP: + console_write(fd, "\eOA", 3); + break; + case GP_KEY_DOWN: + console_write(fd, "\eOB", 3); + break; + case GP_KEY_RIGHT: + console_write(fd, "\eOC", 3); + break; + case GP_KEY_LEFT: + console_write(fd, "\eOD", 3); + break; + case GP_KEY_DELETE: + console_write(fd, "\e[3~", 4); + break; + case GP_KEY_PAGE_UP: + console_write(fd, "\e[5~", 4); + break; + case GP_KEY_PAGE_DOWN: + console_write(fd, "\e[6~", 4); + break; + case GP_KEY_HOME: + console_write(fd, "\e[7~", 4); + break; + case GP_KEY_END: + console_write(fd, "\e[8~", 4); + break; + case GP_KEY_F1: + console_write(fd, "\e[11~", 5); + break; + case GP_KEY_F2: + console_write(fd, "\e[12~", 5); + break; + case GP_KEY_F3: + console_write(fd, "\e[13~", 5); + break; + case GP_KEY_F4: + console_write(fd, "\e[14~", 5); + break; + case GP_KEY_F5: + console_write(fd, "\e[15~", 5); + break; + case GP_KEY_F6: + console_write(fd, "\e[17~", 5); + break; + case GP_KEY_F7: + console_write(fd, "\e[18~", 5); + break; + case GP_KEY_F8: + console_write(fd, "\e[19~", 5); + break; + case GP_KEY_F9: + console_write(fd, "\e[20~", 5); + break; + case GP_KEY_F10: + console_write(fd, "\e[21~", 5); + break; + case GP_KEY_F11: + console_write(fd, "\e[23~", 5); + break; + case GP_KEY_F12: + console_write(fd, "\e[24~", 5); + break; + } +} + +struct RGB { + uint8_t r; + uint8_t g; + uint8_t b; +}; + +struct RGB RGB_colors[16] = { + /* BLACK */ + {0x00, 0x00, 0x00}, + /* RED */ + {0xff, 0x00, 0x00}, + /* GREEN */ + {0x00, 0xff, 0x00}, + /* YELLOW */ + {0xff, 0xff, 0x00}, + /* BLUE */ + {0x00, 0x00, 0xff}, + /* MAGENTA */ + {0xff, 0x00, 0xff}, + /* CYAN */ + {0x00, 0xff, 0xff}, + /* GRAY */ + {0xee, 0xee, 0xee}, + + /* BRIGHT BLACK */ + {0x44, 0x44, 0x44}, + /* BRIGHT RED */ + {0xff, 0x44, 0x44}, + /* BRIGHT GREEN */ + {0x44, 0xff, 0x44}, + /* BRIGHT YELLOW */ + {0xff, 0xff, 0x44}, + /* BRIGHT BLUE */ + {0x44, 0x44, 0xff}, + /* BRIGHT MAGENTA */ + {0xff, 0x44, 0xff}, + /* BRIGHT CYAN */ + {0x44, 0xff, 0xff}, + /* WHITE */ + {0xff, 0xff, 0xff}, +}; + + +static void backend_init(void) +{ + int i; + + backend = GP_BackendInit("X11", "Termini"); + if (backend == NULL) { + fprintf(stderr, "Failed to initalize backend\n"); + exit(1); + } + + for (i = 0; i < 16; i++) { + colors[i] = GP_RGBToPixmapPixel(RGB_colors[i].r, + RGB_colors[i].g, + RGB_colors[i].b, + backend->pixmap); + } +} + +int main(int argc, char *argv[]) +{ + backend_init(); + + GP_TextStyle style = { + .font = GP_FontHaxorNarrow17, + //.font = &GP_DefaultConsoleFont, + .pixel_xmul = 1, + .pixel_ymul = 1, + }; + + GP_TextStyle style_bold = { + .font = GP_FontHaxorNarrowBold17, + //.font = &GP_DefaultConsoleFont, + .pixel_xmul = 1, + .pixel_ymul = 1, + }; + + text_style = &style; + text_style_bold = &style_bold; + + char_width = GP_TextMaxWidth(text_style, 1); + char_height = GP_TextHeight(text_style); + + cols = GP_PixmapW(backend->pixmap)/char_width; + rows = GP_PixmapH(backend->pixmap)/char_height; + + fprintf(stderr, "Cols %i Rows %i\n", cols, rows); + + term_init(); + + int fd = open_console(); + + struct pollfd fds[2] = { + {.fd = fd, .events = POLLIN}, + {.fd = backend->fd, .events = POLLIN} + }; + + for (;;) { + GP_Event ev; + + if (poll(fds, 2, repaint_sleep_ms) == 0) + repaint_damage(); + + while (GP_BackendPollEvent(backend, &ev)) { + switch (ev.type) { + case GP_EV_KEY: + if (ev.code == GP_EV_KEY_UP) + break; + + event_to_console(&ev, fd); + break; + case GP_EV_SYS: + switch (ev.code) { + case GP_EV_SYS_RESIZE: + GP_BackendResizeAck(backend); + cols = ev.val.sys.w/char_width; + rows = ev.val.sys.h/char_height; + vterm_set_size(vt, rows, cols); + console_resize(fd, cols, rows); + GP_Fill(backend->pixmap, 0); + VTermRect rect = {.start_row = 0, .start_col = 0, .end_row = rows, .end_col = cols}; + term_damage(rect, NULL); + //TODO cursor + break; + case GP_EV_SYS_QUIT: + do_exit(fd); + break; + } + break; + } + } + + console_read(fd); + } + + return 0; +} commit 7d4836a776c798bab9ba8cb8a367c12d07d98ae7 Author: Cyril Hrubis <metan(a)ucw.cz> Date: Fri, 29 Sep 2017 19:01:14 +0200 URL: <
http://repo.or.cz/gfxprim.git/7d4836a776c798ba
> text: Add HaxorNarrow fonts. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- build/syms/Text_symbols.txt | 6 + include/text/GP_Font.h | 9 +- include/text/GP_Fonts.h | 12 + libs/text/GP_HaxorNarrow15.c | 442 +++++++++++++++++++++++++++++++++++ libs/text/GP_HaxorNarrow16.c | 442 +++++++++++++++++++++++++++++++++++ libs/text/GP_HaxorNarrow17.c | 442 +++++++++++++++++++++++++++++++++++ libs/text/GP_Text.gen.c.t | 4 +- 7 files changed, 1352 insertions(+), 5 deletions(-) create mode 100644 libs/text/GP_HaxorNarrow15.c create mode 100644 libs/text/GP_HaxorNarrow16.c create mode 100644 libs/text/GP_HaxorNarrow17.c diff --git a/build/syms/Text_symbols.txt b/build/syms/Text_symbols.txt index 3b04747fb71c..21019ba20dfa 100644 --- a/build/syms/Text_symbols.txt +++ b/build/syms/Text_symbols.txt @@ -24,3 +24,9 @@ GP_DefaultConsoleFont GP_FontTiny GP_FontTinyMono GP_FontC64 +GP_FontHaxorNarrow15 +GP_FontHaxorNarrowBold15 +GP_FontHaxorNarrow16 +GP_FontHaxorNarrowBold16 +GP_FontHaxorNarrow17 +GP_FontHaxorNarrowBold17 diff --git a/include/text/GP_Font.h b/include/text/GP_Font.h index a6a584c22f99..e14e6cb12bc6 100644 --- a/include/text/GP_Font.h +++ b/include/text/GP_Font.h @@ -143,9 +143,12 @@ typedef struct GP_FontFace { /* * Offsets to the glyph data. * - * If glyph_offset[0] == 0, the table glyph_offsets holds - * offsets for all characters in glyphs. Otherwise the - * glyph_offset[0] defines step in the glyph table. + * If glyph_offset[0] == 0, the table glyph_offsets holds offsets for + * all characters in glyphs, the last offset i.e. offsets[len] holds + * the size of glyphs array. + * + * If glyph_offset[0] != 0 the glyph_offset[0] defines step in the + * glyph table. */ uint32_t glyph_offsets[]; } GP_FontFace; diff --git a/include/text/GP_Fonts.h b/include/text/GP_Fonts.h index 3a54da300bc8..b2176cd56451 100644 --- a/include/text/GP_Fonts.h +++ b/include/text/GP_Fonts.h @@ -44,4 +44,16 @@ extern const GP_FontFace *GP_FontTiny; */ extern const GP_FontFace *GP_FontC64; +/* + * HaxorNarrow family, converted from bdf fonts from: + * + *
https://github.com/metan-ucw/fonts
+ */ +extern const GP_FontFace *GP_FontHaxorNarrow15; +extern const GP_FontFace *GP_FontHaxorNarrowBold15; +extern const GP_FontFace *GP_FontHaxorNarrow16; +extern const GP_FontFace *GP_FontHaxorNarrowBold16; +extern const GP_FontFace *GP_FontHaxorNarrow17; +extern const GP_FontFace *GP_FontHaxorNarrowBold17; + #endif /* TEXT_GP_FONTS_H */ diff --git a/libs/text/GP_HaxorNarrow15.c b/libs/text/GP_HaxorNarrow15.c new file mode 100644 index 000000000000..1dffc3848246 --- /dev/null +++ b/libs/text/GP_HaxorNarrow15.c @@ -0,0 +1,442 @@ +/* Generated file, do not touch */ + +#include <text/GP_Font.h> + +static uint8_t font_glyphs[] = { + /* ' ' */ 0, 0, 0, 0, 8, + 0x00, 0x00, 0x00, + /* '!' */ 1, 11, 3, 11, 8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, + /* '"' */ 5, 4, 1, 12, 8, + 0xd8, 0x48, 0x48, 0x90, 0x00, 0x00, 0x00, + /* '#' */ 7, 10, 0, 10, 8, + 0x14, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x50, 0x00, + /* '$' */ 7, 11, 0, 11, 8, + 0x10, 0x7c, 0x92, 0x90, 0x90, 0x7c, 0x12, 0x12, 0x92, 0x7c, 0x10, + /* '%' */ 7, 11, 0, 11, 8, + 0x62, 0x92, 0x94, 0x68, 0x08, 0x10, 0x20, 0x2c, 0x52, 0x92, 0x8c, + /* '&' */ 7, 11, 0, 11, 8, + 0x30, 0x48, 0x48, 0x48, 0x30, 0x52, 0x8a, 0x8a, 0x86, 0x84, 0x7a, + /* ''' */ 2, 4, 2, 12, 8, + 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '(' */ 4, 13, 1, 12, 8, + 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x00, 0x00, + /* ')' */ 4, 13, 1, 12, 8, + 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00, + /* '*' */ 5, 6, 1, 9, 8, + 0x20, 0xa8, 0x70, 0x70, 0xa8, 0x20, 0x00, + /* '+' */ 7, 7, 0, 9, 8, + 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, + /* ',' */ 2, 4, 2, 3, 8, + 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '-' */ 5, 1, 1, 6, 8, + 0xf8, 0x00, 0x00, + /* '.' */ 2, 2, 2, 2, 8, + 0xc0, 0xc0, 0x00, + /* '/' */ 6, 11, 0, 11, 8, + 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, + /* '0' */ 6, 11, 0, 11, 8, + 0x30, 0x48, 0x84, 0x84, 0x94, 0xb4, 0xa4, 0x84, 0x84, 0x48, 0x30, + /* '1' */ 4, 11, 1, 11, 8, + 0x30, 0x50, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + /* '2' */ 5, 11, 1, 11, 8, + 0x70, 0x88, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xf8, + /* '3' */ 5, 11, 1, 11, 8, + 0x70, 0x88, 0x08, 0x08, 0x08, 0x30, 0x08, 0x08, 0x08, 0x88, 0x70, + /* '4' */ 6, 11, 1, 11, 8, + 0x08, 0x18, 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, + /* '5' */ 5, 11, 1, 11, 8, + 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70, + /* '6' */ 5, 11, 1, 11, 8, + 0x70, 0x88, 0x80, 0x80, 0xf0, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + /* '7' */ 5, 11, 1, 11, 8, + 0xf8, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, + /* '8' */ 5, 11, 1, 11, 8, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70, + /* '9' */ 5, 11, 1, 11, 8, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x78, 0x08, 0x08, 0x08, 0x88, 0x70, + /* ':' */ 2, 8, 2, 9, 8, + 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* ';' */ 2, 9, 2, 9, 8, + 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, 0x00, 0x00, + /* '<' */ 5, 9, 0, 10, 8, + 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, + /* '=' */ 6, 5, 0, 8, 8, + 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, + /* '>' */ 5, 9, 0, 10, 8, + 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, + /* '?' */ 6, 11, 0, 11, 8, + 0x78, 0x84, 0x04, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20, + /* '@' */ 6, 11, 0, 11, 8, + 0x78, 0x84, 0x84, 0x9c, 0xa4, 0xa4, 0xa4, 0x9c, 0x80, 0x80, 0x78, + /* 'A' */ 5, 11, 0, 11, 8, + 0x20, 0x50, 0x50, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x88, + /* 'B' */ 5, 11, 0, 11, 8, + 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, + /* 'C' */ 5, 11, 0, 11, 8, + 0x70, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70, + /* 'D' */ 5, 11, 0, 11, 8, + 0xe0, 0x90, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x90, 0xe0, + /* 'E' */ 5, 11, 0, 11, 8, + 0xf8, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0xf8, + /* 'F' */ 5, 11, 0, 11, 8, + 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + /* 'G' */ 5, 11, 0, 11, 8, + 0x70, 0x88, 0x80, 0x80, 0x80, 0x98, 0x88, 0x88, 0x88, 0x88, 0x70, + /* 'H' */ 5, 11, 0, 11, 8, + 0x88, 0x88, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x88, 0x88, + /* 'I' */ 3, 11, 1, 11, 8, + 0xe0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0, + /* 'J' */ 5, 11, 0, 11, 8, + 0xf8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x88, 0x70, + /* 'K' */ 5, 11, 0, 11, 8, + 0x88, 0x88, 0x90, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x90, 0x88, 0x88, + /* 'L' */ 5, 11, 0, 11, 8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, + /* 'M' */ 5, 11, 0, 11, 8, + 0x88, 0xd8, 0xd8, 0xa8, 0xa8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + /* 'N' */ 5, 11, 0, 11, 8, + 0x88, 0xc8, 0xc8, 0xa8, 0xa8, 0x98, 0x98, 0x88, 0x88, 0x88, 0x88, + /* 'O' */ 5, 11, 0, 11, 8, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + /* 'P' */ 5, 11, 0, 11, 8, + 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, + /* 'Q' */ 5, 11, 0, 11, 8, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, + /* 'R' */ 5, 11, 0, 11, 8, + 0xf0, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x90, 0x90, 0x88, 0x88, 0x88, + /* 'S' */ 5, 11, 0, 11, 8, + 0x70, 0x88, 0x80, 0x80, 0x40, 0x20, 0x10, 0x08, 0x08, 0x88, 0x70, + /* 'T' */ 5, 11, 0, 11, 8, + 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + /* 'U' */ 5, 11, 0, 11, 8, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, + /* 'V' */ 5, 11, 0, 11, 8, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x50, 0x50, 0x20, 0x20, + /* 'W' */ 7, 11, 0, 11, 8, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44, + /* 'X' */ 5, 11, 0, 11, 8, + 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x50, 0x50, 0x88, 0x88, 0x88, + /* 'Y' */ 5, 11, 0, 11, 8, + 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + /* 'Z' */ 5, 11, 0, 11, 8, + 0xf8, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, 0x40, 0x80, 0xf8, + /* '[' */ 3, 12, 1, 12, 8, + 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, 0x00, + /* '\' */ 6, 11, 0, 11, 8, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, + /* ']' */ 3, 12, 1, 12, 8, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, 0x00, + /* '^' */ 5, 4, 1, 11, 8, + 0x20, 0x50, 0x50, 0x88, 0x00, 0x00, 0x00, + /* '_' */ 6, 1, 0, 1, 8, + 0xfc, 0x00, 0x00, + /* '`' */ 3, 3, 1, 13, 8, + 0x80, 0x40, 0x20, + /* 'a' */ 5, 8, 0, 8, 8, + 0x70, 0x88, 0x08, 0x78, 0x88, 0x88, 0x98, 0x68, 0x00, 0x00, 0x00, + /* 'b' */ 5, 11, 0, 11, 8, + 0x80, 0x80, 0x80, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0xc8, 0xb0, + /* 'c' */ 5, 8, 0, 8, 8, + 0x70, 0x88, 0x80, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, 0x00, 0x00, + /* 'd' */ 5, 11, 0, 11, 8, + 0x08, 0x08, 0x08, 0x68, 0x98, 0x88, 0x88, 0x88, 0x88, 0x98, 0x68, + /* 'e' */ 5, 8, 0, 8, 8, + 0x70, 0x88, 0x88, 0xf8, 0x80, 0x80, 0x88, 0x70, 0x00, 0x00, 0x00, + /* 'f' */ 5, 11, 0, 11, 8, + 0x38, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + /* 'g' */ 6, 10, 0, 8, 8, + 0x7c, 0x88, 0x88, 0x88, 0x70, 0x80, 0x78, 0x84, 0x84, 0x78, 0x00, + /* 'h' */ 5, 11, 0, 11, 8, + 0x80, 0x80, 0x80, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + /* 'i' */ 5, 11, 0, 11, 8, + 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, + /* 'j' */ 5, 13, 0, 11, 8, + 0x08, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70, 0x00, 0x00, + /* 'k' */ 5, 11, 0, 11, 8, + 0x80, 0x80, 0x80, 0x88, 0x90, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x88, + /* 'l' */ 5, 11, 0, 11, 8, + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, + /* 'm' */ 5, 8, 0, 8, 8, + 0xf0, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, 0x00, 0x00, + /* 'n' */ 5, 8, 0, 8, 8, + 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, + /* 'o' */ 5, 8, 0, 8, 8, + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, + /* 'p' */ 5, 10, 0, 8, 8, + 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x88, 0xc8, 0xb0, 0x80, 0x80, 0x00, + /* 'q' */ 5, 10, 0, 8, 8, + 0x68, 0x98, 0x88, 0x88, 0x88, 0x88, 0x98, 0x68, 0x08, 0x08, 0x00, + /* 'r' */ 5, 8, 1, 8, 8, + 0xb0, 0xc8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, + /* 's' */ 5, 8, 0, 8, 8, + 0x70, 0x88, 0x80, 0x60, 0x10, 0x08, 0x88, 0x70, 0x00, 0x00, 0x00, + /* 't' */ 5, 11, 0, 11, 8, + 0x40, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x38, + /* 'u' */ 5, 8, 0, 8, 8, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x98, 0x68, 0x00, 0x00, 0x00, + /* 'v' */ 5, 8, 0, 8, 8, + 0x88, 0x88, 0x88, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, + /* 'w' */ 5, 8, 0, 8, 8, + 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xa8, 0x50, 0x50, 0x00, 0x00, 0x00, + /* 'x' */ 5, 8, 0, 8, 8, + 0x88, 0x88, 0x50, 0x20, 0x20, 0x50, 0x88, 0x88, 0x00, 0x00, 0x00, + /* 'y' */ 5, 11, 0, 8, 8, + 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x40, 0x40, 0x80, 0x80, + /* 'z' */ 5, 8, 0, 8, 8, + 0xf8, 0x08, 0x10, 0x20, 0x20, 0x40, 0x80, 0xf8, 0x00, 0x00, 0x00, + /* '{' */ 3, 13, 2, 12, 8, + 0x60, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x80, 0x80, 0x80, 0x60, 0x00, 0x00, + /* '|' */ 1, 11, 3, 11, 8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + /* '}' */ 3, 13, 3, 12, 8, + 0xc0, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, + /* '~' */ 7, 3, 0, 7, 8, + 0x60, 0x92, 0x0c, +}; + +static struct GP_FontFace font = { + .family_name = "HaxorNarrow15", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 13, + .descend = 3, + .max_glyph_width = 7, + .max_glyph_advance = 8, + .glyphs = &font_glyphs, + .glyph_offsets = { + 0x0000, 0x0008, 0x0018, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064, + 0x0070, 0x0084, 0x0098, 0x00a4, 0x00b0, 0x00bc, 0x00c4, 0x00cc, + 0x00dc, 0x00ec, 0x00fc, 0x010c, 0x011c, 0x012c, 0x013c, 0x014c, + 0x015c, 0x016c, 0x017c, 0x018c, 0x019c, 0x01ac, 0x01b8, 0x01c8, + 0x01d8, 0x01e8, 0x01f8, 0x0208, 0x0218, 0x0228, 0x0238, 0x0248, + 0x0258, 0x0268, 0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8, + 0x02d8, 0x02e8, 0x02f8, 0x0308, 0x0318, 0x0328, 0x0338, 0x0348, + 0x0358, 0x0368, 0x0378, 0x0388, 0x039c, 0x03ac, 0x03c0, 0x03cc, + 0x03d4, 0x03dc, 0x03ec, 0x03fc, 0x040c, 0x041c, 0x042c, 0x043c, + 0x044c, 0x045c, 0x046c, 0x0480, 0x0490, 0x04a0, 0x04b0, 0x04c0, + 0x04d0, 0x04e0, 0x04f0, 0x0500, 0x0510, 0x0520, 0x0530, 0x0540, + 0x0550, 0x0560, 0x0570, 0x0580, 0x0594, 0x05a4, 0x05b8, 0x05c0, + } +}; + +const struct GP_FontFace *GP_FontHaxorNarrow15 = &font; +static uint8_t font_bold_glyphs[] = { + /* ' ' */ 0, 0, 0, 0, 8, + 0x00, 0x00, 0x00, + /* '!' */ 2, 11, 3, 11, 8, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, + /* '"' */ 6, 4, 1, 12, 8, + 0xfc, 0x6c, 0x6c, 0xd8, 0x00, 0x00, 0x00, + /* '#' */ 7, 10, 0, 10, 8, + 0x1e, 0x1e, 0x1e, 0x7f, 0x3c, 0x3c, 0xfe, 0x78, 0x78, 0x78, 0x00, + /* '$' */ 7, 11, 0, 11, 8, + 0x18, 0x7e, 0xdb, 0xd8, 0xd8, 0x7e, 0x1b, 0x1b, 0xdb, 0x7e, 0x18, + /* '%' */ 7, 11, 0, 11, 8, + 0x73, 0xdb, 0xde, 0x7c, 0x0c, 0x18, 0x30, 0x3e, 0x7b, 0xdb, 0xce, + /* '&' */ 7, 11, 0, 11, 8, + 0x38, 0x6c, 0x6c, 0x6c, 0x38, 0x7b, 0xcf, 0xcf, 0xc7, 0xc6, 0x7f, + /* ''' */ 3, 4, 2, 12, 8, + 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + /* '(' */ 5, 13, 1, 12, 8, + 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x18, 0x00, 0x00, + /* ')' */ 5, 13, 1, 12, 8, + 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, 0x00, 0x00, + /* '*' */ 6, 6, 1, 9, 8, + 0x30, 0xfc, 0x78, 0x78, 0xfc, 0x30, 0x00, + /* '+' */ 7, 7, 0, 9, 8, + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, + /* ',' */ 3, 4, 2, 3, 8, + 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + /* '-' */ 6, 1, 1, 6, 8, + 0xfc, 0x00, 0x00, + /* '.' */ 3, 2, 2, 2, 8, + 0xe0, 0xe0, 0x00, + /* '/' */ 7, 11, 0, 11, 8, + 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0, + /* '0' */ 7, 11, 0, 11, 8, + 0x38, 0x6c, 0xc6, 0xc6, 0xde, 0xfe, 0xf6, 0xc6, 0xc6, 0x6c, 0x38, + /* '1' */ 5, 11, 1, 11, 8, + 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + /* '2' */ 6, 11, 1, 11, 8, + 0x78, 0xcc, 0x0c, 0x0c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfc, + /* '3' */ 6, 11, 1, 11, 8, + 0x78, 0xcc, 0x0c, 0x0c, 0x0c, 0x38, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, + /* '4' */ 7, 11, 1, 11, 8, + 0x0c, 0x1c, 0x1c, 0x3c, 0x6c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, + /* '5' */ 6, 11, 1, 11, 8, + 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, + /* '6' */ 6, 11, 1, 11, 8, + 0x78, 0xcc, 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, + /* '7' */ 6, 11, 1, 11, 8, + 0xfc, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, + /* '8' */ 6, 11, 1, 11, 8, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, + /* '9' */ 6, 11, 1, 11, 8, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, + /* ':' */ 3, 8, 2, 9, 8, + 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00, + /* ';' */ 3, 9, 2, 9, 8, + 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 0xc0, 0x00, 0x00, + /* '<' */ 6, 9, 0, 10, 8, + 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, + /* '=' */ 7, 5, 0, 8, 8, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, + /* '>' */ 6, 9, 0, 10, 8, + 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, + /* '?' */ 7, 11, 0, 11, 8, + 0x7c, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x30, 0x30, + /* '@' */ 7, 11, 0, 11, 8, + 0x7c, 0xc6, 0xc6, 0xde, 0xf6, 0xf6, 0xf6, 0xde, 0xc0, 0xc0, 0x7c, + /* 'A' */ 6, 11, 0, 11, 8, + 0x30, 0x78, 0x78, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, + /* 'B' */ 6, 11, 0, 11, 8, + 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, + /* 'C' */ 6, 11, 0, 11, 8, + 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, + /* 'D' */ 6, 11, 0, 11, 8, + 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0, + /* 'E' */ 6, 11, 0, 11, 8, + 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, + /* 'F' */ 6, 11, 0, 11, 8, + 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, + /* 'G' */ 6, 11, 0, 11, 8, + 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, + /* 'H' */ 6, 11, 0, 11, 8, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + /* 'I' */ 4, 11, 1, 11, 8, + 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, + /* 'J' */ 6, 11, 0, 11, 8, + 0xfc, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, + /* 'K' */ 6, 11, 0, 11, 8, + 0xcc, 0xcc, 0xd8, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xd8, 0xcc, 0xcc, + /* 'L' */ 6, 11, 0, 11, 8, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, + /* 'M' */ 6, 11, 0, 11, 8, + 0xcc, 0xfc, 0xfc, 0xfc, 0xfc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + /* 'N' */ 6, 11, 0, 11, 8, + 0xcc, 0xec, 0xec, 0xfc, 0xfc, 0xdc, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, + /* 'O' */ 6, 11, 0, 11, 8, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, + /* 'P' */ 6, 11, 0, 11, 8, + 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, + /* 'Q' */ 6, 11, 0, 11, 8, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xd8, 0x7c, + /* 'R' */ 6, 11, 0, 11, 8, + 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xd8, 0xd8, 0xcc, 0xcc, 0xcc, + /* 'S' */ 6, 11, 0, 11, 8, + 0x78, 0xcc, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x0c, 0xcc, 0x78, + /* 'T' */ 6, 11, 0, 11, 8, + 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + /* 'U' */ 6, 11, 0, 11, 8, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, + /* 'V' */ 6, 11, 0, 11, 8, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x78, 0x78, 0x30, 0x30, + /* 'W' */ 7, 11, 0, 11, 8, + 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0x66, 0x66, + /* 'X' */ 6, 11, 0, 11, 8, + 0xcc, 0xcc, 0x78, 0x78, 0x30, 0x30, 0x78, 0x78, 0xcc, 0xcc, 0xcc, + /* 'Y' */ 6, 11, 0, 11, 8, + 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + /* 'Z' */ 6, 11, 0, 11, 8, + 0xfc, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xfc, + /* '[' */ 4, 12, 1, 12, 8, + 0xf0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x00, 0x00, 0x00, + /* '\' */ 7, 11, 0, 11, 8, + 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, + /* ']' */ 4, 12, 1, 12, 8, + 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x00, 0x00, 0x00, + /* '^' */ 6, 4, 1, 11, 8, + 0x30, 0x78, 0x78, 0xcc, 0x00, 0x00, 0x00, + /* '_' */ 7, 1, 0, 1, 8, + 0xfe, 0x00, 0x00, + /* '`' */ 4, 3, 1, 13, 8, + 0xc0, 0x60, 0x30, + /* 'a' */ 6, 8, 0, 8, 8, + 0x78, 0xcc, 0x0c, 0x7c, 0xcc, 0xcc, 0xdc, 0x7c, 0x00, 0x00, 0x00, + /* 'b' */ 6, 11, 0, 11, 8, + 0xc0, 0xc0, 0xc0, 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xf8, + /* 'c' */ 6, 8, 0, 8, 8, + 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00, + /* 'd' */ 6, 11, 0, 11, 8, + 0x0c, 0x0c, 0x0c, 0x7c, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7c, + /* 'e' */ 6, 8, 0, 8, 8, + 0x78, 0xcc, 0xcc, 0xfc, 0xc0, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00, + /* 'f' */ 6, 11, 0, 11, 8, + 0x3c, 0x60, 0x60, 0xfc, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + /* 'g' */ 7, 10, 0, 8, 8, + 0x7e, 0xcc, 0xcc, 0xcc, 0x78, 0xc0, 0x7c, 0xc6, 0xc6, 0x7c, 0x00, + /* 'h' */ 6, 11, 0, 11, 8, + 0xc0, 0xc0, 0xc0, 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + /* 'i' */ 6, 11, 0, 11, 8, + 0x30, 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, + /* 'j' */ 6, 13, 0, 11, 8, + 0x0c, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, 0x00, 0x00, + /* 'k' */ 6, 11, 0, 11, 8, + 0xc0, 0xc0, 0xc0, 0xcc, 0xd8, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xcc, + /* 'l' */ 6, 11, 0, 11, 8, + 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, + /* 'm' */ 6, 8, 0, 8, 8, + 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, + /* 'n' */ 6, 8, 0, 8, 8, + 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, + /* 'o' */ 6, 8, 0, 8, 8, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, + /* 'p' */ 6, 10, 0, 8, 8, + 0xf8, 0xec, 0xcc, 0xcc, 0xcc, 0xcc, 0xec, 0xf8, 0xc0, 0xc0, 0x00, + /* 'q' */ 6, 10, 0, 8, 8, + 0x7c, 0xdc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7c, 0x0c, 0x0c, 0x00, + /* 'r' */ 6, 8, 1, 8, 8, + 0xf8, 0xec, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* 's' */ 6, 8, 0, 8, 8, + 0x78, 0xcc, 0xc0, 0x70, 0x18, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, + /* 't' */ 6, 11, 0, 11, 8, + 0x60, 0x60, 0x60, 0xfc, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x3c, + /* 'u' */ 6, 8, 0, 8, 8, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7c, 0x00, 0x00, 0x00, + /* 'v' */ 6, 8, 0, 8, 8, + 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x78, 0x30, 0x30, 0x00, 0x00, 0x00, + /* 'w' */ 6, 8, 0, 8, 8, + 0xcc, 0xcc, 0xcc, 0xfc, 0xfc, 0xfc, 0x78, 0x78, 0x00, 0x00, 0x00, + /* 'x' */ 6, 8, 0, 8, 8, + 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0xcc, 0xcc, 0x00, 0x00, 0x00, + /* 'y' */ 6, 11, 0, 8, 8, + 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x78, 0x30, 0x60, 0x60, 0xc0, 0xc0, + /* 'z' */ 6, 8, 0, 8, 8, + 0xfc, 0x0c, 0x18, 0x30, 0x30, 0x60, 0xc0, 0xfc, 0x00, 0x00, 0x00, + /* '{' */ 4, 13, 2, 12, 8, + 0x70, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x70, 0x00, 0x00, + /* '|' */ 2, 11, 3, 11, 8, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, + /* '}' */ 4, 13, 3, 12, 8, + 0xe0, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00, + /* '~' */ 7, 3, 0, 7, 8, + 0x70, 0xdb, 0x0e, +}; + +static struct GP_FontFace font_bold = { + .family_name = "HaxorNarrowBold15", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 13, + .descend = 3, + .max_glyph_width = 7, + .max_glyph_advance = 8, + .glyphs = &font_bold_glyphs, + .glyph_offsets = { + 0x0000, 0x0008, 0x0018, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064, + 0x0070, 0x0084, 0x0098, 0x00a4, 0x00b0, 0x00bc, 0x00c4, 0x00cc, + 0x00dc, 0x00ec, 0x00fc, 0x010c, 0x011c, 0x012c, 0x013c, 0x014c, + 0x015c, 0x016c, 0x017c, 0x018c, 0x019c, 0x01ac, 0x01b8, 0x01c8, + 0x01d8, 0x01e8, 0x01f8, 0x0208, 0x0218, 0x0228, 0x0238, 0x0248, + 0x0258, 0x0268, 0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8, + 0x02d8, 0x02e8, 0x02f8, 0x0308, 0x0318, 0x0328, 0x0338, 0x0348, + 0x0358, 0x0368, 0x0378, 0x0388, 0x039c, 0x03ac, 0x03c0, 0x03cc, + 0x03d4, 0x03dc, 0x03ec, 0x03fc, 0x040c, 0x041c, 0x042c, 0x043c, + 0x044c, 0x045c, 0x046c, 0x0480, 0x0490, 0x04a0, 0x04b0, 0x04c0, + 0x04d0, 0x04e0, 0x04f0, 0x0500, 0x0510, 0x0520, 0x0530, 0x0540, + 0x0550, 0x0560, 0x0570, 0x0580, 0x0594, 0x05a4, 0x05b8, 0x05c0, + } +}; + +const struct GP_FontFace *GP_FontHaxorNarrowBold15 = &font_bold; diff --git a/libs/text/GP_HaxorNarrow16.c b/libs/text/GP_HaxorNarrow16.c new file mode 100644 index 000000000000..ee5ad84b7371 --- /dev/null +++ b/libs/text/GP_HaxorNarrow16.c @@ -0,0 +1,442 @@ +/* Generated file, do not touch */ + +#include <text/GP_Font.h> + +static uint8_t font_glyphs[] = { + /* ' ' */ 0, 0, 0, 0, 9, + 0x00, 0x00, 0x00, + /* '!' */ 1, 12, 4, 12, 9, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, + /* '"' */ 7, 4, 0, 12, 9, + 0xee, 0x22, 0x22, 0x44, 0x00, 0x00, 0x00, + /* '#' */ 8, 11, 0, 11, 9, + 0x12, 0x12, 0x12, 0x7f, 0x24, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x48, + /* '$' */ 7, 12, 0, 12, 9, + 0x10, 0x7c, 0x92, 0x90, 0x90, 0x70, 0x1c, 0x12, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, 0x00, + /* '%' */ 7, 12, 0, 12, 9, + 0x62, 0x92, 0x94, 0x64, 0x08, 0x10, 0x10, 0x20, 0x4c, 0x52, 0x92, 0x8c, 0x00, 0x00, 0x00, + /* '&' */ 7, 12, 0, 12, 9, + 0x30, 0x48, 0x48, 0x48, 0x30, 0x60, 0xd2, 0x92, 0x8a, 0x8a, 0xc4, 0x7a, 0x00, 0x00, 0x00, + /* ''' */ 2, 4, 2, 12, 9, + 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '(' */ 4, 14, 1, 13, 9, + 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x00, + /* ')' */ 4, 14, 1, 13, 9, + 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00, + /* '*' */ 5, 6, 1, 10, 9, + 0x20, 0xa8, 0x70, 0x70, 0xa8, 0x20, 0x00, + /* '+' */ 7, 7, 0, 9, 9, + 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, + /* ',' */ 2, 4, 2, 3, 9, + 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '-' */ 5, 1, 1, 6, 9, + 0xf8, 0x00, 0x00, + /* '.' */ 2, 3, 2, 3, 9, + 0xc0, 0xc0, 0xc0, + /* '/' */ 5, 12, 1, 12, 9, + 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00, + /* '0' */ 7, 12, 0, 12, 9, + 0x38, 0x44, 0x82, 0x82, 0x8a, 0x92, 0x92, 0xa2, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, + /* '1' */ 4, 12, 1, 12, 9, + 0x30, 0x50, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* '2' */ 6, 12, 1, 12, 9, + 0x78, 0x84, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfc, 0x00, 0x00, 0x00, + /* '3' */ 6, 12, 1, 12, 9, + 0x78, 0x84, 0x04, 0x04, 0x04, 0x38, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00, + /* '4' */ 6, 12, 1, 12, 9, + 0x08, 0x18, 0x18, 0x28, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, + /* '5' */ 6, 12, 1, 12, 9, + 0xfc, 0x80, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00, + /* '6' */ 6, 12, 1, 12, 9, + 0x78, 0x84, 0x80, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, + /* '7' */ 6, 12, 1, 12, 9, + 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + /* '8' */ 6, 12, 1, 12, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, + /* '9' */ 6, 12, 1, 12, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00, + /* ':' */ 2, 8, 3, 9, 9, + 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* ';' */ 2, 9, 3, 9, 9, + 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, 0x00, 0x00, + /* '<' */ 5, 9, 1, 10, 9, + 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, + /* '=' */ 6, 5, 0, 8, 9, + 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, + /* '>' */ 5, 9, 1, 10, 9, + 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, + /* '?' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, + /* '@' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x84, 0x84, 0x9c, 0xa4, 0xa4, 0xa4, 0x9c, 0x80, 0x80, 0x78, 0x00, 0x00, 0x00, + /* 'A' */ 6, 12, 0, 12, 9, + 0x30, 0x48, 0x48, 0x48, 0x84, 0x84, 0x84, 0xfc, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'B' */ 6, 12, 0, 12, 9, + 0xf8, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00, 0x00, + /* 'C' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, 0x00, + /* 'D' */ 6, 12, 0, 12, 9, + 0xf0, 0x88, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x88, 0xf0, 0x00, 0x00, 0x00, + /* 'E' */ 5, 12, 0, 12, 9, + 0xf8, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00, 0x00, 0x00, + /* 'F' */ 5, 12, 0, 12, 9, + 0xf8, 0x80, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, + /* 'G' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x8c, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, + /* 'H' */ 6, 12, 0, 12, 9, + 0x84, 0x84, 0x84, 0x84, 0x84, 0xfc, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'I' */ 5, 12, 0, 12, 9, + 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, 0x00, + /* 'J' */ 6, 12, 0, 12, 9, + 0xfc, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, + /* 'K' */ 6, 12, 0, 12, 9, + 0x84, 0x84, 0x88, 0x90, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x88, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'L' */ 6, 12, 0, 12, 9, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, 0x00, + /* 'M' */ 7, 12, 0, 12, 9, + 0x82, 0xc6, 0xaa, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, + /* 'N' */ 6, 12, 0, 12, 9, + 0x84, 0xc4, 0xa4, 0xa4, 0x94, 0x94, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'O' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, + /* 'P' */ 6, 12, 0, 12, 9, + 0xf8, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, + /* 'Q' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x94, 0x88, 0x74, 0x00, 0x00, 0x00, + /* 'R' */ 6, 12, 0, 12, 9, + 0xf8, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x88, 0x88, 0x88, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'S' */ 6, 12, 0, 12, 9, + 0x78, 0x84, 0x80, 0x80, 0x40, 0x30, 0x08, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, 0x00, + /* 'T' */ 7, 12, 0, 12, 9, + 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* 'U' */ 6, 12, 0, 12, 9, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, + /* 'V' */ 7, 12, 0, 12, 9, + 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, + /* 'W' */ 7, 12, 0, 12, 9, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x00, 0x00, 0x00, + /* 'X' */ 7, 12, 0, 12, 9, + 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, 0x10, 0x28, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, 0x00, + /* 'Y' */ 7, 12, 0, 12, 9, + 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* 'Z' */ 6, 12, 0, 12, 9, + 0xfc, 0x04, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfc, 0x00, 0x00, 0x00, + /* '[' */ 3, 13, 2, 13, 9, + 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, + /* '\' */ 5, 12, 1, 12, 9, + 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, 0x00, + /* ']' */ 3, 13, 2, 13, 9, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, + /* '^' */ 5, 5, 1, 12, 9, + 0x20, 0x50, 0x50, 0x88, 0x88, 0x00, 0x00, + /* '_' */ 7, 1, 0, 1, 9, + 0xfe, 0x00, 0x00, + /* '`' */ 3, 3, 1, 13, 9, + 0x80, 0x40, 0x20, + /* 'a' */ 6, 9, 0, 9, 9, + 0x78, 0x84, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00, + /* 'b' */ 6, 12, 0, 12, 9, + 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x00, 0x00, 0x00, + /* 'c' */ 6, 9, 0, 9, 9, + 0x78, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, + /* 'd' */ 6, 12, 0, 12, 9, + 0x04, 0x04, 0x04, 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00, 0x00, + /* 'e' */ 6, 9, 0, 9, 9, + 0x78, 0x84, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, + /* 'f' */ 6, 12, 0, 12, 9, + 0x1c, 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + /* 'g' */ 7, 12, 0, 9, 9, + 0x7e, 0x84, 0x84, 0x84, 0x78, 0x80, 0x80, 0x7c, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, + /* 'h' */ 6, 12, 0, 12, 9, + 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'i' */ 5, 12, 1, 12, 9, + 0x20, 0x00, 0x00, 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, 0x00, + /* 'j' */ 5, 14, 1, 12, 9, + 0x08, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70, 0x00, + /* 'k' */ 6, 12, 0, 12, 9, + 0x80, 0x80, 0x80, 0x84, 0x88, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x84, 0x84, 0x00, 0x00, 0x00, + /* 'l' */ 5, 12, 1, 12, 9, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, 0x00, + /* 'm' */ 7, 9, 0, 9, 9, + 0xec, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, + /* 'n' */ 6, 9, 0, 9, 9, + 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, + /* 'o' */ 6, 9, 0, 9, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* 'p' */ 6, 12, 0, 9, 9, + 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, + /* 'q' */ 6, 12, 0, 9, 9, + 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + /* 'r' */ 6, 9, 0, 9, 9, + 0xb8, 0xc4, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 's' */ 6, 9, 0, 9, 9, + 0x78, 0x84, 0x80, 0x80, 0x78, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, + /* 't' */ 6, 12, 0, 12, 9, + 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, 0x00, + /* 'u' */ 6, 9, 0, 9, 9, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00, + /* 'v' */ 7, 9, 0, 9, 9, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x00, 0x00, + /* 'w' */ 7, 9, 0, 9, 9, + 0x82, 0x82, 0x82, 0x82, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x00, 0x00, + /* 'x' */ 7, 9, 0, 9, 9, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, + /* 'y' */ 7, 12, 0, 9, 9, + 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, + /* 'z' */ 6, 9, 0, 9, 9, + 0xfc, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00, + /* '{' */ 3, 13, 2, 13, 9, + 0x60, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x80, 0x80, 0x80, 0x60, 0x00, 0x00, + /* '|' */ 1, 12, 3, 12, 9, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, + /* '}' */ 3, 13, 3, 13, 9, + 0xc0, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, + /* '~' */ 7, 3, 0, 7, 9, + 0x60, 0x92, 0x0c, +}; + +static struct GP_FontFace font = { + .family_name = "HaxorNarrow16", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 15, + .descend = 3, + .max_glyph_width = 8, + .max_glyph_advance = 9, + .glyphs = &font_glyphs, + .glyph_offsets = { + 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074, + 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc, + 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c, + 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204, + 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4, + 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344, + 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4, + 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c, + 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8, + 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590, + 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c, + 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4, + } +}; + +const struct GP_FontFace *GP_FontHaxorNarrow16 = &font; +static uint8_t font_bold_glyphs[] = { + /* ' ' */ 0, 0, 0, 0, 9, + 0x00, 0x00, 0x00, + /* '!' */ 2, 12, 4, 12, 9, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* '"' */ 8, 4, 0, 12, 9, + 0xff, 0x33, 0x33, 0x66, 0x00, 0x00, 0x00, + /* '#' */ 8, 11, 0, 11, 9, + 0x1b, 0x1b, 0x1b, 0x7f, 0x36, 0x36, 0x36, 0xff, 0x6c, 0x6c, 0x6c, + /* '$' */ 8, 12, 0, 12, 9, + 0x18, 0x7e, 0xdb, 0xd8, 0xd8, 0x78, 0x1e, 0x1b, 0x1b, 0xdb, 0x7e, 0x18, 0x00, 0x00, 0x00, + /* '%' */ 8, 12, 0, 12, 9, + 0x73, 0xdb, 0xde, 0x76, 0x0c, 0x18, 0x18, 0x30, 0x6e, 0x7b, 0xdb, 0xce, 0x00, 0x00, 0x00, + /* '&' */ 8, 12, 0, 12, 9, + 0x38, 0x6c, 0x6c, 0x6c, 0x38, 0x70, 0xfb, 0xdb, 0xcf, 0xcf, 0xe6, 0x7f, 0x00, 0x00, 0x00, + /* ''' */ 3, 4, 2, 12, 9, + 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + /* '(' */ 5, 14, 1, 13, 9, + 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x18, 0x00, + /* ')' */ 5, 14, 1, 13, 9, + 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, 0x00, + /* '*' */ 6, 6, 1, 10, 9, + 0x30, 0xfc, 0x78, 0x78, 0xfc, 0x30, 0x00, + /* '+' */ 8, 7, 0, 9, 9, + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, + /* ',' */ 3, 4, 2, 3, 9, + 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + /* '-' */ 6, 1, 1, 6, 9, + 0xfc, 0x00, 0x00, + /* '.' */ 3, 3, 2, 3, 9, + 0xe0, 0xe0, 0xe0, + /* '/' */ 6, 12, 1, 12, 9, + 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* '0' */ 8, 12, 0, 12, 9, + 0x3c, 0x66, 0xc3, 0xc3, 0xcf, 0xdb, 0xdb, 0xf3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, + /* '1' */ 5, 12, 1, 12, 9, + 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, + /* '2' */ 7, 12, 1, 12, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, + /* '3' */ 7, 12, 1, 12, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* '4' */ 7, 12, 1, 12, 9, + 0x0c, 0x1c, 0x1c, 0x3c, 0x3c, 0x6c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, + /* '5' */ 7, 12, 1, 12, 9, + 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* '6' */ 7, 12, 1, 12, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* '7' */ 7, 12, 1, 12, 9, + 0xfe, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, + /* '8' */ 7, 12, 1, 12, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* '9' */ 7, 12, 1, 12, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* ':' */ 3, 8, 3, 9, 9, + 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00, + /* ';' */ 3, 9, 3, 9, 9, + 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 0xc0, 0x00, 0x00, + /* '<' */ 6, 9, 1, 10, 9, + 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, + /* '=' */ 7, 5, 0, 8, 9, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, + /* '>' */ 6, 9, 1, 10, 9, + 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, + /* '?' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, + /* '@' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xf6, 0xf6, 0xf6, 0xde, 0xc0, 0xc0, 0x7c, 0x00, 0x00, 0x00, + /* 'A' */ 7, 12, 0, 12, 9, + 0x38, 0x6c, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'B' */ 7, 12, 0, 12, 9, + 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, 0x00, + /* 'C' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* 'D' */ 7, 12, 0, 12, 9, + 0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x00, 0x00, 0x00, + /* 'E' */ 6, 12, 0, 12, 9, + 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0x00, 0x00, 0x00, + /* 'F' */ 6, 12, 0, 12, 9, + 0xfc, 0xc0, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* 'G' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xce, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* 'H' */ 7, 12, 0, 12, 9, + 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'I' */ 6, 12, 0, 12, 9, + 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00, + /* 'J' */ 7, 12, 0, 12, 9, + 0xfe, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* 'K' */ 7, 12, 0, 12, 9, + 0xc6, 0xc6, 0xcc, 0xd8, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xcc, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'L' */ 7, 12, 0, 12, 9, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, + /* 'M' */ 8, 12, 0, 12, 9, + 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, + /* 'N' */ 7, 12, 0, 12, 9, + 0xc6, 0xe6, 0xf6, 0xf6, 0xde, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'O' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* 'P' */ 7, 12, 0, 12, 9, + 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* 'Q' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xde, 0xcc, 0x7e, 0x00, 0x00, 0x00, + /* 'R' */ 7, 12, 0, 12, 9, + 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xcc, 0xcc, 0xcc, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'S' */ 7, 12, 0, 12, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0x60, 0x38, 0x0c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* 'T' */ 8, 12, 0, 12, 9, + 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, + /* 'U' */ 7, 12, 0, 12, 9, + 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, + /* 'V' */ 8, 12, 0, 12, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, + /* 'W' */ 8, 12, 0, 12, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0x66, 0x66, 0x00, 0x00, 0x00, + /* 'X' */ 8, 12, 0, 12, 9, + 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, + /* 'Y' */ 8, 12, 0, 12, 9, + 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, + /* 'Z' */ 7, 12, 0, 12, 9, + 0xfe, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, + /* '[' */ 4, 13, 2, 13, 9, + 0xf0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x00, 0x00, + /* '\' */ 6, 12, 1, 12, 9, + 0xc0, 0xc0, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, 0x00, + /* ']' */ 4, 13, 2, 13, 9, + 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x00, 0x00, + /* '^' */ 6, 5, 1, 12, 9, + 0x30, 0x78, 0x78, 0xcc, 0xcc, 0x00, 0x00, + /* '_' */ 8, 1, 0, 1, 9, + 0xff, 0x00, 0x00, + /* '`' */ 4, 3, 1, 13, 9, + 0xc0, 0x60, 0x30, + /* 'a' */ 7, 9, 0, 9, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x7e, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00, + /* 'b' */ 7, 12, 0, 12, 9, + 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0x00, 0x00, 0x00, + /* 'c' */ 7, 9, 0, 9, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, + /* 'd' */ 7, 12, 0, 12, 9, + 0x06, 0x06, 0x06, 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00, 0x00, + /* 'e' */ 7, 9, 0, 9, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, + /* 'f' */ 7, 12, 0, 12, 9, + 0x1e, 0x30, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, + /* 'g' */ 8, 12, 0, 9, 9, + 0x7f, 0xc6, 0xc6, 0xc6, 0x7c, 0xc0, 0xc0, 0x7e, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, + /* 'h' */ 7, 12, 0, 12, 9, + 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'i' */ 6, 12, 1, 12, 9, + 0x30, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00, + /* 'j' */ 6, 14, 1, 12, 9, + 0x0c, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, 0x00, + /* 'k' */ 7, 12, 0, 12, 9, + 0xc0, 0xc0, 0xc0, 0xc6, 0xcc, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc6, 0x00, 0x00, 0x00, + /* 'l' */ 6, 12, 1, 12, 9, + 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, 0x00, + /* 'm' */ 8, 9, 0, 9, 9, + 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, + /* 'n' */ 7, 9, 0, 9, 9, + 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, + /* 'o' */ 7, 9, 0, 9, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, + /* 'p' */ 7, 12, 0, 9, 9, + 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* 'q' */ 7, 12, 0, 9, 9, + 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, + /* 'r' */ 7, 9, 0, 9, 9, + 0xfc, 0xe6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, + /* 's' */ 7, 9, 0, 9, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, + /* 't' */ 7, 12, 0, 12, 9, + 0x30, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x00, 0x00, + /* 'u' */ 7, 9, 0, 9, 9, + 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00, + /* 'v' */ 8, 9, 0, 9, 9, + 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, + /* 'w' */ 8, 9, 0, 9, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xff, 0xff, 0x66, 0x66, 0x00, 0x00, + /* 'x' */ 8, 9, 0, 9, 9, + 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, + /* 'y' */ 8, 12, 0, 9, 9, + 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, + /* 'z' */ 7, 9, 0, 9, 9, + 0xfe, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x60, 0xc0, 0xfe, 0x00, 0x00, + /* '{' */ 4, 13, 2, 13, 9, + 0x70, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x70, 0x00, 0x00, + /* '|' */ 2, 12, 3, 12, 9, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* '}' */ 4, 13, 3, 13, 9, + 0xe0, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00, + /* '~' */ 8, 3, 0, 7, 9, + 0x70, 0xdb, 0x0e, +}; + +static struct GP_FontFace font_bold = { + .family_name = "HaxorNarrowBold16", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 15, + .descend = 3, + .max_glyph_width = 8, + .max_glyph_advance = 9, + .glyphs = &font_bold_glyphs, + .glyph_offsets = { + 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074, + 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc, + 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c, + 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204, + 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4, + 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344, + 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4, + 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c, + 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8, + 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590, + 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c, + 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4, + } +}; + +const struct GP_FontFace *GP_FontHaxorNarrowBold16 = &font_bold; diff --git a/libs/text/GP_HaxorNarrow17.c b/libs/text/GP_HaxorNarrow17.c new file mode 100644 index 000000000000..46d3d9bbdfad --- /dev/null +++ b/libs/text/GP_HaxorNarrow17.c @@ -0,0 +1,442 @@ +/* Generated file, do not touch */ + +#include <text/GP_Font.h> + +static uint8_t font_glyphs[] = { + /* ' ' */ 0, 0, 0, 0, 9, + 0x00, 0x00, 0x00, + /* '!' */ 1, 13, 4, 13, 9, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, + /* '"' */ 7, 4, 0, 13, 9, + 0xee, 0x22, 0x22, 0x44, 0x00, 0x00, 0x00, + /* '#' */ 8, 11, 0, 11, 9, + 0x12, 0x12, 0x12, 0x7f, 0x24, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x48, + /* '$' */ 7, 13, 0, 13, 9, + 0x10, 0x7c, 0x92, 0x90, 0x90, 0x50, 0x38, 0x14, 0x12, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, + /* '%' */ 7, 13, 0, 13, 9, + 0x62, 0x92, 0x94, 0x64, 0x08, 0x08, 0x10, 0x20, 0x20, 0x4c, 0x52, 0x92, 0x8c, 0x00, 0x00, + /* '&' */ 7, 13, 0, 13, 9, + 0x38, 0x44, 0x44, 0x44, 0x48, 0x30, 0x60, 0xd2, 0x92, 0x8a, 0x8a, 0xc4, 0x7a, 0x00, 0x00, + /* ''' */ 2, 4, 2, 13, 9, + 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '(' */ 4, 15, 1, 14, 9, + 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, + /* ')' */ 4, 15, 1, 14, 9, + 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, + /* '*' */ 5, 6, 1, 10, 9, + 0x20, 0xa8, 0x70, 0x70, 0xa8, 0x20, 0x00, + /* '+' */ 7, 7, 0, 10, 9, + 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, + /* ',' */ 2, 4, 2, 3, 9, + 0xc0, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '-' */ 5, 1, 1, 7, 9, + 0xf8, 0x00, 0x00, + /* '.' */ 2, 3, 2, 3, 9, + 0xc0, 0xc0, 0xc0, + /* '/' */ 5, 13, 1, 13, 9, + 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0x00, + /* '0' */ 7, 13, 0, 13, 9, + 0x38, 0x44, 0x82, 0x82, 0x82, 0x8a, 0x92, 0xa2, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + /* '1' */ 4, 13, 1, 13, 9, + 0x30, 0x50, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* '2' */ 6, 13, 1, 13, 9, + 0x78, 0x84, 0x84, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* '3' */ 6, 13, 1, 13, 9, + 0x78, 0x84, 0x04, 0x04, 0x04, 0x38, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, + /* '4' */ 7, 13, 0, 13, 9, + 0x04, 0x0c, 0x0c, 0x14, 0x24, 0x24, 0x44, 0x84, 0xfe, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, + /* '5' */ 6, 13, 1, 13, 9, + 0xfc, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, + /* '6' */ 6, 13, 1, 13, 9, + 0x78, 0x84, 0x80, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '7' */ 7, 13, 0, 13, 9, + 0xfe, 0x02, 0x02, 0x04, 0x04, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* '8' */ 6, 13, 1, 13, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '9' */ 6, 13, 1, 13, 9, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x04, 0x04, 0x84, 0x78, 0x00, 0x00, + /* ':' */ 2, 8, 3, 10, 9, + 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* ';' */ 2, 9, 3, 10, 9, + 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x80, 0x00, 0x00, + /* '<' */ 7, 9, 0, 11, 9, + 0x02, 0x0c, 0x10, 0x60, 0x80, 0x60, 0x10, 0x0c, 0x02, 0x00, 0x00, + /* '=' */ 7, 5, 0, 9, 9, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, + /* '>' */ 7, 9, 0, 11, 9, + 0x80, 0x60, 0x10, 0x0c, 0x02, 0x0c, 0x10, 0x60, 0x80, 0x00, 0x00, + /* '?' */ 6, 13, 1, 13, 9, + 0x78, 0x84, 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, + /* '@' */ 7, 13, 0, 13, 9, + 0x38, 0x44, 0x82, 0x82, 0x9e, 0xa2, 0xa2, 0xa2, 0xa2, 0x9c, 0x80, 0x42, 0x3c, 0x00, 0x00, + /* 'A' */ 7, 13, 0, 13, 9, + 0x10, 0x28, 0x28, 0x44, 0x44, 0x44, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'B' */ 7, 13, 0, 13, 9, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, + /* 'C' */ 7, 13, 0, 13, 9, + 0x3c, 0x42, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x42, 0x3c, 0x00, 0x00, + /* 'D' */ 7, 13, 0, 13, 9, + 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, + /* 'E' */ 6, 13, 0, 13, 9, + 0xfc, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* 'F' */ 6, 13, 0, 13, 9, + 0xfc, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'G' */ 7, 13, 0, 13, 9, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x8e, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'H' */ 7, 13, 0, 13, 9, + 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'I' */ 5, 13, 1, 13, 9, + 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, + /* 'J' */ 7, 13, 0, 13, 9, + 0xfe, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'K' */ 7, 13, 0, 13, 9, + 0x84, 0x84, 0x88, 0x90, 0x90, 0xa0, 0xe0, 0x90, 0x88, 0x88, 0x84, 0x84, 0x82, 0x00, 0x00, + /* 'L' */ 7, 13, 0, 13, 9, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'M' */ 7, 13, 0, 13, 9, + 0x82, 0xc6, 0xaa, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'N' */ 7, 13, 0, 13, 9, + 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'O' */ 7, 13, 0, 13, 9, + 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + /* 'P' */ 7, 13, 0, 13, 9, + 0xf8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'Q' */ 7, 13, 0, 13, 9, + 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x8a, 0x44, 0x3a, 0x00, 0x00, + /* 'R' */ 7, 13, 0, 13, 9, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x84, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'S' */ 7, 13, 0, 13, 9, + 0x38, 0x44, 0x82, 0x80, 0x80, 0x40, 0x38, 0x04, 0x02, 0x02, 0x82, 0x44, 0x38, 0x00, 0x00, + /* 'T' */ 7, 13, 0, 13, 9, + 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'U' */ 7, 13, 0, 13, 9, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + /* 'V' */ 7, 13, 0, 13, 9, + 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, + /* 'W' */ 7, 13, 0, 13, 9, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x00, 0x00, + /* 'X' */ 7, 13, 0, 13, 9, + 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00, + /* 'Y' */ 7, 13, 0, 13, 9, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'Z' */ 7, 13, 0, 13, 9, + 0xfe, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* '[' */ 3, 13, 2, 13, 9, + 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, + /* '\' */ 5, 13, 1, 13, 9, + 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, + /* ']' */ 3, 13, 2, 13, 9, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, + /* '^' */ 7, 4, 0, 13, 9, + 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, + /* '_' */ 8, 1, 0, 1, 9, + 0xff, 0x00, 0x00, + /* '`' */ 3, 3, 1, 13, 9, + 0x80, 0x40, 0x20, + /* 'a' */ 6, 10, 1, 10, 9, + 0x78, 0x84, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, + /* 'b' */ 6, 13, 1, 13, 9, + 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x00, 0x00, + /* 'c' */ 6, 10, 1, 10, 9, + 0x38, 0x44, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x44, 0x38, 0x00, + /* 'd' */ 6, 13, 1, 13, 9, + 0x04, 0x04, 0x04, 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, 0x00, + /* 'e' */ 6, 10, 1, 10, 9, + 0x78, 0x84, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, + /* 'f' */ 7, 13, 0, 13, 9, + 0x1c, 0x22, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* 'g' */ 7, 13, 0, 10, 9, + 0x7e, 0x84, 0x84, 0x84, 0x84, 0x78, 0x80, 0x80, 0x7c, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'h' */ 6, 13, 1, 13, 9, + 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, + /* 'i' */ 5, 13, 2, 13, 9, + 0x20, 0x00, 0x00, 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, + /* 'j' */ 5, 15, 1, 13, 9, + 0x08, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x70, + /* 'k' */ 6, 13, 1, 13, 9, + 0x80, 0x80, 0x80, 0x84, 0x88, 0x90, 0xa0, 0xc0, 0xe0, 0x90, 0x88, 0x84, 0x84, 0x00, 0x00, + /* 'l' */ 5, 13, 2, 13, 9, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, + /* 'm' */ 7, 10, 0, 10, 9, + 0xec, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, + /* 'n' */ 6, 10, 1, 10, 9, + 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, + /* 'o' */ 7, 10, 0, 10, 9, + 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, + /* 'p' */ 6, 13, 1, 10, 9, + 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'q' */ 6, 13, 1, 10, 9, + 0x74, 0x8c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x04, 0x04, 0x04, 0x00, 0x00, + /* 'r' */ 6, 10, 1, 10, 9, + 0xb8, 0xc4, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, + /* 's' */ 7, 10, 0, 10, 9, + 0x3c, 0x42, 0x40, 0x40, 0x30, 0x0c, 0x02, 0x02, 0x82, 0x7c, 0x00, + /* 't' */ 7, 13, 0, 13, 9, + 0x20, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00, + /* 'u' */ 6, 10, 1, 10, 9, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x00, + /* 'v' */ 7, 10, 0, 10, 9, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x00, + /* 'w' */ 7, 10, 0, 10, 9, + 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xaa, 0x44, 0x44, 0x00, + /* 'x' */ 7, 10, 0, 10, 9, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, + /* 'y' */ 7, 13, 0, 10, 9, + 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, + /* 'z' */ 7, 10, 0, 10, 9, + 0xfe, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, + /* '{' */ 3, 13, 2, 13, 9, + 0x60, 0x80, 0x80, 0x80, 0x40, 0x40, 0x80, 0x40, 0x40, 0x80, 0x80, 0x80, 0x60, 0x00, 0x00, + /* '|' */ 1, 12, 3, 12, 9, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, + /* '}' */ 3, 13, 3, 13, 9, + 0xc0, 0x20, 0x20, 0x20, 0x40, 0x40, 0x20, 0x40, 0x40, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, + /* '~' */ 7, 3, 0, 7, 9, + 0x60, 0x92, 0x0c, +}; + +static struct GP_FontFace font = { + .family_name = "HaxorNarrow17", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 16, + .descend = 3, + .max_glyph_width = 8, + .max_glyph_advance = 9, + .glyphs = &font_glyphs, + .glyph_offsets = { + 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074, + 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc, + 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c, + 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204, + 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4, + 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344, + 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4, + 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c, + 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8, + 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590, + 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c, + 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4, + } +}; + +const struct GP_FontFace *GP_FontHaxorNarrow17 = &font; +static uint8_t font_bold_glyphs[] = { + /* ' ' */ 0, 0, 0, 0, 9, + 0x00, 0x00, 0x00, + /* '!' */ 2, 13, 4, 13, 9, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, + /* '"' */ 8, 4, 0, 13, 9, + 0xff, 0x33, 0x33, 0x66, 0x00, 0x00, 0x00, + /* '#' */ 8, 11, 0, 11, 9, + 0x1b, 0x1b, 0x1b, 0x7f, 0x36, 0x36, 0x36, 0xff, 0x6c, 0x6c, 0x6c, + /* '$' */ 8, 13, 0, 13, 9, + 0x18, 0x7e, 0xdb, 0xd8, 0xd8, 0x78, 0x3c, 0x1e, 0x1b, 0x1b, 0xdb, 0x7e, 0x18, 0x00, 0x00, + /* '%' */ 8, 13, 0, 13, 9, + 0x73, 0xdb, 0xde, 0x76, 0x0c, 0x0c, 0x18, 0x30, 0x30, 0x6e, 0x7b, 0xdb, 0xce, 0x00, 0x00, + /* '&' */ 8, 13, 0, 13, 9, + 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x38, 0x70, 0xfb, 0xdb, 0xcf, 0xcf, 0xe6, 0x7f, 0x00, 0x00, + /* ''' */ 3, 4, 2, 13, 9, + 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + /* '(' */ 5, 15, 1, 14, 9, + 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x18, + /* ')' */ 5, 15, 1, 14, 9, + 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, + /* '*' */ 6, 6, 1, 10, 9, + 0x30, 0xfc, 0x78, 0x78, 0xfc, 0x30, 0x00, + /* '+' */ 8, 7, 0, 10, 9, + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, + /* ',' */ 3, 4, 2, 3, 9, + 0xe0, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + /* '-' */ 6, 1, 1, 7, 9, + 0xfc, 0x00, 0x00, + /* '.' */ 3, 3, 2, 3, 9, + 0xe0, 0xe0, 0xe0, + /* '/' */ 6, 13, 1, 13, 9, + 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x00, 0x00, + /* '0' */ 8, 13, 0, 13, 9, + 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xcf, 0xdb, 0xf3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, + /* '1' */ 5, 13, 1, 13, 9, + 0x38, 0x78, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, + /* '2' */ 7, 13, 1, 13, 9, + 0x7c, 0xc6, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xfe, 0x00, 0x00, + /* '3' */ 7, 13, 1, 13, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, + /* '4' */ 8, 13, 0, 13, 9, + 0x06, 0x0e, 0x0e, 0x1e, 0x36, 0x36, 0x66, 0xc6, 0xff, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, + /* '5' */ 7, 13, 1, 13, 9, + 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, + /* '6' */ 7, 13, 1, 13, 9, + 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, + /* '7' */ 8, 13, 0, 13, 9, + 0xff, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, + /* '8' */ 7, 13, 1, 13, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, + /* '9' */ 7, 13, 1, 13, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, + /* ':' */ 3, 8, 3, 10, 9, + 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00, + /* ';' */ 3, 9, 3, 10, 9, + 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, 0xc0, 0x00, 0x00, + /* '<' */ 8, 9, 0, 11, 9, + 0x03, 0x0e, 0x18, 0x70, 0xc0, 0x70, 0x18, 0x0e, 0x03, 0x00, 0x00, + /* '=' */ 8, 5, 0, 9, 9, + 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, + /* '>' */ 8, 9, 0, 11, 9, + 0xc0, 0x70, 0x18, 0x0e, 0x03, 0x0e, 0x18, 0x70, 0xc0, 0x00, 0x00, + /* '?' */ 7, 13, 1, 13, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, + /* '@' */ 8, 13, 0, 13, 9, + 0x3c, 0x66, 0xc3, 0xc3, 0xdf, 0xf3, 0xf3, 0xf3, 0xf3, 0xde, 0xc0, 0x63, 0x3e, 0x00, 0x00, + /* 'A' */ 8, 13, 0, 13, 9, + 0x18, 0x3c, 0x3c, 0x66, 0x66, 0x66, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, + /* 'B' */ 8, 13, 0, 13, 9, + 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0x00, 0x00, + /* 'C' */ 8, 13, 0, 13, 9, + 0x3e, 0x63, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x63, 0x3e, 0x00, 0x00, + /* 'D' */ 8, 13, 0, 13, 9, + 0xfc, 0xc6, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc6, 0xfc, 0x00, 0x00, + /* 'E' */ 7, 13, 0, 13, 9, + 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, + /* 'F' */ 7, 13, 0, 13, 9, + 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, + /* 'G' */ 8, 13, 0, 13, 9, + 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcf, 0xc3, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, + /* 'H' */ 8, 13, 0, 13, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, + /* 'I' */ 6, 13, 1, 13, 9, + 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, + /* 'J' */ 8, 13, 0, 13, 9, + 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xc3, 0xc3, 0x7e, 0x00, 0x00, + /* 'K' */ 8, 13, 0, 13, 9, + 0xc6, 0xc6, 0xcc, 0xd8, 0xd8, 0xf0, 0xf0, 0xd8, 0xcc, 0xcc, 0xc6, 0xc6, 0xc3, 0x00, 0x00, + /* 'L' */ 8, 13, 0, 13, 9, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, + /* 'M' */ 8, 13, 0, 13, 9, + 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, + /* 'N' */ 8, 13, 0, 13, 9, + 0xc3, 0xe3, 0xf3, 0xf3, 0xdb, 0xcf, 0xcf, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, + /* 'O' */ 8, 13, 0, 13, 9, + 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, + /* 'P' */ 8, 13, 0, 13, 9, + 0xfc, 0xc6, 0xc3, 0xc3, 0xc3, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, + /* 'Q' */ 8, 13, 0, 13, 9, + 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xcf, 0x66, 0x3f, 0x00, 0x00, + /* 'R' */ 8, 13, 0, 13, 9, + 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xcc, 0xc6, 0xc6, 0xc3, 0xc3, 0xc3, 0x00, 0x00, + /* 'S' */ 8, 13, 0, 13, 9, + 0x3c, 0x66, 0xc3, 0xc0, 0xc0, 0x60, 0x3c, 0x06, 0x03, 0x03, 0xc3, 0x66, 0x3c, 0x00, 0x00, + /* 'T' */ 8, 13, 0, 13, 9, + 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, + /* 'U' */ 8, 13, 0, 13, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, + /* 'V' */ 8, 13, 0, 13, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x00, + /* 'W' */ 8, 13, 0, 13, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0xff, 0x66, 0x66, 0x00, 0x00, + /* 'X' */ 8, 13, 0, 13, 9, + 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00, + /* 'Y' */ 8, 13, 0, 13, 9, + 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, + /* 'Z' */ 8, 13, 0, 13, 9, + 0xff, 0x03, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xff, 0x00, 0x00, + /* '[' */ 4, 13, 2, 13, 9, + 0xf0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x00, 0x00, + /* '\' */ 6, 13, 1, 13, 9, + 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, + /* ']' */ 4, 13, 2, 13, 9, + 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0x00, 0x00, + /* '^' */ 8, 4, 0, 13, 9, + 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, + /* '_' */ 8, 1, 0, 1, 9, + 0xff, 0x00, 0x00, + /* '`' */ 4, 3, 1, 13, 9, + 0xc0, 0x60, 0x30, + /* 'a' */ 7, 10, 1, 10, 9, + 0x7c, 0xc6, 0x06, 0x06, 0x7e, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, + /* 'b' */ 7, 13, 1, 13, 9, + 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0x00, 0x00, + /* 'c' */ 7, 10, 1, 10, 9, + 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00, + /* 'd' */ 7, 13, 1, 13, 9, + 0x06, 0x06, 0x06, 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, 0x00, + /* 'e' */ 7, 10, 1, 10, 9, + 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, + /* 'f' */ 8, 13, 0, 13, 9, + 0x1e, 0x33, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, + /* 'g' */ 8, 13, 0, 10, 9, + 0x7f, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc0, 0xc0, 0x7e, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, + /* 'h' */ 7, 13, 1, 13, 9, + 0xc0, 0xc0, 0xc0, 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, + /* 'i' */ 6, 13, 2, 13, 9, + 0x30, 0x00, 0x00, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, + /* 'j' */ 6, 15, 1, 13, 9, + 0x0c, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0x78, + /* 'k' */ 7, 13, 1, 13, 9, + 0xc0, 0xc0, 0xc0, 0xc6, 0xcc, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc6, 0x00, 0x00, + /* 'l' */ 6, 13, 2, 13, 9, + 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, 0x00, + /* 'm' */ 8, 10, 0, 10, 9, + 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, + /* 'n' */ 7, 10, 1, 10, 9, + 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, + /* 'o' */ 8, 10, 0, 10, 9, + 0x3c, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, + /* 'p' */ 7, 13, 1, 10, 9, + 0xfc, 0xe6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xe6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00, + /* 'q' */ 7, 13, 1, 10, 9, + 0x7e, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, + /* 'r' */ 7, 10, 1, 10, 9, + 0xfc, 0xe6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, + /* 's' */ 8, 10, 0, 10, 9, + 0x3e, 0x63, 0x60, 0x60, 0x38, 0x0e, 0x03, 0x03, 0xc3, 0x7e, 0x00, + /* 't' */ 8, 13, 0, 13, 9, + 0x30, 0x30, 0x30, 0xfe, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00, + /* 'u' */ 7, 10, 1, 10, 9, + 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xce, 0x7e, 0x00, + /* 'v' */ 8, 10, 0, 10, 9, + 0xc3, 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x3c, 0x18, 0x00, + /* 'w' */ 8, 10, 0, 10, 9, + 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0xff, 0x66, 0x66, 0x00, + /* 'x' */ 8, 10, 0, 10, 9, + 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x66, 0xc3, 0xc3, 0x00, + /* 'y' */ 8, 13, 0, 10, 9, + 0xc3, 0xc3, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, + /* 'z' */ 8, 10, 0, 10, 9, + 0xff, 0x03, 0x06, 0x0c, 0x18, 0x18, 0x30, 0x60, 0xc0, 0xff, 0x00, + /* '{' */ 4, 13, 2, 13, 9, + 0x70, 0xc0, 0xc0, 0xc0, 0x60, 0x60, 0xc0, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x70, 0x00, 0x00, + /* '|' */ 2, 12, 3, 12, 9, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, + /* '}' */ 4, 13, 3, 13, 9, + 0xe0, 0x30, 0x30, 0x30, 0x60, 0x60, 0x30, 0x60, 0x60, 0x30, 0x30, 0x30, 0xe0, 0x00, 0x00, + /* '~' */ 8, 3, 0, 7, 9, + 0x70, 0xdb, 0x0e, +}; + +static struct GP_FontFace font_bold = { + .family_name = "HaxorNarrowBold17", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 16, + .descend = 3, + .max_glyph_width = 8, + .max_glyph_advance = 9, + .glyphs = &font_bold_glyphs, + .glyph_offsets = { + 0x0000, 0x0008, 0x001c, 0x0028, 0x0038, 0x004c, 0x0060, 0x0074, + 0x0080, 0x0094, 0x00a8, 0x00b4, 0x00c0, 0x00cc, 0x00d4, 0x00dc, + 0x00f0, 0x0104, 0x0118, 0x012c, 0x0140, 0x0154, 0x0168, 0x017c, + 0x0190, 0x01a4, 0x01b8, 0x01c8, 0x01d8, 0x01e8, 0x01f4, 0x0204, + 0x0218, 0x022c, 0x0240, 0x0254, 0x0268, 0x027c, 0x0290, 0x02a4, + 0x02b8, 0x02cc, 0x02e0, 0x02f4, 0x0308, 0x031c, 0x0330, 0x0344, + 0x0358, 0x036c, 0x0380, 0x0394, 0x03a8, 0x03bc, 0x03d0, 0x03e4, + 0x03f8, 0x040c, 0x0420, 0x0434, 0x0448, 0x045c, 0x0470, 0x047c, + 0x0484, 0x048c, 0x049c, 0x04b0, 0x04c0, 0x04d4, 0x04e4, 0x04f8, + 0x050c, 0x0520, 0x0534, 0x0548, 0x055c, 0x0570, 0x0580, 0x0590, + 0x05a0, 0x05b4, 0x05c8, 0x05d8, 0x05e8, 0x05fc, 0x060c, 0x061c, + 0x062c, 0x063c, 0x0650, 0x0660, 0x0674, 0x0688, 0x069c, 0x06a4, + } +}; + +const struct GP_FontFace *GP_FontHaxorNarrowBold17 = &font_bold; diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t index 189cf7f2f031..4e06be6cc5e5 100644 --- a/libs/text/GP_Text.gen.c.t +++ b/libs/text/GP_Text.gen.c.t @@ -56,8 +56,8 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle * int start_x = x + (i + glyph->bearing_x) * x_mul; - if (p == str) - start_x -= glyph->bearing_x * x_mul; + //if (p == str) + // start_x -= glyph->bearing_x * x_mul; int start_y = y - (glyph->bearing_y - style->font->ascend) * y_mul; ----------------------------------------------------------------------- Summary of changes: build/syms/Text_symbols.txt | 6 + configure | 3 + demos/Makefile | 4 + demos/termini/.gitignore | 1 + demos/{particle => termini}/Makefile | 10 +- demos/{ttf2img => termini}/runtest.sh | 0 demos/termini/termini.c | 612 ++++++++++++++++++++++++++ include/text/GP_Font.h | 9 +- include/text/GP_Fonts.h | 12 + libs/text/GP_HaxorNarrow15.c | 442 +++++++++++++++++++ libs/text/GP_HaxorNarrow16.c | 442 +++++++++++++++++++ libs/text/GP_HaxorNarrow17.c | 442 +++++++++++++++++++ libs/text/GP_Text.gen.c.t | 4 +- 13 files changed, 1978 insertions(+), 9 deletions(-) create mode 100644 demos/termini/.gitignore copy demos/{particle => termini}/Makefile (57%) copy demos/{ttf2img => termini}/runtest.sh (100%) create mode 100644 demos/termini/termini.c create mode 100644 libs/text/GP_HaxorNarrow15.c create mode 100644 libs/text/GP_HaxorNarrow16.c create mode 100644 libs/text/GP_HaxorNarrow17.c repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive no reply. -- gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
0
0
[repo.or.cz] gfxprim.git branch master updated: 1.0.0-rc1-181-gedf5e7cc9c3f
by metan
29 Sep '17
29 Sep '17
This is an automated email generated because a ref change occurred in the git repository for project gfxprim.git. The branch, master has been updated discards 68ca236236dffbd3fbb303802e6824f747d3cc50 (commit) discards c97efe2001dac56f7f16079c6ae1ada635262ff2 (commit) discards e0e66873d593fa879e90c19fb6c521f4bfc63ca2 (commit) discards 112167d6829f8dd4d26491ff63e0a8c4887061df (commit) via edf5e7cc9c3fece148b15f59939164d9017de42f (commit) via f00e352e51f3f7988c2a8f544eca87b996b51a1a (commit) via 98cd4f682a77e56eea48dbcd85336c5073deb00c (commit) This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this: * -- * -- B -- O -- O -- O (68ca236236dffbd3fbb303802e6824f747d3cc50) \ N -- N -- N (edf5e7cc9c3fece148b15f59939164d9017de42f) When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B. Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit edf5e7cc9c3fece148b15f59939164d9017de42f Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 11:09:42 +0200 URL: <
http://repo.or.cz/gfxprim.git/edf5e7cc9c3fece1
> text/GP_Text.gen.c.t: Optimize 1BPP font drawing Calling a HLine() function from the inner loop was a bad idea after all. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- libs/text/GP_Text.gen.c.t | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t index 209d00defd07..189cf7f2f031 100644 --- a/libs/text/GP_Text.gen.c.t +++ b/libs/text/GP_Text.gen.c.t @@ -38,7 +38,7 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle * if (glyph == NULL) glyph = GP_GetGlyphBitmap(style->font, ' '); - int i, j, k; + int i, j, k, l; unsigned int x_mul = style->pixel_xmul + style->pixel_xspace; unsigned int y_mul = style->pixel_ymul + style->pixel_yspace; @@ -51,17 +51,25 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle * for (i = 0; i < glyph->width; i++) { uint8_t bit = (glyph->bitmap[i/8 + j * bpp]) & (0x80>>(i%8)); - unsigned int x_start = x + (i + glyph->bearing_x) * x_mul; + if (!bit) + continue; + + int start_x = x + (i + glyph->bearing_x) * x_mul; if (p == str) - x_start -= glyph->bearing_x * x_mul; + start_x -= glyph->bearing_x * x_mul; - if (!bit) - continue; + int start_y = y - (glyph->bearing_y - style->font->ascend) * y_mul; - for (k = 0; k < style->pixel_ymul; k++) - GP_HLine(pixmap, x_start, x_start + style->pixel_xmul - 1, - y - (glyph->bearing_y - style->font->ascend) * y_mul + k, fg); + for (k = start_y; k < start_y + style->pixel_ymul; k++) { + for (l = start_x; l < start_x + style->pixel_xmul; l++) { + int px = l; + int py = k; + GP_TRANSFORM_POINT(pixmap, px, py); + if (!GP_PIXEL_IS_CLIPPED(pixmap, px, py)) + GP_PutPixel_Raw_{{ pt.pixelsize.suffix }}(pixmap, px, py, fg); + } + } } y += style->pixel_ymul + style->pixel_yspace; commit f00e352e51f3f7988c2a8f544eca87b996b51a1a Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 11:08:49 +0200 URL: <
http://repo.or.cz/gfxprim.git/f00e352e51f3f798
> fonts/GP_DefaultFont: Whitespace cleanup. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- libs/text/GP_DefaultFont.c | 876 ++++++++++++++++++------------------- 1 file changed, 438 insertions(+), 438 deletions(-) rewrite libs/text/GP_DefaultFont.c (82%) diff --git a/libs/text/GP_DefaultFont.c b/libs/text/GP_DefaultFont.c dissimilarity index 82% index d67fa99e9e9b..5dd67b182890 100644 --- a/libs/text/GP_DefaultFont.c +++ b/libs/text/GP_DefaultFont.c @@ -1,438 +1,438 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * <jiri.bluebear.dluhos(a)gmail.com> * - * * - * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> * - * * - *****************************************************************************/ - -#include "GP_Font.h" - -static int8_t default_console_glyphs[] = { - /* ' ' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '!' */ 7, 11, 0, 9, 8, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, - /* '"' */ 7, 11, 0, 9, 8, - 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '#' */ 7, 11, 0, 9, 8, - 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00, - /* '$' */ 7, 11, 0, 9, 8, - 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, - /* '%' */ 7, 11, 0, 9, 8, - 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, - /* '&' */ 7, 11, 0, 9, 8, - 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, - /* ''' */ 7, 11, 0, 9, 8, - 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '(' */ 7, 11, 0, 9, 8, - 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, - /* ')' */ 7, 11, 0, 9, 8, - 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, - /* '*' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00, - /* '+' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - /* ',' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, - /* '-' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '.' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - /* '/' */ 7, 11, 0, 9, 8, - 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, - /* '0' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, - /* '1' */ 7, 11, 1, 9, 8, - 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, - /* '2' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, - /* '3' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '4' */ 7, 11, 1, 9, 8, - 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, - /* '5' */ 7, 11, 1, 9, 8, - 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '6' */ 7, 11, 1, 9, 8, - 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '7' */ 7, 11, 1, 9, 8, - 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* '8' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '9' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, - /* ':' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - /* ';' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, - /* '<' */ 7, 11, 0, 9, 8, - 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, - /* '=' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, - /* '>' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, - /* '?' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - /* '@' */ 8, 11, 0, 9, 8, - 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, - /* 'A' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'B' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, - /* 'C' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, - /* 'D' */ 7, 11, 0, 9, 8, - 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, - /* 'E' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, - /* 'F' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'G' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'H' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'I' */ 7, 11, 0, 9, 8, - 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, - /* 'J' */ 7, 11, 0, 9, 8, - 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'K' */ 7, 11, 0, 9, 8, - 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'L' */ 7, 11, 0, 9, 8, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, - /* 'M' */ 7, 11, 0, 9, 8, - 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'N' */ 7, 11, 0, 9, 8, - 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, - /* 'O' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'P' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'Q' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, - /* 'R' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'S' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'T' */ 7, 11, 0, 9, 8, - 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'U' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'V' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - /* 'W' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, - /* 'X' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, - /* 'Y' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'Z' */ 7, 11, 0, 9, 8, - 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, - /* '[' */ 7, 11, 0, 9, 8, - 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00, - /* '\' */ 7, 11, 0, 9, 8, - 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, - /* ']' */ 7, 11, 0, 9, 8, - 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00, - /* '^' */ 7, 11, 0, 9, 8, - 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '_' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, - /* '`' */ 7, 11, 0, 9, 8, - 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* 'a' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00, - /* 'b' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, - /* 'c' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, - /* 'd' */ 7, 11, 0, 9, 8, - 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, - /* 'e' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00, - /* 'f' */ 7, 11, 0, 9, 8, - 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - /* 'g' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, - /* 'h' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - /* 'i' */ 7, 11, 0, 9, 8, - 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, - /* 'j' */ 7, 11, 0, 9, 8, - 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, - /* 'k' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, - /* 'l' */ 7, 11, 0, 9, 8, - 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, - /* 'm' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, - /* 'n' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - /* 'o' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, - /* 'p' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, - /* 'q' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, - /* 'r' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - /* 's' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, - /* 't' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, - /* 'u' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, - /* 'v' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, - /* 'w' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, - /* 'x' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, - /* 'y' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, - /* 'z' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, - /* '{' */ 7, 11, 0, 9, 8, - 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, - /* '|' */ 7, 11, 0, 9, 8, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, - /* '}' */ 7, 11, 0, 9, 8, - 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, - /* '~' */ 7, 11, 0, 9, 8, - 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -struct GP_FontFace GP_DefaultConsoleFont = { - .family_name = "Gfxprim", - .style_name = "Mono", - .charset = GP_CHARSET_7BIT, - .ascend = 9, - .descend = 2, - .max_glyph_width = 8, - .max_glyph_advance = 8, - .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, - .glyphs = default_console_glyphs, - .glyph_offsets = {16}, -}; - -static uint8_t default_proportional_glyphs[] = { - /* ' ' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '!' */ 4, 11, 0, 9, 6, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - /* '"' */ 8, 11, 0, 9, 9, - 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '#' */ 8, 11, 0, 9, 9, - 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00, - /* '$' */ 7, 11, 0, 9, 8, - 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, - /* '%' */ 7, 11, 0, 9, 8, - 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, - /* '&' */ 7, 11, 0, 9, 8, - 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, - /* ''' */ 4, 11, 0, 9, 5, - 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '(' */ 2, 11, 0, 9, 4, - 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00, - /* ')' */ 2, 11, 0, 9, 4, - 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, - /* '*' */ 5, 11, 0, 9, 6, - 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00, - /* '+' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - /* ',' */ 4, 11, 0, 9, 6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, - /* '-' */ 4, 11, 0, 9, 6, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '.' */ 4, 11, 0, 9, 6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - /* '/' */ 5, 11, 0, 9, 6, - 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, - /* '0' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, - /* '1' */ 6, 11, 0, 9, 7, - 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, - /* '2' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, - /* '3' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '4' */ 6, 11, 0, 9, 7, - 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, - /* '5' */ 6, 11, 0, 9, 7, - 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '6' */ 6, 11, 0, 9, 7, - 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '7' */ 6, 11, 0, 9, 7, - 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* '8' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '9' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, - /* ':' */ 4, 11, 0, 9, 5, - 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - /* ';' */ 4, 11, 0, 9, 5, - 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00, - /* '<' */ 4, 11, 0, 9, 6, - 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, - /* '=' */ 5, 11, 0, 9, 6, - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, - /* '>' */ 4, 11, 0, 9, 6, - 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, - /* '?' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - /* '@' */ 8, 11, 0, 9, 9, - 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, - /* 'A' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'B' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, - /* 'C' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, - /* 'D' */ 7, 11, 0, 9, 8, - 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, - /* 'E' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, - /* 'F' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'G' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'H' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'I' */ 1, 11, 0, 9, 2, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'J' */ 7, 11, 0, 9, 8, - 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'K' */ 7, 11, 0, 9, 8, - 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'L' */ 6, 11, 0, 9, 7, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, - /* 'M' */ 7, 11, 0, 9, 8, - 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'N' */ 7, 11, 0, 9, 8, - 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, - /* 'O' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'P' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'Q' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, - /* 'R' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'S' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'T' */ 7, 11, 0, 9, 8, - 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'U' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'V' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - /* 'W' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, - /* 'X' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, - /* 'Y' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'Z' */ 7, 11, 0, 9, 8, - 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, - /* '[' */ 3, 11, 0, 9, 4, - 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, - /* '\' */ 5, 11, 0, 9, 6, - 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, - /* ']' */ 3, 11, 0, 9, 4, - 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, - /* '^' */ 8, 11, 0, 9, 9, - 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '_' */ 8, 11, 0, 9, 9, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, - /* '`' */ 2, 11, 0, 9, 3, - 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* 'a' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00, - /* 'b' */ 6, 11, 0, 9, 7, - 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00, - /* 'c' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, - /* 'd' */ 6, 11, 0, 9, 7, - 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, - /* 'e' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00, - /* 'f' */ 6, 11, 0, 9, 7, - 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - /* 'g' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, - /* 'h' */ 6, 11, 0, 9, 7, - 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, - /* 'i' */ 2, 11, 0, 9, 4, - 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - /* 'j' */ 3, 11, 0, 9, 4, - 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0, - /* 'k' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, - /* 'l' */ 4, 11, 0, 9, 5, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, - /* 'm' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, - /* 'n' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, - /* 'o' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* 'p' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, - /* 'q' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, - /* 'r' */ 5, 11, 0, 9, 6, - 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 's' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, - /* 't' */ 6, 11, 0, 9, 7, - 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, - /* 'u' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, - /* 'v' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00, - /* 'w' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, - /* 'x' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00, - /* 'y' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, - /* 'z' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00, - /* '{' */ 5, 11, 0, 9, 6, - 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, - /* '|' */ 1, 11, 0, 9, 2, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* '}' */ 5, 11, 0, 9, 6, - 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, - /* '~' */ 6, 11, 0, 9, 7, - 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -struct GP_FontFace GP_DefaultProportionalFont = { - .family_name = "Gfxprim", - .style_name = "Proportional", - .charset = GP_CHARSET_7BIT, - .ascend = 9, - .descend = 2, - .max_glyph_width = 9, - .max_glyph_advance = 9, - .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, - .glyphs = default_proportional_glyphs, - .glyph_offsets = {16}, -}; +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * <jiri.bluebear.dluhos(a)gmail.com> * + * * + * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> * + * * + *****************************************************************************/ + +#include "GP_Font.h" + +static int8_t default_console_glyphs[] = { + /* ' ' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '!' */ 7, 11, 0, 9, 8, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, + /* '"' */ 7, 11, 0, 9, 8, + 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '#' */ 7, 11, 0, 9, 8, + 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00, + /* '$' */ 7, 11, 0, 9, 8, + 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, + /* '%' */ 7, 11, 0, 9, 8, + 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, + /* '&' */ 7, 11, 0, 9, 8, + 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, + /* ''' */ 7, 11, 0, 9, 8, + 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '(' */ 7, 11, 0, 9, 8, + 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, + /* ')' */ 7, 11, 0, 9, 8, + 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, + /* '*' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00, + /* '+' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* ',' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, + /* '-' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '.' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + /* '/' */ 7, 11, 0, 9, 8, + 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, + /* '0' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, + /* '1' */ 7, 11, 1, 9, 8, + 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, + /* '2' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* '3' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '4' */ 7, 11, 1, 9, 8, + 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, + /* '5' */ 7, 11, 1, 9, 8, + 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '6' */ 7, 11, 1, 9, 8, + 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '7' */ 7, 11, 1, 9, 8, + 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* '8' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '9' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, + /* ':' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + /* ';' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, + /* '<' */ 7, 11, 0, 9, 8, + 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, + /* '=' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, + /* '>' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, + /* '?' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, + /* '@' */ 8, 11, 0, 9, 8, + 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, + /* 'A' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'B' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, + /* 'C' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, + /* 'D' */ 7, 11, 0, 9, 8, + 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, + /* 'E' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'F' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'G' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'H' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'I' */ 7, 11, 0, 9, 8, + 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, + /* 'J' */ 7, 11, 0, 9, 8, + 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'K' */ 7, 11, 0, 9, 8, + 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'L' */ 7, 11, 0, 9, 8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'M' */ 7, 11, 0, 9, 8, + 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'N' */ 7, 11, 0, 9, 8, + 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, + /* 'O' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'P' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'Q' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, + /* 'R' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'S' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'T' */ 7, 11, 0, 9, 8, + 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'U' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'V' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, + /* 'W' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, + /* 'X' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, + /* 'Y' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'Z' */ 7, 11, 0, 9, 8, + 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, + /* '[' */ 7, 11, 0, 9, 8, + 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00, + /* '\' */ 7, 11, 0, 9, 8, + 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, + /* ']' */ 7, 11, 0, 9, 8, + 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00, + /* '^' */ 7, 11, 0, 9, 8, + 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '_' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, + /* '`' */ 7, 11, 0, 9, 8, + 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 'a' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00, + /* 'b' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, + /* 'c' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + /* 'd' */ 7, 11, 0, 9, 8, + 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, + /* 'e' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00, + /* 'f' */ 7, 11, 0, 9, 8, + 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* 'g' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, + /* 'h' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + /* 'i' */ 7, 11, 0, 9, 8, + 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + /* 'j' */ 7, 11, 0, 9, 8, + 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, + /* 'k' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, + /* 'l' */ 7, 11, 0, 9, 8, + 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, + /* 'm' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, + /* 'n' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + /* 'o' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + /* 'p' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, + /* 'q' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, + /* 'r' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + /* 's' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, + /* 't' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, + /* 'u' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, + /* 'v' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, + /* 'w' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, + /* 'x' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, + /* 'y' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, + /* 'z' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, + /* '{' */ 7, 11, 0, 9, 8, + 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, + /* '|' */ 7, 11, 0, 9, 8, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + /* '}' */ 7, 11, 0, 9, 8, + 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, + /* '~' */ 7, 11, 0, 9, 8, + 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +struct GP_FontFace GP_DefaultConsoleFont = { + .family_name = "Gfxprim", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 9, + .descend = 2, + .max_glyph_width = 8, + .max_glyph_advance = 8, + .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, + .glyphs = default_console_glyphs, + .glyph_offsets = {16}, +}; + +static uint8_t default_proportional_glyphs[] = { + /* ' ' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '!' */ 4, 11, 0, 9, 6, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, + /* '"' */ 8, 11, 0, 9, 9, + 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '#' */ 8, 11, 0, 9, 9, + 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00, + /* '$' */ 7, 11, 0, 9, 8, + 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, + /* '%' */ 7, 11, 0, 9, 8, + 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, + /* '&' */ 7, 11, 0, 9, 8, + 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, + /* ''' */ 4, 11, 0, 9, 5, + 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '(' */ 2, 11, 0, 9, 4, + 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00, + /* ')' */ 2, 11, 0, 9, 4, + 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, + /* '*' */ 5, 11, 0, 9, 6, + 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00, + /* '+' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* ',' */ 4, 11, 0, 9, 6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, + /* '-' */ 4, 11, 0, 9, 6, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '.' */ 4, 11, 0, 9, 6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + /* '/' */ 5, 11, 0, 9, 6, + 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, + /* '0' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, + /* '1' */ 6, 11, 0, 9, 7, + 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, + /* '2' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* '3' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '4' */ 6, 11, 0, 9, 7, + 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, + /* '5' */ 6, 11, 0, 9, 7, + 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '6' */ 6, 11, 0, 9, 7, + 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '7' */ 6, 11, 0, 9, 7, + 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* '8' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '9' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, + /* ':' */ 4, 11, 0, 9, 5, + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + /* ';' */ 4, 11, 0, 9, 5, + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00, + /* '<' */ 4, 11, 0, 9, 6, + 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, + /* '=' */ 5, 11, 0, 9, 6, + 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, + /* '>' */ 4, 11, 0, 9, 6, + 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '?' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, + /* '@' */ 8, 11, 0, 9, 9, + 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, + /* 'A' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'B' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, + /* 'C' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, + /* 'D' */ 7, 11, 0, 9, 8, + 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, + /* 'E' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'F' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'G' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'H' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'I' */ 1, 11, 0, 9, 2, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'J' */ 7, 11, 0, 9, 8, + 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'K' */ 7, 11, 0, 9, 8, + 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'L' */ 6, 11, 0, 9, 7, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* 'M' */ 7, 11, 0, 9, 8, + 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'N' */ 7, 11, 0, 9, 8, + 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, + /* 'O' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'P' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'Q' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, + /* 'R' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'S' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'T' */ 7, 11, 0, 9, 8, + 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'U' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'V' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, + /* 'W' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, + /* 'X' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, + /* 'Y' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'Z' */ 7, 11, 0, 9, 8, + 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, + /* '[' */ 3, 11, 0, 9, 4, + 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, + /* '\' */ 5, 11, 0, 9, 6, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, + /* ']' */ 3, 11, 0, 9, 4, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, + /* '^' */ 8, 11, 0, 9, 9, + 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '_' */ 8, 11, 0, 9, 9, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, + /* '`' */ 2, 11, 0, 9, 3, + 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 'a' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00, + /* 'b' */ 6, 11, 0, 9, 7, + 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00, + /* 'c' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, + /* 'd' */ 6, 11, 0, 9, 7, + 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, + /* 'e' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00, + /* 'f' */ 6, 11, 0, 9, 7, + 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* 'g' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, + /* 'h' */ 6, 11, 0, 9, 7, + 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, + /* 'i' */ 2, 11, 0, 9, 4, + 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + /* 'j' */ 3, 11, 0, 9, 4, + 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0, + /* 'k' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, + /* 'l' */ 4, 11, 0, 9, 5, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, + /* 'm' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, + /* 'n' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, + /* 'o' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* 'p' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, + /* 'q' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, + /* 'r' */ 5, 11, 0, 9, 6, + 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 's' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, + /* 't' */ 6, 11, 0, 9, 7, + 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, + /* 'u' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, + /* 'v' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00, + /* 'w' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, + /* 'x' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00, + /* 'y' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, + /* 'z' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00, + /* '{' */ 5, 11, 0, 9, 6, + 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, + /* '|' */ 1, 11, 0, 9, 2, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* '}' */ 5, 11, 0, 9, 6, + 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, + /* '~' */ 6, 11, 0, 9, 7, + 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +struct GP_FontFace GP_DefaultProportionalFont = { + .family_name = "Gfxprim", + .style_name = "Proportional", + .charset = GP_CHARSET_7BIT, + .ascend = 9, + .descend = 2, + .max_glyph_width = 9, + .max_glyph_advance = 9, + .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, + .glyphs = default_proportional_glyphs, + .glyph_offsets = {16}, +}; commit 98cd4f682a77e56eea48dbcd85336c5073deb00c Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 10:54:22 +0200 URL: <
http://repo.or.cz/gfxprim.git/98cd4f682a77e56e
> Rename GP_Context -> GP_Pixmap This should have been done long long time ago. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- build/syms/Backend_symbols.txt | 2 +- build/syms/Core_symbols.txt | 26 +-- demos/bogoman/bogoman.c | 14 +- demos/bogoman/bogoman_render.c | 98 ++++---- demos/bogoman/bogoman_render.h | 6 +- demos/c_simple/SDL_glue.c | 18 +- demos/c_simple/backend_example.c | 12 +- demos/c_simple/backend_timers_example.c | 6 +- demos/c_simple/blittest.c | 32 +-- demos/c_simple/convolution.c | 2 +- demos/c_simple/debug_handler.c | 6 +- demos/c_simple/fileview.c | 16 +- demos/c_simple/filters_symmetry.c | 6 +- demos/c_simple/fonttest.c | 26 +-- demos/c_simple/gaussian_noise.c | 4 +- demos/c_simple/gfx_koch.c | 12 +- demos/c_simple/input_example.c | 12 +- demos/c_simple/koch.c | 36 +-- demos/c_simple/linetest.c | 22 +- demos/c_simple/loaders.c | 2 +- demos/c_simple/loaders_example.c | 2 +- demos/c_simple/loaders_register.c | 4 +- demos/c_simple/memory_io.c | 6 +- demos/c_simple/pretty_print.c | 8 +- demos/c_simple/randomshapetest.c | 58 ++--- demos/c_simple/shapetest.c | 40 ++-- demos/c_simple/showimage.c | 12 +- demos/c_simple/sin_AA.c | 24 +- demos/c_simple/textaligntest.c | 42 ++-- demos/c_simple/v4l2_show.c | 12 +- demos/c_simple/virtual_backend_example.c | 42 ++-- demos/c_simple/weighted_median.c | 4 +- demos/c_simple/x11_windows.c | 18 +- demos/c_simple/zip_container.c | 14 +- demos/grinder/grinder.c | 78 +++---- demos/grinder/histogram.c | 6 +- demos/grinder/histogram.h | 2 +- demos/particle/particle_demo.c | 18 +- demos/particle/space.c | 42 ++-- demos/particle/space.h | 2 +- demos/py_simple/backends.py | 2 +- demos/py_simple/blit.py | 8 +- demos/py_simple/cam_view.py | 2 +- demos/py_simple/font_style.py | 2 +- demos/py_simple/gfx.py | 78 +++---- demos/py_simple/gravplots_AA.py | 16 +- demos/py_simple/showimage.py | 2 +- demos/py_simple/sinplots_AA.py | 10 +- demos/py_simple/x11_windows.py | 2 +- demos/spiv/image_cache.c | 32 +-- demos/spiv/image_cache.h | 8 +- demos/spiv/image_loader.c | 10 +- demos/spiv/image_loader.h | 4 +- demos/spiv/spiv.c | 134 +++++------ demos/spiv/spiv_help.c | 6 +- demos/ttf2img/ttf2img.c | 14 +- doc/Makefile | 2 +- doc/about.txt | 2 +- doc/backends.txt | 20 +- doc/backends_python.txt | 4 +- doc/blits.txt | 24 +- doc/coding_style.txt | 8 +- doc/convert.txt | 8 +- doc/core.txt | 6 +- doc/core_python.txt | 34 +-- doc/debug.txt | 2 +- doc/environment_variables.txt | 6 +- doc/example_SDL_glue.txt | 2 +- doc/filters.txt | 218 ++++++++--------- doc/filters_dithering.txt | 16 +- doc/filters_resize.txt | 28 +-- doc/gamma.txt | 2 +- doc/get_put_pixel.txt | 22 +- doc/gfx.txt | 56 ++--- doc/gfx_python.txt | 48 ++-- doc/grabbers.txt | 4 +- doc/images/regen.py | 8 +- doc/loaders.txt | 200 ++++++++-------- doc/loaders_python.txt | 2 +- doc/{context.txt => pixmap.txt} | 146 ++++++------ doc/text.txt | 6 +- include/backends/GP_Backend.h | 14 +- .../{GP_SDL_Context.h => GP_SDL_Pixmap.h} | 18 +- include/core/GP_Blit.h | 36 +-- include/core/GP_Convert.gen.h.t | 2 +- include/core/GP_Convert.h | 26 +-- include/core/GP_Core.h | 4 +- include/core/GP_Debug.h | 2 +- include/core/GP_Fill.h | 4 +- include/core/GP_FnPerBpp.h | 20 +- include/core/GP_Gamma.h | 4 +- include/core/GP_GammaCorrection.h | 2 +- include/core/GP_GammaPixel.gen.h.t | 2 +- include/core/GP_GetPutPixel.gen.h.t | 16 +- include/core/GP_GetPutPixel.h | 36 +-- include/core/GP_MixPixels.gen.h.t | 26 +-- include/core/GP_Pixel.gen.h.t | 4 +- include/core/GP_Pixel.h | 4 +- include/core/{GP_Context.h => GP_Pixmap.h} | 136 +++++------ include/core/GP_Transform.h | 90 +++---- include/filters/GP_ApplyTables.h | 10 +- include/filters/GP_Arithmetic.h | 50 ++-- include/filters/GP_Blur.h | 10 +- include/filters/GP_Convolution.h | 12 +- include/filters/GP_Dither.h | 12 +- include/filters/GP_EdgeDetection.h | 8 +- include/filters/GP_Filter.h | 2 +- include/filters/GP_Filters.h | 2 +- include/filters/GP_GaussianNoise.h | 14 +- include/filters/GP_Laplace.h | 8 +- include/filters/GP_Linear.h | 22 +- include/filters/GP_Median.h | 12 +- include/filters/GP_MultiTone.h | 12 +- include/filters/GP_Point.h | 56 ++--- include/filters/GP_Resize.h | 8 +- include/filters/GP_ResizeCubic.h | 8 +- include/filters/GP_ResizeLinear.h | 8 +- include/filters/GP_ResizeNN.h | 4 +- include/filters/GP_Rotate.h | 38 +-- include/filters/GP_Sepia.h | 12 +- include/filters/GP_Sigma.h | 12 +- include/filters/GP_Stats.h | 2 +- include/filters/GP_WeightedMedian.h | 12 +- include/gfx/GP_Arc.h | 6 +- include/gfx/GP_Circle.h | 18 +- include/gfx/GP_CircleSeg.h | 10 +- include/gfx/GP_Ellipse.h | 10 +- include/gfx/GP_Gfx.h | 2 +- include/gfx/GP_HLine.gen.h.t | 2 +- include/gfx/GP_HLine.h | 18 +- include/gfx/GP_HLineAA.h | 10 +- include/gfx/GP_Line.h | 6 +- include/gfx/GP_LineAA.h | 10 +- include/gfx/GP_Polygon.h | 10 +- include/gfx/GP_PutPixelAA.h | 14 +- include/gfx/GP_Rect.h | 34 +-- include/gfx/GP_Tetragon.h | 10 +- include/gfx/GP_Triangle.h | 10 +- include/gfx/GP_VLine.gen.h.t | 2 +- include/gfx/GP_VLine.h | 18 +- include/gfx/GP_VLineAA.h | 10 +- include/grabbers/GP_Grabber.h | 6 +- include/loaders/GP_BMP.h | 12 +- include/loaders/GP_Container.h | 14 +- include/loaders/GP_GIF.h | 6 +- include/loaders/GP_JP2.h | 8 +- include/loaders/GP_JPG.h | 12 +- include/loaders/GP_Loader.h | 30 +-- include/loaders/GP_Loaders.h | 2 +- include/loaders/GP_PCX.h | 8 +- include/loaders/GP_PNG.h | 14 +- include/loaders/GP_PNM.h | 32 +-- include/loaders/GP_PSD.h | 8 +- include/loaders/GP_PSP.h | 10 +- include/loaders/GP_TIFF.h | 12 +- include/loaders/GP_ZIP.h | 2 +- include/text/GP_Text.h | 20 +- libs/backends/GP_AALib.c | 14 +- libs/backends/GP_Backend.c | 14 +- libs/backends/GP_BackendVirtual.c | 30 +-- libs/backends/GP_LinuxFB.c | 40 ++-- libs/backends/GP_SDL.c | 38 +-- libs/backends/GP_X11.c | 46 ++-- libs/backends/GP_X11_Win.h | 2 +- libs/core/GP_Blit.c | 66 +++--- libs/core/GP_Blit.gen.c.t | 38 +-- libs/core/GP_Context.c | 220 +++++++++--------- libs/core/GP_Fill.gen.c.t | 8 +- libs/core/GP_GetPutPixel.c | 16 +- libs/filters/GP_ApplyTables.c | 10 +- libs/filters/GP_ApplyTables.gen.c.t | 10 +- libs/filters/GP_Blur.c | 16 +- libs/filters/GP_Convolution.c | 10 +- libs/filters/GP_Edge.c | 30 +-- libs/filters/GP_FloydSteinberg.gen.c.t | 16 +- libs/filters/GP_GaussianNoise.gen.c.t | 20 +- libs/filters/GP_HilbertPeano.gen.c.t | 16 +- libs/filters/GP_Histogram.gen.c.t | 8 +- libs/filters/GP_Laplace.c | 16 +- libs/filters/GP_LinearConvolution.c | 6 +- libs/filters/GP_LinearConvolution.gen.c.t | 26 +-- libs/filters/GP_Median.c | 16 +- libs/filters/GP_MirrorH.gen.c.t | 18 +- libs/filters/GP_MultiTone.gen.c.t | 18 +- libs/filters/GP_Resize.c | 12 +- libs/filters/GP_ResizeCubic.gen.c.t | 10 +- libs/filters/GP_ResizeCubicFloat.c | 4 +- libs/filters/GP_ResizeLinear.gen.c.t | 14 +- libs/filters/GP_ResizeNN.gen.c.t | 8 +- libs/filters/GP_Rotate.c | 16 +- libs/filters/GP_Rotate.gen.c.t | 48 ++-- libs/filters/GP_Sepia.c | 6 +- libs/filters/GP_Sigma.c | 16 +- libs/filters/GP_WeightedMedian.c | 16 +- libs/filters/arithmetic_filter.t | 22 +- libs/filters/point_filter.t | 10 +- libs/gfx/GP_Arc.c | 16 +- libs/gfx/GP_Circle.c | 42 ++-- libs/gfx/GP_CircleSeg.c | 38 +-- libs/gfx/GP_Ellipse.c | 16 +- libs/gfx/GP_FillCircle.gen.c.t | 22 +- libs/gfx/GP_FillEllipse.gen.c.t | 24 +- libs/gfx/GP_HLine.c | 36 +-- libs/gfx/GP_HLine.gen.c.t | 10 +- libs/gfx/GP_HLineAA.c | 28 +-- libs/gfx/GP_HLineAA.gen.c.t | 16 +- libs/gfx/GP_Line.gen.c.t | 38 +-- libs/gfx/GP_LineAA.c | 16 +- libs/gfx/GP_LineAA.gen.c.t | 40 ++-- libs/gfx/GP_PartialEllipse.c | 16 +- libs/gfx/GP_Polygon.c | 24 +- libs/gfx/GP_PutPixelAA.gen.c.t | 22 +- libs/gfx/GP_Rect.c | 54 ++--- libs/gfx/GP_Tetragon.c | 44 ++-- libs/gfx/GP_Triangle.c | 36 +-- libs/gfx/GP_VLine.c | 42 ++-- libs/gfx/GP_VLine.gen.c.t | 4 +- libs/gfx/GP_VLineAA.c | 28 +-- libs/gfx/GP_VLineAA.gen.c.t | 16 +- libs/gfx/algo/Arc.algo.h | 24 +- libs/gfx/algo/Circle.algo.h | 26 +-- libs/gfx/algo/CircleSeg.algo.h | 26 +-- libs/gfx/algo/Ellipse.algo.h | 28 +-- libs/gfx/algo/FillRing.algo.h | 20 +- libs/gfx/algo/FillTriangle.algo.h | 10 +- libs/gfx/algo/PartialEllipse.algo.h | 16 +- libs/grabbers/GP_V4L2.c | 8 +- libs/loaders/GP_BMP.c | 48 ++-- libs/loaders/GP_BMP_RLE.h | 12 +- libs/loaders/GP_Container.c | 2 +- libs/loaders/GP_GIF.c | 16 +- libs/loaders/GP_JP2.c | 14 +- libs/loaders/GP_JPG.c | 30 +-- libs/loaders/GP_Loader.c | 28 +-- libs/loaders/GP_PCX.c | 24 +- libs/loaders/GP_PNG.c | 26 +-- libs/loaders/GP_PNM.c | 188 +++++++-------- libs/loaders/GP_PSD.c | 32 +-- libs/loaders/GP_PSP.c | 10 +- libs/loaders/GP_TIFF.c | 30 +-- libs/loaders/GP_ZIP.c | 12 +- libs/text/GP_Text.c | 22 +- libs/text/GP_Text.gen.c.t | 46 ++-- pylib/gfxprim/__init__.py | 6 +- pylib/gfxprim/backends/__init__.py | 2 +- pylib/gfxprim/backends/_extend_backend.py | 2 +- pylib/gfxprim/core/__init__.py | 124 +++++----- pylib/gfxprim/core/core.i | 86 +++---- pylib/gfxprim/filters/__init__.py | 12 +- pylib/gfxprim/gfx/__init__.py | 16 +- pylib/gfxprim/gfx/gfx.i | 8 +- pylib/gfxprim/loaders/__init__.py | 6 +- pylib/gfxprim/text/__init__.py | 12 +- tests/afl/loaders.c | 4 +- tests/core/.gitignore | 2 +- tests/core/BlitClipped.c | 14 +- tests/core/BlitConv.gen.c.t | 26 +-- tests/core/GetPutPixel.gen.c.t | 28 +-- tests/core/Makefile | 4 +- tests/core/{Context.c => Pixmap.c} | 142 +++++------ tests/core/runtest.sh | 2 +- tests/core/test_list.txt | 2 +- tests/drivers/framebuffer_test.c | 34 +-- tests/filters/APICoverage.gen.c.t | 100 ++++---- tests/filters/FilterMirrorH.c | 30 +-- tests/filters/FiltersCompare.gen.c.t | 22 +- tests/filters/LinearConvolution.c | 10 +- tests/filters/common.c | 4 +- tests/filters/common.h | 6 +- tests/gfx/APICoverage.gen.c.t | 42 ++-- tests/gfx/Circle.c | 8 +- tests/gfx/CircleSeg.c | 8 +- tests/gfx/Ellipse.c | 8 +- tests/gfx/FillCircle.c | 8 +- tests/gfx/FillEllipse.c | 8 +- tests/gfx/FillRect.c | 28 +-- tests/gfx/HLine.c | 8 +- tests/gfx/HLineAA.c | 8 +- tests/gfx/Line.c | 8 +- tests/gfx/LineAA.c | 8 +- tests/gfx/Polygon.c | 8 +- tests/gfx/PutPixelAA.c | 8 +- tests/gfx/VLine.c | 8 +- tests/gfx/common.c | 4 +- tests/gfx/common.h | 6 +- tests/gfx/gfx_benchmark.c | 6 +- tests/loaders/GIF.c | 6 +- tests/loaders/JPG.c | 22 +- tests/loaders/Loader.h | 44 ++-- tests/loaders/PBM.c | 2 +- tests/loaders/PCX.c | 12 +- tests/loaders/PGM.c | 2 +- tests/loaders/PNG.c | 28 +-- tests/loaders/PNM.c | 2 +- tests/loaders/PPM.c | 2 +- tests/loaders/SaveAbort.gen.c.t | 12 +- tests/loaders/SaveLoad.gen.c.t | 18 +- tests/loaders/ZIP.c | 8 +- tests/loaders/loaders_suite.c | 44 ++-- tests/pylib/test_core.py | 76 +++--- tests/pylib/test_gfx.py | 26 +-- tests/pylib/testutils.py | 16 +- 302 files changed, 3327 insertions(+), 3327 deletions(-) rename doc/{context.txt => pixmap.txt} (65%) rename include/backends/{GP_SDL_Context.h => GP_SDL_Pixmap.h} (82%) rename include/core/{GP_Context.h => GP_Pixmap.h} (59%) rename tests/core/{Context.c => Pixmap.c} (60%) diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt index 4c830bf39987..24bbc8b6f2c6 100644 --- a/build/syms/Backend_symbols.txt +++ b/build/syms/Backend_symbols.txt @@ -9,7 +9,7 @@ GP_BackendIsX11 GP_BackendX11RequestFullscreen GP_BackendSDLInit -GP_ContextFromSDLSurface +GP_PixmapFromSDLSurface GP_BackendAALibInit diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt index 47acec59d1db..7ee4ff213aff 100644 --- a/build/syms/Core_symbols.txt +++ b/build/syms/Core_symbols.txt @@ -1,19 +1,19 @@ GP_PixelTypes GP_PixelHasFlags -GP_ContextAlloc -GP_ContextResize -GP_ContextConvertAlloc -GP_ContextPrintInfo -GP_ContextRotateCCW -GP_SubContextAlloc -GP_ContextConvert -GP_ContextRotateCW -GP_ContextFree -GP_ContextInit -GP_SubContext -GP_ContextCopy -GP_ContextEqual +GP_PixmapAlloc +GP_PixmapResize +GP_PixmapConvertAlloc +GP_PixmapPrintInfo +GP_PixmapRotateCCW +GP_SubPixmapAlloc +GP_PixmapConvert +GP_PixmapRotateCW +GP_PixmapFree +GP_PixmapInit +GP_SubPixmap +GP_PixmapCopy +GP_PixmapEqual GP_PixelAddrOffset GP_GammaRelease diff --git a/demos/bogoman/bogoman.c b/demos/bogoman/bogoman.c index 36402c845038..cd0def6c3a67 100644 --- a/demos/bogoman/bogoman.c +++ b/demos/bogoman/bogoman.c @@ -32,29 +32,29 @@ static void save_png(struct bogoman_map *map, unsigned int elem_size, const char *filename) { - GP_Context *ctx; + GP_Pixmap *pixmap; unsigned int rx, ry; rx = elem_size * map->w; ry = elem_size * map->h; - ctx = GP_ContextAlloc(rx, ry, GP_PIXEL_RGB888); + pixmap = GP_PixmapAlloc(rx, ry, GP_PIXEL_RGB888); - if (ctx == NULL) + if (pixmap == NULL) return; struct bogoman_render render = { .map = map, .map_x_offset = 0, .map_y_offset = 0, - .ctx = ctx, + .pixmap = pixmap, .map_elem_size = elem_size, }; bogoman_render(&render, BOGOMAN_RENDER_ALL); - GP_SavePNG(ctx, filename, NULL); - GP_ContextFree(ctx); + GP_SavePNG(pixmap, filename, NULL); + GP_PixmapFree(pixmap); } static struct GP_Backend *backend; @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) .map = map, .map_x_offset = 0, .map_y_offset = 0, - .ctx = backend->context, + .pixmap = backend->pixmap, .backend = backend, .map_elem_size = ELEM_SIZE, }; diff --git a/demos/bogoman/bogoman_render.c b/demos/bogoman/bogoman_render.c index bc47f7d22530..c045b541935b 100644 --- a/demos/bogoman/bogoman_render.c +++ b/demos/bogoman/bogoman_render.c @@ -56,17 +56,17 @@ struct render_colors { static struct render_colors colors; -static void init_colors(GP_Context *ctx, struct render_colors *colors) +static void init_colors(GP_Pixmap *pixmap, struct render_colors *colors) { - colors->bg = GP_RGBToContextPixel(0xee, 0xee, 0xee, ctx); - colors->player = GP_RGBToContextPixel(0x00, 0xee, 0x00, ctx); - colors->frames = GP_RGBToContextPixel(0x00, 0x00, 0x00, ctx); - colors->diamond = GP_RGBToContextPixel(0x00, 0x00, 0xee, ctx); - colors->wall = GP_RGBToContextPixel(0x66, 0x66, 0x66, ctx); - colors->moveable = GP_RGBToContextPixel(0xff, 0xff, 0x60, ctx); - colors->edible = GP_RGBToContextPixel(0xff, 0x7f, 0x50, ctx); - colors->particle = GP_RGBToContextPixel(0xff, 0xff, 0x00, ctx); - colors->particle_dir = GP_RGBToContextPixel(0xff, 0x44, 0x00, ctx); + colors->bg = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap); + colors->player = GP_RGBToPixmapPixel(0x00, 0xee, 0x00, pixmap); + colors->frames = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + colors->diamond = GP_RGBToPixmapPixel(0x00, 0x00, 0xee, pixmap); + colors->wall = GP_RGBToPixmapPixel(0x66, 0x66, 0x66, pixmap); + colors->moveable = GP_RGBToPixmapPixel(0xff, 0xff, 0x60, pixmap); + colors->edible = GP_RGBToPixmapPixel(0xff, 0x7f, 0x50, pixmap); + colors->particle = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, pixmap); + colors->particle_dir = GP_RGBToPixmapPixel(0xff, 0x44, 0x00, pixmap); } static void render_none(struct bogoman_render *render, @@ -77,7 +77,7 @@ static void render_none(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); } static void render_player(struct bogoman_render *render, @@ -88,10 +88,10 @@ static void render_player(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); - GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2 - 1, colors.player); - GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); + GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2 - 1, colors.player); + GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); } static void render_wall(struct bogoman_render *render, @@ -100,26 +100,26 @@ static void render_wall(struct bogoman_render *render, { unsigned int w = render->map_elem_size; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.wall); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.wall); if (!(elem->flags & BOGOMAN_LEFT)) { - GP_VLineXYH(render->ctx, x, y, w, colors.frames); - GP_VLineXYH(render->ctx, x+1, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x+1, y, w, colors.frames); } if (!(elem->flags & BOGOMAN_RIGHT)) { - GP_VLineXYH(render->ctx, x + w - 1, y, w, colors.frames); - GP_VLineXYH(render->ctx, x + w - 2, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x + w - 1, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x + w - 2, y, w, colors.frames); } if (!(elem->flags & BOGOMAN_UP)) { - GP_HLineXYW(render->ctx, x, y, w, colors.frames); - GP_HLineXYW(render->ctx, x, y+1, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y+1, w, colors.frames); } if (!(elem->flags & BOGOMAN_DOWN)) { - GP_HLineXYW(render->ctx, x, y + w - 1, w, colors.frames); - GP_HLineXYW(render->ctx, x, y + w - 2, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y + w - 1, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y + w - 2, w, colors.frames); } } @@ -129,16 +129,16 @@ static void render_diamond(struct bogoman_render *render, { unsigned int w = render->map_elem_size; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); (void) elem; - GP_FillTetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2, + GP_FillTetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2, x + w/2, y + w - 1, x, y + w/2, colors.diamond); - GP_Tetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2, + GP_Tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2, x + w/2, y + w - 1, x, y + w/2, colors.frames); - GP_Tetragon(render->ctx, x + w/2, y+1, x + w - 2, y + w/2, + GP_Tetragon(render->pixmap, x + w/2, y+1, x + w - 2, y + w/2, x + w/2, y + w - 2, x+1, y + w/2, colors.frames); } @@ -150,11 +150,11 @@ static void render_moveable(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); - GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.moveable); - GP_RectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.frames); - GP_RectXYWH(render->ctx, x + 2, y + 2, w - 4, w - 4, colors.frames); + GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.moveable); + GP_RectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.frames); + GP_RectXYWH(render->pixmap, x + 2, y + 2, w - 4, w - 4, colors.frames); } static void render_edible(struct bogoman_render *render, @@ -165,9 +165,9 @@ static void render_edible(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); - GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.edible); + GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.edible); } static void render_particle(struct bogoman_render *render, @@ -177,43 +177,43 @@ static void render_particle(struct bogoman_render *render, unsigned int w = render->map_elem_size; int dir = elem->flags & BOGOMAN_DIRECTION_MASK; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); switch (elem->flags & ~BOGOMAN_DIRECTION_MASK) { case BOGOMAN_PARTICLE_ROUND: - GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2-1, colors.particle); - GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); + GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2-1, colors.particle); + GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); break; case BOGOMAN_PARTICLE_SQUARE: - GP_FillRectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.particle); - GP_RectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.frames); - GP_RectXYWH(render->ctx, x+2, y+2, w-4, w-4, colors.frames); + GP_FillRectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.particle); + GP_RectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.frames); + GP_RectXYWH(render->pixmap, x+2, y+2, w-4, w-4, colors.frames); break; } switch (dir) { case BOGOMAN_LEFT: - GP_FillTriangle(render->ctx, x + w/4, y + w/2, + GP_FillTriangle(render->pixmap, x + w/4, y + w/2, x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.particle_dir); - GP_Triangle(render->ctx, x + w/4, y + w/2, + GP_Triangle(render->pixmap, x + w/4, y + w/2, x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.frames); break; case BOGOMAN_RIGHT: - GP_FillTriangle(render->ctx, x + 3*w/4, y + w/2, + GP_FillTriangle(render->pixmap, x + 3*w/4, y + w/2, x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.particle_dir); - GP_Triangle(render->ctx, x + 3*w/4, y + w/2, + GP_Triangle(render->pixmap, x + 3*w/4, y + w/2, x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.frames); break; case BOGOMAN_UP: - GP_FillTriangle(render->ctx, x + w/2, y + w/4, + GP_FillTriangle(render->pixmap, x + w/2, y + w/4, x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.particle_dir); - GP_Triangle(render->ctx, x + w/2, y + w/4, + GP_Triangle(render->pixmap, x + w/2, y + w/4, x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.frames); break; case BOGOMAN_DOWN: - GP_FillTriangle(render->ctx, x + w/2, y + 3*w/4, + GP_FillTriangle(render->pixmap, x + w/2, y + 3*w/4, x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.particle_dir); - GP_Triangle(render->ctx, x + w/2, y + 3*w/4, + GP_Triangle(render->pixmap, x + w/2, y + 3*w/4, x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.frames); break; } @@ -268,10 +268,10 @@ void bogoman_render(struct bogoman_render *render, int flags) unsigned int x, y; //TODO: Hack - init_colors(render->ctx, &colors); + init_colors(render->pixmap, &colors); if (flags & BOGOMAN_RENDER_ALL) - GP_Fill(render->ctx, colors.bg); + GP_Fill(render->pixmap, colors.bg); for (y = render->map_x_offset; y < render->map->h; y++) { for (x = render->map_x_offset; x < render->map->w; x++) diff --git a/demos/bogoman/bogoman_render.h b/demos/bogoman/bogoman_render.h index e27744e2b064..38b7f0d59722 100644 --- a/demos/bogoman/bogoman_render.h +++ b/demos/bogoman/bogoman_render.h @@ -24,7 +24,7 @@ #define __BOGOMAN_RENDER_H__ struct bogoman_map; -struct GP_Context; +struct GP_Pixmap; struct bogoman_render { /* both in map elements */ @@ -34,8 +34,8 @@ struct bogoman_render { /* current map */ struct bogoman_map *map; - /* context to be used for rendering */ - struct GP_Context *ctx; + /* pixmap to be used for rendering */ + struct GP_Pixmap *pixmap; /* if not NULL is used to update screen */ struct GP_Backend *backend; diff --git a/demos/c_simple/SDL_glue.c b/demos/c_simple/SDL_glue.c index 8e9e2162db29..ef360e0b0e84 100644 --- a/demos/c_simple/SDL_glue.c +++ b/demos/c_simple/SDL_glue.c @@ -33,13 +33,13 @@ #include <stdlib.h> #include <SDL/SDL.h> #include <GP.h> -#include <backends/GP_SDL_Context.h> +#include <backends/GP_SDL_Pixmap.h> #define W 320 #define H 240 static SDL_Surface *display = NULL; -static GP_Context context; +static GP_Pixmap pixmap; static GP_Pixel black_pixel, darkgray_pixel; @@ -47,13 +47,13 @@ void redraw_screen(void) { SDL_LockSurface(display); - GP_Fill(&context, black_pixel); + GP_Fill(&pixmap, black_pixel); - GP_Text(&context, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW, + GP_Text(&pixmap, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW, darkgray_pixel, black_pixel, "GFXprim SDL Demo"); - GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel); - GP_Line(&context, 0, H-1, W-1, 0, darkgray_pixel); + GP_Line(&pixmap, 0, 0, W-1, H-1, darkgray_pixel); + GP_Line(&pixmap, 0, H-1, W-1, 0, darkgray_pixel); SDL_UnlockSurface(display); } @@ -100,10 +100,10 @@ int main(void) return 1; } - GP_ContextFromSDLSurface(&context, display); + GP_PixmapFromSDLSurface(&pixmap, display); - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, &context); - darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, &context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, &pixmap); + darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, &pixmap); redraw_screen(); SDL_Flip(display); diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c index 5e87ff18f178..6c8288347871 100644 --- a/demos/c_simple/backend_example.c +++ b/demos/c_simple/backend_example.c @@ -31,15 +31,15 @@ static void redraw(GP_Backend *self) { - GP_Context *context = self->context; + GP_Pixmap *pixmap = self->pixmap; GP_Pixel white_pixel, black_pixel; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, black_pixel); - GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel); - GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel); + GP_Fill(pixmap, black_pixel); + GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel); + GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel); /* Update the backend screen */ GP_BackendFlip(self); diff --git a/demos/c_simple/backend_timers_example.c b/demos/c_simple/backend_timers_example.c index 7b7aae2a06fd..16912fb592df 100644 --- a/demos/c_simple/backend_timers_example.c +++ b/demos/c_simple/backend_timers_example.c @@ -31,10 +31,10 @@ static void redraw(GP_Backend *self) { - GP_Context *context = self->context; - GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); + GP_Pixmap *pixmap = self->pixmap; + GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); - GP_Fill(context, black_pixel); + GP_Fill(pixmap, black_pixel); /* Update the backend screen */ GP_BackendFlip(self); diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c index 362ef8b09cc2..c12c8fe70b35 100644 --- a/demos/c_simple/blittest.c +++ b/demos/c_simple/blittest.c @@ -31,7 +31,7 @@ static GP_Pixel white; static GP_Backend *win; -static GP_Context *bitmap, *bitmap_raw, *bitmap_conv; +static GP_Pixmap *bitmap, *bitmap_raw, *bitmap_conv; static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3; static int pause_flag = 0; @@ -42,7 +42,7 @@ void redraw_screen(void) bitmap_x += bitmap_vx; bitmap_y += bitmap_vy; - if (bitmap_x + GP_ContextW(bitmap) > win->context->w) { + if (bitmap_x + GP_PixmapW(bitmap) > win->pixmap->w) { bitmap_vx = -bitmap_vx; bitmap_x += bitmap_vx; } @@ -52,7 +52,7 @@ void redraw_screen(void) bitmap_x += bitmap_vx; } - if (bitmap_y + GP_ContextH(bitmap) > win->context->h) { + if (bitmap_y + GP_PixmapH(bitmap) > win->pixmap->h) { bitmap_vy = -bitmap_vy; bitmap_y += bitmap_vy; } @@ -62,20 +62,20 @@ void redraw_screen(void) bitmap_y += bitmap_vy; } - GP_FillRectXYWH(win->context, 20, 20, 300, 50, black); + GP_FillRectXYWH(win->pixmap, 20, 20, 300, 50, black); - GP_Text(win->context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + GP_Text(win->pixmap, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, text_buf); - GP_Print(win->context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + GP_Print(win->pixmap, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ', bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' '); - GP_Blit(bitmap, 0, 0, GP_ContextW(bitmap), GP_ContextH(bitmap), - win->context, bitmap_x, bitmap_y); + GP_Blit(bitmap, 0, 0, GP_PixmapW(bitmap), GP_PixmapH(bitmap), + win->pixmap, bitmap_x, bitmap_y); GP_BackendUpdateRectXYWH(win, bitmap_x, bitmap_y, - GP_ContextW(bitmap), GP_ContextH(bitmap)); + GP_PixmapW(bitmap), GP_PixmapH(bitmap)); GP_BackendUpdateRectXYWH(win, 20, 20, 400, 50); } @@ -88,7 +88,7 @@ static void change_bitmap(void) snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'", GP_PixelTypeName(bitmap->pixel_type), - GP_PixelTypeName(win->context->pixel_type)); + GP_PixelTypeName(win->pixmap->pixel_type)); } void event_loop(void) @@ -133,7 +133,7 @@ void event_loop(void) break; case GP_EV_SYS_RESIZE: GP_BackendResizeAck(win); - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); GP_BackendFlip(win); break; } @@ -175,14 +175,14 @@ int main(void) return 1; } - bitmap_conv = GP_ContextConvertAlloc(bitmap_raw, - win->context->pixel_type); + bitmap_conv = GP_PixmapConvertAlloc(bitmap_raw, + win->pixmap->pixel_type); change_bitmap(); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); GP_BackendFlip(win); for (;;) { diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c index 213baf8ecc68..7d26f17563f2 100644 --- a/demos/c_simple/convolution.c +++ b/demos/c_simple/convolution.c @@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; struct callback_priv priv; GP_ProgressCallback callback = {.callback = progress_callback, .priv = &priv}; diff --git a/demos/c_simple/debug_handler.c b/demos/c_simple/debug_handler.c index 1744b0498ec1..5c472fd61e4f 100644 --- a/demos/c_simple/debug_handler.c +++ b/demos/c_simple/debug_handler.c @@ -65,11 +65,11 @@ int main(void) /* Turn on verbose debug and call some library functions */ GP_SetDebugLevel(10); - GP_Context *ctx = GP_ContextAlloc(1000, 1000, 1); + GP_Pixmap *pixmap = GP_PixmapAlloc(1000, 1000, 1); - GP_FilterGaussianBlur(ctx, ctx, 10, 10, NULL); + GP_FilterGaussianBlur(pixmap, pixmap, 10, 10, NULL); - GP_ContextFree(ctx); + GP_PixmapFree(pixmap); return 0; } diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c index e33a74a33338..d5c870b65f8c 100644 --- a/demos/c_simple/fileview.c +++ b/demos/c_simple/fileview.c @@ -29,7 +29,7 @@ #include <GP.h> -static GP_Context *win; +static GP_Pixmap *win; static GP_Backend *backend; static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel, @@ -266,14 +266,14 @@ int main(int argc, char *argv[]) return 1; } - win = backend->context; + win = backend->pixmap; - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win); - gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win); - dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win); - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win); + gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win); + dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win); redraw_screen(); GP_BackendFlip(backend); diff --git a/demos/c_simple/filters_symmetry.c b/demos/c_simple/filters_symmetry.c index 735be56668ec..926445354f9a 100644 --- a/demos/c_simple/filters_symmetry.c +++ b/demos/c_simple/filters_symmetry.c @@ -48,7 +48,7 @@ static void usage_and_exit(int ret) int main(int argc, char *argv[]) { - GP_Context *src, *res; + GP_Pixmap *src, *res; const char *symmetry = NULL; int opt, sym, debug = 0; @@ -109,8 +109,8 @@ int main(int argc, char *argv[]) } /* Cleanup */ - GP_ContextFree(src); - GP_ContextFree(res); + GP_PixmapFree(src); + GP_PixmapFree(res); return 0; } diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c index 7d6a7ca073b8..e2e5dd6c2b82 100644 --- a/demos/c_simple/fonttest.c +++ b/demos/c_simple/fonttest.c @@ -101,7 +101,7 @@ static void print_font_properties(const GP_FontFace *font) void redraw_screen(void) { - GP_Fill(win->context, black_pixel); + GP_Fill(win->pixmap, black_pixel); GP_TextStyle style = GP_DEFAULT_TEXT_STYLE; @@ -144,29 +144,29 @@ void redraw_screen(void) style.pixel_yspace = 0; style.char_xspace = tracking; - GP_FillRectXYWH(win->context, + GP_FillRectXYWH(win->pixmap, 16, SPACING*i + 16, GP_TextWidth(&style, test_string), GP_FontHeight(style.font), dark_gray_pixel); - GP_RectXYWH(win->context, + GP_RectXYWH(win->pixmap, 15, SPACING*i + 15, GP_TextMaxWidth(&style, strlen(test_string)) + 1, GP_FontHeight(style.font) + 1, blue_pixel); - GP_Text(win->context, &style, 16, SPACING*i + 16, align, + GP_Text(win->pixmap, &style, 16, SPACING*i + 16, align, white_pixel, dark_gray_pixel, test_string); style.pixel_xmul = 2; style.pixel_ymul = 2; style.pixel_yspace = 1; - GP_Text(win->context, &style, 34, SPACING * i + 44, align, + GP_Text(win->pixmap, &style, 34, SPACING * i + 44, align, white_pixel, black_pixel, test_string); - GP_RectXYWH(win->context, 33, SPACING * i + 43, + GP_RectXYWH(win->pixmap, 33, SPACING * i + 43, GP_TextWidth(&style, test_string) + 1, GP_TextHeight(&style) + 1, dark_gray_pixel); @@ -184,7 +184,7 @@ void redraw_screen(void) style.pixel_yspace = 2; } - GP_Text(win->context, &style, 64, SPACING*i + 88, align, + GP_Text(win->pixmap, &style, 64, SPACING*i + 88, align, dark_gray_pixel, black_pixel, test_string); } } @@ -287,12 +287,12 @@ int main(int argc, char *argv[]) return 1; } - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win->context); - dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context); - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win->pixmap); + dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap); redraw_screen(); GP_BackendFlip(win); diff --git a/demos/c_simple/gaussian_noise.c b/demos/c_simple/gaussian_noise.c index 21425ce0bb79..8c0cb152ebc9 100644 --- a/demos/c_simple/gaussian_noise.c +++ b/demos/c_simple/gaussian_noise.c @@ -42,7 +42,7 @@ static void help(const char *app) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; float sigma = 0.1, mu = 0.1; int opt; @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) return 1; } - GP_Context *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL); + GP_Pixmap *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL); if (GP_SaveImage(res, argv[optind + 1], NULL)) { fprintf(stderr, "Failed to save image '%s': %s", diff --git a/demos/c_simple/gfx_koch.c b/demos/c_simple/gfx_koch.c index c188f3adde71..615f2345ce9e 100644 --- a/demos/c_simple/gfx_koch.c +++ b/demos/c_simple/gfx_koch.c @@ -38,7 +38,7 @@ static int aa_flag = 0; /* * Generate color depending on distance from center * - * We could do this only and only because the context + * We could do this only and only because the pixmap * pixel type is fixed to GP_PIXEL_RGB888. */ static GP_Pixel do_color(int xc, int yc, float x, float y) @@ -66,7 +66,7 @@ static GP_Pixel do_color(int xc, int yc, float x, float y) return bmask | (gmask<<8) | (rmask << 16); } -static void draw(GP_Context *img, int level, float x0, float y0, float x1, float y1) +static void draw(GP_Pixmap *img, int level, float x0, float y0, float x1, float y1) { if (level == 0) { GP_Pixel pixel; @@ -106,13 +106,13 @@ static void draw(GP_Context *img, int level, float x0, float y0, float x1, float int main(void) { - GP_Context *img; + GP_Pixmap *img; /* Create RGB 24 bit image */ - img = GP_ContextAlloc(600, 600, GP_PIXEL_RGB888); + img = GP_PixmapAlloc(600, 600, GP_PIXEL_RGB888); if (img == NULL) { - fprintf(stderr, "Failed to allocate context"); + fprintf(stderr, "Failed to allocate pixmap"); return 1; } @@ -129,7 +129,7 @@ int main(void) } /* Cleanup */ - GP_ContextFree(img); + GP_PixmapFree(img); return 0; } diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c index 3a294d23e1f8..5ac76d302a1f 100644 --- a/demos/c_simple/input_example.c +++ b/demos/c_simple/input_example.c @@ -29,7 +29,7 @@ #include "GP.h" -static GP_Context *win; +static GP_Pixmap *win; static GP_Backend *backend; static GP_Pixel red, green, white, black; @@ -148,12 +148,12 @@ int main(int argc, char *argv[]) return 1; } - win = backend->context; + win = backend->pixmap; - red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win); - green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win); - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win); + red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win); + green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win); GP_Fill(win, black); GP_BackendFlip(backend); diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c index 27ce6744f8b0..b5558c06f9ab 100644 --- a/demos/c_simple/koch.c +++ b/demos/c_simple/koch.c @@ -40,7 +40,7 @@ #define sgn(x) ((x)>0 ? 1 : -1) static GP_Backend *backend; -static GP_Context *context; +static GP_Pixmap *pixmap; static int iter, l, way = 1, draw_edge = 1; static GP_Pixel black, blue, gray, red; @@ -49,11 +49,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) { double x2, y2, x3, y3, x5, y5; GP_Pixel pixel; - pixel = GP_RGBToPixel(0, 0, 255-16*iter, context->pixel_type); + pixel = GP_RGBToPixel(0, 0, 255-16*iter, pixmap->pixel_type); if (iter <= 0) { if (draw_edge) - GP_Line(context, x1, y1, x4, y4, black); + GP_Line(pixmap, x1, y1, x4, y4, black); return; } @@ -66,11 +66,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) x5 = (x1+x4)/2 + (y2 - y3)*sqrt(3.00/4); y5 = (y1+y4)/2 + (x3 - x2)*sqrt(3.00/4); - GP_FillTriangle(context, x2, y2, x3, y3, x5, y5, pixel); + GP_FillTriangle(pixmap, x2, y2, x3, y3, x5, y5, pixel); - GP_PutPixel(context, x2, y2, red); - GP_PutPixel(context, x3, y3, red); - GP_PutPixel(context, x5, y5, red); + GP_PutPixel(pixmap, x2, y2, red); + GP_PutPixel(pixmap, x3, y3, red); + GP_PutPixel(pixmap, x5, y5, red); sierpinsky(x1, y1, x2, y2, iter - 1); sierpinsky(x2, y2, x5, y5, iter - 1); @@ -81,8 +81,8 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) static void draw(int x, int y, int l, int iter) { double x1, y1, x2, y2, x3, y3; - int w = context->w; - int h = context->h; + int w = pixmap->w; + int h = pixmap->h; l = ((w < h ? w : h) - 20)/(5 - 1.00*iter/120); @@ -95,9 +95,9 @@ static void draw(int x, int y, int l, int iter) x3 = sin(1.00 * (iter+240)/57) * l + x; y3 = cos(1.00 * (iter+240)/57) * l + y; - GP_Fill(context, gray); + GP_Fill(pixmap, gray); - GP_FillTriangle(context, x1, y1, x2, y2, x3, y3, blue); + GP_FillTriangle(pixmap, x1, y1, x2, y2, x3, y3, blue); sierpinsky(x1, y1, x2, y2, iter/60%6); sierpinsky(x2, y2, x3, y3, iter/60%6); @@ -121,7 +121,7 @@ void redraw(void) if (iter < 0) way *= -1; - draw(context->w/2, context->h/2, l, iter); + draw(pixmap->w/2, pixmap->h/2, l, iter); } int main(void) @@ -136,15 +136,15 @@ int main(void) return 1; } - context = backend->context; + pixmap = backend->pixmap; - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - blue = GP_RGBToContextPixel(0x00, 0x00, 0xff, context); - gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, context); - red = GP_RGBToContextPixel(0xff, 0x00, 0x00, context); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + blue = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap); + gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, pixmap); + red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap); iter = 0; - draw(context->w/2, context->h/2, l, iter); + draw(pixmap->w/2, pixmap->h/2, l, iter); for (;;) { GP_Event ev; diff --git a/demos/c_simple/linetest.c b/demos/c_simple/linetest.c index 19a0244dc932..7e535df94a61 100644 --- a/demos/c_simple/linetest.c +++ b/demos/c_simple/linetest.c @@ -41,12 +41,12 @@ void redraw_screen(void) { double angle; int x, y; - int w = win->context->w; - int h = win->context->h; + int w = win->pixmap->w; + int h = win->pixmap->h; int xcenter = w/2; int ycenter = h/2; - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); for (angle = 0.0; angle < 2*M_PI; angle += 0.1) { x = (int) (w/2 * cos(start_angle + angle)); @@ -56,22 +56,22 @@ void redraw_screen(void) int b = 127.0 + 127.0 * sin(start_angle + angle); GP_Pixel pixel; - pixel = GP_RGBToPixel(r, 0, b, win->context->pixel_type); + pixel = GP_RGBToPixel(r, 0, b, win->pixmap->pixel_type); if (aa_flag) { - GP_LineAA_Raw(win->context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter), + GP_LineAA_Raw(win->pixmap, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter), GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel); } else { - GP_Line(win->context, xcenter + x, ycenter + y, xcenter, ycenter, pixel); - GP_Line(win->context, xcenter, ycenter, xcenter + x, ycenter + y, pixel); + GP_Line(win->pixmap, xcenter + x, ycenter + y, xcenter, ycenter, pixel); + GP_Line(win->pixmap, xcenter, ycenter, xcenter + x, ycenter + y, pixel); } } GP_BackendFlip(win); /* axes */ -// GP_HLineXYW(&context, 0, ycenter, display->w, white); -// GP_VLineXYH(&context, xcenter, 0, display->h, white); +// GP_HLineXYW(&pixmap, 0, ycenter, display->w, white); +// GP_VLineXYH(&pixmap, xcenter, 0, display->h, white); } void event_loop(void) @@ -135,8 +135,8 @@ int main(int argc, char *argv[]) return 1; } - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); redraw_screen(); diff --git a/demos/c_simple/loaders.c b/demos/c_simple/loaders.c index 369ec488c149..e9a3a306c1c3 100644 --- a/demos/c_simple/loaders.c +++ b/demos/c_simple/loaders.c @@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; struct callback_priv priv; GP_ProgressCallback callback = {.callback = progress_callback, .priv = &priv}; diff --git a/demos/c_simple/loaders_example.c b/demos/c_simple/loaders_example.c index 9c0a65ad4c94..b240aea952aa 100644 --- a/demos/c_simple/loaders_example.c +++ b/demos/c_simple/loaders_example.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; /* Turn on debug messages */ GP_SetDebugLevel(10); diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c index 5152d6b56e0b..4279c51f1014 100644 --- a/demos/c_simple/loaders_register.c +++ b/demos/c_simple/loaders_register.c @@ -37,7 +37,7 @@ /* * Saves 2 bpp grayscale image as ASCII Art */ -static int write_data(const GP_Context *img, GP_IO *io, +static int write_data(const GP_Pixmap *img, GP_IO *io, GP_ProgressCallback *callback) { GP_IO *bio; @@ -106,7 +106,7 @@ GP_Loader loader = { int main(int argc, char *argv[]) { - GP_Context *c, *gc; + GP_Pixmap *c, *gc; GP_LoaderRegister(&loader); diff --git a/demos/c_simple/memory_io.c b/demos/c_simple/memory_io.c index 873b27c7f420..57d09174473f 100644 --- a/demos/c_simple/memory_io.c +++ b/demos/c_simple/memory_io.c @@ -56,7 +56,7 @@ static char pgm[] = { int main(void) { GP_Backend *b; - GP_Context *img; + GP_Pixmap *img; GP_IO *io; io = GP_IOMem(pgm, sizeof(pgm), NULL); @@ -81,8 +81,8 @@ int main(void) return 1; } - GP_Fill(b->context, 0); - GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->context, + GP_Fill(b->pixmap, 0); + GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->pixmap, (WIN_W - img->w)/2, (WIN_H - img->h)/2); GP_BackendFlip(b); diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c index 82e9d084c918..ddd79bbacd25 100644 --- a/demos/c_simple/pretty_print.c +++ b/demos/c_simple/pretty_print.c @@ -22,7 +22,7 @@ /* - Pretty print function for pixel and context. + Pretty print function for pixel and pixmap. */ @@ -30,14 +30,14 @@ int main(void) { - GP_Context *ctx = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888); + GP_Pixmap *pixmap = GP_PixmapAlloc(100, 100, GP_PIXEL_RGB888); GP_Pixel pix = ~(GP_Pixel)0; /* Pretty prints pixel values */ GP_PixelPrint(pix, GP_PIXEL_RGB888); - /* Pretty prints context info */ - GP_ContextPrintInfo(ctx); + /* Pretty prints pixmap info */ + GP_PixmapPrintInfo(pixmap); return 0; } diff --git a/demos/c_simple/randomshapetest.c b/demos/c_simple/randomshapetest.c index 6b970f0b5dae..766b48e5ee92 100644 --- a/demos/c_simple/randomshapetest.c +++ b/demos/c_simple/randomshapetest.c @@ -56,7 +56,7 @@ static int fill_flag = 1; /* Do a clipping test? */ static int cliptest_flag = 0; -void random_point(const GP_Context *c, int *x, int *y) +void random_point(const GP_Pixmap *c, int *x, int *y) { if (cliptest_flag) { *x = random() % (3*c->w) - c->w; @@ -67,7 +67,7 @@ void random_point(const GP_Context *c, int *x, int *y) } } -void random_point_AA(const GP_Context *c, int *x, int *y) +void random_point_AA(const GP_Pixmap *c, int *x, int *y) { *x = random() % (c->w<<8); *y = random() % (c->h<<8); @@ -76,70 +76,70 @@ void random_point_AA(const GP_Context *c, int *x, int *y) void draw_random_circle(GP_Pixel pixel) { int x, y; - random_point(win->context, &x, &y); + random_point(win->pixmap, &x, &y); int r = random() % 50; if (fill_flag) - GP_FillCircle(win->context, x, y, r, pixel); + GP_FillCircle(win->pixmap, x, y, r, pixel); if (outline_flag) - GP_Circle(win->context, x, y, r, white); + GP_Circle(win->pixmap, x, y, r, white); } void draw_random_ellipse(GP_Pixel pixel) { int x, y; - random_point(win->context, &x, &y); + random_point(win->pixmap, &x, &y); int rx = random() % 50; int ry = random() % 50; if (fill_flag) - GP_FillEllipse(win->context, x, y, rx, ry, pixel); + GP_FillEllipse(win->pixmap, x, y, rx, ry, pixel); if (outline_flag) - GP_Ellipse(win->context, x, y, rx, ry, white); + GP_Ellipse(win->pixmap, x, y, rx, ry, white); } void draw_random_triangle(GP_Pixel pixel) { int x0, y0, x1, y1, x2, y2; - random_point(win->context, &x0, &y0); - random_point(win->context, &x1, &y1); - random_point(win->context, &x2, &y2); + random_point(win->pixmap, &x0, &y0); + random_point(win->pixmap, &x1, &y1); + random_point(win->pixmap, &x2, &y2); if (fill_flag) - GP_FillTriangle(win->context, x0, y0, x1, y1, x2, y2, pixel); + GP_FillTriangle(win->pixmap, x0, y0, x1, y1, x2, y2, pixel); if (outline_flag) - GP_Triangle(win->context, x0, y0, x1, y1, x2, y2, white); + GP_Triangle(win->pixmap, x0, y0, x1, y1, x2, y2, white); } void draw_random_rectangle(GP_Pixel pixel) { int x0, y0, x1, y1; - random_point(win->context, &x0, &y0); - random_point(win->context, &x1, &y1); + random_point(win->pixmap, &x0, &y0); + random_point(win->pixmap, &x1, &y1); if (fill_flag) - GP_FillRect(win->context, x0, y0, x1, y1, pixel); + GP_FillRect(win->pixmap, x0, y0, x1, y1, pixel); if (outline_flag) - GP_Rect(win->context, x0, y0, x1, y1, white); + GP_Rect(win->pixmap, x0, y0, x1, y1, white); } void draw_random_tetragon(GP_Pixel pixel) { int x0, y0, x1, y1, x2, y2, x3, y3; - random_point(win->context, &x0, &y0); - random_point(win->context, &x1, &y1); - random_point(win->context, &x2, &y2); - random_point(win->context, &x3, &y3); + random_point(win->pixmap, &x0, &y0); + random_point(win->pixmap, &x1, &y1); + random_point(win->pixmap, &x2, &y2); + random_point(win->pixmap, &x3, &y3); if (fill_flag) - GP_FillTetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); + GP_FillTetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel); if (outline_flag) - GP_Tetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); + GP_Tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel); } void draw_random_polygon(GP_Pixel pixel) @@ -148,15 +148,15 @@ void draw_random_polygon(GP_Pixel pixel) int i; for (i = 0; i < 5; i++) { - random_point(win->context, xy + 2*i, xy + 2*i + 1); + random_point(win->pixmap, xy + 2*i, xy + 2*i + 1); } - GP_FillPolygon_Raw(win->context, 5, xy, pixel); + GP_FillPolygon_Raw(win->pixmap, 5, xy, pixel); } void clear_screen(void) { - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); GP_BackendFlip(win); } @@ -168,7 +168,7 @@ void redraw_screen(void) /* Pick a random color for drawing. */ GP_Pixel pixel; pixel = GP_RGBToPixel(random() % 256, random() % 256, - random() % 256, win->context->pixel_type); + random() % 256, win->pixmap->pixel_type); switch (shape) { case SHAPE_CIRCLE: @@ -258,8 +258,8 @@ int main(void) return 1; } - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); for (;;) { GP_BackendPoll(win); diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c index 14e832ce75ac..71d82c85af60 100644 --- a/demos/c_simple/shapetest.c +++ b/demos/c_simple/shapetest.c @@ -28,7 +28,7 @@ #include <GP.h> -static GP_Context *win; +static GP_Pixmap *win; static GP_Backend *backend; /* Basic colors in display-specific format. */ @@ -253,8 +253,8 @@ void redraw_screen(void) if (show_axes) { int w, h; - w = GP_ContextW(win); - h = GP_ContextH(win); + w = GP_PixmapW(win); + h = GP_PixmapH(win); GP_HLine(win, 0, w, center_y, gray); GP_HLine(win, 0, w, center_y-yradius, darkgray); @@ -310,7 +310,7 @@ void redraw_screen(void) static void xradius_add(int xradius_add) { if (xradius + xradius_add > 1 && - xradius + xradius_add < (int)GP_ContextW(win)) + xradius + xradius_add < (int)GP_PixmapW(win)) xradius += xradius_add; } @@ -318,21 +318,21 @@ static void xradius_add(int xradius_add) static void yradius_add(int yradius_add) { if (yradius + yradius_add > 1 && - yradius + yradius_add < (int)GP_ContextH(win)) + yradius + yradius_add < (int)GP_PixmapH(win)) yradius += yradius_add; } static void xcenter_add(int xcenter_add) { if (center_x + xcenter_add > 1 && - center_x + xcenter_add < (int)GP_ContextW(win)/2) + center_x + xcenter_add < (int)GP_PixmapW(win)/2) center_x += xcenter_add; } static void ycenter_add(int ycenter_add) { if (center_y + ycenter_add > 1 && - center_y + ycenter_add < (int)GP_ContextH(win)/2) + center_y + ycenter_add < (int)GP_PixmapH(win)/2) center_y += ycenter_add; } @@ -364,8 +364,8 @@ void event_loop(void) break; case GP_KEY_R: win->axes_swap = !win->axes_swap; - center_x = GP_ContextW(win) / 2; - center_y = GP_ContextH(win) / 2; + center_x = GP_PixmapW(win) / 2; + center_y = GP_PixmapH(win) / 2; break; case GP_KEY_F: fill = !fill; @@ -451,9 +451,9 @@ void event_loop(void) break; case GP_EV_SYS_RESIZE: GP_BackendResizeAck(backend); - win = backend->context; - center_x = GP_ContextW(win) / 2; - center_y = GP_ContextH(win) / 2; + win = backend->pixmap; + center_x = GP_PixmapW(win) / 2; + center_y = GP_PixmapH(win) / 2; break; } break; @@ -506,19 +506,19 @@ int main(int argc, char *argv[]) return 1; } - win = backend->context; + win = backend->pixmap; center_x = win->w / 2; center_y = win->h / 2; /* Load colors compatible with the display */ - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win); - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win); - yellow = GP_RGBToContextPixel(0xff, 0xff, 0x00, win); - green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win); - red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win); - gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win); - darkgray = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win); + yellow = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win); + green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win); + red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win); + gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win); + darkgray = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win); print_instructions(); redraw_screen(); diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c index 4934d4cff423..4208b201c0b5 100644 --- a/demos/c_simple/showimage.c +++ b/demos/c_simple/showimage.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) { GP_Backend *backend; - GP_Context *image; + GP_Pixmap *image; if (argc != 2) { fprintf(stderr, "Takes image as an argument\n"); @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) } /* Blit image into the window and show it */ - GP_Blit(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_Blit(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0); GP_BackendFlip(backend); /* Wait for events */ @@ -78,11 +78,11 @@ int main(int argc, char *argv[]) GP_BackendResizeAck(backend); - cx = ((int)backend->context->w - (int)image->w) / 2; - cy = ((int)backend->context->h - (int)image->h) / 2; + cx = ((int)backend->pixmap->w - (int)image->w) / 2; + cy = ((int)backend->pixmap->h - (int)image->h) / 2; - GP_Fill(backend->context, 0); - GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, cx, cy); + GP_Fill(backend->pixmap, 0); + GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, cx, cy); GP_BackendFlip(backend); } } diff --git a/demos/c_simple/sin_AA.c b/demos/c_simple/sin_AA.c index 20e320276f3f..0191918a2e80 100644 --- a/demos/c_simple/sin_AA.c +++ b/demos/c_simple/sin_AA.c @@ -32,35 +32,35 @@ #include <GP.h> -static void redraw(GP_Context *context) +static void redraw(GP_Pixmap *pixmap) { static float param = 1; static float param2 = 0.01; static int flag = 1; - GP_Pixel b = GP_RGBToContextPixel(0xbe, 0xbe, 0x9e, context); + GP_Pixel b = GP_RGBToPixmapPixel(0xbe, 0xbe, 0x9e, pixmap); unsigned int y; - GP_Fill(context, b); + GP_Fill(pixmap, b); - for (y = 0; y < context->w; y++) { + for (y = 0; y < pixmap->w; y++) { GP_Coord x0, x1, l1, l2; - x0 = (context->w)<<7; - x1 = (context->w)<<7; + x0 = (pixmap->w)<<7; + x1 = (pixmap->w)<<7; - l1 = (context->w)<<5; - l2 = (context->w)<<3; + l1 = (pixmap->w)<<5; + l2 = (pixmap->w)<<3; - GP_Pixel p = GP_RGBToContextPixel(120 - 3 * param, abs(40 * param), 0, context); + GP_Pixel p = GP_RGBToPixmapPixel(120 - 3 * param, abs(40 * param), 0, pixmap); - l2 *= 4.00 * y / context->h; + l2 *= 4.00 * y / pixmap->h; l1 *= param; x0 += l1 * sin(param2 * y) + l2; x1 -= l1 * cos(param2 * y) + l2; - GP_HLineAA(context, x0, x1, y<<8, p); + GP_HLineAA(pixmap, x0, x1, y<<8, p); } if (flag) { @@ -97,7 +97,7 @@ int main(void) /* Wait for events */ for (;;) { if (!pause_flag) { - redraw(backend->context); + redraw(backend->pixmap); GP_BackendFlip(backend); } diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c index 0c08140ba9fa..9827ee6b96a0 100644 --- a/demos/c_simple/textaligntest.c +++ b/demos/c_simple/textaligntest.c @@ -41,11 +41,11 @@ static GP_Backend *win; void redraw_screen(void) { - GP_Fill(win->context, black_pixel); + GP_Fill(win->pixmap, black_pixel); /* draw axes intersecting in the middle, where text should be shown */ - GP_HLine(win->context, 0, X, Y/2, darkgray_pixel); - GP_VLine(win->context, X/2, 0, Y, darkgray_pixel); + GP_HLine(win->pixmap, 0, X, Y/2, darkgray_pixel); + GP_VLine(win->pixmap, X/2, 0, Y, darkgray_pixel); switch (font_flag) { case 0: @@ -68,17 +68,17 @@ void redraw_screen(void) break; } - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW, yellow_pixel, black_pixel, "bottom left"); - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, red_pixel, black_pixel, "bottom right"); - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE, blue_pixel, black_pixel, "top right"); - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE, green_pixel, black_pixel, "top left"); - GP_HLine(win->context, 0, X, Y/3, darkgray_pixel); - GP_Text(win->context, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE, + GP_HLine(win->pixmap, 0, X, Y/3, darkgray_pixel); + GP_Text(win->pixmap, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE, white_pixel, black_pixel, "x center y baseline"); } @@ -96,13 +96,13 @@ static void event_loop(void) switch (ev.val.key.key) { case GP_KEY_X: - win->context->x_swap = !win->context->x_swap; + win->pixmap->x_swap = !win->pixmap->x_swap; break; case GP_KEY_Y: - win->context->y_swap = !win->context->y_swap; + win->pixmap->y_swap = !win->pixmap->y_swap; break; case GP_KEY_R: - win->context->axes_swap = !win->context->axes_swap; + win->pixmap->axes_swap = !win->pixmap->axes_swap; GP_SWAP(X, Y); break; case GP_KEY_SPACE: @@ -146,8 +146,8 @@ static void event_loop(void) break; case GP_EV_SYS_RESIZE: GP_BackendResizeAck(win); - X = win->context->w; - Y = win->context->h; + X = win->pixmap->w; + Y = win->pixmap->h; break; } break; @@ -186,13 +186,13 @@ int main(int argc, char *argv[]) return 1; } - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context); - green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, win->context); - yellow_pixel = GP_RGBToContextPixel(0xff, 0xff, 0x00, win->context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap); + green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win->pixmap); + yellow_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win->pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap); redraw_screen(); GP_BackendFlip(win); diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c index 443d6d4926cb..5f5dacf86c72 100644 --- a/demos/c_simple/v4l2_show.c +++ b/demos/c_simple/v4l2_show.c @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) for (;;) { if (GP_GrabberPoll(grabber) > 0) { - GP_Context *res, *img = grabber->frame; + GP_Pixmap *res, *img = grabber->frame; switch (mode) { case 0: @@ -113,14 +113,14 @@ int main(int argc, char *argv[]) break; } - unsigned int c_x = (backend->context->w - res->w) / 2; - unsigned int c_y = (backend->context->h - res->h) / 2; + unsigned int c_x = (backend->pixmap->w - res->w) / 2; + unsigned int c_y = (backend->pixmap->h - res->h) / 2; - GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, c_x, c_y); + GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->pixmap, c_x, c_y); GP_BackendFlip(backend); if (mode) - GP_ContextFree(res); + GP_PixmapFree(res); } usleep(1000); @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) case GP_EV_SYS: if (ev.code == GP_EV_SYS_RESIZE) { GP_BackendResizeAck(backend); - GP_Fill(backend->context, 0); + GP_Fill(backend->pixmap, 0); } break; } diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c index f59f4ec384c1..b1d8199f5b89 100644 --- a/demos/c_simple/virtual_backend_example.c +++ b/demos/c_simple/virtual_backend_example.c @@ -35,48 +35,48 @@ static GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel; static void redraw(GP_Backend *backend) { - GP_Context *context = backend->context; + GP_Pixmap *pixmap = backend->pixmap; /* Now draw some testing patters */ - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, context); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, context); - green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap); + green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, pixmap); - GP_Fill(context, white_pixel); + GP_Fill(pixmap, white_pixel); unsigned int i, j; for (i = 0; i < 40; i++) { - GP_HLineXYW(context, 0, i, i, black_pixel); - GP_HLineXYW(context, 1, i + 40, i, black_pixel); - GP_HLineXYW(context, 2, i + 80, i, black_pixel); - GP_HLineXYW(context, 3, i + 120, i, black_pixel); - GP_HLineXYW(context, 4, i + 160, i, black_pixel); - GP_HLineXYW(context, 5, i + 200, i, black_pixel); - GP_HLineXYW(context, 6, i + 240, i, black_pixel); - GP_HLineXYW(context, 7, i + 280, i, black_pixel); + GP_HLineXYW(pixmap, 0, i, i, black_pixel); + GP_HLineXYW(pixmap, 1, i + 40, i, black_pixel); + GP_HLineXYW(pixmap, 2, i + 80, i, black_pixel); + GP_HLineXYW(pixmap, 3, i + 120, i, black_pixel); + GP_HLineXYW(pixmap, 4, i + 160, i, black_pixel); + GP_HLineXYW(pixmap, 5, i + 200, i, black_pixel); + GP_HLineXYW(pixmap, 6, i + 240, i, black_pixel); + GP_HLineXYW(pixmap, 7, i + 280, i, black_pixel); } for (i = 0; i < 256; i++) { for (j = 0; j < 256; j++) { uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5; - GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context); - GP_PutPixel(context, i + 60, j + 10, pix); + GP_Pixel pix = GP_RGBToPixmapPixel(i, j, val, pixmap); + GP_PutPixel(pixmap, i + 60, j + 10, pix); } } - GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, black_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, red_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, green_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, blue_pixel, white_pixel, "Lorem Ipsum dolor sit..."); /* Update the backend screen */ diff --git a/demos/c_simple/weighted_median.c b/demos/c_simple/weighted_median.c index a0b09fd4f946..dc481603f9d5 100644 --- a/demos/c_simple/weighted_median.c +++ b/demos/c_simple/weighted_median.c @@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; struct callback_priv priv; GP_ProgressCallback callback = {.callback = progress_callback, .priv = &priv}; @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) priv.op = "Weighted Median"; - GP_Context *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback); + GP_Pixmap *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback); printf("\n"); diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c index aa37c7b20b67..da9d8d8b8041 100644 --- a/demos/c_simple/x11_windows.c +++ b/demos/c_simple/x11_windows.c @@ -29,16 +29,16 @@ #include <stdio.h> #include <GP.h> -static void redraw(struct GP_Context *context) +static void redraw(struct GP_Pixmap *pixmap) { GP_Pixel white_pixel, black_pixel; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, black_pixel); - GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel); - GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel); + GP_Fill(pixmap, black_pixel); + GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel); + GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel); } static int ev_loop(struct GP_Backend *backend, const char *name) @@ -68,7 +68,7 @@ static int ev_loop(struct GP_Backend *backend, const char *name) switch (ev.code) { case GP_EV_SYS_RESIZE: GP_BackendResizeAck(backend); - redraw(backend->context); + redraw(backend->pixmap); GP_BackendFlip(backend); break; case GP_EV_SYS_QUIT: @@ -99,8 +99,8 @@ int main(void) } /* Update the backend screen */ - redraw(win_1->context); - redraw(win_2->context); + redraw(win_1->pixmap); + redraw(win_2->pixmap); GP_BackendFlip(win_1); GP_BackendFlip(win_2); diff --git a/demos/c_simple/zip_container.c b/demos/c_simple/zip_container.c index 1fe5e36fceca..4cf77fd9aef1 100644 --- a/demos/c_simple/zip_container.c +++ b/demos/c_simple/zip_container.c @@ -33,7 +33,7 @@ #include <GP.h> static GP_Backend *backend; -static GP_Context *image; +static GP_Pixmap *image; static GP_Container *container; /* @@ -45,20 +45,20 @@ static GP_Container *container; */ static void load_next(void) { - GP_ContextFree(image); + GP_PixmapFree(image); image = GP_ContainerLoadNext(container, NULL); if (image == NULL) return; - if (image->w != backend->context->w || - image->h != backend->context->h) { + if (image->w != backend->pixmap->w || + image->h != backend->pixmap->h) { GP_BackendResize(backend, image->w, image->h); return; } - GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0); GP_BackendFlip(backend); } @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) } /* Blit image into the window and show it */ - GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0); GP_BackendFlip(backend); /* Wait for events */ @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) if (ev.code == GP_EV_SYS_RESIZE) { GP_BackendResizeAck(backend); GP_Blit_Clipped(image, 0, 0, image->w, image->h, - backend->context, 0, 0); + backend->pixmap, 0, 0); GP_BackendFlip(backend); } break; diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index 8c798d4cd5a1..fe40e2529e2a 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -106,7 +106,7 @@ static struct param resize_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int resize(GP_Context **c, const char *params) +static int resize(GP_Pixmap **c, const char *params) { int alg = 1; float ratio = -1; @@ -122,14 +122,14 @@ static int resize(GP_Context **c, const char *params) GP_Size w = ratio * (*c)->w; GP_Size h = ratio * (*c)->h; - GP_Context *res = NULL; + GP_Pixmap *res = NULL; res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback); if (res == NULL) return EINVAL; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; return 0; @@ -164,7 +164,7 @@ static struct param scale_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int scale(GP_Context **c, const char *params) +static int scale(GP_Pixmap **c, const char *params) { int alg = 1; int w = -1; @@ -185,14 +185,14 @@ static int scale(GP_Context **c, const char *params) if (h == -1) h = (*c)->h * (1.00 * w/(*c)->w) + 0.5; - GP_Context *res = NULL; + GP_Pixmap *res = NULL; res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback); if (res == NULL) return EINVAL; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; return 0; @@ -211,7 +211,7 @@ static struct param rotate_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int rotate(GP_Context **c, const char *params) +static int rotate(GP_Pixmap **c, const char *params) { int rot = -1; @@ -223,7 +223,7 @@ static int rotate(GP_Context **c, const char *params) return EINVAL; } - GP_Context *res = NULL; + GP_Pixmap *res = NULL; switch (rot) { case 0: @@ -240,7 +240,7 @@ static int rotate(GP_Context **c, const char *params) if (res == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; return 0; @@ -254,7 +254,7 @@ static struct param mirror_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int mirror(GP_Context **c, const char *params) +static int mirror(GP_Pixmap **c, const char *params) { int vert = 0, horiz = 0; @@ -277,7 +277,7 @@ static struct param bright_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int bright(GP_Context **c, const char *params) +static int bright(GP_Pixmap **c, const char *params) { float bright = 0; @@ -296,7 +296,7 @@ static struct param contrast_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int contrast(GP_Context **c, const char *params) +static int contrast(GP_Pixmap **c, const char *params) { float mul = 0; @@ -319,7 +319,7 @@ static struct param invert_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int invert(GP_Context **c, const char *params) +static int invert(GP_Pixmap **c, const char *params) { if (param_parse(params, invert_params, "invert", param_err)) return EINVAL; @@ -338,7 +338,7 @@ static struct param blur_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int blur(GP_Context **c, const char *params) +static int blur(GP_Pixmap **c, const char *params) { float sigma = 0; float sigma_x = 0; @@ -389,7 +389,7 @@ static struct param dither_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int dither(GP_Context **c, const char *params) +static int dither(GP_Pixmap **c, const char *params) { int fmt = -1; @@ -401,15 +401,15 @@ static int dither(GP_Context **c, const char *params) return EINVAL; } - GP_Context *bw; + GP_Pixmap *bw; bw = GP_FilterFloydSteinbergAlloc(*c, dither_pixel_types[fmt], progress_callback); - //TODO: so far we convert the context back to RGB888 + //TODO: so far we convert the pixmap back to RGB888 //(so we can do further work with it) - GP_Blit(bw, 0, 0, GP_ContextW(bw), GP_ContextH(bw), *c, 0, 0); + GP_Blit(bw, 0, 0, GP_PixmapW(bw), GP_PixmapH(bw), *c, 0, 0); - GP_ContextFree(bw); + GP_PixmapFree(bw); return 0; } @@ -421,7 +421,7 @@ static struct param save_jpg_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int save_jpg(GP_Context **c, const char *params) +static int save_jpg(GP_Pixmap **c, const char *params) { char *file = NULL; @@ -445,7 +445,7 @@ static struct param save_png_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int save_png(GP_Context **c, const char *params) +static int save_png(GP_Pixmap **c, const char *params) { char *file = NULL; @@ -471,7 +471,7 @@ static struct param median_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int median(GP_Context **c, const char *params) +static int median(GP_Pixmap **c, const char *params) { int rad = -1, rad_x, rad_y; @@ -486,12 +486,12 @@ static int median(GP_Context **c, const char *params) if (rad_x < 0 || rad_y < 0) return EINVAL; - GP_Context *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback); + GP_Pixmap *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback); if (ret == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = ret; return 0; @@ -508,7 +508,7 @@ static struct param sigma_mean_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int sigma_mean(GP_Context **c, const char *params) +static int sigma_mean(GP_Pixmap **c, const char *params) { int rad = -1, rad_x, rad_y, min = 0; float sigma = 0.1; @@ -527,12 +527,12 @@ static int sigma_mean(GP_Context **c, const char *params) (*c)->gamma = GP_GammaAcquire((*c)->pixel_type, 1.2); - GP_Context *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback); + GP_Pixmap *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback); if (ret == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = ret; return 0; @@ -545,19 +545,19 @@ static struct param sharpen_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int sharpen(GP_Context **c, const char *params) +static int sharpen(GP_Pixmap **c, const char *params) { float weight = 0.1; if (param_parse(params, sharpen_params, "sigma", param_err, &weight)) return EINVAL; - GP_Context *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback); + GP_Pixmap *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback); if (ret == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = ret; return 0; @@ -571,7 +571,7 @@ static struct param gauss_noise_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int gauss_noise(GP_Context **c, const char *params) +static int gauss_noise(GP_Pixmap **c, const char *params) { float sigma = 0.1; float mu = 0; @@ -601,7 +601,7 @@ static struct param arithmetic_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int arithmetic(GP_Context **c, const char *params) +static int arithmetic(GP_Pixmap **c, const char *params) { char *file = NULL; int op = -1; @@ -614,7 +614,7 @@ static int arithmetic(GP_Context **c, const char *params) return EINVAL; } - GP_Context *img, *res = NULL; + GP_Pixmap *img, *res = NULL; if ((img = GP_LoadImage(file, progress_callback)) == NULL) { print_error("arithmetic: Invalid image."); @@ -642,7 +642,7 @@ static int arithmetic(GP_Context **c, const char *params) if (res == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; @@ -656,7 +656,7 @@ static struct param histogram_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int histogram(GP_Context **c, const char *params) +static int histogram(GP_Pixmap **c, const char *params) { char *file = "histogram.png"; @@ -678,7 +678,7 @@ struct filter { const char *name; const char *desc; struct param *param_desc; - int (*apply)(GP_Context **c, const char *params); + int (*apply)(GP_Pixmap **c, const char *params); }; static struct filter filter_table[] = { @@ -763,7 +763,7 @@ static void add_filter(char *params) filter_params[filter_cnt++] = params; } -static void apply_filters(GP_Context **src) +static void apply_filters(GP_Pixmap **src) { unsigned int i; int ret; @@ -845,7 +845,7 @@ static void check_fmt(const char *fmt) exit(1); } -static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char *fmt) +static void save_by_fmt(struct GP_Pixmap *bitmap, const char *name, const char *fmt) { int ret; @@ -874,7 +874,7 @@ static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char int main(int argc, char *argv[]) { - GP_Context *bitmap; + GP_Pixmap *bitmap; int opt, i; const char *out_fmt = "ppm"; diff --git a/demos/grinder/histogram.c b/demos/grinder/histogram.c index 9706315b0f99..d02f17518235 100644 --- a/demos/grinder/histogram.c +++ b/demos/grinder/histogram.c @@ -22,7 +22,7 @@ #include "histogram.h" -void histogram_to_png(const GP_Context *src, const char *filename) +void histogram_to_png(const GP_Pixmap *src, const char *filename) { GP_Histogram *hist; @@ -36,7 +36,7 @@ void histogram_to_png(const GP_Context *src, const char *filename) unsigned int i, j; - GP_Context *res = GP_ContextAlloc(257*4, 256, GP_PIXEL_RGB888); + GP_Pixmap *res = GP_PixmapAlloc(257*4, 256, GP_PIXEL_RGB888); GP_Fill(res, 0xffffff); @@ -76,6 +76,6 @@ void histogram_to_png(const GP_Context *src, const char *filename) GP_SavePNG(res, filename, NULL); - GP_ContextFree(res); + GP_PixmapFree(res); GP_HistogramFree(hist); } diff --git a/demos/grinder/histogram.h b/demos/grinder/histogram.h index d6fdb4e5331f..e58dfd4c4527 100644 --- a/demos/grinder/histogram.h +++ b/demos/grinder/histogram.h @@ -25,6 +25,6 @@ #include <GP.h> -void histogram_to_png(const GP_Context *src, const char *filename); +void histogram_to_png(const GP_Pixmap *src, const char *filename); #endif /* HISTOGRAM_H */ diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c index 46fafe299887..e4226c27114b 100644 --- a/demos/particle/particle_demo.c +++ b/demos/particle/particle_demo.c @@ -37,7 +37,7 @@ static GP_Pixel black_pixel; static GP_Pixel white_pixel; static GP_Backend *backend = NULL; -static GP_Context *context = NULL; +static GP_Pixmap *pixmap = NULL; static void sighandler(int signo) { @@ -88,16 +88,16 @@ int main(int argc, char *argv[]) init_backend(backend_opts); - context = backend->context; + pixmap = backend->pixmap; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, black_pixel); + GP_Fill(pixmap, black_pixel); GP_BackendFlip(backend); struct space *space; - space = space_create(particles, 10<<8, 10<<8, (context->w - 10)<<8, (context->h - 10)<<8); + space = space_create(particles, 10<<8, 10<<8, (pixmap->w - 10)<<8, (pixmap->h - 10)<<8); for (;;) { if (backend->Poll) @@ -146,8 +146,8 @@ int main(int argc, char *argv[]) space_destroy(space); space = space_create(particles, 10<<8, 10<<8, - (context->w - 10)<<8, - (context->h - 10)<<8); + (pixmap->w - 10)<<8, + (pixmap->h - 10)<<8); break; } break; @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) if (!pause_flag) { space_time_tick(space, 1); - space_draw_particles(context, space); + space_draw_particles(pixmap, space); GP_BackendFlip(backend); } } diff --git a/demos/particle/space.c b/demos/particle/space.c index c53b9e31b286..8dfc956d656a 100644 --- a/demos/particle/space.c +++ b/demos/particle/space.c @@ -67,11 +67,11 @@ void space_destroy(struct space *space) #define SQUARE(x) ((x) * (x)) -void space_draw_particles(GP_Context *context, struct space *space) +void space_draw_particles(GP_Pixmap *pixmap, struct space *space) { unsigned int i; - GP_Fill(context, 0x000000); + GP_Fill(pixmap, 0x000000); for (i = 0; i < space->particle_count; i++) { GP_Pixel color; @@ -88,9 +88,9 @@ void space_draw_particles(GP_Context *context, struct space *space) } */ - color = GP_RGBToContextPixel(0xee, 0xee, 0xee, context); + color = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap); - GP_PutPixelAA(context, x, y, color); + GP_PutPixelAA(pixmap, x, y, color); int val = SQUARE(space->particles[i].vx) + SQUARE(space->particles[i].vy); @@ -99,29 +99,29 @@ void space_draw_particles(GP_Context *context, struct space *space) if (val > 255) val = 255; - color = GP_RGBToContextPixel(val, val, 0x40, context); + color = GP_RGBToPixmapPixel(val, val, 0x40, pixmap); /* Hexagons */ - GP_LineAA(context, x - a2, y - a1, x + a2, y - a1, color); - // GP_LineAA(context, x + a2, y - a1, x + a1, y - a2, color); - GP_LineAA(context, x + a1, y - a2, x + a1, y + a2, color); - // GP_LineAA(context, x + a1, y + a2, x + a2, y + a1, color); - GP_LineAA(context, x + a2, y + a1, x - a2, y + a1, color); - // GP_LineAA(context, x - a2, y + a1, x - a1, y + a2, color); - GP_LineAA(context, x - a1, y + a2, x - a1, y - a2, color); - // GP_LineAA(context, x - a1, y - a2, x - a2, y - a1, color); + GP_LineAA(pixmap, x - a2, y - a1, x + a2, y - a1, color); + // GP_LineAA(pixmap, x + a2, y - a1, x + a1, y - a2, color); + GP_LineAA(pixmap, x + a1, y - a2, x + a1, y + a2, color); + // GP_LineAA(pixmap, x + a1, y + a2, x + a2, y + a1, color); + GP_LineAA(pixmap, x + a2, y + a1, x - a2, y + a1, color); + // GP_LineAA(pixmap, x - a2, y + a1, x - a1, y + a2, color); + GP_LineAA(pixmap, x - a1, y + a2, x - a1, y - a2, color); + // GP_LineAA(pixmap, x - a1, y - a2, x - a2, y - a1, color); /* - GP_PutPixelAA(context, x + a2, y - a1, 0xffffff); - GP_PutPixelAA(context, x + a1, y - a2, 0xffffff); + GP_PutPixelAA(pixmap, x + a2, y - a1, 0xffffff); + GP_PutPixelAA(pixmap, x + a1, y - a2, 0xffffff); - GP_PutPixelAA(context, x + a1, y + a2, 0xffffff); - GP_PutPixelAA(context, x + a2, y + a1, 0xffffff); + GP_PutPixelAA(pixmap, x + a1, y + a2, 0xffffff); + GP_PutPixelAA(pixmap, x + a2, y + a1, 0xffffff); - GP_PutPixelAA(context, x - a2, y + a1, 0xffffff); - GP_PutPixelAA(context, x - a1, y + a2, 0xffffff); + GP_PutPixelAA(pixmap, x - a2, y + a1, 0xffffff); + GP_PutPixelAA(pixmap, x - a1, y + a2, 0xffffff); - GP_PutPixelAA(context, x - a1, y - a2, 0xffffff); - GP_PutPixelAA(context, x - a2, y - a1, 0xffffff); + GP_PutPixelAA(pixmap, x - a1, y - a2, 0xffffff); + GP_PutPixelAA(pixmap, x - a2, y - a1, 0xffffff); */ } } diff --git a/demos/particle/space.h b/demos/particle/space.h index 7878b11c2a69..021d615b36fc 100644 --- a/demos/particle/space.h +++ b/demos/particle/space.h @@ -69,7 +69,7 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h, void space_destroy(struct space *space); -void space_draw_particles(GP_Context *context, struct space *space); +void space_draw_particles(GP_Pixmap *pixmap, struct space *space); void space_time_tick(struct space *space, int time); diff --git a/demos/py_simple/backends.py b/demos/py_simple/backends.py index 31fb59d145d3..84715526aa2c 100755 --- a/demos/py_simple/backends.py +++ b/demos/py_simple/backends.py @@ -9,7 +9,7 @@ import gfxprim.text as text import gfxprim.input as input def redraw(bk): - c = bk.context + c = bk.pixmap black = c.RGBToPixel(0, 0, 0) white = c.RGBToPixel(0xff, 0xff, 0xff) diff --git a/demos/py_simple/blit.py b/demos/py_simple/blit.py index 2b3a6943c507..e76b8c08e0aa 100755 --- a/demos/py_simple/blit.py +++ b/demos/py_simple/blit.py @@ -21,13 +21,13 @@ class Ball: self.bg_img = bg_img def draw(self, bk): - self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h) + self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h) def move(self, bk): old_x = self.x; old_y = self.y; - self.bg_img.Blit(old_x, old_y, bk.context, old_x, old_y, self.ball.w, self.ball.h) + self.bg_img.Blit(old_x, old_y, bk.pixmap, old_x, old_y, self.ball.w, self.ball.h) self.x += self.dx self.y += self.dy @@ -38,7 +38,7 @@ class Ball: if (self.y <= 0 or self.y >= self.bg_img.h - self.ball.h): self.dy = -self.dy - self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h) + self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h) bk.UpdateRect(min(old_x, self.x), min(self.y, old_y), max(old_x, self.x) + self.ball.w - 1, max(old_y, self.y) + self.ball.h - 1) @@ -59,7 +59,7 @@ def main(): # Create X11 window bk = backends.BackendX11Init(None, 0, 0, bg.w, bg.h, sys.argv[1], 0) assert(bk) - bg.Blit(0, 0, bk.context, 0, 0, bg.w, bg.h) + bg.Blit(0, 0, bk.pixmap, 0, 0, bg.w, bg.h) bk.Flip() diff --git a/demos/py_simple/cam_view.py b/demos/py_simple/cam_view.py index 6692abb914bb..dd7bcc88286c 100755 --- a/demos/py_simple/cam_view.py +++ b/demos/py_simple/cam_view.py @@ -25,7 +25,7 @@ def main(): sleep(0.01) if (grabber.Poll()): - grabber.frame.Blit(0, 0, bk.context, 0, 0, grabber.frame.w, grabber.frame.h) + grabber.frame.Blit(0, 0, bk.pixmap, 0, 0, grabber.frame.w, grabber.frame.h) bk.Flip() ev = bk.PollEvent() diff --git a/demos/py_simple/font_style.py b/demos/py_simple/font_style.py index 47d8e2cbff8e..1799253d8a10 100755 --- a/demos/py_simple/font_style.py +++ b/demos/py_simple/font_style.py @@ -9,7 +9,7 @@ import gfxprim.input as input import gfxprim.text as text def redraw(win): - c = win.context + c = win.pixmap black = c.RGBToPixel(0, 0, 0) white = c.RGBToPixel(0xff, 0xff, 0xff) diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py index c79d879e8600..0ee8dbe6517e 100755 --- a/demos/py_simple/gfx.py +++ b/demos/py_simple/gfx.py @@ -8,88 +8,88 @@ import gfxprim.backends as backends import gfxprim.input as input def fill(bk): - color = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bk.context.gfx.Fill(color) + color = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bk.pixmap.gfx.Fill(color) bk.Flip() def hline(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) - for i in range(0, bk.context.h, 10): - bk.context.gfx.HLine(0, bk.context.w, i, fg) + bk.pixmap.gfx.Fill(bg) + for i in range(0, bk.pixmap.h, 10): + bk.pixmap.gfx.HLine(0, bk.pixmap.w, i, fg) bk.Flip() def vline(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - for i in range(0, bk.context.w, 10): - bk.context.gfx.VLine(i, 0, bk.context.h, fg) + for i in range(0, bk.pixmap.w, 10): + bk.pixmap.gfx.VLine(i, 0, bk.pixmap.h, fg) bk.Flip() def line(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - for i in range(0, 2 * max(bk.context.w, bk.context.h), 13): - bk.context.gfx.Line(0, i, i, 0, fg) + for i in range(0, 2 * max(bk.pixmap.w, bk.pixmap.h), 13): + bk.pixmap.gfx.Line(0, i, i, 0, fg) bk.Flip() def rect(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) for i in range(10, 130, 10): - bk.context.gfx.Rect(i, i, bk.context.w - i, bk.context.h - i, fg) + bk.pixmap.gfx.Rect(i, i, bk.pixmap.w - i, bk.pixmap.h - i, fg) bk.Flip() def triangle(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - w = bk.context.w - h = bk.context.h + w = bk.pixmap.w + h = bk.pixmap.h for i in range(10, 90, 10): - bk.context.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg) + bk.pixmap.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg) bk.Flip() def tetragon(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - w = bk.context.w - h = bk.context.h + w = bk.pixmap.w + h = bk.pixmap.h for i in range(10, 70, 10): - bk.context.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg) + bk.pixmap.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg) bk.Flip() def polygon(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - w = bk.context.w - h = bk.context.h + w = bk.pixmap.w + h = bk.pixmap.h polygon = [(10, 10), (10, (h-10)//3), ((w-10)//3, (h-10)//2), (10, 2*(h-10)//3), (10, h-10), ((w-10)//3, h-10), @@ -98,7 +98,7 @@ def polygon(bk): (w-10, (h-10)//3), (w-10, 10), (2*(w-10)//3, 10), ((w-10)//2, (h-10)//3), ((w-10)//3, 10)] - bk.context.gfx.Polygon(polygon, fg) + bk.pixmap.gfx.Polygon(polygon, fg) bk.Flip() diff --git a/demos/py_simple/gravplots_AA.py b/demos/py_simple/gravplots_AA.py index 747774402344..5de7bcc6a0a7 100755 --- a/demos/py_simple/gravplots_AA.py +++ b/demos/py_simple/gravplots_AA.py @@ -72,7 +72,7 @@ def main(): print(bk) print("Modify source for parameters,") print("Kill to terminate ;-)") - black = bk.context.RGBToPixel(0, 0, 0) + black = bk.pixmap.RGBToPixel(0, 0, 0) es = [elem() for i in range(N)] while True: @@ -86,18 +86,18 @@ def main(): x = int((e.x % W) * 0x100) y = int(e.y * 0x100) if e.vx > 0.2: - bk.context.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black) + bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black) if e.vx < -0.2: - bk.context.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black) - bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(e.r, e.g, e.b)) + bk.pixmap.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black) + bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b)) else: x = int(e.x % W) y = int(e.y) if e.vx > 0.2: - bk.context.gfx.VLine(x + 1, y - 2, y + 2, black) + bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black) if e.vx < -0.2: - bk.context.gfx.VLine(x - 1, y - 2, y + 2, black) - bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(e.r, e.g, e.b)) + bk.pixmap.gfx.VLine(x - 1, y - 2, y + 2, black) + bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b)) bk.Poll() bk.Flip() global TIMEOUT @@ -106,7 +106,7 @@ def main(): if TIMEOUT == 0: break if SAVETO: - bk.context.Save(SAVETO) + bk.pixmap.Save(SAVETO) if __name__ == '__main__': main() diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py index 6c5e97c572a3..07c54b41913a 100755 --- a/demos/py_simple/showimage.py +++ b/demos/py_simple/showimage.py @@ -18,7 +18,7 @@ def main(): # Create X11 window bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0) assert(bk) - img.Blit(0, 0, bk.context, 0, 0, img.w, img.h) + img.Blit(0, 0, bk.pixmap, 0, 0, img.w, img.h) bk.Flip() # Event loop diff --git a/demos/py_simple/sinplots_AA.py b/demos/py_simple/sinplots_AA.py index e0933b562bd8..44afd21ecb7c 100755 --- a/demos/py_simple/sinplots_AA.py +++ b/demos/py_simple/sinplots_AA.py @@ -34,7 +34,7 @@ def main(): print(bk) print("Modify source for parameters,") print("Kill to terminate ;-)") - black = bk.context.RGBToPixel(0, 0, 0) + black = bk.pixmap.RGBToPixel(0, 0, 0) ps = [plotter() for i in range(N)] t = random.uniform(0.0, 10.0 * W) @@ -46,13 +46,13 @@ def main(): if AA: x = int(x * 0x100) y = int(y * 0x100) - bk.context.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black) - bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(int(r), int(g), int(b))) + bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black) + bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b))) else: x = int(x) y = int(y) - bk.context.gfx.VLine(x + 1, y - 2, y + 2, black) - bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(int(r), int(g), int(b))) + bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black) + bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b))) bk.Flip() if __name__ == '__main__': diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py index 133be6e504b2..3c34ff7a941e 100755 --- a/demos/py_simple/x11_windows.py +++ b/demos/py_simple/x11_windows.py @@ -9,7 +9,7 @@ import gfxprim.input as input import gfxprim.text as text def redraw(bk, id): - c = bk.context + c = bk.pixmap black = c.RGBToPixel(0, 0, 0) white = c.RGBToPixel(0xff, 0xff, 0xff) diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c index 5f270a8a6e88..28ea5bbbfc22 100644 --- a/demos/spiv/image_cache.c +++ b/demos/spiv/image_cache.c @@ -26,7 +26,7 @@ #include "image_cache.h" struct image { - GP_Context *ctx; + GP_Pixmap *pixmap; GP_DataStorage *meta_data; struct image *prev; @@ -73,23 +73,23 @@ size_t image_cache_get_ram_size(void) /* * Reports correct image record size. */ -static size_t image_size2(GP_Context *ctx, GP_DataStorage *meta_data, +static size_t image_size2(GP_Pixmap *pixmap, GP_DataStorage *meta_data, const char *path) { size_t meta_data_size = 0; - size_t context_size = ctx->bytes_per_row * ctx->h + sizeof(GP_Context); + size_t pixmap_size = pixmap->bytes_per_row * pixmap->h + sizeof(GP_Pixmap); //TODO! 4096 is a size of single block, data storage may have more blocks if (meta_data) meta_data_size = 4096; - return meta_data_size + context_size + + return meta_data_size + pixmap_size + sizeof(struct image) + strlen(path) + 1; } static size_t image_size(struct image *img) { - return image_size2(img->ctx, NULL, img->path); + return image_size2(img->pixmap, NULL, img->path); } struct image_cache *image_cache_create(unsigned int max_size_kbytes) @@ -135,7 +135,7 @@ static void remove_img_free(struct image_cache *self, GP_DEBUG(2, "Freeing image '%s' size %zu", img->path, size); remove_img(self, img, size); - GP_ContextFree(img->ctx); + GP_PixmapFree(img->pixmap); GP_DataStorageDestroy(img->meta_data); free(img); } @@ -159,7 +159,7 @@ static void add_img(struct image_cache *self, struct image *img, size_t size) self->end = img; } -int image_cache_get(struct image_cache *self, GP_Context **img, +int image_cache_get(struct image_cache *self, GP_Pixmap **img, GP_DataStorage **meta_data, int elevate, const char *key) { struct image *i; @@ -189,7 +189,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img, } if (img) - *img = i->ctx; + *img = i->pixmap; if (meta_data) *meta_data = i->meta_data; @@ -197,7 +197,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img, return 0; } -GP_Context *image_cache_get2(struct image_cache *self, int elevate, +GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate, const char *fmt, ...) { va_list va; @@ -246,7 +246,7 @@ GP_Context *image_cache_get2(struct image_cache *self, int elevate, if (len >= sizeof(buf)) free(key); - return i ? i->ctx : NULL; + return i ? i->pixmap : NULL; } void image_cache_print(struct image_cache *self) @@ -283,7 +283,7 @@ static int assert_size(struct image_cache *self, size_t size) return 0; } -int image_cache_put(struct image_cache *self, GP_Context *ctx, +int image_cache_put(struct image_cache *self, GP_Pixmap *pixmap, GP_DataStorage *meta_data, const char *key) { size_t size; @@ -291,7 +291,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, if (self == NULL) return 1; - size = image_size2(ctx, meta_data, key); + size = image_size2(pixmap, meta_data, key); /* * We try to create room for the image. If this fails we add the image @@ -307,7 +307,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, return 1; } - img->ctx = ctx; + img->pixmap = pixmap; img->meta_data = meta_data; img->elevated = 0; strcpy(img->path, key); @@ -319,7 +319,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, return 0; } -int image_cache_put2(struct image_cache *self, GP_Context *ctx, +int image_cache_put2(struct image_cache *self, GP_Pixmap *pixmap, GP_DataStorage *meta_data, const char *fmt, ...) { size_t size, len; @@ -333,7 +333,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx, va_end(va); //TODO: FIX THIS - size = image_size2(ctx, meta_data, "") + len + 1; + size = image_size2(pixmap, meta_data, "") + len + 1; /* * We try to create room for the image. If this fails we add the image @@ -349,7 +349,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx, return 1; } - img->ctx = ctx; + img->pixmap = pixmap; img->meta_data = meta_data; img->elevated = 0; diff --git a/demos/spiv/image_cache.h b/demos/spiv/image_cache.h index f2ea1fa16e35..5aa40021ed7c 100644 --- a/demos/spiv/image_cache.h +++ b/demos/spiv/image_cache.h @@ -47,20 +47,20 @@ struct image_cache *image_cache_create(unsigned int max_size_kbytes); * If elevate set and image is found, the image is elevated to the top so * it has lesser chance of being freed. */ -int image_cache_get(struct image_cache *self, GP_Context **img, +int image_cache_get(struct image_cache *self, GP_Pixmap **img, GP_DataStorage **meta_data, int elevate, const char *key); -GP_Context *image_cache_get2(struct image_cache *self, int elevate, +GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); /* * Puts an image into a cache. */ -int image_cache_put(struct image_cache *self, GP_Context *img, +int image_cache_put(struct image_cache *self, GP_Pixmap *img, GP_DataStorage *meta_data, const char *key); -int image_cache_put2(struct image_cache *self, GP_Context *img, +int image_cache_put2(struct image_cache *self, GP_Pixmap *img, GP_DataStorage *meta_data, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); diff --git a/demos/spiv/image_loader.c b/demos/spiv/image_loader.c index c7e0f9ba66fc..8f86f92fc259 100644 --- a/demos/spiv/image_loader.c +++ b/demos/spiv/image_loader.c @@ -22,7 +22,7 @@ #include <errno.h> -#include <core/GP_Context.h> +#include <core/GP_Pixmap.h> #include <core/GP_Debug.h> #include <loaders/GP_Loaders.h> @@ -34,7 +34,7 @@ static struct image_cache *img_cache; static struct image_list *img_list; -static GP_Context *cur_img; +static GP_Pixmap *cur_img; static GP_DataStorage *cur_meta_data; static GP_Container *cur_cont; @@ -57,11 +57,11 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes) return 0; } -GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate) +GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate) { struct cpu_timer timer; const char *path; - GP_Context *img; + GP_Pixmap *img; int err, ret; if (cur_img) @@ -154,7 +154,7 @@ static void drop_cur_img(void) * Currently loaded image is too big to be cached -> free it. */ if (image_cache_get(img_cache, NULL, NULL, 0, path)) { - GP_ContextFree(cur_img); + GP_PixmapFree(cur_img); GP_DataStorageDestroy(cur_meta_data); } diff --git a/demos/spiv/image_loader.h b/demos/spiv/image_loader.h index 9992bca70e50..5d2223ee1c7f 100644 --- a/demos/spiv/image_loader.h +++ b/demos/spiv/image_loader.h @@ -31,7 +31,7 @@ #ifndef __IMAGE_LOADER_H__ #define __IMAGE_LOADER_H__ -#include <core/GP_Context.h> +#include <core/GP_Pixmap.h> #include <core/GP_ProgressCallback.h> /* @@ -46,7 +46,7 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes); * * Note that the callback may not be called when the image is cached. */ -GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate); +GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate); /* * Retruns current image meta data or NULL there are none. diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 91b1a2a3c9e5..947390c964be 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -81,7 +81,7 @@ struct loader_params { static int image_loader_callback(GP_ProgressCallback *self) { static GP_Size size = 0; - GP_Context *c = backend->context; + GP_Pixmap *c = backend->pixmap; if (abort_flag) return 1; @@ -114,7 +114,7 @@ static int image_loader_callback(GP_ProgressCallback *self) return 0; } -static GP_Context *load_image(int elevate); +static GP_Pixmap *load_image(int elevate); static const char *img_name(const char *img_path) { @@ -140,9 +140,9 @@ static void set_caption(const char *path, float rat) /* * Loads image */ -static GP_Context *load_image(int elevate) +static GP_Pixmap *load_image(int elevate) { - GP_Context *img; + GP_Pixmap *img; GP_ProgressCallback callback = {.callback = image_loader_callback, .priv = "Loading image"}; @@ -151,13 +151,13 @@ static GP_Context *load_image(int elevate) if (img) return img; - GP_Context *ctx = backend->context; + GP_Pixmap *pixmap = backend->pixmap; - GP_Fill(ctx, black_pixel); - GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 - 10, + GP_Fill(pixmap, black_pixel); + GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 - 10, GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "'%s'", image_loader_img_path()); - GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 + 10, + GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 + 10, GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "Failed to load image :( (%s)", strerror(errno)); GP_BackendFlip(backend); @@ -166,16 +166,16 @@ static GP_Context *load_image(int elevate) } /* - * Fill context with chessboard-like pattern. + * Fill pixmap with chessboard-like pattern. */ -static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0, +static void pattern_fill(GP_Pixmap *pixmap, unsigned int x0, unsigned int y0, unsigned int w, unsigned int h) { unsigned int x, y, i, j = 0; GP_Pixel col[2]; - col[0] = GP_RGBToContextPixel(0x64, 0x64, 0x64, ctx); - col[1] = GP_RGBToContextPixel(0x80, 0x80, 0x80, ctx); + col[0] = GP_RGBToPixmapPixel(0x64, 0x64, 0x64, pixmap); + col[1] = GP_RGBToPixmapPixel(0x80, 0x80, 0x80, pixmap); unsigned int wm = w/20 < 5 ? 5 : w/20; unsigned int hm = h/20 < 5 ? 5 : h/20; @@ -184,18 +184,18 @@ static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0, i = j; j = !j; for (x = 0; x < w; x += wm) { - GP_FillRectXYWH(ctx, x0 + x, y0 + y, wm, hm, col[i]); + GP_FillRectXYWH(pixmap, x0 + x, y0 + y, wm, hm, col[i]); i = !i; } } } -static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y, +static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); -static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y, +static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, const char *fmt, ...) { va_list va, vac; @@ -203,17 +203,17 @@ static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y, va_start(va, fmt); va_copy(vac, va); - GP_VPrint(ctx, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, + GP_VPrint(pixmap, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, black_pixel, white_pixel, fmt, vac); va_end(vac); - GP_VPrint(ctx, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, + GP_VPrint(pixmap, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, white_pixel, black_pixel, fmt, va); va_end(va); } -static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context, +static unsigned int print_meta_data(GP_DataNode *node, GP_Pixmap *pixmap, unsigned int th, unsigned int y, int level) { GP_DataNode *i; @@ -224,21 +224,21 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context, x = th * level + 10; switch (i->type) { case GP_DATA_INT: - info_printf(context, x, y, "%s : %li", i->id, i->value.i); + info_printf(pixmap, x, y, "%s : %li", i->id, i->value.i); break; case GP_DATA_DOUBLE: - info_printf(context, x, y, "%s : %lf", i->id, i->value.d); + info_printf(pixmap, x, y, "%s : %lf", i->id, i->value.d); break; case GP_DATA_STRING: - info_printf(context, x, y, "%s : %s", i->id, i->value.str); + info_printf(pixmap, x, y, "%s : %s", i->id, i->value.str); break; case GP_DATA_RATIONAL: - info_printf(context, x, y, "%s : %li/%li", + info_printf(pixmap, x, y, "%s : %li/%li", i->id, i->value.rat.num, i->value.rat.den); break; case GP_DATA_DICT: - info_printf(context, x, y, "%s", i->id); - y = print_meta_data(i, context, th, y, level+1); + info_printf(pixmap, x, y, "%s", i->id); + y = print_meta_data(i, pixmap, th, y, level+1); break; } } @@ -246,10 +246,10 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context, return y; } -static void show_info(struct loader_params *params, GP_Context *img, - GP_Context *orig_img) +static void show_info(struct loader_params *params, GP_Pixmap *img, + GP_Pixmap *orig_img) { - GP_Context *context = backend->context; + GP_Pixmap *pixmap = backend->pixmap; const char *img_path = image_loader_img_path(); set_caption(img_path, params->zoom_rat); @@ -259,17 +259,17 @@ static void show_info(struct loader_params *params, GP_Context *img, GP_Size th = GP_TextHeight(config.style), y = 10; - info_printf(context, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s", + info_printf(pixmap, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s", img->w, img->h, orig_img->w, orig_img->h, params->zoom_rat, params->zoom_rat * 100, GP_PixelTypeName(img->pixel_type)); y += th + 2; - info_printf(context, 10, y, "%s", img_name(img_path)); + info_printf(pixmap, 10, y, "%s", img_name(img_path)); y += th + 2; if (params->zoom_rat != 1.00) { - info_printf(context, 10, y, "%s%s", + info_printf(pixmap, 10, y, "%s%s", params->use_low_pass && params->zoom_rat < 1 ? "Gaussian LP + " : "", GP_InterpolationTypeName(params->resampling_method)); y += th + 2; @@ -278,14 +278,14 @@ static void show_info(struct loader_params *params, GP_Context *img, unsigned int count = image_loader_count(); unsigned int pos = image_loader_pos() + 1; - info_printf(context, 10, y, "%u of %u", pos, count); + info_printf(pixmap, 10, y, "%u of %u", pos, count); y += th + 2; if (image_loader_is_in_dir()) { unsigned int dir_count = image_loader_dir_count(); unsigned int dir_pos = image_loader_dir_pos() + 1; - info_printf(context, 10, y, + info_printf(pixmap, 10, y, "%u of %u in directory", dir_pos, dir_count); } @@ -299,13 +299,13 @@ static void show_info(struct loader_params *params, GP_Context *img, if (node->type != GP_DATA_DICT) return; - print_meta_data(node, context, th + 2, y + th, 0); + print_meta_data(node, pixmap, th + 2, y + th, 0); } -static void update_display(struct loader_params *params, GP_Context *img, - GP_Context *orig_img) +static void update_display(struct loader_params *params, GP_Pixmap *img, + GP_Pixmap *orig_img) { - GP_Context *context = backend->context; + GP_Pixmap *pixmap = backend->pixmap; struct cpu_timer timer; GP_ProgressCallback callback = {.callback = image_loader_callback}; @@ -340,11 +340,11 @@ static void update_display(struct loader_params *params, GP_Context *img, */ if (config.win_strategy == ZOOM_WIN_FIXED) { - if (img->w < context->w) - cx = (context->w - img->w)/2; + if (img->w < pixmap->w) + cx = (pixmap->w - img->w)/2; - if (img->h < context->h) - cy = (context->h - img->h)/2; + if (img->h < pixmap->h) + cy = (pixmap->h - img->h)/2; } if (params->zoom_manual) { @@ -352,49 +352,49 @@ static void update_display(struct loader_params *params, GP_Context *img, cy = params->zoom_y_offset; } - GP_Context sub_display; + GP_Pixmap sub_display; cpu_timer_start(&timer, "Blitting"); if (config.floyd_steinberg) { callback.priv = "Dithering"; - GP_SubContext(context, &sub_display, cx, cy, img->w, img->h); + GP_SubPixmap(pixmap, &sub_display, cx, cy, img->w, img->h); GP_FilterFloydSteinberg(img, &sub_display, NULL); // GP_FilterHilbertPeano(img, &sub_display, NULL); } else { if (GP_PixelHasFlags(img->pixel_type, GP_PIXEL_HAS_ALPHA)) - pattern_fill(context, cx, cy, img->w, img->h); - GP_Blit_Clipped(img, 0, 0, img->w, img->h, context, cx, cy); + pattern_fill(pixmap, cx, cy, img->w, img->h); + GP_Blit_Clipped(img, 0, 0, img->w, img->h, pixmap, cx, cy); } cpu_timer_stop(&timer); /* clean up the rest of the display */ - GP_FillRectXYWH(context, 0, 0, cx, context->h, black_pixel); - GP_FillRectXYWH(context, 0, 0, context->w, cy, black_pixel); + GP_FillRectXYWH(pixmap, 0, 0, cx, pixmap->h, black_pixel); + GP_FillRectXYWH(pixmap, 0, 0, pixmap->w, cy, black_pixel); - int w = context->w - img->w - cx; + int w = pixmap->w - img->w - cx; if (w > 0) - GP_FillRectXYWH(context, img->w + cx, 0, w, context->h, black_pixel); + GP_FillRectXYWH(pixmap, img->w + cx, 0, w, pixmap->h, black_pixel); - int h = context->h - img->h - cy; + int h = pixmap->h - img->h - cy; if (h > 0) - GP_FillRectXYWH(context, 0, img->h + cy, context->w, h, black_pixel); + GP_FillRectXYWH(pixmap, 0, img->h + cy, pixmap->w, h, black_pixel); show_info(params, img, orig_img); if (config.combined_orientation) - GP_ContextFree(img); + GP_PixmapFree(img); GP_BackendFlip(backend); } -GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h) +GP_Pixmap *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h) { - GP_Context *img, *res = NULL; + GP_Pixmap *img, *res = NULL; struct cpu_timer timer; GP_ProgressCallback callback = {.callback = image_loader_callback}; @@ -414,10 +414,10 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size if (params->show_nn_first) { /* Do simple interpolation and blit the result */ - GP_Context *nn = GP_FilterResizeNNAlloc(img, w, h, NULL); + GP_Pixmap *nn = GP_FilterResizeNNAlloc(img, w, h, NULL); if (nn != NULL) { update_display(params, nn, img); - GP_ContextFree(nn); + GP_PixmapFree(nn); } } @@ -441,7 +441,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size cpu_timer_start(&timer, "Resampling"); callback.priv = "Resampling Image"; - GP_Context *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback); + GP_Pixmap *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback); img = i1; cpu_timer_stop(&timer); @@ -454,8 +454,8 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size } */ - /* Free low passed context if needed */ - GP_ContextFree(res); + /* Free low passed pixmap if needed */ + GP_PixmapFree(res); if (img == NULL) return NULL; @@ -593,7 +593,7 @@ static void *image_loader(void *ptr) { struct loader_params *params = ptr; struct cpu_timer sum_timer; - GP_Context *img, *orig_img, *context = backend->context; + GP_Pixmap *img, *orig_img, *pixmap = backend->pixmap; cpu_timer_start(&sum_timer, "sum"); @@ -609,7 +609,7 @@ static void *image_loader(void *ptr) GP_Size w, h; params->zoom_rat = calc_img_size(params, orig_img->w, orig_img->h, - context->w, context->h); + pixmap->w, pixmap->h); w = orig_img->w * params->zoom_rat + 0.5; h = orig_img->h * params->zoom_rat + 0.5; @@ -788,7 +788,7 @@ static uint32_t timer_callback(GP_Timer *self) int main(int argc, char *argv[]) { - GP_Context *context = NULL; + GP_Pixmap *pixmap = NULL; int shift_flag; int opts; @@ -853,13 +853,13 @@ int main(int argc, char *argv[]) GP_BACKEND_CALL_EXIT); } - context = backend->context; + pixmap = backend->pixmap; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); - gray_pixel = GP_RGBToContextPixel(0x33, 0x33, 0x33, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); + gray_pixel = GP_RGBToPixmapPixel(0x33, 0x33, 0x33, pixmap); - GP_Fill(context, black_pixel); + GP_Fill(pixmap, black_pixel); GP_BackendFlip(backend); params.show_progress_once = 1; @@ -1115,7 +1115,7 @@ int main(int argc, char *argv[]) /* stop loader thread before resizing backend buffer */ stop_loader(); GP_BackendResizeAck(backend); - GP_Fill(backend->context, 0); + GP_Fill(backend->pixmap, 0); params.show_progress_once = 1; show_image(¶ms); break; diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index 2d7eac9430d4..aad401055a93 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -234,9 +234,9 @@ static int last_line; static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff) { - GP_Context *c = backend->context; - GP_Pixel black = GP_RGBToContextPixel(0x00, 0x00, 0x00, c); - GP_Pixel white = GP_RGBToContextPixel(0xff, 0xff, 0xff, c); + GP_Pixmap *c = backend->pixmap; + GP_Pixel black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, c); + GP_Pixel white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, c); int i; int spacing = GP_TextHeight(config.style)/10 + 2; diff --git a/demos/ttf2img/ttf2img.c b/demos/ttf2img/ttf2img.c index deaa37a48fab..0e75546a7ebd 100644 --- a/demos/ttf2img/ttf2img.c +++ b/demos/ttf2img/ttf2img.c @@ -74,23 +74,23 @@ int main(int argc, char *argv[]) GP_SetDebugLevel(debug_level); - GP_Context *context = GP_ContextAlloc(img_w, img_h, GP_PIXEL_RGB888); + GP_Pixmap *pixmap = GP_PixmapAlloc(img_w, img_h, GP_PIXEL_RGB888); - GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - GP_Pixel white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + GP_Pixel white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, white_pixel); + GP_Fill(pixmap, white_pixel); GP_TextStyle style = GP_DEFAULT_TEXT_STYLE; style.font = GP_FontFaceLoad(font_path, 27, 0); - GP_Text(context, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER, + GP_Text(pixmap, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER, black_pixel, white_pixel, string); - GP_SavePNG(context, img_path, NULL); + GP_SavePNG(pixmap, img_path, NULL); - GP_ContextFree(context); + GP_PixmapFree(pixmap); return 0; } diff --git a/doc/Makefile b/doc/Makefile index 9c1bcfb73242..5da5636ad7ec 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,7 +1,7 @@ TOPDIR=.. include $(TOPDIR)/config.mk -SOURCES=index.html about.txt context.txt loaders.txt filters.txt \ +SOURCES=index.html about.txt pixmap.txt loaders.txt filters.txt \ basic_types.txt gfx.txt backends.txt gamma.txt grabbers.txt \ environment_variables.txt debug.txt core.txt input.txt \ gen.txt pixels.txt coordinate_system.txt coding_style.txt \ diff --git a/doc/about.txt b/doc/about.txt index 167425abe289..96f3652b7238 100644 --- a/doc/about.txt +++ b/doc/about.txt @@ -17,7 +17,7 @@ Core Core of the library contains minimal amount of code to define interface that is shared between all parts of the library. -The most important part of the core is link:context.html[CP_Context] structure +The most important part of the core is link:pixmap.html[GP_Pixmap] structure that represents in-memory pixmap. The Core also contains generated code for basic operations such as diff --git a/doc/backends.txt b/doc/backends.txt index 944c13f3e2db..a4834660817d 100644 --- a/doc/backends.txt +++ b/doc/backends.txt @@ -80,15 +80,15 @@ window resizable. [source,c] ------------------------------------------------------------------------------- -#include <backends/GP_SDL_Context.h> +#include <backends/GP_SDL_Pixmap.h> -int GP_ContextFromSDLSurface(GP_Context *c, const SDL_Surface *surf); +int GP_PixmapFromSDLSurface(GP_Pixmap *c, const SDL_Surface *surf); ------------------------------------------------------------------------------- This function allows you to mix 'SDL' and 'GFXprim' code. -It initializes a 'GFXprim' context from the 'SDL' surface using the pixel -buffer from surface as pixel buffer for the context. +It initializes a 'GFXprim' pixmap from the 'SDL' surface using the pixel +buffer from surface as pixel buffer for the pixmap. Function returns zero on success and non-zero on failure (i.e. there is no 'GFXprim' pixel type to match given surface). @@ -243,9 +243,9 @@ typdef struct GP_Backend { const char *name; /* - * Pointer to context APP should draw to. + * Pointer to pixmap APP should draw to. */ - GP_Context *context; + GP_Pixmap *pixmap; ... @@ -595,8 +595,8 @@ was successful (i.e. X server allowed us to resize the window) the resize event will be send and should be handled in your event loop. You must respond to it by the 'GP_BackendResizeAck()' described below. -NOTE: The backend->context pointer may change upon calling this function and - at least backend->context->pixels pointer will change. +NOTE: The backend->pixmap pointer may change upon calling this function and + at least backend->pixmap->pixels pointer will change. [[ResizeAck]] @@ -613,10 +613,10 @@ int GP_BackendResizeAck(GP_Backend *self); ------------------------------------------------------------------------------- If backend is resizable by user interaction (for example X Window) you will -get resize event for each change of window size, however the backend context +get resize event for each change of window size, however the backend pixmap will not be resized until you call this function. This is useful in multi-threaded application where one threads waits for events and others draws -into the buffer so you can stop the drawing threads before the backend context +into the buffer so you can stop the drawing threads before the backend pixmap size change. diff --git a/doc/backends_python.txt b/doc/backends_python.txt index 183b4c183ba4..b53b6bd74f61 100644 --- a/doc/backends_python.txt +++ b/doc/backends_python.txt @@ -87,8 +87,8 @@ import gfxprim.backends as backends # Assert that inicialization was successful assert(bk) - # Now you can draw into the backend via bk.context - bk.context.gfx.Fill(bk.context.RGBToPixel(0, 0, 0)); + # Now you can draw into the backend via bk.pixmap + bk.pixmap.gfx.Fill(bk.pixmap.RGBToPixel(0, 0, 0)); # If backend is buffered, changes are not propagated unless the screen is # updated via Flip() diff --git a/doc/blits.txt b/doc/blits.txt index d2e4e372de37..5a5373767e02 100644 --- a/doc/blits.txt +++ b/doc/blits.txt @@ -24,17 +24,17 @@ into destination pixel type to speed up the blitting. /* or */ #include <core/GP_Blit.h> -void GP_Blit(const GP_Context *src, +void GP_Blit(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -void GP_BlitXYWH(const GP_Context *src, +void GP_BlitXYWH(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -void GP_BlitXYXY(const GP_Context *src, +void GP_BlitXYXY(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, - GP_Context *dst, GP_Coord x2, GP_Coord y2); + GP_Pixmap *dst, GP_Coord x2, GP_Coord y2); -------------------------------------------------------------------------------- Blit functions to copy rectangular area from source to destination. @@ -54,18 +54,18 @@ WARNING: For these functions the behavior is undefined when you pass /* or */ #include <core/GP_Blit.h> -void GP_BlitXYXY_Clipped(const GP_Context *src, +void GP_BlitXYXY_Clipped(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, - GP_Context *dst, GP_Coord x2, GP_Coord y2); + GP_Pixmap *dst, GP_Coord x2, GP_Coord y2); -void GP_BlitXYWH_Clipped(const GP_Context *src, +void GP_BlitXYWH_Clipped(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -void GP_Blit_Clipped(const GP_Context *src, +void GP_Blit_Clipped(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -------------------------------------------------------------------------------- Blit functions to copy rectangular area from source to destination. Both diff --git a/doc/coding_style.txt b/doc/coding_style.txt index ebd0f3f11145..c23ad06bd524 100644 --- a/doc/coding_style.txt +++ b/doc/coding_style.txt @@ -108,14 +108,14 @@ GFXprim Specific Rules * Library external API uses CamelCase ** Together with mandatory 'GP_' prefix. -** For example 'GP_PixelType', 'GP_Context', etc. +** For example 'GP_PixelType', 'GP_Pixmap', etc. ** We will not change that, get over it. (It could have been worse, trust me.) * Basic library types are typedefed ** We have 'GP_Size' and 'GP_Coord' integer types to better distinguish roles of function parameters. -** The basic structures are also typedefed so you can wite 'GP_Context' - instead of 'struct GP_Context'. +** The basic structures are also typedefed so you can wite 'GP_Pixmap' + instead of 'struct GP_Pixmap'. ** Other uses of typedef are frowned upon. * When you add an externally visible symbol, i.e. new API function @@ -143,5 +143,5 @@ All constants are available in 'foo.C' submodules (i.e. 'core.C') to avoid clutter. Where this makes sense, functions should be available as methods of -an object (i.e. 'Context.Copy()' rather than 'Copy(context)'). Be Pythonic. +an object (i.e. 'Pixmap.Copy()' rather than 'Copy(pixmap)'). Be Pythonic. diff --git a/doc/convert.txt b/doc/convert.txt index f11f932a4c42..a534ecb56b5a 100644 --- a/doc/convert.txt +++ b/doc/convert.txt @@ -14,11 +14,11 @@ GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b, GP_PixelType type); GP_Pixel GP_RGBAToPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, GP_PixelType type); -GP_Pixel GP_RGBToContextPixel(uint8_t r, uint8_t g, uint8_t b, - const GP_Context *context); +GP_Pixel GP_RGBToPixmapPixel(uint8_t r, uint8_t g, uint8_t b, + const GP_Pixmap *pixmap); -GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, - const GP_Context *context); +GP_Pixel GP_RGBAToPixmapPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, + const GP_Pixmap *pixmap); ------------------------------------------------------------------------------- Simple functions to convert RGB or RGBA 8 bit values into the specific diff --git a/doc/core.txt b/doc/core.txt index 1ae253a6d293..439494a6021d 100644 --- a/doc/core.txt +++ b/doc/core.txt @@ -4,7 +4,7 @@ Library Core Library core contains all basic data structures and functions that forms the glue which holds the GFXprim libraries together. -The most important data structure is a link:context.html[Context] which +The most important data structure is a link:pixmap.html[Pixmap] which describes in-memory pixmap which is used extensively in all parts of the library. @@ -20,7 +20,7 @@ or link:progress_callback.html[Progress callback]. [grid="rows"] [options="autowidth"] |============================================================================= -| link:context.html[Context] | Describes in-memory pixmap +| link:pixmap.html[Pixmap] | Describes in-memory pixmap | link:basic_types.html[Basic types] | Types for size, lenght, pixel and color @@ -30,7 +30,7 @@ or link:progress_callback.html[Progress callback]. | link:get_put_pixel.html[GetPixel and PutPixel] | Macros and functions to get and put pixels -| link:blits.html[Blits] | Blits (copies) a rectangular area from one context to +| link:blits.html[Blits] | Blits (copies) a rectangular area from one pixmap to another as well as simple pixel format conversions | link:progress_callback.html[Progress Callback] | Progress callback passed diff --git a/doc/core_python.txt b/doc/core_python.txt index 108c8594360c..0b960007a586 100644 --- a/doc/core_python.txt +++ b/doc/core_python.txt @@ -3,28 +3,28 @@ Python Core module The python binding maps mostly to the C API with the 'GP_' prefix stripped. -However structures as 'GP_Context' are not created by the 'GP_ContextAlloc()' +However structures as 'GP_Pixmap' are not created by the 'GP_PixmapAlloc()' function but have proper constructor and destructor to keep the Python reference counting happy. Then there are a bit more tricky solutions, such as 'GP_ProgressCallback' which needs a proxy function to call the python callback from the C code. -Context +Pixmap ~~~~~~~ [source,python] ------------------------------------------------------------------------------- import gfxprim.core as core - # Create 100x100 RGB888 context - c = core.Context(100, 100, core.C.PIXEL_RGB888) + # Create 100x100 RGB888 pixmap + c = core.Pixmap(100, 100, core.C.PIXEL_RGB888) print("w={} h={} bpp={}".format(c.w, c.h, c.bpp)) ------------------------------------------------------------------------------- -Creates a context of a particular size and pixel type. +Creates a pixmap of a particular size and pixel type. First two parameters are 'width' and 'height' third is pixel type which is an enumeration @@ -41,7 +41,7 @@ enumeration ------------------------------------------------------------------------------- import gfxprim.core as core - pixel = context.GetPixel(x, y) + pixel = pixmap.GetPixel(x, y) ------------------------------------------------------------------------------- @@ -52,7 +52,7 @@ returned. ------------------------------------------------------------------------------- import gfxprim.core as core - context.PutPixel(x, y, pixel) + pixmap.PutPixel(x, y, pixel) ------------------------------------------------------------------------------- @@ -66,11 +66,11 @@ NOTE: You may want to see link:coordinate_system.html[coordinate system] ------------------------------------------------------------------------------- import gfxprim.core as core - grayscale = context.Convert(core.C.PIXEL_G8) + grayscale = pixmap.Convert(core.C.PIXEL_G8) ------------------------------------------------------------------------------- -Returns context converted into the desired pixel format. +Returns pixmap converted into the desired pixel format. The conversion is naive i.e. the values are just divided/multiplied. @@ -80,15 +80,15 @@ The conversion is naive i.e. the values are just divided/multiplied. ------------------------------------------------------------------------------- import gfxprim.core as core - # Blits context to target starting at - # sx and sy in the source context + # Blits pixmap to target starting at + # sx and sy in the source pixmap # tx and ty in in the target - context.Blit(sx, sy, target, tx, ty, w, h) + pixmap.Blit(sx, sy, target, tx, ty, w, h) # Alternatively the size can be described by # coordinates in the source or target - context.Blit(sx, sy, target, tx, ty, sx2=, sy2=) - context.Blit(sx, sy, target, tx, ty, tx2=, ty2=) + pixmap.Blit(sx, sy, target, tx, ty, sx2=, sy2=) + pixmap.Blit(sx, sy, target, tx, ty, tx2=, ty2=) ------------------------------------------------------------------------------- @@ -118,8 +118,8 @@ import gfxprim.core as core # You can create a pixel from RGB and pixel type black = core.RGBToPixel(0, 0, 0, core.C.PIXEL_G1) - # Or using shortcut from context - black = context.RGBToPixel(0, 0, 0) + # Or using shortcut from pixmap + black = pixmap.RGBToPixel(0, 0, 0) ------------------------------------------------------------------------------- @@ -170,5 +170,5 @@ import gfxprim.core as core Sets and gets the GFXprim debug level. See link:debug.html[debug messages] description for more details. -These are basic 'Context' methods from core module. Importing other modules +These are basic 'Pixmap' methods from core module. Importing other modules will add some other (for example gfx module adds all drawing functions). diff --git a/doc/debug.txt b/doc/debug.txt index 09c80aa0e560..b209b53a56c6 100644 --- a/doc/debug.txt +++ b/doc/debug.txt @@ -5,7 +5,7 @@ The GFXprim library includes a debug message infrastructure in order to ease the debugging. Many places of the library uses debug messages to report warnings, bugs, or -generally important events (i.e. context has been allocated, filter function +generally important events (i.e. pixmap has been allocated, filter function has been called). Debug messages are printed into the stderr and could be redirected to custom diff --git a/doc/environment_variables.txt b/doc/environment_variables.txt index 5ce7488a02f8..216f19f1e8a3 100644 --- a/doc/environment_variables.txt +++ b/doc/environment_variables.txt @@ -48,13 +48,13 @@ The output is, by default, written to stderr and will look like: 1: GP_Loader.c:loader_by_filename():222: Loading file by filename extension 'pgm' 1: GP_Loader.c:loader_by_extension():198: Found loader 'Netpbm portable Graymap' 1: GP_PNM.c:load_header():244: Have header P2 (ASCII encoded PGM) 24x7 depth=15 -1: GP_Context.c:GP_ContextAlloc():62: Allocating context 24 x 7 - G4 +1: GP_Pixmap.c:GP_PixmapAlloc():62: Allocating pixmap 24 x 7 - G4 4: GP_X11.c:x11_update_rect():71: Updating rect 222x458-418x479 4: GP_X11.c:x11_update_rect():71: Updating rect 214x458-426x479 2: GP_Blit.c:GP_BlitXYXY_Clipped():129: Blitting 23x6, available 332x244 2: GP_Blit.c:GP_BlitXYXY_Clipped():139: Blitting 0x0->23x6 in 24x7 to 308x236 in 640x480 3: GP_X11.c:x11_set_attributes():225: Setting window caption to 'Spiv ~ test.pgm 1:1.000' - 4: GP_X11.c:x11_flip():91: Flipping context -1: GP_Context.c:GP_ContextFree():102: Freeing context (0x7f5008000b60) + 4: GP_X11.c:x11_flip():91: Flipping pixmap +1: GP_Pixmap.c:GP_PixmapFree():102: Freeing pixmap (0x7f5008000b60) 1: GP_X11_Conn.h:x11_close():72: Closing X11 display ------------------------------------------------------------------------------ diff --git a/doc/example_SDL_glue.txt b/doc/example_SDL_glue.txt index 804898f4b74b..5e12aac6ce32 100644 --- a/doc/example_SDL_glue.txt +++ b/doc/example_SDL_glue.txt @@ -1,7 +1,7 @@ SDL Glue -------- -You can easily mix SDL and GFXprim code using 'GP_ContextFromSDLSurface()' +You can easily mix SDL and GFXprim code using 'GP_PixmapFromSDLSurface()' function. [source,c] diff --git a/doc/filters.txt b/doc/filters.txt index c0cc54666c31..da1cf5aa4f0d 100644 --- a/doc/filters.txt +++ b/doc/filters.txt @@ -1,12 +1,12 @@ -Context filters +Pixmap filters --------------- -Pixel filters for 'GP_Context'. +Pixel filters for 'GP_Pixmap'. -The context filter is basically a function that operates on context pixels. +The pixmap filter is basically a function that operates on pixmap pixels. The result may be stored into a new bitmap or placed to bitmap passed as argument or, in some cases, the filter could be used 'in place' so the result -is stored into the same context as the one passed as filter source. +is stored into the same pixmap as the one passed as filter source. Common filter API ~~~~~~~~~~~~~~~~~ @@ -22,21 +22,21 @@ For convenience, the filters API is unified: * And the last argument is link:progress_callback.html[progress callback] When using allocating version of the filter, pointer to the newly allocated -context is returned, or in case of failure NULL is returned. +pixmap is returned, or in case of failure NULL is returned. If 'malloc()' has failed NULL is returned. If filter has been interrupted by a callback, all allocated memory is freed, and NULL is returned. -When using non-allocating variant of the filter, the destination context must +When using non-allocating variant of the filter, the destination pixmap must have correct pixel type and the size must be big enough to store the result. The return value from such filter is either zero, in case of success, or non-zero when filter was interrupted by a callback. For filters that work 'in-place' (which is explicitly said for each filter) -the source and the destination could be the same context. Note that this is -not expected to work if you do several overlapping sub-contexts and pass these +the source and the destination could be the same pixmap. Note that this is +not expected to work if you do several overlapping sub-pixmaps and pass these as arguments. [source,c] @@ -44,11 +44,11 @@ as arguments. /* * Filter common API. */ -int GP_FilterFoo(const GP_Context *src, GP_Context *dst, +int GP_FilterFoo(const GP_Pixmap *src, GP_Pixmap *dst, foo params ..., GP_ProgressCallback *callback); -GP_Context *GP_FilterFooAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterFooAlloc(const GP_Pixmap *src, foo params ..., GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -71,10 +71,10 @@ Invert /* or */ #include <filters/GP_Point.h> -int GP_FilterInvert(const GP_Context *src, GP_Context *dst, +int GP_FilterInvert(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterInvertAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterInvertAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -91,10 +91,10 @@ Brightness /* or */ #include <filters/GP_Point.h> -int GP_FilterBrightness(const GP_Context *src, GP_Context *dst, +int GP_FilterBrightness(const GP_Pixmap *src, GP_Pixmap *dst, float p, GP_ProgressCallback *callback); -GP_Context *GP_FilterBrightnessAlloc(const GP_Context *src, float p, +GP_Pixmap *GP_FilterBrightnessAlloc(const GP_Pixmap *src, float p, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -111,10 +111,10 @@ Contrast /* or */ #include <filters/GP_Point.h> -int GP_FilterContrast(const GP_Context *src, GP_Context *dst, +int GP_FilterContrast(const GP_Pixmap *src, GP_Pixmap *dst, float p, GP_ProgressCallback *callback); -GP_Context *GP_FilterContrastAlloc(const GP_Context *src, float p, +GP_Pixmap *GP_FilterContrastAlloc(const GP_Pixmap *src, float p, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -131,11 +131,11 @@ BrightnessContrast /* or */ #include <filters/GP_Point.h> -int GP_FilterBrightnessContrast(const GP_Context *src, GP_Context *dst, +int GP_FilterBrightnessContrast(const GP_Pixmap *src, GP_Pixmap *dst, float b, float c, GP_ProgressCallback *callback); -GP_Context *GP_FilterBrightnessContrastAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterBrightnessContrastAlloc(const GP_Pixmap *src, float b, float c, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -153,10 +153,10 @@ Posterize /* or */ #include <filters/GP_Point.h> -int GP_FilterPosterize(const GP_Context *src, GP_Context *dst, +int GP_FilterPosterize(const GP_Pixmap *src, GP_Pixmap *dst, unsigned int levels, GP_ProgressCallback *callback); -GP_Context *GP_FilterPosterizeAlloc(const GP_Context *src, unsigned int levels, +GP_Pixmap *GP_FilterPosterizeAlloc(const GP_Pixmap *src, unsigned int levels, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -174,27 +174,27 @@ Gaussian additive noise filter /* or */ #include <filters/GP_GaussianNoise.h> -int GP_FilterGaussianNoiseAddEx(const GP_Context *src, +int GP_FilterGaussianNoiseAddEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float sigma, float mu, GP_ProgressCallback *callback); -GP_Context *GP_FilterGaussianNoiseAddExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterGaussianNoiseAddExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, float sigma, float mu, GP_ProgressCallback *callback); -static inline int GP_FilterGaussianNoiseAdd(const GP_Context *src, - GP_Context *dst, +static inline int GP_FilterGaussianNoiseAdd(const GP_Pixmap *src, + GP_Pixmap *dst, float sigma, float mu, GP_ProgressCallback *callback); -static inline GP_Context * -GP_FilterGaussianNoiseAddAlloc(const GP_Context *src, +static inline GP_Pixmap * +GP_FilterGaussianNoiseAddAlloc(const GP_Pixmap *src, float sigma, float mu, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -210,12 +210,12 @@ include::images/gaussian_noise/images.txt[] Arithmetic filters ~~~~~~~~~~~~~~~~~~ -Arithmetic filters do take two contexts as an input and combines them into one -output context. +Arithmetic filters do take two pixmaps as an input and combines them into one +output pixmap. -The pixel type of both input contexts must match. +The pixel type of both input pixmaps must match. -If size of the input contexts differs, minimum is used. +If size of the input pixmaps differs, minimum is used. [source,c] ------------------------------------------------------------------------------- @@ -223,17 +223,17 @@ If size of the input contexts differs, minimum is used. /* or */ #include <GP.h> -int GP_FilterAddition(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterAddition(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterAdditionAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterAdditionAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Produces saturated (clamped) addition of two contexts. +Produces saturated (clamped) addition of two pixmaps. [source,c] ------------------------------------------------------------------------------- @@ -241,17 +241,17 @@ Produces saturated (clamped) addition of two contexts. /* or */ #include <GP.h> -int GP_FilterMultiply(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterMultiply(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMultiplyAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterMultiplyAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Produces saturated (clamped) multiplication of two contexts. +Produces saturated (clamped) multiplication of two pixmaps. [source,c] ------------------------------------------------------------------------------- @@ -259,13 +259,13 @@ Produces saturated (clamped) multiplication of two contexts. /* or */ #include <GP.h> -int GP_FilterDifference(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterDifference(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterDifferenceAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterDifferenceAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -278,22 +278,22 @@ Produces symmetric difference (i.e. abs(a - b)). /* or */ #include <GP.h> -int GP_FilterMax(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterMax(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMaxAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterMaxAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); -int GP_FilterMin(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterMin(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMinAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterMinAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -308,14 +308,14 @@ Rotation and Symmetry filters /* or */ #include <GP.h> -int GP_FilterMirrorH(const GP_Context *src, GP_Context *dst, +int GP_FilterMirrorH(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMirrorHAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMirrorHAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Mirrors context horizontally. +Mirrors pixmap horizontally. Works 'in-place'. @@ -330,14 +330,14 @@ include::images/mirror_h/images.txt[] /* or */ #include <GP.h> -int GP_FilterMirrorV(const GP_Context *src, GP_Context *dst, +int GP_FilterMirrorV(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMirrorVAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMirrorVAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Mirrors context vertically. +Mirrors pixmap vertically. Works 'in-place'. @@ -352,19 +352,19 @@ include::images/mirror_v/images.txt[] /* or */ #include <GP.h> -int GP_FilterRotate90(const GP_Context *src, GP_Context *dst, +int GP_FilterRotate90(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterRotate90Alloc(const GP_Context *src, +GP_Pixmap *GP_FilterRotate90Alloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Rotate context by 90 degrees. +Rotate pixmap by 90 degrees. Doesn't work 'in-place' (yet). The destination has to have the same pixel type and size must be large enough to -fit rotated context (i.e. W and H are swapped). +fit rotated pixmap (i.e. W and H are swapped). include::images/rotate_90/images.txt[] @@ -374,14 +374,14 @@ include::images/rotate_90/images.txt[] /* or */ #include <GP.h> -int GP_FilterRotate180(const GP_Context *src, GP_Context *dst, +int GP_FilterRotate180(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterRotate180Alloc(const GP_Context *src, +GP_Pixmap *GP_FilterRotate180Alloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Rotate context by 180 degrees. +Rotate pixmap by 180 degrees. Doesn't work 'in-place' (yet). @@ -396,19 +396,19 @@ include::images/rotate_180/images.txt[] /* or */ #include <GP.h> -int GP_FilterRotate270(const GP_Context *src, GP_Context *dst, +int GP_FilterRotate270(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterRotate270Alloc(const GP_Context *src, +GP_Pixmap *GP_FilterRotate270Alloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Rotate context by 270 degrees. +Rotate pixmap by 270 degrees. Doesn't work 'in-place' (yet). The destination has to have the same pixel type and destination size must be -large enough to fit rotated context (i.e. W and H are swapped). +large enough to fit rotated pixmap (i.e. W and H are swapped). include::images/rotate_270/images.txt[] @@ -428,11 +428,11 @@ typedef enum GP_FilterSymmetries { GP_MIRROR_V, } GP_FilterSymmetries; -GP_Context *GP_FilterSymmetry(const GP_Context *src, +GP_Pixmap *GP_FilterSymmetry(const GP_Pixmap *src, GP_FilterSymmetries symmetry, GP_ProgressCallback *callback); -int GP_FilterSymmetry(const GP_Context *src, GP_Context *dst, +int GP_FilterSymmetry(const GP_Pixmap *src, GP_Pixmap *dst, GP_FilterSymmetries symmetry, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -481,10 +481,10 @@ ready-to-use filters. /* or */ #include <GP.h> -int GP_FilterLinearConvolution_Raw(const GP_Context *src, +int GP_FilterLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float kernel[], uint32_t kw, uint32_t kh, float kern_div, GP_ProgressCallback *callback); @@ -493,10 +493,10 @@ int GP_FilterLinearConvolution_Raw(const GP_Context *src, Internal generic convolution filter, this is a base for all linear convolution filters with non-separable kernel. -The src coordinate and sizes denotes rectangle in the source context that the +The src coordinate and sizes denotes rectangle in the source pixmap that the filter operates on. -The dst coordinates defines offset into the dst context. +The dst coordinates defines offset into the dst pixmap. The kernel is two-dimensional array of a size kw * kh indexed as kernel[x + y*kw]. @@ -539,26 +539,26 @@ include::images/convolution/images.txt[] /* or */ #include <GP.h> -int GP_FilterHLinearConvolution_Raw(const GP_Context *src, +int GP_FilterHLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float kernel[], uint32_t kw, float kern_div, GP_ProgressCallback *callback); -int GP_FilterVLinearConvolution_Raw(const GP_Context *src, +int GP_FilterVLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float kernel[], uint32_t kh, float kern_div, GP_ProgressCallback *callback); -int GP_FilterVHLinearConvolution_Raw(const GP_Context *src, +int GP_FilterVHLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float hkernel[], uint32_t kw, float hkern_div, float vkernel[], uint32_t kh, float vkern_div, @@ -570,7 +570,7 @@ void GP_FilterKernelPrint_Raw(float kernel[], int kw, int kh, float kern_div); Internal special functions for one dimensional vertical and horizontal convolution these two functions are base for all separable convolution filters. -The src coordinate and sizes denotes rectangle in the source context that the +The src coordinate and sizes denotes rectangle in the source pixmap that the filter operates on. The dst coordinates are offset into the dst. @@ -640,25 +640,25 @@ typedef struct GP_FilterKernel2D { float *kernel; } GP_FilterKernel2D; -int GP_FilterConvolutionEx(const GP_Context *src, +int GP_FilterConvolutionEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Coord h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); -GP_Context *GP_FilterConvolutionExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterConvolutionExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); -int GP_FilterConvolution(const GP_Context *src, GP_Context *dst, +int GP_FilterConvolution(const GP_Pixmap *src, GP_Pixmap *dst, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); -GP_Context *GP_FilterConvolutionAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterConvolutionAlloc(const GP_Pixmap *src, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); @@ -690,7 +690,7 @@ WARNING: If filter is executed in-place the work cannot be distributed between /* * Example box smoothing filter. */ -static void box_smoothing(GP_Context *img) +static void box_smoothing(GP_Pixmap *img) { float box_filter[] = { 1, 1, 1, @@ -720,10 +720,10 @@ Laplace Filter /* or */ #include <GP.h> -int GP_FilterLaplace(const GP_Context *src, GP_Context *dst, +int GP_FilterLaplace(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterLaplaceAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterLaplaceAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -767,10 +767,10 @@ Laplacian Edge Sharpening /* or */ #include <GP.h> -int GP_FilterEdgeSharpening(const GP_Context *src, GP_Context *dst, +int GP_FilterEdgeSharpening(const GP_Pixmap *src, GP_Pixmap *dst, float w, GP_ProgressCallback *callback); -GP_Context *GP_FilterEdgeSharpeningAlloc(const GP_Context *src, float w, +GP_Pixmap *GP_FilterEdgeSharpeningAlloc(const GP_Pixmap *src, float w, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -798,25 +798,25 @@ Gaussian Blur /* or */ #include <GP.h> -int GP_FilterGaussianBlurEx(const GP_Context *src, +int GP_FilterGaussianBlurEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float x_sigma, float y_sigma, GP_ProgressCallback *callback); -GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterGaussianBlurExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, float x_sigma, float y_sigma, GP_ProgressCallback *callback); -int GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, +int GP_FilterGaussianBlur(const GP_Pixmap *src, GP_Pixmap *dst, float x_sigma, float y_sigma, GP_ProgressCallback *callback) -GP_Context *GP_FilterGaussianBlurAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterGaussianBlurAlloc(const GP_Pixmap *src, float x_sigma, float y_sigma, GP_ProgressCallback *callback) ------------------------------------------------------------------------------- @@ -879,26 +879,26 @@ Median /* or */ #include <GP.h> -int GP_FilterMedianEx(const GP_Context *src, +int GP_FilterMedianEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, int xmed, int ymed, GP_ProgressCallback *callback); -GP_Context *GP_FilterMedianExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMedianExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, int xmed, int ymed, GP_ProgressCallback *callback); -int GP_FilterMedian(const GP_Context *src, - GP_Context *dst, +int GP_FilterMedian(const GP_Pixmap *src, + GP_Pixmap *dst, int xmed, int ymed, GP_ProgressCallback *callback); -GP_Context *GP_FilterMedianAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMedianAlloc(const GP_Pixmap *src, int xmed, int ymed, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- diff --git a/doc/filters_dithering.txt b/doc/filters_dithering.txt index 94c8203315bc..c7cf060b694a 100644 --- a/doc/filters_dithering.txt +++ b/doc/filters_dithering.txt @@ -27,11 +27,11 @@ And is throwed away at the image borders. /* or */ #include <filters/GP_Dither.h> -int GP_FilterFloydSteinberg(const GP_Context *src, GP_Context *dst, +int GP_FilterFloydSteinberg(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Renders Floyd Steinberg dithering directly into passed context. The +Renders Floyd Steinberg dithering directly into passed pixmap. The destination must be at least as large as source. If operation was aborted by a callback, non-zero is returned. @@ -45,12 +45,12 @@ the function returns non-zero and sets errno to 'ENOSYS'. /* or */ #include <filters/GP_Dither.h> -GP_Context *GP_FilterFloydSteinbergAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterFloydSteinbergAlloc(const GP_Pixmap *src, GP_PixelType pixel_type, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Returns pointer to allocated context of given pixel_type. +Returns pointer to allocated pixmap of given pixel_type. If 'malloc(2)' has failed, or operation was aborted by a callback NULL is returned. @@ -75,11 +75,11 @@ edges tend to be less sharp. /* or */ #include <filters/GP_Dither.h> -int GP_FilterHilbertPeano(const GP_Context *src, GP_Context *dst, +int GP_FilterHilbertPeano(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Renders Hilbert Peano dithering directly into passed context. The +Renders Hilbert Peano dithering directly into passed pixmap. The destination must be at least as large as source. If operation was aborted by a callback, non-zero is returned. @@ -93,12 +93,12 @@ the function returns NULL and sets errno to 'ENOSYS'. /* or */ #include <filters/GP_Dither.h> -GP_Context *GP_FilterHilbertPeanoAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterHilbertPeanoAlloc(const GP_Pixmap *src, GP_PixelType pixel_type, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Returns pointer to allocated context of given pixel_type. +Returns pointer to allocated pixmap of given pixel_type. If 'malloc(2)' has failed, or operation was aborted by a callback NULL is returned. diff --git a/doc/filters_resize.txt b/doc/filters_resize.txt index 6cf656447e6b..349ad2a71590 100644 --- a/doc/filters_resize.txt +++ b/doc/filters_resize.txt @@ -21,17 +21,17 @@ typedef enum GP_InterpolationType { const char *GP_InterpolationTypeName(enum GP_InterpolationType interp_type); -int GP_FilterResize(const GP_Context *src, GP_Context *dst, +int GP_FilterResize(const GP_Pixmap *src, GP_Pixmap *dst, GP_InterpolationType type, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_InterpolationType type, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Interpolate (resize) the context. +Interpolate (resize) the pixmap. Resize image given size and interpolation type. @@ -49,7 +49,7 @@ GP_FilterResizeAlloc The +GP_FilterResizeAlloc()+ allocates the destination give it's size. -Returns pointer to newly allocated context or NULL in case of failure and +Returns pointer to newly allocated pixmap or NULL in case of failure and errno is set. Nearest Neighbour Interpolation @@ -61,10 +61,10 @@ Nearest Neighbour Interpolation /* or */ #include <filters/GP_ResizeNN.h> -int GP_FilterResizeNN(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeNN(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -static inline GP_Context *GP_FilterResizeNNAlloc(const GP_Context *src, +static inline GP_Pixmap *GP_FilterResizeNNAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -87,17 +87,17 @@ Bilinear Interpolation /* or */ #include <filters/GP_ResizeLinear.h> -int GP_FilterResizeLinearInt(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeLinearInt(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -int GP_FilterResizeLinearLFInt(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeLinearLFInt(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeLinearIntAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeLinearIntAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeLinearLFIntAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeLinearLFIntAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -115,17 +115,17 @@ Bicubic Interpolation /* or */ #include <filters/GP_ResizeCubic.h> -int GP_FilterResizeCubicInt(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeCubicInt(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -int GP_FilterResizeCubic(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeCubic(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeCubicIntAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeCubicIntAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeCubicAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeCubicAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- diff --git a/doc/gamma.txt b/doc/gamma.txt index a38518bd2c76..521306a76962 100644 --- a/doc/gamma.txt +++ b/doc/gamma.txt @@ -38,7 +38,7 @@ and text still use legacy gamma support.) Implementation ~~~~~~~~~~~~~~ -The 'GP_Gamma' structure defines per context, per channel, gamma tables. +The 'GP_Gamma' structure defines per pixmap, per channel, gamma tables. The tables for particular gamma are reference counted. There is only one table for particular gamma value and bit depth in memory at a time. diff --git a/doc/get_put_pixel.txt b/doc/get_put_pixel.txt index 86d90c7f35f3..db9893f04e96 100644 --- a/doc/get_put_pixel.txt +++ b/doc/get_put_pixel.txt @@ -7,17 +7,17 @@ GetPixel and PutPixel /* or */ #include <core/GP_GetPutPixel.h> -GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y); +GP_Pixel GP_GetPixel(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y); -void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p); +void GP_PutPixel(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p); -------------------------------------------------------------------------------- Gets, puts a pixel value. GP_Pixel is a number which holds a pixel value. -This functions are clipped, GetPixel outside of the context returns zero, -PutPixel outside the context is no-op. +This functions are clipped, GetPixel outside of the pixmap returns zero, +PutPixel outside the pixmap is no-op. -This functions honour link:context.html[context rotation flags]. +This functions honour link:pixmap.html[pixmap rotation flags]. Generally these function are safe to use but rather slow in innner cycles. @@ -27,23 +27,23 @@ Generally these function are safe to use but rather slow in innner cycles. /* or */ #include <core/GP_GetPutPixel.h> -GP_Pixel GP_GetPixel_Raw(const GP_Context *context, GP_Coord x, GP_Coord y); +GP_Pixel GP_GetPixel_Raw(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y); -void GP_PutPixel_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p); +void GP_PutPixel_Raw(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p); /* * Substitute {{ bpp }} for specific bits per pixel (1BPP_LE, 24BPP, ...) * * These macros are generated to core/GP_GetPutPixel.gen.h */ -GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Context *c, int x, int y); +GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Pixmap *c, int x, int y); -void GP_PutPixel_Raw_{{ bpp }}(GP_Context *c, GP_Coord x, GP_Coord y, +void GP_PutPixel_Raw_{{ bpp }}(GP_Pixmap *c, GP_Coord x, GP_Coord y, GP_Pixel p); -------------------------------------------------------------------------------- -These functions are generally fast, but does not honour context rotation flags -and do not check that coordinates are inside of the context. +These functions are generally fast, but does not honour pixmap rotation flags +and do not check that coordinates are inside of the pixmap. They are intended as basic building blocks for other GFX primitives, filters, etc. diff --git a/doc/gfx.txt b/doc/gfx.txt index 14cb7d8b2fa5..35f75d234303 100644 --- a/doc/gfx.txt +++ b/doc/gfx.txt @@ -11,7 +11,7 @@ See also RGB tripplet to pixel link:convert.html[conversions]. Rotation Flags ~~~~~~~~~~~~~~ -Drawing orientation is affected by the link:context.html[context rotation +Drawing orientation is affected by the link:pixmap.html[pixmap rotation flags]. The parameters passed to the functions are transformed accordingly to the flags before the drawing, which allows for fast and transparent rotated or mirrored rendering. @@ -28,10 +28,10 @@ Fill [source,c] -------------------------------------------------------------------------------- -void GP_Fill(GP_Context *context, GP_Pixel pixel); +void GP_Fill(GP_Pixmap *pixmap, GP_Pixel pixel); -------------------------------------------------------------------------------- -Fills the whole context bitmap with the specified pixel value. +Fills the whole pixmap bitmap with the specified pixel value. NOTE: GP_Fill is implemented in the library Core rather than in GFX so that it's available to all library parts. @@ -41,10 +41,10 @@ Lines [source,c] -------------------------------------------------------------------------------- -void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y, +void GP_HLineXXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord x1, GP_Coord y, GP_Pixel pixel); -void GP_HLine(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y, +void GP_HLine(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord x1, GP_Coord y, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -55,7 +55,7 @@ x0, x1 can be specified in any order. [source,c] -------------------------------------------------------------------------------- -void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w, +void GP_HLineXYW(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Size w, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -64,10 +64,10 @@ Draws a horizontal line from (x, y) to (x+w-1, y), inclusive. [source,c] -------------------------------------------------------------------------------- -void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1, +void GP_VLineXYY(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y0, GP_Coord y1, GP_Pixel pixel); -void GP_VLine(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1, +void GP_VLine(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y0, GP_Coord y1, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -78,7 +78,7 @@ y0, y1 can be specified in any order. [source,c] -------------------------------------------------------------------------------- -void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h, +void GP_VLineXYH(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Size h, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -87,7 +87,7 @@ Draws a vertical line from (x, y) to (x, y+h-1), inclusive. [source,c] -------------------------------------------------------------------------------- -void GP_Line(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_Line(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -100,7 +100,7 @@ Circles [source,c] -------------------------------------------------------------------------------- -void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, +void GP_Circle(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter, GP_Size r, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -111,7 +111,7 @@ specified by points (xcenter-r, ycenter-r, xcenter+r, ycenter+r), inclusive. [source,c] -------------------------------------------------------------------------------- -void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, +void GP_FillCircle(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter, GP_Size r, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -125,7 +125,7 @@ Rings ~~~~~ [source,c] -------------------------------------------------------------------------------- -void GP_Ring(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, +void GP_Ring(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter, GP_Size r1, GP_Size r2, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -136,7 +136,7 @@ and appropriate radii. [source,c] -------------------------------------------------------------------------------- -void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, +void GP_FillRing(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter, GP_Size r1, GP_Size r2, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -150,7 +150,7 @@ Ellipses [source,c] -------------------------------------------------------------------------------- -void GP_Ellipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, +void GP_Ellipse(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter, GP_Size a, GP_Size b, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -161,7 +161,7 @@ specified by points (xcenter-a, ycenter-b, xcenter+a, ycenter+b), inclusive. [source,c] -------------------------------------------------------------------------------- -void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, +void GP_FillEllipse(GP_Pixmap *pixmap, GP_Coord xcenter, GP_Coord ycenter, GP_Size a, GP_Size b, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -172,7 +172,7 @@ Triangles [source,c] -------------------------------------------------------------------------------- -void GP_Triangle(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_Triangle(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -181,7 +181,7 @@ Draws a triangle. [source,c] -------------------------------------------------------------------------------- -void GP_FillTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_FillTriangle(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -193,13 +193,13 @@ Rects [source,c] -------------------------------------------------------------------------------- -void GP_RectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_RectXYXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Pixel pixel); -void GP_RectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, +void GP_RectXYWH(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel); -void GP_Rect(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_Rect(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -211,13 +211,13 @@ The 'GP_Rect()' function is an alias for 'GP_RectXYXY()'. [source,c] -------------------------------------------------------------------------------- -void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_FillRectXYXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Pixel pixel); -void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, +void GP_FillRectXYWH(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel); -void GP_FillRect(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_FillRect(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -234,7 +234,7 @@ Tetragons [source,c] -------------------------------------------------------------------------------- -void GP_Tetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_Tetragon(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, GP_Coord x3, GP_Coord y3, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -243,7 +243,7 @@ Draws a tetragon. [source,c] -------------------------------------------------------------------------------- -void GP_FillTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, +void GP_FillTetragon(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, GP_Coord x3, GP_Coord y3, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -255,7 +255,7 @@ Polygons [source,c] -------------------------------------------------------------------------------- -void GP_Polygon(GP_Context *context, unsigned int vertex_count, +void GP_Polygon(GP_Pixmap *pixmap, unsigned int vertex_count, const GP_Coord *xy, GP_Pixel pixel); -------------------------------------------------------------------------------- @@ -263,7 +263,7 @@ Draws a polygon. [source,c] -------------------------------------------------------------------------------- -void GP_FillPolygon(GP_Context *context, unsigned int vertex_count, +void GP_FillPolygon(GP_Pixmap *pixmap, unsigned int vertex_count, const GP_Coord *xy, GP_Pixel pixel); -------------------------------------------------------------------------------- diff --git a/doc/gfx_python.txt b/doc/gfx_python.txt index 941b1f85b0d4..eda0951d80be 100644 --- a/doc/gfx_python.txt +++ b/doc/gfx_python.txt @@ -3,7 +3,7 @@ Python GFX module The python binding maps mostly to the C API with the 'GP_' prefix stripped. -The gfx module adds methods to the gfx context submodule. +The gfx module adds methods to the gfx pixmap submodule. NOTE: You may want to see the link:coordinate_system.html[coordinate system] first. @@ -13,9 +13,9 @@ Drawing functions All drawing functions takes a 'pixel' value (to describe color) which link:core_python.html#Colors_and_Pixels[can be obtained], for a particular -pixel type (context), from a RGB triplet. +pixel type (pixmap), from a RGB triplet. -All drawing functions are clipped. Drawing outside of a context is no-op. +All drawing functions are clipped. Drawing outside of a pixmap is no-op. WARNING: Drawing functions takes strictly integer coordinates, make sure that all divisions are integer divisions (i.e. use // instead of /) to @@ -28,7 +28,7 @@ Line Based Primitives ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.HLine(x0, x1, y, pixel) + pixmap.gfx.HLine(x0, x1, y, pixel) ------------------------------------------------------------------------------- @@ -38,7 +38,7 @@ Draws a horizontal line from 'x0' to 'x1' at 'y'. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.VLine(x, y0, y1, pixel) + pixmap.gfx.VLine(x, y0, y1, pixel) ------------------------------------------------------------------------------- @@ -49,7 +49,7 @@ Draws a vertical line from 'y0' to 'y1' at 'x'. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Line(x0, y0, x1, y1, pixel) + pixmap.gfx.Line(x0, y0, x1, y1, pixel) ------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ Draws a line from x0, y0 to x1, y1. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Rect(x0, y0, x1, y1, pixel) + pixmap.gfx.Rect(x0, y0, x1, y1, pixel) ------------------------------------------------------------------------------- @@ -69,7 +69,7 @@ Draws a rectangle defined by two points. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Triangle(x0, y0, x1, y1, x1, y2, pixel) + pixmap.gfx.Triangle(x0, y0, x1, y1, x1, y2, pixel) ------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ Draws a triangle defined by three points. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Tetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel) + pixmap.gfx.Tetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel) ------------------------------------------------------------------------------- @@ -89,9 +89,9 @@ Draws a tetragon defined by four points. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Polygon([x0, y0, x1, y1, ...], pixel) + pixmap.gfx.Polygon([x0, y0, x1, y1, ...], pixel) - context.gfx.Polygon([(x0, y0), (x1, y1), ...], pixel) + pixmap.gfx.Polygon([(x0, y0), (x1, y1), ...], pixel) ------------------------------------------------------------------------------- @@ -102,7 +102,7 @@ integers or list of N tuples. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Circle(x, y, r, pixel) + pixmap.gfx.Circle(x, y, r, pixel) ------------------------------------------------------------------------------- @@ -112,7 +112,7 @@ Draws a circle. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Ellipse(x, y, a, b, pixel) + pixmap.gfx.Ellipse(x, y, a, b, pixel) ------------------------------------------------------------------------------- @@ -122,7 +122,7 @@ Draws an ellipse. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Ring(x, y, r1, r2, pixel) + pixmap.gfx.Ring(x, y, r1, r2, pixel) ------------------------------------------------------------------------------- @@ -135,17 +135,17 @@ Filled Primitives ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.Fill(pixel) + pixmap.gfx.Fill(pixel) ------------------------------------------------------------------------------- -Fills context with particular 'pixel' value. +Fills pixmap with particular 'pixel' value. [source,python] ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillRect(x0, y0, x1, y1, pixel) + pixmap.gfx.FillRect(x0, y0, x1, y1, pixel) ------------------------------------------------------------------------------- @@ -155,7 +155,7 @@ Fills a rectangle defined by two points. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillTriangle(x0, y0, x1, y1, x1, y2, pixel) + pixmap.gfx.FillTriangle(x0, y0, x1, y1, x1, y2, pixel) ------------------------------------------------------------------------------- @@ -165,7 +165,7 @@ Draws a filled triangle defined by three points. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillTetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel) + pixmap.gfx.FillTetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel) ------------------------------------------------------------------------------- @@ -175,9 +175,9 @@ Draws a filled tetragon defined by four points. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillPolygon([x0, y0, x1, y1, ...], pixel) + pixmap.gfx.FillPolygon([x0, y0, x1, y1, ...], pixel) - context.gfx.FillPolygon([(x0, y0), (x1, y1), ...], pixel) + pixmap.gfx.FillPolygon([(x0, y0), (x1, y1), ...], pixel) ------------------------------------------------------------------------------- @@ -188,7 +188,7 @@ integers or list of N tuples. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillCircle(x, y, r, pixel) + pixmap.gfx.FillCircle(x, y, r, pixel) ------------------------------------------------------------------------------- @@ -198,7 +198,7 @@ Fills a circle. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillEllipse(x, y, a, b, pixel) + pixmap.gfx.FillEllipse(x, y, a, b, pixel) ------------------------------------------------------------------------------- @@ -208,7 +208,7 @@ Fills an ellipse. ------------------------------------------------------------------------------- import gfxprim.gfx as gfx - context.gfx.FillRing(x, y, r1, r2, pixel) + pixmap.gfx.FillRing(x, y, r1, r2, pixel) ------------------------------------------------------------------------------- diff --git a/doc/grabbers.txt b/doc/grabbers.txt index 212859219078..871cfdca287c 100644 --- a/doc/grabbers.txt +++ b/doc/grabbers.txt @@ -25,7 +25,7 @@ typdef struct GP_Grabber { /* * Currently loaded frame. */ - GP_Context *frame; + GP_Pixmap *frame; /* * Connection fd usable for select() or poll(). @@ -100,7 +100,7 @@ grabber 'fd' is not -1 it's preferable to call it when select() or poll() returns that data are available on the 'fd'. This function returns non-zero if new frame was received and stored into the -'frame' context. Otherwise zero is returned. +'frame' pixmap. Otherwise zero is returned. Grabber Initializations ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/images/regen.py b/doc/images/regen.py index ba540aa7058f..0dabd6c687e7 100755 --- a/doc/images/regen.py +++ b/doc/images/regen.py @@ -33,10 +33,10 @@ def to_str(x, to_str): return res -def convert(ctx): - if (ctx.pixel_type == core.C.PIXEL_RGB332): - return ctx.Convert(core.C.PIXEL_RGB888) - return ctx +def convert(pixmap): + if (pixmap.pixel_type == core.C.PIXEL_RGB332): + return pixmap.Convert(core.C.PIXEL_RGB888) + return pixmap class ImgGen: def __init__(self, orig_path): diff --git a/doc/loaders.txt b/doc/loaders.txt index 0b83df55eb04..a01d4a32e2ff 100644 --- a/doc/loaders.txt +++ b/doc/loaders.txt @@ -1,4 +1,4 @@ -Context loaders +Pixmap loaders --------------- This part of GFXprim library implements API to load and save images for common image file formats. @@ -19,8 +19,8 @@ to a file and one that reads data from an link:loaders_io.html[IO stream]. All loading functions returns a pointer to newly allocated and loaded image or upon a failure NULL and errno is set. -The link:context.html[Context] returned by the loaders should be later freed -with link:context.html#ContextFree[GP_ContextFree()]. +The link:pixmap.html[Pixmap] returned by the loaders should be later freed +with link:pixmap.html#PixmapFree[GP_PixmapFree()]. All saving functions returns zero on success and non-zero on failure. If image saving is aborted by a callback, the opened file is closed and removed from a @@ -57,7 +57,7 @@ General interface /* or */ #include <GP.h> -GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback); +GP_Pixmap *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- Loads an image from a file. @@ -75,8 +75,8 @@ signature is recognized, image loader it is called and the result is returned. If file extension disagrees with file signature (which is quite common on the internet) a warning is printed into the stderr. -The resulting link:context.html[Context] should be later freed with -link:context.html#ContextFree[GP_ContextFree()]. +The resulting link:pixmap.html[Pixmap] should be later freed with +link:pixmap.html#PixmapFree[GP_PixmapFree()]. [[Save_Image]] [source,c] @@ -85,11 +85,11 @@ link:context.html#ContextFree[GP_ContextFree()]. /* or */ #include <GP.h> -int GP_SaveImage(GP_Context *src, const char *dst_path, +int GP_SaveImage(GP_Pixmap *src, const char *dst_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Saves a link:context.html[Context] into a file. +Saves a link:pixmap.html[Pixmap] into a file. The file format is matched accordingly to the file extension. @@ -99,7 +99,7 @@ If extension was found but support for saving the image format is not implemented errno is set to 'ENOSYS' (this may happen in case that GFXprim wasn't compiled with support for this image type). -If context pixel type is not supported by the format errno is set to +If pixmap pixel type is not supported by the format errno is set to 'EINVAL'. [[Register_Loader]] @@ -112,17 +112,17 @@ typedef struct GP_Loader { /* * Reads an image from an IO stream. * - * Returns newly allocated context cotaining the loaded image or in + * Returns newly allocated pixmap cotaining the loaded image or in * case of failure NULL and errno is set. */ - GP_Context *(*Read)(GP_IO *io, GP_ProgressCallback *callback); + GP_Pixmap *(*Read)(GP_IO *io, GP_ProgressCallback *callback); /* * Save an image. * * Returns zero on success, non-zero on failure and errno must be set. */ - int (*Save)(const GP_Context *src, const char *dst_path, + int (*Save)(const GP_Pixmap *src, const char *dst_path, GP_ProgressCallback *callback); /* @@ -224,7 +224,7 @@ against extensions defined by loaders. /* or */ #include <GP.h> -GP_Context *GP_LoaderLoadImage(const GP_Loader *self, const char *src_path, +GP_Pixmap *GP_LoaderLoadImage(const GP_Loader *self, const char *src_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -247,17 +247,17 @@
link:http://www.libpng.org/[libpng
library]. /* or */ #include <GP.h> -GP_Context *GP_ReadPNG(GP_IO *io, GP_ProgressCallback *callback); +GP_Pixmap *GP_ReadPNG(GP_IO *io, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- Reads a 'PNG' image from readable 'GP_IO'. The link:loaders_io.html[IO stream] is expected to start exactly at the 'PNG' file signature. -Returns newly allocated context (containing decompressed image) or in case of +Returns newly allocated pixmap (containing decompressed image) or in case of failure NULL and errno is set. -The resulting link:context.html[Context] should be later freed with -link:context.html#ContextFree[GP_ContextFree()]. +The resulting link:pixmap.html[Pixmap] should be later freed with +link:pixmap.html#PixmapFree[GP_PixmapFree()]. [source,c] ------------------------------------------------------------------------------- @@ -265,7 +265,7 @@ link:context.html#ContextFree[GP_ContextFree()]. /* or */ #include <GP.h> -GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback); +GP_Pixmap *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- Loads a 'PNG' image from a file. @@ -273,8 +273,8 @@ Loads a 'PNG' image from a file. Returns a pointer to newly allocated loaded image, or in case of failure NULL and errno is set. -The resulting link:context.html[Context] should be later freed with -link:context.html#ContextFree[GP_ContextFree()]. +The resulting link:pixmap.html[Pixmap] should be later freed with +link:pixmap.html#PixmapFree[GP_PixmapFree()]. [source,c] ------------------------------------------------------------------------------- @@ -282,11 +282,11 @@ link:context.html#ContextFree[GP_ContextFree()]. /* or */ #include <GP.h> -int GP_SavePNG(const GP_Context *src, const char *dst_path, +int GP_SavePNG(const GP_Pixmap *src, const char *dst_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Saves a link:context.html[Context] as a 'PNG' image, in case particular pixel +Saves a link:pixmap.html[Pixmap] as a 'PNG' image, in case particular pixel type is not supported non-zero is returned and errno is set to 'ENOSYS'. Supports 'G1', 'G2', 'G4', 'G8', 'G16', and 8-bit 'RGB' and 'RGBA' pixel @@ -314,17 +314,17 @@ The 'JPEG' image support is implemented by the jpeg library. /* or */ #include <GP.h> -GP_Context *GP_ReadJPG(GP_IO *io, GP_ProgressCallback *callback); +GP_Pixmap *GP_ReadJPG(GP_IO *io, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- Reads a 'JPEG' image from readable 'GP_IO'. The link:loaders_io.html[IO stream] is expected to start exactly at the 'JPEG' file signature. -Returns newly allocated context (containing decompressed image) or in case of +Returns newly allocated pixmap (containing decompressed image) or in case of failure NULL and errno is set. -The resulting link:context.html[Context] should be later freed with -link:context.html#ContextFree[GP_ContextFree()]. +The resulting link:pixmap.html[Pixmap] should be later freed with +link:pixmap.html#PixmapFree[GP_PixmapFree()]. [source,c] ------------------------------------------------------------------------------- @@ -332,7 +332,7 @@ link:context.html#ContextFree[GP_ContextFree()]. /* or */ #include <GP.h> -GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback); +GP_Pixmap *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- Loads a 'JPEG' image from a file. @@ -340,8 +340,8 @@ Loads a 'JPEG' image from a file. Returns a pointer to newly allocated loaded image, or in case of failure NULL and errno is set. -The resulting link:context.html[Context] should be later freed with -link:context.html#ContextFree[GP_ContextFree()]. +The resulting link:pixmap.html[Pixmap] should be later freed with +link:pixmap.html#PixmapFree[GP_PixmapFree()]. [source,c] ------------------------------------------------------------------------------- @@ -349,11 +349,11 @@ link:context.html#ContextFree[GP_ContextFree()]. /* or */ #include <GP.h> -int GP_SaveJPG(const GP_Context *src, const char *dst_path, +int GP_SaveJPG(const GP_Pixmap *src, const char *dst_path, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Saves a link:context.html[Context] as a 'JPEG' image. +Saves a link:pixmap.html[Pixmap] as a 'JPEG' image. The 'JPEG' format could store either 'G8' or 8-bit 'RGB' pixel-types. @@ -380,17 +380,17 @@ The 'JPEG 2000' image support is implemented using the openjpeg library. /* or */ #include <GP.h> -GP_Context *GP_ReadJP2(GP_IO *io, GP_ProgressCallback *callback); +GP_Pixmap *GP_ReadJP2(GP_IO *io, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- Reads a 'JPEG2000' image from readable 'GP_IO'. The link:loaders_io.html[IO stream] is expected to start exactly at the 'JPEG2000' file signature. -Returns newly allocated context (containing decompressed image) or in case of +Returns newly allocated pixmap (containing decompressed image) or in case of failure NULL and errno is set. -The resulting link:context.html[Context] should be later freed with -link:context.html#ContextFree[GP_ContextFree()]. +The resulting link:pixmap.html[Pixmap] should be later freed with ...e-mail trimmed, has been too large.
1
0
0
0
[repo.or.cz] gfxprim.git branch master updated: 1.0.0-rc1-182-g68ca236236df
by metan
29 Sep '17
29 Sep '17
This is an automated email generated because a ref change occurred in the git repository for project gfxprim.git. The branch, master has been updated via 68ca236236dffbd3fbb303802e6824f747d3cc50 (commit) via c97efe2001dac56f7f16079c6ae1ada635262ff2 (commit) via e0e66873d593fa879e90c19fb6c521f4bfc63ca2 (commit) via 112167d6829f8dd4d26491ff63e0a8c4887061df (commit) via 5f21803a755338b573dc6e1519779df8bc7fc78f (commit) via 63deea8aff7c8198f4ffb3e566f3390747150c46 (commit) via 69925ef2de2657916d62381ea95842d622f5b742 (commit) from 3bd8980e057fc508b4a9a77d2bd0c225258cb62b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 68ca236236dffbd3fbb303802e6824f747d3cc50 Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 10:51:05 +0200 URL: <
http://repo.or.cz/gfxprim.git/68ca236236dffbd3
> demos: Add termini libvterm based terminal Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- configure | 3 + demos/Makefile | 4 + demos/termini/.gitignore | 1 + demos/termini/Makefile | 17 ++ demos/termini/runtest.sh | 9 + demos/termini/termini.c | 527 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 561 insertions(+) create mode 100644 demos/termini/.gitignore create mode 100644 demos/termini/Makefile create mode 100755 demos/termini/runtest.sh create mode 100644 demos/termini/termini.c diff --git a/configure b/configure index 7d7a3c056d4a..a01830e050d8 100755 --- a/configure +++ b/configure @@ -404,6 +404,9 @@ if __name__ == '__main__': ["V4L2", "Video for linux 2", [header_exists, "linux/videodev2.h"], "", "", ["grabbers"]], + ["libvterm", + "Implementation of a VT220/xterm/ECMA-48 terminal emulator", + [header_exists, "vterm.h"], "", "", [""]], ["pthread", "Posix Threads", [header_exists, "pthread.h"], "-pthread", "-pthread", ["core"]], diff --git a/demos/Makefile b/demos/Makefile index 1943f919b785..bf71c075d541 100644 --- a/demos/Makefile +++ b/demos/Makefile @@ -1,3 +1,7 @@ TOPDIR=.. +include $(TOPDIR)/config.gen.mk SUBDIRS=grinder spiv particle ttf2img c_simple bogoman +ifeq ($(HAVE_LIBVTERM),yes) +SUBDIRS+=termini +endif include $(TOPDIR)/post.mk diff --git a/demos/termini/.gitignore b/demos/termini/.gitignore new file mode 100644 index 000000000000..23409a7d1275 --- /dev/null +++ b/demos/termini/.gitignore @@ -0,0 +1 @@ +termini diff --git a/demos/termini/Makefile b/demos/termini/Makefile new file mode 100644 index 000000000000..f54364741e4d --- /dev/null +++ b/demos/termini/Makefile @@ -0,0 +1,17 @@ +TOPDIR=../.. +include $(TOPDIR)/pre.mk + +CSOURCES=$(shell echo *.c) + +INCLUDE= +LDFLAGS+=-L$(TOPDIR)/build/ + +LDLIBS+=-lgfxprim-backends -lgfxprim -lvterm -lutil + +APPS=termini + +INSTALL_BIN=termini + +include $(TOPDIR)/app.mk +include $(TOPDIR)/install.mk +include $(TOPDIR)/post.mk diff --git a/demos/termini/runtest.sh b/demos/termini/runtest.sh new file mode 100755 index 000000000000..dac7bc8b8671 --- /dev/null +++ b/demos/termini/runtest.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Run dynamically linked test. +# + +PROG="$1" +shift + +LD_LIBRARY_PATH=../../build/ ./$PROG "$@" diff --git a/demos/termini/termini.c b/demos/termini/termini.c new file mode 100644 index 000000000000..ddbd4db54189 --- /dev/null +++ b/demos/termini/termini.c @@ -0,0 +1,527 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2017 Cyril Hrubis <metan(a)ucw.cz> * + * * + *****************************************************************************/ + + /* + + TERMINI -- minimal terminal emulator. + + */ + +#include <stdio.h> +#include <fcntl.h> +#include <poll.h> +#include <pty.h> +#include <vterm.h> +#include <GP.h> + +static GP_Backend *backend; + +static VTerm *vt; +static VTermScreen *vts; + +static unsigned int cols; +static unsigned int rows; +static unsigned int char_width; +static unsigned int char_height; +static GP_TextStyle *text_style; + +/* delay before we repaint merged damage */ +static int repaint_sleep_ms = -1; + +/* HACK to draw frames */ +static void draw_utf8_frames(int x, int y, uint32_t val, GP_Pixel fg) +{ + switch (val) { + case 0x2500: /* Horizontal line */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width, fg); + break; + case 0x2502: /* Vertical line */ + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg); + break; + case 0x250c: /* Upper left corner */ + GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg); + break; + case 0x2510: /* Upper right corner */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y + char_height/2, char_height/2+1, fg); + break; + case 0x2514: /* Bottom left corner */ + GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2, fg); + break; + case 0x2518: /* Bottom right corner */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height/2+1, fg); + break; + case 0x251c: /* Left vertical tee */ + GP_HLineXYW(backend->pixmap, x + char_width/2, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg); + break; + case 0x2524: /* Right vertical tee */ + GP_HLineXYW(backend->pixmap, x, y + char_height/2, char_width/2, fg); + GP_VLineXYH(backend->pixmap, x + char_width/2, y, char_height, fg); + break; + default: + fprintf(stderr, "WARN: unhandled utf8 char %x\n", val); + } +} + +static void draw_cell(VTermPos pos) +{ + VTermScreenCell c; + + vterm_screen_get_cell(vts, pos, &c); + + GP_Pixel bg = GP_RGBToPixmapPixel(c.bg.red, c.bg.green, c.bg.blue, backend->pixmap); + GP_Pixel fg = GP_RGBToPixmapPixel(c.fg.red, c.fg.green, c.fg.blue, backend->pixmap); + + if (c.attrs.reverse) + GP_SWAP(bg, fg); + + char buf[2] = {c.chars[0], 0}; + + int x = pos.col * char_width; + int y = pos.row * char_height; + + GP_FillRectXYWH(backend->pixmap, x, y, char_width, char_height, bg); + + //fprintf(stderr, "Drawing %x %c %02i %02i\n", buf[0], buf[0], pos.row, pos.col); + + if (c.width > 1) + fprintf(stderr, "%i\n", c.width); + + if (c.chars[0] > 0x7f) + draw_utf8_frames(x, y, c.chars[0], fg); + else + GP_Text(backend->pixmap, text_style, x, y, GP_ALIGN_RIGHT | GP_VALIGN_BELOW, fg, bg, buf); + + if (c.attrs.bold) + GP_Text(backend->pixmap, text_style, x+1, y, GP_ALIGN_RIGHT | GP_VALIGN_BELOW, fg, bg, buf); +} + +static void update_rect(VTermRect rect) +{ + int x = rect.start_col * char_width; + int y = rect.start_row * char_height; + int w = rect.end_col * char_width; + int h = rect.end_row * char_height; + + GP_BackendUpdateRectXYXY(backend, x, y, w, h); +} + +static VTermRect damaged; +static int damage_repainted = 1; + +static void merge_damage(VTermRect rect) +{ + if (damage_repainted) { + damaged = rect; + damage_repainted = 0; + return; + } + + damaged.start_col = GP_MIN(damaged.start_col, rect.start_col); + damaged.end_col = GP_MAX(damaged.end_col, rect.end_col); + + damaged.start_row = GP_MIN(damaged.start_row, rect.start_row); + damaged.end_row = GP_MAX(damaged.end_row, rect.end_row); + +} + +static void repaint_damage(void) +{ + int row, col; + + for (row = damaged.start_row; row < damaged.end_row; row++) { + for (col = damaged.start_col; col < damaged.end_col; col++) { + VTermPos pos = {.row = row, .col = col}; + draw_cell(pos); + } + } + + update_rect(damaged); + damage_repainted = 1; + repaint_sleep_ms = -1; +} + + +static int term_damage(VTermRect rect, void *user_data) +{ + (void)user_data; + + merge_damage(rect); +// fprintf(stderr, "rect: %i %i %i %i\n", rect.start_row, rect.end_row, rect.start_col, rect.end_col); + repaint_sleep_ms = 1; + + return 1; +} + +static int term_moverect(VTermRect dest, VTermRect src, void *user_data) +{ + (void)dest; + (void)src; + (void)user_data; + fprintf(stderr, "Move rect!\n"); + + return 0; +} + +static int term_movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user_data) +{ + (void)user_data; + unsigned int x = oldpos.col * char_width; + unsigned int y = oldpos.row * char_height; + + draw_cell(oldpos); + GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height); + + x = pos.col * char_width; + y = pos.row * char_height; + + GP_RectXYWH(backend->pixmap, x, y, char_width, char_height, 0xffffff); + GP_BackendUpdateRectXYWH(backend, x, y, char_width, char_height); + + //fprintf(stderr, "Move cursor %i %i -> %i %i!\n", oldpos.col, oldpos.row, pos.col, pos.row); + + //vterm_screen_flush_damage(vts); + + return 1; +} + +static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) +{ + (void)user_data; + + switch (prop) { + case VTERM_PROP_TITLE: + fprintf(stderr, "caption %s\n", val->string); + GP_BackendSetCaption(backend, val->string); + return 1; + case VTERM_PROP_ALTSCREEN: + fprintf(stderr, "altscreen\n"); + return 0; + case VTERM_PROP_ICONNAME: + fprintf(stderr, "iconname %s\n", val->string); + return 0; + case VTERM_PROP_CURSORSHAPE: + fprintf(stderr, "cursorshape %i\n", val->number); + return 0; + case VTERM_PROP_REVERSE: + fprintf(stderr, "reverse %i\n", val->boolean); + return 0; + case VTERM_PROP_CURSORVISIBLE: + fprintf(stderr, "cursorvisible %i\n", val->boolean); + return 0; + case VTERM_PROP_CURSORBLINK: + fprintf(stderr, "blink %i\n", val->boolean); + return 0; + case VTERM_PROP_MOUSE: + fprintf(stderr, "mouse %i\n", val->number); + return 0; + default: + break; + } + + fprintf(stderr, "Set term prop!\n"); + + return 0; +} + +static int term_screen_resize(int new_rows, int new_cols, void *user) +{ + (void)new_rows; + (void)new_cols; + (void)user; + + fprintf(stderr, "Resize %i %i\n", new_rows, new_cols); + + return 1; +} + +static int term_bell(void *user) +{ + (void)user; + fprintf(stderr, "Bell!\n"); + + return 1; +} + +static int term_sb_pushline(int cols, const VTermScreenCell *cells, void *user) +{ + (void)cols; + (void)cells; + (void)user; + + fprintf(stderr, "Pushline!\n"); + + return 0; +} + +static VTermScreenCallbacks screen_callbacks = { + .damage = term_damage, +// .moverect = term_moverect, + .movecursor = term_movecursor, + .settermprop = term_settermprop, + .bell = term_bell, +// .sb_pushline = term_sb_pushline, + .resize = term_screen_resize, +// .sb_popline = term_sb_popline, +}; + +static void term_init(void) +{ + vt = vterm_new(rows, cols); + vterm_set_utf8(vt, 1); + + vts = vterm_obtain_screen(vt); + vterm_screen_enable_altscreen(vts,1); + vterm_screen_set_callbacks(vts, &screen_callbacks, NULL); + VTermState *vs = vterm_obtain_state(vt); + vterm_state_set_bold_highbright(vs,1); + vterm_screen_reset(vts, 1); +// vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_SCROLL); + //vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_ROW); +} + +/* + * Forks and runs a shell, returns master fd. + */ +static int open_console(void) +{ + int fd, pid, flags; + + pid = forkpty(&fd, NULL, NULL, NULL); + if (pid < 0) + return -1; + + if (pid == 0) { + char *shell = getenv("SHELL"); + + if (!shell) + shell = "/bin/sh"; + + putenv("TERM=xterm"); + + execl(shell, shell, NULL); + } + + flags = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); + + return fd; +} + +static void close_console(int fd) +{ + close(fd); +} + +static int console_read(int fd) +{ + char buf[1024]; + int len; + + len = read(fd, buf, sizeof(buf)); + + if (len > 0) + vterm_input_write(vt, buf, len); + + return len; +} + +static void console_write(int fd, char *buf, int buf_len) +{ + write(fd, buf, buf_len); +} + +static void console_resize(int fd, int cols, int rows) +{ + struct winsize size = {rows, cols, 0, 0}; + ioctl(fd, TIOCSWINSZ, &size); +} + +static void do_exit(int fd) +{ + close_console(fd); + GP_BackendExit(backend); + vterm_free(vt); +} + +static void event_to_console(GP_Event *ev, int fd) +{ + int ctrl = GP_EventGetKey(ev, GP_KEY_RIGHT_CTRL) || + GP_EventGetKey(ev, GP_KEY_LEFT_CTRL); + + if (ctrl) { + if (ev->val.key.ascii >= 'a' && ev->val.key.ascii <= 'z') { + char buf = ev->val.key.ascii - 'a' + 1; + console_write(fd, &buf, 1); + } + return; + } + + if (ev->val.key.ascii) { + write(fd, &ev->val.key.ascii, 1); + return; + } + + switch (ev->val.key.key) { + case GP_KEY_UP: + console_write(fd, "\eOA", 3); + break; + case GP_KEY_DOWN: + console_write(fd, "\eOB", 3); + break; + case GP_KEY_RIGHT: + console_write(fd, "\eOC", 3); + break; + case GP_KEY_LEFT: + console_write(fd, "\eOD", 3); + break; + case GP_KEY_DELETE: + console_write(fd, "\e[3~", 4); + break; + case GP_KEY_PAGE_UP: + console_write(fd, "\e[5~", 4); + break; + case GP_KEY_PAGE_DOWN: + console_write(fd, "\e[6~", 4); + break; + case GP_KEY_HOME: + console_write(fd, "\e[7~", 4); + break; + case GP_KEY_END: + console_write(fd, "\e[8~", 4); + break; + case GP_KEY_F1: + console_write(fd, "\e[11~", 5); + break; + case GP_KEY_F2: + console_write(fd, "\e[12~", 5); + break; + case GP_KEY_F3: + console_write(fd, "\e[13~", 5); + break; + case GP_KEY_F4: + console_write(fd, "\e[14~", 5); + break; + case GP_KEY_F5: + console_write(fd, "\e[15~", 5); + break; + case GP_KEY_F6: + console_write(fd, "\e[17~", 5); + break; + case GP_KEY_F7: + console_write(fd, "\e[18~", 5); + break; + case GP_KEY_F8: + console_write(fd, "\e[19~", 5); + break; + case GP_KEY_F9: + console_write(fd, "\e[20~", 5); + break; + case GP_KEY_F10: + console_write(fd, "\e[21~", 5); + break; + case GP_KEY_F11: + console_write(fd, "\e[23~", 5); + break; + case GP_KEY_F12: + console_write(fd, "\e[24~", 5); + break; + } +} + +extern struct GP_FontFace *GP_FontFoo; + +int main(int argc, char *argv[]) +{ + backend = GP_BackendInit("X11", "Termini"); + if (backend == NULL) { + fprintf(stderr, "Failed to initalize backend\n"); + exit(1); + } + + GP_TextStyle style = {.font = GP_FontFoo, + //.font = &GP_DefaultConsoleFont, + .pixel_xmul = 1, + .pixel_ymul = 1, + }; + text_style = &style; + + char_width = GP_TextMaxWidth(text_style, 1); + char_height = GP_TextHeight(text_style); + + cols = GP_PixmapW(backend->pixmap)/char_width; + rows = GP_PixmapH(backend->pixmap)/char_height; + + fprintf(stderr, "Cols %i Rows %i\n", cols, rows); + + term_init(); + int fd = open_console(); + + struct pollfd fds[2] = { + {.fd = fd, .events = POLLIN}, + {.fd = backend->fd, .events = POLLIN} + }; + + for (;;) { + GP_Event ev; + + if (poll(fds, 2, repaint_sleep_ms) == 0) + repaint_damage(); + + while (GP_BackendPollEvent(backend, &ev)) { + switch (ev.type) { + case GP_EV_KEY: + if (ev.code == GP_EV_KEY_UP) + break; + + event_to_console(&ev, fd); + break; + case GP_EV_SYS: + switch (ev.code) { + case GP_EV_SYS_RESIZE: + GP_BackendResizeAck(backend); + cols = ev.val.sys.w/char_width; + rows = ev.val.sys.h/char_height; + vterm_set_size(vt, rows, cols); + console_resize(fd, cols, rows); + GP_Fill(backend->pixmap, 0); + VTermRect rect = {.start_row = 0, .start_col = 0, .end_row = rows, .end_col = cols}; + term_damage(rect, NULL); + //TODO cursor + break; + case GP_EV_SYS_QUIT: + do_exit(fd); + break; + } + break; + } + } + + console_read(fd); + } + + return 0; +} commit c97efe2001dac56f7f16079c6ae1ada635262ff2 Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 11:09:42 +0200 URL: <
http://repo.or.cz/gfxprim.git/c97efe2001dac56f
> text/GP_Text.gen.c.t: Optimize 1BPP font drawing Calling a HLine() function from the inner loop was a bad idea after all. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- libs/text/GP_Text.gen.c.t | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libs/text/GP_Text.gen.c.t b/libs/text/GP_Text.gen.c.t index 209d00defd07..189cf7f2f031 100644 --- a/libs/text/GP_Text.gen.c.t +++ b/libs/text/GP_Text.gen.c.t @@ -38,7 +38,7 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle * if (glyph == NULL) glyph = GP_GetGlyphBitmap(style->font, ' '); - int i, j, k; + int i, j, k, l; unsigned int x_mul = style->pixel_xmul + style->pixel_xspace; unsigned int y_mul = style->pixel_ymul + style->pixel_yspace; @@ -51,17 +51,25 @@ static void text_draw_1BPP_{{ pt.name }}(GP_Pixmap *pixmap, const GP_TextStyle * for (i = 0; i < glyph->width; i++) { uint8_t bit = (glyph->bitmap[i/8 + j * bpp]) & (0x80>>(i%8)); - unsigned int x_start = x + (i + glyph->bearing_x) * x_mul; + if (!bit) + continue; + + int start_x = x + (i + glyph->bearing_x) * x_mul; if (p == str) - x_start -= glyph->bearing_x * x_mul; + start_x -= glyph->bearing_x * x_mul; - if (!bit) - continue; + int start_y = y - (glyph->bearing_y - style->font->ascend) * y_mul; - for (k = 0; k < style->pixel_ymul; k++) - GP_HLine(pixmap, x_start, x_start + style->pixel_xmul - 1, - y - (glyph->bearing_y - style->font->ascend) * y_mul + k, fg); + for (k = start_y; k < start_y + style->pixel_ymul; k++) { + for (l = start_x; l < start_x + style->pixel_xmul; l++) { + int px = l; + int py = k; + GP_TRANSFORM_POINT(pixmap, px, py); + if (!GP_PIXEL_IS_CLIPPED(pixmap, px, py)) + GP_PutPixel_Raw_{{ pt.pixelsize.suffix }}(pixmap, px, py, fg); + } + } } y += style->pixel_ymul + style->pixel_yspace; commit e0e66873d593fa879e90c19fb6c521f4bfc63ca2 Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 11:08:49 +0200 URL: <
http://repo.or.cz/gfxprim.git/e0e66873d593fa87
> fonts/GP_DefaultFont: Whitespace cleanup. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- libs/text/GP_DefaultFont.c | 876 ++++++++++++++++++------------------- 1 file changed, 438 insertions(+), 438 deletions(-) rewrite libs/text/GP_DefaultFont.c (82%) diff --git a/libs/text/GP_DefaultFont.c b/libs/text/GP_DefaultFont.c dissimilarity index 82% index d67fa99e9e9b..5dd67b182890 100644 --- a/libs/text/GP_DefaultFont.c +++ b/libs/text/GP_DefaultFont.c @@ -1,438 +1,438 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * <jiri.bluebear.dluhos(a)gmail.com> * - * * - * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> * - * * - *****************************************************************************/ - -#include "GP_Font.h" - -static int8_t default_console_glyphs[] = { - /* ' ' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '!' */ 7, 11, 0, 9, 8, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, - /* '"' */ 7, 11, 0, 9, 8, - 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '#' */ 7, 11, 0, 9, 8, - 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00, - /* '$' */ 7, 11, 0, 9, 8, - 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, - /* '%' */ 7, 11, 0, 9, 8, - 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, - /* '&' */ 7, 11, 0, 9, 8, - 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, - /* ''' */ 7, 11, 0, 9, 8, - 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '(' */ 7, 11, 0, 9, 8, - 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, - /* ')' */ 7, 11, 0, 9, 8, - 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, - /* '*' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00, - /* '+' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - /* ',' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, - /* '-' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '.' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - /* '/' */ 7, 11, 0, 9, 8, - 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, - /* '0' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, - /* '1' */ 7, 11, 1, 9, 8, - 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, - /* '2' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, - /* '3' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '4' */ 7, 11, 1, 9, 8, - 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, - /* '5' */ 7, 11, 1, 9, 8, - 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '6' */ 7, 11, 1, 9, 8, - 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '7' */ 7, 11, 1, 9, 8, - 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* '8' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '9' */ 7, 11, 1, 9, 8, - 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, - /* ':' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - /* ';' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, - /* '<' */ 7, 11, 0, 9, 8, - 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, - /* '=' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, - /* '>' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, - /* '?' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - /* '@' */ 8, 11, 0, 9, 8, - 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, - /* 'A' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'B' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, - /* 'C' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, - /* 'D' */ 7, 11, 0, 9, 8, - 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, - /* 'E' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, - /* 'F' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'G' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'H' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'I' */ 7, 11, 0, 9, 8, - 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, - /* 'J' */ 7, 11, 0, 9, 8, - 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'K' */ 7, 11, 0, 9, 8, - 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'L' */ 7, 11, 0, 9, 8, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, - /* 'M' */ 7, 11, 0, 9, 8, - 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'N' */ 7, 11, 0, 9, 8, - 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, - /* 'O' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'P' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'Q' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, - /* 'R' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'S' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'T' */ 7, 11, 0, 9, 8, - 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'U' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'V' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - /* 'W' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, - /* 'X' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, - /* 'Y' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'Z' */ 7, 11, 0, 9, 8, - 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, - /* '[' */ 7, 11, 0, 9, 8, - 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00, - /* '\' */ 7, 11, 0, 9, 8, - 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, - /* ']' */ 7, 11, 0, 9, 8, - 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00, - /* '^' */ 7, 11, 0, 9, 8, - 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '_' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, - /* '`' */ 7, 11, 0, 9, 8, - 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* 'a' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00, - /* 'b' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, - /* 'c' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, - /* 'd' */ 7, 11, 0, 9, 8, - 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, - /* 'e' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00, - /* 'f' */ 7, 11, 0, 9, 8, - 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - /* 'g' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, - /* 'h' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - /* 'i' */ 7, 11, 0, 9, 8, - 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, - /* 'j' */ 7, 11, 0, 9, 8, - 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, - /* 'k' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, - /* 'l' */ 7, 11, 0, 9, 8, - 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, - /* 'm' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, - /* 'n' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, - /* 'o' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, - /* 'p' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, - /* 'q' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, - /* 'r' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - /* 's' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, - /* 't' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, - /* 'u' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, - /* 'v' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, - /* 'w' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, - /* 'x' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, - /* 'y' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, - /* 'z' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, - /* '{' */ 7, 11, 0, 9, 8, - 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, - /* '|' */ 7, 11, 0, 9, 8, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, - /* '}' */ 7, 11, 0, 9, 8, - 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, - /* '~' */ 7, 11, 0, 9, 8, - 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -struct GP_FontFace GP_DefaultConsoleFont = { - .family_name = "Gfxprim", - .style_name = "Mono", - .charset = GP_CHARSET_7BIT, - .ascend = 9, - .descend = 2, - .max_glyph_width = 8, - .max_glyph_advance = 8, - .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, - .glyphs = default_console_glyphs, - .glyph_offsets = {16}, -}; - -static uint8_t default_proportional_glyphs[] = { - /* ' ' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '!' */ 4, 11, 0, 9, 6, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, - /* '"' */ 8, 11, 0, 9, 9, - 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '#' */ 8, 11, 0, 9, 9, - 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00, - /* '$' */ 7, 11, 0, 9, 8, - 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, - /* '%' */ 7, 11, 0, 9, 8, - 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, - /* '&' */ 7, 11, 0, 9, 8, - 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, - /* ''' */ 4, 11, 0, 9, 5, - 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '(' */ 2, 11, 0, 9, 4, - 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00, - /* ')' */ 2, 11, 0, 9, 4, - 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, - /* '*' */ 5, 11, 0, 9, 6, - 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00, - /* '+' */ 7, 11, 0, 9, 8, - 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, - /* ',' */ 4, 11, 0, 9, 6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, - /* '-' */ 4, 11, 0, 9, 6, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '.' */ 4, 11, 0, 9, 6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - /* '/' */ 5, 11, 0, 9, 6, - 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, - /* '0' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, - /* '1' */ 6, 11, 0, 9, 7, - 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, - /* '2' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, - /* '3' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '4' */ 6, 11, 0, 9, 7, - 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, - /* '5' */ 6, 11, 0, 9, 7, - 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '6' */ 6, 11, 0, 9, 7, - 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '7' */ 6, 11, 0, 9, 7, - 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* '8' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* '9' */ 6, 11, 0, 9, 7, - 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, - /* ':' */ 4, 11, 0, 9, 5, - 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, - /* ';' */ 4, 11, 0, 9, 5, - 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00, - /* '<' */ 4, 11, 0, 9, 6, - 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, - /* '=' */ 5, 11, 0, 9, 6, - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, - /* '>' */ 4, 11, 0, 9, 6, - 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, - /* '?' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, - /* '@' */ 8, 11, 0, 9, 9, - 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, - /* 'A' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'B' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, - /* 'C' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, - /* 'D' */ 7, 11, 0, 9, 8, - 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, - /* 'E' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, - /* 'F' */ 7, 11, 0, 9, 8, - 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'G' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'H' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'I' */ 1, 11, 0, 9, 2, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'J' */ 7, 11, 0, 9, 8, - 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'K' */ 7, 11, 0, 9, 8, - 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'L' */ 6, 11, 0, 9, 7, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, - /* 'M' */ 7, 11, 0, 9, 8, - 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, - /* 'N' */ 7, 11, 0, 9, 8, - 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, - /* 'O' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'P' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 'Q' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, - /* 'R' */ 7, 11, 0, 9, 8, - 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, - /* 'S' */ 7, 11, 0, 9, 8, - 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, - /* 'T' */ 7, 11, 0, 9, 8, - 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'U' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, - /* 'V' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - /* 'W' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, - /* 'X' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, - /* 'Y' */ 7, 11, 0, 9, 8, - 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, - /* 'Z' */ 7, 11, 0, 9, 8, - 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, - /* '[' */ 3, 11, 0, 9, 4, - 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, - /* '\' */ 5, 11, 0, 9, 6, - 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, - /* ']' */ 3, 11, 0, 9, 4, - 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, - /* '^' */ 8, 11, 0, 9, 9, - 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* '_' */ 8, 11, 0, 9, 9, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, - /* '`' */ 2, 11, 0, 9, 3, - 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* 'a' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00, - /* 'b' */ 6, 11, 0, 9, 7, - 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00, - /* 'c' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, - /* 'd' */ 6, 11, 0, 9, 7, - 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, - /* 'e' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00, - /* 'f' */ 6, 11, 0, 9, 7, - 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, - /* 'g' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, - /* 'h' */ 6, 11, 0, 9, 7, - 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, - /* 'i' */ 2, 11, 0, 9, 4, - 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, - /* 'j' */ 3, 11, 0, 9, 4, - 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0, - /* 'k' */ 7, 11, 0, 9, 8, - 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, - /* 'l' */ 4, 11, 0, 9, 5, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, - /* 'm' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, - /* 'n' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, - /* 'o' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, - /* 'p' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, - /* 'q' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, - /* 'r' */ 5, 11, 0, 9, 6, - 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* 's' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, - /* 't' */ 6, 11, 0, 9, 7, - 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, - /* 'u' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, - /* 'v' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00, - /* 'w' */ 7, 11, 0, 9, 8, - 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, - /* 'x' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00, - /* 'y' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, - /* 'z' */ 6, 11, 0, 9, 7, - 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00, - /* '{' */ 5, 11, 0, 9, 6, - 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, - /* '|' */ 1, 11, 0, 9, 2, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, - /* '}' */ 5, 11, 0, 9, 6, - 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, - /* '~' */ 6, 11, 0, 9, 7, - 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -struct GP_FontFace GP_DefaultProportionalFont = { - .family_name = "Gfxprim", - .style_name = "Proportional", - .charset = GP_CHARSET_7BIT, - .ascend = 9, - .descend = 2, - .max_glyph_width = 9, - .max_glyph_advance = 9, - .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, - .glyphs = default_proportional_glyphs, - .glyph_offsets = {16}, -}; +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * <jiri.bluebear.dluhos(a)gmail.com> * + * * + * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> * + * * + *****************************************************************************/ + +#include "GP_Font.h" + +static int8_t default_console_glyphs[] = { + /* ' ' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '!' */ 7, 11, 0, 9, 8, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, + /* '"' */ 7, 11, 0, 9, 8, + 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '#' */ 7, 11, 0, 9, 8, + 0x00, 0x14, 0x14, 0x7e, 0x28, 0x28, 0xfc, 0x50, 0x50, 0x00, 0x00, + /* '$' */ 7, 11, 0, 9, 8, + 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, + /* '%' */ 7, 11, 0, 9, 8, + 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, + /* '&' */ 7, 11, 0, 9, 8, + 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, + /* ''' */ 7, 11, 0, 9, 8, + 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '(' */ 7, 11, 0, 9, 8, + 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, + /* ')' */ 7, 11, 0, 9, 8, + 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, + /* '*' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x54, 0x54, 0x38, 0x54, 0x54, 0x10, 0x00, 0x00, 0x00, + /* '+' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* ',' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, + /* '-' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '.' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + /* '/' */ 7, 11, 0, 9, 8, + 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, + /* '0' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, + /* '1' */ 7, 11, 1, 9, 8, + 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, + /* '2' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* '3' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '4' */ 7, 11, 1, 9, 8, + 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, + /* '5' */ 7, 11, 1, 9, 8, + 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '6' */ 7, 11, 1, 9, 8, + 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '7' */ 7, 11, 1, 9, 8, + 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* '8' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '9' */ 7, 11, 1, 9, 8, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, + /* ':' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + /* ';' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, + /* '<' */ 7, 11, 0, 9, 8, + 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, + /* '=' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, + /* '>' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, + /* '?' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, + /* '@' */ 8, 11, 0, 9, 8, + 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, + /* 'A' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'B' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, + /* 'C' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, + /* 'D' */ 7, 11, 0, 9, 8, + 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, + /* 'E' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'F' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'G' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'H' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'I' */ 7, 11, 0, 9, 8, + 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, + /* 'J' */ 7, 11, 0, 9, 8, + 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'K' */ 7, 11, 0, 9, 8, + 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'L' */ 7, 11, 0, 9, 8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'M' */ 7, 11, 0, 9, 8, + 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'N' */ 7, 11, 0, 9, 8, + 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, + /* 'O' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'P' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'Q' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, + /* 'R' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'S' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'T' */ 7, 11, 0, 9, 8, + 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'U' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'V' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, + /* 'W' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, + /* 'X' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, + /* 'Y' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'Z' */ 7, 11, 0, 9, 8, + 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, + /* '[' */ 7, 11, 0, 9, 8, + 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x00, 0x00, + /* '\' */ 7, 11, 0, 9, 8, + 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, + /* ']' */ 7, 11, 0, 9, 8, + 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x00, + /* '^' */ 7, 11, 0, 9, 8, + 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '_' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, + /* '`' */ 7, 11, 0, 9, 8, + 0x30, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 'a' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x3e, 0x00, 0x00, + /* 'b' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, + /* 'c' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + /* 'd' */ 7, 11, 0, 9, 8, + 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, + /* 'e' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3e, 0x00, 0x00, + /* 'f' */ 7, 11, 0, 9, 8, + 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* 'g' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, + /* 'h' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + /* 'i' */ 7, 11, 0, 9, 8, + 0x08, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + /* 'j' */ 7, 11, 0, 9, 8, + 0x08, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, + /* 'k' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, + /* 'l' */ 7, 11, 0, 9, 8, + 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, + /* 'm' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, + /* 'n' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + /* 'o' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + /* 'p' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, + /* 'q' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, + /* 'r' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + /* 's' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, + /* 't' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, + /* 'u' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, + /* 'v' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, + /* 'w' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, + /* 'x' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, + /* 'y' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, + /* 'z' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, + /* '{' */ 7, 11, 0, 9, 8, + 0x0c, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, + /* '|' */ 7, 11, 0, 9, 8, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + /* '}' */ 7, 11, 0, 9, 8, + 0x30, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, + /* '~' */ 7, 11, 0, 9, 8, + 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +struct GP_FontFace GP_DefaultConsoleFont = { + .family_name = "Gfxprim", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 9, + .descend = 2, + .max_glyph_width = 8, + .max_glyph_advance = 8, + .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, + .glyphs = default_console_glyphs, + .glyph_offsets = {16}, +}; + +static uint8_t default_proportional_glyphs[] = { + /* ' ' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '!' */ 4, 11, 0, 9, 6, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, + /* '"' */ 8, 11, 0, 9, 9, + 0x24, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '#' */ 8, 11, 0, 9, 9, + 0x00, 0x12, 0x12, 0x7f, 0x24, 0x24, 0xfe, 0x48, 0x48, 0x00, 0x00, + /* '$' */ 7, 11, 0, 9, 8, + 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x12, 0x92, 0x7c, 0x10, 0x00, 0x00, + /* '%' */ 7, 11, 0, 9, 8, + 0x61, 0x92, 0x94, 0x68, 0x10, 0x2c, 0x52, 0x92, 0x0c, 0x00, 0x00, + /* '&' */ 7, 11, 0, 9, 8, + 0x30, 0x48, 0x48, 0x30, 0x56, 0x88, 0x88, 0x88, 0x76, 0x00, 0x00, + /* ''' */ 4, 11, 0, 9, 5, + 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '(' */ 2, 11, 0, 9, 4, + 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00, + /* ')' */ 2, 11, 0, 9, 4, + 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, + /* '*' */ 5, 11, 0, 9, 6, + 0x00, 0x20, 0xa8, 0xa8, 0x70, 0xa8, 0xa8, 0x20, 0x00, 0x00, 0x00, + /* '+' */ 7, 11, 0, 9, 8, + 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + /* ',' */ 4, 11, 0, 9, 6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, + /* '-' */ 4, 11, 0, 9, 6, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '.' */ 4, 11, 0, 9, 6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + /* '/' */ 5, 11, 0, 9, 6, + 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, + /* '0' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x8c, 0x94, 0xb4, 0xa4, 0xc4, 0x84, 0x78, 0x00, 0x00, + /* '1' */ 6, 11, 0, 9, 7, + 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x00, 0x00, + /* '2' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x60, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* '3' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x04, 0x18, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '4' */ 6, 11, 0, 9, 7, + 0x18, 0x28, 0x48, 0x48, 0x88, 0xfc, 0x08, 0x08, 0x08, 0x00, 0x00, + /* '5' */ 6, 11, 0, 9, 7, + 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '6' */ 6, 11, 0, 9, 7, + 0x78, 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '7' */ 6, 11, 0, 9, 7, + 0xfc, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* '8' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* '9' */ 6, 11, 0, 9, 7, + 0x78, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, 0x00, 0x00, + /* ':' */ 4, 11, 0, 9, 5, + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + /* ';' */ 4, 11, 0, 9, 5, + 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x20, 0x40, 0x00, + /* '<' */ 4, 11, 0, 9, 6, + 0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, + /* '=' */ 5, 11, 0, 9, 6, + 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, + /* '>' */ 4, 11, 0, 9, 6, + 0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, + /* '?' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x02, 0x0c, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, + /* '@' */ 8, 11, 0, 9, 9, + 0x3e, 0x41, 0x9d, 0xa5, 0xa5, 0xa5, 0x9e, 0x41, 0x3e, 0x00, 0x00, + /* 'A' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'B' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x82, 0x82, 0x82, 0xfc, 0x00, 0x00, + /* 'C' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x7c, 0x00, 0x00, + /* 'D' */ 7, 11, 0, 9, 8, + 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, + /* 'E' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + /* 'F' */ 7, 11, 0, 9, 8, + 0xfe, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'G' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'H' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'I' */ 1, 11, 0, 9, 2, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'J' */ 7, 11, 0, 9, 8, + 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'K' */ 7, 11, 0, 9, 8, + 0x82, 0x84, 0x88, 0x90, 0xe0, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'L' */ 6, 11, 0, 9, 7, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x00, 0x00, + /* 'M' */ 7, 11, 0, 9, 8, + 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + /* 'N' */ 7, 11, 0, 9, 8, + 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, + /* 'O' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'P' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 'Q' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x9a, 0x84, 0x7a, 0x00, 0x00, + /* 'R' */ 7, 11, 0, 9, 8, + 0xfc, 0x82, 0x82, 0x82, 0x82, 0xfc, 0x88, 0x84, 0x82, 0x00, 0x00, + /* 'S' */ 7, 11, 0, 9, 8, + 0x7c, 0x82, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x82, 0x7c, 0x00, 0x00, + /* 'T' */ 7, 11, 0, 9, 8, + 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'U' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, + /* 'V' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, + /* 'W' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0xaa, 0x44, 0x00, 0x00, + /* 'X' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x82, 0x00, 0x00, + /* 'Y' */ 7, 11, 0, 9, 8, + 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + /* 'Z' */ 7, 11, 0, 9, 8, + 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, + /* '[' */ 3, 11, 0, 9, 4, + 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x00, 0x00, + /* '\' */ 5, 11, 0, 9, 6, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, + /* ']' */ 3, 11, 0, 9, 4, + 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x00, 0x00, + /* '^' */ 8, 11, 0, 9, 9, + 0x08, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '_' */ 8, 11, 0, 9, 9, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, + /* '`' */ 2, 11, 0, 9, 3, + 0xc0, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 'a' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x04, 0x04, 0x7c, 0x84, 0x84, 0x7c, 0x00, 0x00, + /* 'b' */ 6, 11, 0, 9, 7, + 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x00, 0x00, + /* 'c' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x84, 0x80, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, + /* 'd' */ 6, 11, 0, 9, 7, + 0x04, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, + /* 'e' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x84, 0x84, 0xfc, 0x80, 0x80, 0x7c, 0x00, 0x00, + /* 'f' */ 6, 11, 0, 9, 7, + 0x1e, 0x20, 0x20, 0xfc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* 'g' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, + /* 'h' */ 6, 11, 0, 9, 7, + 0x80, 0x80, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, + /* 'i' */ 2, 11, 0, 9, 4, + 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + /* 'j' */ 3, 11, 0, 9, 4, + 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0, + /* 'k' */ 7, 11, 0, 9, 8, + 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, + /* 'l' */ 4, 11, 0, 9, 5, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x00, 0x00, + /* 'm' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, + /* 'n' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, + /* 'o' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x00, 0x00, + /* 'p' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0xf8, 0x84, 0x84, 0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, + /* 'q' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, + /* 'r' */ 5, 11, 0, 9, 6, + 0x00, 0x00, 0xb8, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 's' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x7c, 0x80, 0x80, 0x7c, 0x02, 0x02, 0x7c, 0x00, 0x00, + /* 't' */ 6, 11, 0, 9, 7, + 0x00, 0x20, 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, + /* 'u' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x00, 0x00, + /* 'v' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x84, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00, + /* 'w' */ 7, 11, 0, 9, 8, + 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, + /* 'x' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x48, 0x30, 0x48, 0x84, 0x84, 0x00, 0x00, + /* 'y' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x78, + /* 'z' */ 6, 11, 0, 9, 7, + 0x00, 0x00, 0xfc, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x00, 0x00, + /* '{' */ 5, 11, 0, 9, 6, + 0x18, 0x20, 0x20, 0x20, 0xc0, 0x20, 0x20, 0x20, 0x18, 0x00, 0x00, + /* '|' */ 1, 11, 0, 9, 2, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + /* '}' */ 5, 11, 0, 9, 6, + 0xc0, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0xc0, 0x00, 0x00, + /* '~' */ 6, 11, 0, 9, 7, + 0x64, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +struct GP_FontFace GP_DefaultProportionalFont = { + .family_name = "Gfxprim", + .style_name = "Proportional", + .charset = GP_CHARSET_7BIT, + .ascend = 9, + .descend = 2, + .max_glyph_width = 9, + .max_glyph_advance = 9, + .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, + .glyphs = default_proportional_glyphs, + .glyph_offsets = {16}, +}; commit 112167d6829f8dd4d26491ff63e0a8c4887061df Author: Cyril Hrubis <metan(a)ucw.cz> Date: Sat, 23 Sep 2017 10:54:22 +0200 URL: <
http://repo.or.cz/gfxprim.git/112167d6829f8dd4
> Rename GP_Context -> GP_Pixmap This should have been done long long time ago. Signed-off-by: Cyril Hrubis <metan(a)ucw.cz> --- build/syms/Backend_symbols.txt | 2 +- build/syms/Core_symbols.txt | 26 +- demos/bogoman/bogoman.c | 14 +- demos/bogoman/bogoman_render.c | 98 +++--- demos/bogoman/bogoman_render.h | 6 +- demos/c_simple/SDL_glue.c | 18 +- demos/c_simple/backend_example.c | 12 +- demos/c_simple/backend_timers_example.c | 6 +- demos/c_simple/blittest.c | 32 +- demos/c_simple/convolution.c | 2 +- demos/c_simple/debug_handler.c | 6 +- demos/c_simple/fileview.c | 16 +- demos/c_simple/filters_symmetry.c | 6 +- demos/c_simple/fonttest.c | 26 +- demos/c_simple/gaussian_noise.c | 4 +- demos/c_simple/gfx_koch.c | 12 +- demos/c_simple/input_example.c | 12 +- demos/c_simple/koch.c | 36 +- demos/c_simple/linetest.c | 22 +- demos/c_simple/loaders.c | 2 +- demos/c_simple/loaders_example.c | 2 +- demos/c_simple/loaders_register.c | 4 +- demos/c_simple/memory_io.c | 6 +- demos/c_simple/pretty_print.c | 8 +- demos/c_simple/randomshapetest.c | 58 ++-- demos/c_simple/shapetest.c | 40 +-- demos/c_simple/showimage.c | 12 +- demos/c_simple/sin_AA.c | 24 +- demos/c_simple/textaligntest.c | 42 +-- demos/c_simple/v4l2_show.c | 12 +- demos/c_simple/virtual_backend_example.c | 42 +-- demos/c_simple/weighted_median.c | 4 +- demos/c_simple/x11_windows.c | 18 +- demos/c_simple/zip_container.c | 14 +- demos/grinder/grinder.c | 78 ++--- demos/grinder/histogram.c | 6 +- demos/grinder/histogram.h | 2 +- demos/particle/particle_demo.c | 18 +- demos/particle/space.c | 42 +-- demos/particle/space.h | 2 +- demos/py_simple/backends.py | 2 +- demos/py_simple/blit.py | 8 +- demos/py_simple/cam_view.py | 2 +- demos/py_simple/font_style.py | 2 +- demos/py_simple/gfx.py | 78 ++--- demos/py_simple/gravplots_AA.py | 16 +- demos/py_simple/showimage.py | 2 +- demos/py_simple/sinplots_AA.py | 10 +- demos/py_simple/x11_windows.py | 2 +- demos/spiv/image_cache.c | 32 +- demos/spiv/image_cache.h | 8 +- demos/spiv/image_loader.c | 10 +- demos/spiv/image_loader.h | 4 +- demos/spiv/spiv.c | 134 ++++---- demos/spiv/spiv_help.c | 6 +- demos/ttf2img/ttf2img.c | 14 +- doc/Makefile | 2 +- doc/about.txt | 2 +- doc/backends.txt | 20 +- doc/backends_python.txt | 4 +- doc/blits.txt | 24 +- doc/coding_style.txt | 8 +- doc/context.txt | 309 ------------------ doc/convert.txt | 8 +- doc/core.txt | 6 +- doc/core_python.txt | 34 +- doc/debug.txt | 2 +- doc/environment_variables.txt | 6 +- doc/example_SDL_glue.txt | 2 +- doc/filters.txt | 218 ++++++------ doc/filters_dithering.txt | 16 +- doc/filters_resize.txt | 28 +- doc/gamma.txt | 2 +- doc/get_put_pixel.txt | 22 +- doc/gfx.txt | 56 ++-- doc/gfx_python.txt | 48 +-- doc/grabbers.txt | 4 +- doc/images/regen.py | 8 +- doc/loaders.txt | 200 ++++++------ doc/loaders_python.txt | 2 +- doc/text.txt | 6 +- include/backends/GP_Backend.h | 14 +- .../{GP_SDL_Context.h => GP_SDL_Pixmap.h} | 18 +- include/core/GP_Blit.h | 36 +- include/core/GP_Convert.gen.h.t | 2 +- include/core/GP_Convert.h | 26 +- include/core/GP_Core.h | 4 +- include/core/GP_Debug.h | 2 +- include/core/GP_Fill.h | 4 +- include/core/GP_FnPerBpp.h | 20 +- include/core/GP_Gamma.h | 4 +- include/core/GP_GammaCorrection.h | 2 +- include/core/GP_GammaPixel.gen.h.t | 2 +- include/core/GP_GetPutPixel.gen.h.t | 16 +- include/core/GP_GetPutPixel.h | 36 +- include/core/GP_MixPixels.gen.h.t | 26 +- include/core/GP_Pixel.gen.h.t | 4 +- include/core/GP_Pixel.h | 4 +- include/core/{GP_Context.h => GP_Pixmap.h} | 136 ++++---- include/core/GP_Transform.h | 90 ++--- include/filters/GP_ApplyTables.h | 10 +- include/filters/GP_Arithmetic.h | 50 +-- include/filters/GP_Blur.h | 10 +- include/filters/GP_Convolution.h | 12 +- include/filters/GP_Dither.h | 12 +- include/filters/GP_EdgeDetection.h | 8 +- include/filters/GP_Filter.h | 2 +- include/filters/GP_Filters.h | 2 +- include/filters/GP_GaussianNoise.h | 14 +- include/filters/GP_Laplace.h | 8 +- include/filters/GP_Linear.h | 22 +- include/filters/GP_Median.h | 12 +- include/filters/GP_MultiTone.h | 12 +- include/filters/GP_Point.h | 56 ++-- include/filters/GP_Resize.h | 8 +- include/filters/GP_ResizeCubic.h | 8 +- include/filters/GP_ResizeLinear.h | 8 +- include/filters/GP_ResizeNN.h | 4 +- include/filters/GP_Rotate.h | 38 +-- include/filters/GP_Sepia.h | 12 +- include/filters/GP_Sigma.h | 12 +- include/filters/GP_Stats.h | 2 +- include/filters/GP_WeightedMedian.h | 12 +- include/gfx/GP_Arc.h | 6 +- include/gfx/GP_Circle.h | 18 +- include/gfx/GP_CircleSeg.h | 10 +- include/gfx/GP_Ellipse.h | 10 +- include/gfx/GP_Gfx.h | 2 +- include/gfx/GP_HLine.gen.h.t | 2 +- include/gfx/GP_HLine.h | 18 +- include/gfx/GP_HLineAA.h | 10 +- include/gfx/GP_Line.h | 6 +- include/gfx/GP_LineAA.h | 10 +- include/gfx/GP_Polygon.h | 10 +- include/gfx/GP_PutPixelAA.h | 14 +- include/gfx/GP_Rect.h | 34 +- include/gfx/GP_Tetragon.h | 10 +- include/gfx/GP_Triangle.h | 10 +- include/gfx/GP_VLine.gen.h.t | 2 +- include/gfx/GP_VLine.h | 18 +- include/gfx/GP_VLineAA.h | 10 +- include/grabbers/GP_Grabber.h | 6 +- include/loaders/GP_BMP.h | 12 +- include/loaders/GP_Container.h | 14 +- include/loaders/GP_GIF.h | 6 +- include/loaders/GP_JP2.h | 8 +- include/loaders/GP_JPG.h | 12 +- include/loaders/GP_Loader.h | 30 +- include/loaders/GP_Loaders.h | 2 +- include/loaders/GP_PCX.h | 8 +- include/loaders/GP_PNG.h | 14 +- include/loaders/GP_PNM.h | 32 +- include/loaders/GP_PSD.h | 8 +- include/loaders/GP_PSP.h | 10 +- include/loaders/GP_TIFF.h | 12 +- include/loaders/GP_ZIP.h | 2 +- include/text/GP_Text.h | 20 +- libs/backends/GP_AALib.c | 14 +- libs/backends/GP_Backend.c | 14 +- libs/backends/GP_BackendVirtual.c | 30 +- libs/backends/GP_LinuxFB.c | 40 +-- libs/backends/GP_SDL.c | 38 +-- libs/backends/GP_X11.c | 46 +-- libs/backends/GP_X11_Win.h | 2 +- libs/core/GP_Blit.c | 66 ++-- libs/core/GP_Blit.gen.c.t | 38 +-- libs/core/GP_Context.c | 220 ++++++------- libs/core/GP_Fill.gen.c.t | 8 +- libs/core/GP_GetPutPixel.c | 16 +- libs/filters/GP_ApplyTables.c | 10 +- libs/filters/GP_ApplyTables.gen.c.t | 10 +- libs/filters/GP_Blur.c | 16 +- libs/filters/GP_Convolution.c | 10 +- libs/filters/GP_Edge.c | 30 +- libs/filters/GP_FloydSteinberg.gen.c.t | 16 +- libs/filters/GP_GaussianNoise.gen.c.t | 20 +- libs/filters/GP_HilbertPeano.gen.c.t | 16 +- libs/filters/GP_Histogram.gen.c.t | 8 +- libs/filters/GP_Laplace.c | 16 +- libs/filters/GP_LinearConvolution.c | 6 +- libs/filters/GP_LinearConvolution.gen.c.t | 26 +- libs/filters/GP_Median.c | 16 +- libs/filters/GP_MirrorH.gen.c.t | 18 +- libs/filters/GP_MultiTone.gen.c.t | 18 +- libs/filters/GP_Resize.c | 12 +- libs/filters/GP_ResizeCubic.gen.c.t | 10 +- libs/filters/GP_ResizeCubicFloat.c | 4 +- libs/filters/GP_ResizeLinear.gen.c.t | 14 +- libs/filters/GP_ResizeNN.gen.c.t | 8 +- libs/filters/GP_Rotate.c | 16 +- libs/filters/GP_Rotate.gen.c.t | 48 +-- libs/filters/GP_Sepia.c | 6 +- libs/filters/GP_Sigma.c | 16 +- libs/filters/GP_WeightedMedian.c | 16 +- libs/filters/arithmetic_filter.t | 22 +- libs/filters/point_filter.t | 10 +- libs/gfx/GP_Arc.c | 16 +- libs/gfx/GP_Circle.c | 42 +-- libs/gfx/GP_CircleSeg.c | 38 +-- libs/gfx/GP_Ellipse.c | 16 +- libs/gfx/GP_FillCircle.gen.c.t | 22 +- libs/gfx/GP_FillEllipse.gen.c.t | 24 +- libs/gfx/GP_HLine.c | 36 +- libs/gfx/GP_HLine.gen.c.t | 10 +- libs/gfx/GP_HLineAA.c | 28 +- libs/gfx/GP_HLineAA.gen.c.t | 16 +- libs/gfx/GP_Line.gen.c.t | 38 +-- libs/gfx/GP_LineAA.c | 16 +- libs/gfx/GP_LineAA.gen.c.t | 40 +-- libs/gfx/GP_PartialEllipse.c | 16 +- libs/gfx/GP_Polygon.c | 24 +- libs/gfx/GP_PutPixelAA.gen.c.t | 22 +- libs/gfx/GP_Rect.c | 54 +-- libs/gfx/GP_Tetragon.c | 44 +-- libs/gfx/GP_Triangle.c | 36 +- libs/gfx/GP_VLine.c | 42 +-- libs/gfx/GP_VLine.gen.c.t | 4 +- libs/gfx/GP_VLineAA.c | 28 +- libs/gfx/GP_VLineAA.gen.c.t | 16 +- libs/gfx/algo/Arc.algo.h | 24 +- libs/gfx/algo/Circle.algo.h | 26 +- libs/gfx/algo/CircleSeg.algo.h | 26 +- libs/gfx/algo/Ellipse.algo.h | 28 +- libs/gfx/algo/FillRing.algo.h | 20 +- libs/gfx/algo/FillTriangle.algo.h | 10 +- libs/gfx/algo/PartialEllipse.algo.h | 16 +- libs/grabbers/GP_V4L2.c | 8 +- libs/loaders/GP_BMP.c | 48 +-- libs/loaders/GP_BMP_RLE.h | 12 +- libs/loaders/GP_Container.c | 2 +- libs/loaders/GP_GIF.c | 16 +- libs/loaders/GP_JP2.c | 14 +- libs/loaders/GP_JPG.c | 30 +- libs/loaders/GP_Loader.c | 28 +- libs/loaders/GP_PCX.c | 24 +- libs/loaders/GP_PNG.c | 26 +- libs/loaders/GP_PNM.c | 188 +++++------ libs/loaders/GP_PSD.c | 32 +- libs/loaders/GP_PSP.c | 10 +- libs/loaders/GP_TIFF.c | 30 +- libs/loaders/GP_ZIP.c | 12 +- libs/text/GP_Text.c | 22 +- libs/text/GP_Text.gen.c.t | 46 +-- pylib/gfxprim/__init__.py | 6 +- pylib/gfxprim/backends/__init__.py | 2 +- pylib/gfxprim/backends/_extend_backend.py | 2 +- pylib/gfxprim/core/__init__.py | 124 +++---- pylib/gfxprim/core/core.i | 86 ++--- pylib/gfxprim/filters/__init__.py | 12 +- pylib/gfxprim/gfx/__init__.py | 16 +- pylib/gfxprim/gfx/gfx.i | 8 +- pylib/gfxprim/loaders/__init__.py | 6 +- pylib/gfxprim/text/__init__.py | 12 +- tests/afl/loaders.c | 4 +- tests/core/.gitignore | 2 +- tests/core/BlitClipped.c | 14 +- tests/core/BlitConv.gen.c.t | 26 +- tests/core/GetPutPixel.gen.c.t | 28 +- tests/core/Makefile | 4 +- tests/core/{Context.c => Pixmap.c} | 142 ++++---- tests/core/runtest.sh | 2 +- tests/core/test_list.txt | 2 +- tests/drivers/framebuffer_test.c | 34 +- tests/filters/APICoverage.gen.c.t | 100 +++--- tests/filters/FilterMirrorH.c | 30 +- tests/filters/FiltersCompare.gen.c.t | 22 +- tests/filters/LinearConvolution.c | 10 +- tests/filters/common.c | 4 +- tests/filters/common.h | 6 +- tests/gfx/APICoverage.gen.c.t | 42 +-- tests/gfx/Circle.c | 8 +- tests/gfx/CircleSeg.c | 8 +- tests/gfx/Ellipse.c | 8 +- tests/gfx/FillCircle.c | 8 +- tests/gfx/FillEllipse.c | 8 +- tests/gfx/FillRect.c | 28 +- tests/gfx/HLine.c | 8 +- tests/gfx/HLineAA.c | 8 +- tests/gfx/Line.c | 8 +- tests/gfx/LineAA.c | 8 +- tests/gfx/Polygon.c | 8 +- tests/gfx/PutPixelAA.c | 8 +- tests/gfx/VLine.c | 8 +- tests/gfx/common.c | 4 +- tests/gfx/common.h | 6 +- tests/gfx/gfx_benchmark.c | 6 +- tests/loaders/GIF.c | 6 +- tests/loaders/JPG.c | 22 +- tests/loaders/Loader.h | 44 +-- tests/loaders/PBM.c | 2 +- tests/loaders/PCX.c | 12 +- tests/loaders/PGM.c | 2 +- tests/loaders/PNG.c | 28 +- tests/loaders/PNM.c | 2 +- tests/loaders/PPM.c | 2 +- tests/loaders/SaveAbort.gen.c.t | 12 +- tests/loaders/SaveLoad.gen.c.t | 18 +- tests/loaders/ZIP.c | 8 +- tests/loaders/loaders_suite.c | 44 +-- tests/pylib/test_core.py | 76 ++--- tests/pylib/test_gfx.py | 26 +- tests/pylib/testutils.py | 16 +- 302 files changed, 3254 insertions(+), 3563 deletions(-) delete mode 100644 doc/context.txt rename include/backends/{GP_SDL_Context.h => GP_SDL_Pixmap.h} (82%) rename include/core/{GP_Context.h => GP_Pixmap.h} (59%) rename tests/core/{Context.c => Pixmap.c} (60%) diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt index 4c830bf39987..24bbc8b6f2c6 100644 --- a/build/syms/Backend_symbols.txt +++ b/build/syms/Backend_symbols.txt @@ -9,7 +9,7 @@ GP_BackendIsX11 GP_BackendX11RequestFullscreen GP_BackendSDLInit -GP_ContextFromSDLSurface +GP_PixmapFromSDLSurface GP_BackendAALibInit diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt index 47acec59d1db..7ee4ff213aff 100644 --- a/build/syms/Core_symbols.txt +++ b/build/syms/Core_symbols.txt @@ -1,19 +1,19 @@ GP_PixelTypes GP_PixelHasFlags -GP_ContextAlloc -GP_ContextResize -GP_ContextConvertAlloc -GP_ContextPrintInfo -GP_ContextRotateCCW -GP_SubContextAlloc -GP_ContextConvert -GP_ContextRotateCW -GP_ContextFree -GP_ContextInit -GP_SubContext -GP_ContextCopy -GP_ContextEqual +GP_PixmapAlloc +GP_PixmapResize +GP_PixmapConvertAlloc +GP_PixmapPrintInfo +GP_PixmapRotateCCW +GP_SubPixmapAlloc +GP_PixmapConvert +GP_PixmapRotateCW +GP_PixmapFree +GP_PixmapInit +GP_SubPixmap +GP_PixmapCopy +GP_PixmapEqual GP_PixelAddrOffset GP_GammaRelease diff --git a/demos/bogoman/bogoman.c b/demos/bogoman/bogoman.c index 36402c845038..cd0def6c3a67 100644 --- a/demos/bogoman/bogoman.c +++ b/demos/bogoman/bogoman.c @@ -32,29 +32,29 @@ static void save_png(struct bogoman_map *map, unsigned int elem_size, const char *filename) { - GP_Context *ctx; + GP_Pixmap *pixmap; unsigned int rx, ry; rx = elem_size * map->w; ry = elem_size * map->h; - ctx = GP_ContextAlloc(rx, ry, GP_PIXEL_RGB888); + pixmap = GP_PixmapAlloc(rx, ry, GP_PIXEL_RGB888); - if (ctx == NULL) + if (pixmap == NULL) return; struct bogoman_render render = { .map = map, .map_x_offset = 0, .map_y_offset = 0, - .ctx = ctx, + .pixmap = pixmap, .map_elem_size = elem_size, }; bogoman_render(&render, BOGOMAN_RENDER_ALL); - GP_SavePNG(ctx, filename, NULL); - GP_ContextFree(ctx); + GP_SavePNG(pixmap, filename, NULL); + GP_PixmapFree(pixmap); } static struct GP_Backend *backend; @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) .map = map, .map_x_offset = 0, .map_y_offset = 0, - .ctx = backend->context, + .pixmap = backend->pixmap, .backend = backend, .map_elem_size = ELEM_SIZE, }; diff --git a/demos/bogoman/bogoman_render.c b/demos/bogoman/bogoman_render.c index bc47f7d22530..c045b541935b 100644 --- a/demos/bogoman/bogoman_render.c +++ b/demos/bogoman/bogoman_render.c @@ -56,17 +56,17 @@ struct render_colors { static struct render_colors colors; -static void init_colors(GP_Context *ctx, struct render_colors *colors) +static void init_colors(GP_Pixmap *pixmap, struct render_colors *colors) { - colors->bg = GP_RGBToContextPixel(0xee, 0xee, 0xee, ctx); - colors->player = GP_RGBToContextPixel(0x00, 0xee, 0x00, ctx); - colors->frames = GP_RGBToContextPixel(0x00, 0x00, 0x00, ctx); - colors->diamond = GP_RGBToContextPixel(0x00, 0x00, 0xee, ctx); - colors->wall = GP_RGBToContextPixel(0x66, 0x66, 0x66, ctx); - colors->moveable = GP_RGBToContextPixel(0xff, 0xff, 0x60, ctx); - colors->edible = GP_RGBToContextPixel(0xff, 0x7f, 0x50, ctx); - colors->particle = GP_RGBToContextPixel(0xff, 0xff, 0x00, ctx); - colors->particle_dir = GP_RGBToContextPixel(0xff, 0x44, 0x00, ctx); + colors->bg = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap); + colors->player = GP_RGBToPixmapPixel(0x00, 0xee, 0x00, pixmap); + colors->frames = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + colors->diamond = GP_RGBToPixmapPixel(0x00, 0x00, 0xee, pixmap); + colors->wall = GP_RGBToPixmapPixel(0x66, 0x66, 0x66, pixmap); + colors->moveable = GP_RGBToPixmapPixel(0xff, 0xff, 0x60, pixmap); + colors->edible = GP_RGBToPixmapPixel(0xff, 0x7f, 0x50, pixmap); + colors->particle = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, pixmap); + colors->particle_dir = GP_RGBToPixmapPixel(0xff, 0x44, 0x00, pixmap); } static void render_none(struct bogoman_render *render, @@ -77,7 +77,7 @@ static void render_none(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); } static void render_player(struct bogoman_render *render, @@ -88,10 +88,10 @@ static void render_player(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); - GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2 - 1, colors.player); - GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); + GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2 - 1, colors.player); + GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); } static void render_wall(struct bogoman_render *render, @@ -100,26 +100,26 @@ static void render_wall(struct bogoman_render *render, { unsigned int w = render->map_elem_size; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.wall); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.wall); if (!(elem->flags & BOGOMAN_LEFT)) { - GP_VLineXYH(render->ctx, x, y, w, colors.frames); - GP_VLineXYH(render->ctx, x+1, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x+1, y, w, colors.frames); } if (!(elem->flags & BOGOMAN_RIGHT)) { - GP_VLineXYH(render->ctx, x + w - 1, y, w, colors.frames); - GP_VLineXYH(render->ctx, x + w - 2, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x + w - 1, y, w, colors.frames); + GP_VLineXYH(render->pixmap, x + w - 2, y, w, colors.frames); } if (!(elem->flags & BOGOMAN_UP)) { - GP_HLineXYW(render->ctx, x, y, w, colors.frames); - GP_HLineXYW(render->ctx, x, y+1, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y+1, w, colors.frames); } if (!(elem->flags & BOGOMAN_DOWN)) { - GP_HLineXYW(render->ctx, x, y + w - 1, w, colors.frames); - GP_HLineXYW(render->ctx, x, y + w - 2, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y + w - 1, w, colors.frames); + GP_HLineXYW(render->pixmap, x, y + w - 2, w, colors.frames); } } @@ -129,16 +129,16 @@ static void render_diamond(struct bogoman_render *render, { unsigned int w = render->map_elem_size; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); (void) elem; - GP_FillTetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2, + GP_FillTetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2, x + w/2, y + w - 1, x, y + w/2, colors.diamond); - GP_Tetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2, + GP_Tetragon(render->pixmap, x + w/2, y, x + w - 1, y + w/2, x + w/2, y + w - 1, x, y + w/2, colors.frames); - GP_Tetragon(render->ctx, x + w/2, y+1, x + w - 2, y + w/2, + GP_Tetragon(render->pixmap, x + w/2, y+1, x + w - 2, y + w/2, x + w/2, y + w - 2, x+1, y + w/2, colors.frames); } @@ -150,11 +150,11 @@ static void render_moveable(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); - GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.moveable); - GP_RectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.frames); - GP_RectXYWH(render->ctx, x + 2, y + 2, w - 4, w - 4, colors.frames); + GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.moveable); + GP_RectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.frames); + GP_RectXYWH(render->pixmap, x + 2, y + 2, w - 4, w - 4, colors.frames); } static void render_edible(struct bogoman_render *render, @@ -165,9 +165,9 @@ static void render_edible(struct bogoman_render *render, (void) elem; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); - GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.edible); + GP_FillRectXYWH(render->pixmap, x + 1, y + 1, w - 2, w - 2, colors.edible); } static void render_particle(struct bogoman_render *render, @@ -177,43 +177,43 @@ static void render_particle(struct bogoman_render *render, unsigned int w = render->map_elem_size; int dir = elem->flags & BOGOMAN_DIRECTION_MASK; - GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); + GP_FillRectXYWH(render->pixmap, x, y, w, w, colors.bg); switch (elem->flags & ~BOGOMAN_DIRECTION_MASK) { case BOGOMAN_PARTICLE_ROUND: - GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2-1, colors.particle); - GP_FillRing(render->ctx, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); + GP_FillCircle(render->pixmap, x + w/2, y + w/2, w/2-1, colors.particle); + GP_FillRing(render->pixmap, x + w/2, y + w/2, w/2 - 1, w/2 - 2, colors.frames); break; case BOGOMAN_PARTICLE_SQUARE: - GP_FillRectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.particle); - GP_RectXYWH(render->ctx, x+1, y+1, w-2, w-2, colors.frames); - GP_RectXYWH(render->ctx, x+2, y+2, w-4, w-4, colors.frames); + GP_FillRectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.particle); + GP_RectXYWH(render->pixmap, x+1, y+1, w-2, w-2, colors.frames); + GP_RectXYWH(render->pixmap, x+2, y+2, w-4, w-4, colors.frames); break; } switch (dir) { case BOGOMAN_LEFT: - GP_FillTriangle(render->ctx, x + w/4, y + w/2, + GP_FillTriangle(render->pixmap, x + w/4, y + w/2, x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.particle_dir); - GP_Triangle(render->ctx, x + w/4, y + w/2, + GP_Triangle(render->pixmap, x + w/4, y + w/2, x + 5*w/8, y + w/4, x + 5*w/8, y + 3*w/4, colors.frames); break; case BOGOMAN_RIGHT: - GP_FillTriangle(render->ctx, x + 3*w/4, y + w/2, + GP_FillTriangle(render->pixmap, x + 3*w/4, y + w/2, x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.particle_dir); - GP_Triangle(render->ctx, x + 3*w/4, y + w/2, + GP_Triangle(render->pixmap, x + 3*w/4, y + w/2, x + 3*w/8, y + w/4, x + 3*w/8, y + 3*w/4, colors.frames); break; case BOGOMAN_UP: - GP_FillTriangle(render->ctx, x + w/2, y + w/4, + GP_FillTriangle(render->pixmap, x + w/2, y + w/4, x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.particle_dir); - GP_Triangle(render->ctx, x + w/2, y + w/4, + GP_Triangle(render->pixmap, x + w/2, y + w/4, x + w/4, y + 5*w/8, x + 3*w/4, y + 5*w/8, colors.frames); break; case BOGOMAN_DOWN: - GP_FillTriangle(render->ctx, x + w/2, y + 3*w/4, + GP_FillTriangle(render->pixmap, x + w/2, y + 3*w/4, x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.particle_dir); - GP_Triangle(render->ctx, x + w/2, y + 3*w/4, + GP_Triangle(render->pixmap, x + w/2, y + 3*w/4, x + w/4, y + 3*w/8, x + 3*w/4, y + 3*w/8, colors.frames); break; } @@ -268,10 +268,10 @@ void bogoman_render(struct bogoman_render *render, int flags) unsigned int x, y; //TODO: Hack - init_colors(render->ctx, &colors); + init_colors(render->pixmap, &colors); if (flags & BOGOMAN_RENDER_ALL) - GP_Fill(render->ctx, colors.bg); + GP_Fill(render->pixmap, colors.bg); for (y = render->map_x_offset; y < render->map->h; y++) { for (x = render->map_x_offset; x < render->map->w; x++) diff --git a/demos/bogoman/bogoman_render.h b/demos/bogoman/bogoman_render.h index e27744e2b064..38b7f0d59722 100644 --- a/demos/bogoman/bogoman_render.h +++ b/demos/bogoman/bogoman_render.h @@ -24,7 +24,7 @@ #define __BOGOMAN_RENDER_H__ struct bogoman_map; -struct GP_Context; +struct GP_Pixmap; struct bogoman_render { /* both in map elements */ @@ -34,8 +34,8 @@ struct bogoman_render { /* current map */ struct bogoman_map *map; - /* context to be used for rendering */ - struct GP_Context *ctx; + /* pixmap to be used for rendering */ + struct GP_Pixmap *pixmap; /* if not NULL is used to update screen */ struct GP_Backend *backend; diff --git a/demos/c_simple/SDL_glue.c b/demos/c_simple/SDL_glue.c index 8e9e2162db29..ef360e0b0e84 100644 --- a/demos/c_simple/SDL_glue.c +++ b/demos/c_simple/SDL_glue.c @@ -33,13 +33,13 @@ #include <stdlib.h> #include <SDL/SDL.h> #include <GP.h> -#include <backends/GP_SDL_Context.h> +#include <backends/GP_SDL_Pixmap.h> #define W 320 #define H 240 static SDL_Surface *display = NULL; -static GP_Context context; +static GP_Pixmap pixmap; static GP_Pixel black_pixel, darkgray_pixel; @@ -47,13 +47,13 @@ void redraw_screen(void) { SDL_LockSurface(display); - GP_Fill(&context, black_pixel); + GP_Fill(&pixmap, black_pixel); - GP_Text(&context, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW, + GP_Text(&pixmap, NULL, W/2, 20, GP_ALIGN_CENTER | GP_VALIGN_BELOW, darkgray_pixel, black_pixel, "GFXprim SDL Demo"); - GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel); - GP_Line(&context, 0, H-1, W-1, 0, darkgray_pixel); + GP_Line(&pixmap, 0, 0, W-1, H-1, darkgray_pixel); + GP_Line(&pixmap, 0, H-1, W-1, 0, darkgray_pixel); SDL_UnlockSurface(display); } @@ -100,10 +100,10 @@ int main(void) return 1; } - GP_ContextFromSDLSurface(&context, display); + GP_PixmapFromSDLSurface(&pixmap, display); - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, &context); - darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, &context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, &pixmap); + darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, &pixmap); redraw_screen(); SDL_Flip(display); diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c index 5e87ff18f178..6c8288347871 100644 --- a/demos/c_simple/backend_example.c +++ b/demos/c_simple/backend_example.c @@ -31,15 +31,15 @@ static void redraw(GP_Backend *self) { - GP_Context *context = self->context; + GP_Pixmap *pixmap = self->pixmap; GP_Pixel white_pixel, black_pixel; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, black_pixel); - GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel); - GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel); + GP_Fill(pixmap, black_pixel); + GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel); + GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel); /* Update the backend screen */ GP_BackendFlip(self); diff --git a/demos/c_simple/backend_timers_example.c b/demos/c_simple/backend_timers_example.c index 7b7aae2a06fd..16912fb592df 100644 --- a/demos/c_simple/backend_timers_example.c +++ b/demos/c_simple/backend_timers_example.c @@ -31,10 +31,10 @@ static void redraw(GP_Backend *self) { - GP_Context *context = self->context; - GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); + GP_Pixmap *pixmap = self->pixmap; + GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); - GP_Fill(context, black_pixel); + GP_Fill(pixmap, black_pixel); /* Update the backend screen */ GP_BackendFlip(self); diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c index 362ef8b09cc2..c12c8fe70b35 100644 --- a/demos/c_simple/blittest.c +++ b/demos/c_simple/blittest.c @@ -31,7 +31,7 @@ static GP_Pixel white; static GP_Backend *win; -static GP_Context *bitmap, *bitmap_raw, *bitmap_conv; +static GP_Pixmap *bitmap, *bitmap_raw, *bitmap_conv; static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3; static int pause_flag = 0; @@ -42,7 +42,7 @@ void redraw_screen(void) bitmap_x += bitmap_vx; bitmap_y += bitmap_vy; - if (bitmap_x + GP_ContextW(bitmap) > win->context->w) { + if (bitmap_x + GP_PixmapW(bitmap) > win->pixmap->w) { bitmap_vx = -bitmap_vx; bitmap_x += bitmap_vx; } @@ -52,7 +52,7 @@ void redraw_screen(void) bitmap_x += bitmap_vx; } - if (bitmap_y + GP_ContextH(bitmap) > win->context->h) { + if (bitmap_y + GP_PixmapH(bitmap) > win->pixmap->h) { bitmap_vy = -bitmap_vy; bitmap_y += bitmap_vy; } @@ -62,20 +62,20 @@ void redraw_screen(void) bitmap_y += bitmap_vy; } - GP_FillRectXYWH(win->context, 20, 20, 300, 50, black); + GP_FillRectXYWH(win->pixmap, 20, 20, 300, 50, black); - GP_Text(win->context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + GP_Text(win->pixmap, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, text_buf); - GP_Print(win->context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + GP_Print(win->pixmap, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ', bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' '); - GP_Blit(bitmap, 0, 0, GP_ContextW(bitmap), GP_ContextH(bitmap), - win->context, bitmap_x, bitmap_y); + GP_Blit(bitmap, 0, 0, GP_PixmapW(bitmap), GP_PixmapH(bitmap), + win->pixmap, bitmap_x, bitmap_y); GP_BackendUpdateRectXYWH(win, bitmap_x, bitmap_y, - GP_ContextW(bitmap), GP_ContextH(bitmap)); + GP_PixmapW(bitmap), GP_PixmapH(bitmap)); GP_BackendUpdateRectXYWH(win, 20, 20, 400, 50); } @@ -88,7 +88,7 @@ static void change_bitmap(void) snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'", GP_PixelTypeName(bitmap->pixel_type), - GP_PixelTypeName(win->context->pixel_type)); + GP_PixelTypeName(win->pixmap->pixel_type)); } void event_loop(void) @@ -133,7 +133,7 @@ void event_loop(void) break; case GP_EV_SYS_RESIZE: GP_BackendResizeAck(win); - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); GP_BackendFlip(win); break; } @@ -175,14 +175,14 @@ int main(void) return 1; } - bitmap_conv = GP_ContextConvertAlloc(bitmap_raw, - win->context->pixel_type); + bitmap_conv = GP_PixmapConvertAlloc(bitmap_raw, + win->pixmap->pixel_type); change_bitmap(); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); GP_BackendFlip(win); for (;;) { diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c index 213baf8ecc68..7d26f17563f2 100644 --- a/demos/c_simple/convolution.c +++ b/demos/c_simple/convolution.c @@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; struct callback_priv priv; GP_ProgressCallback callback = {.callback = progress_callback, .priv = &priv}; diff --git a/demos/c_simple/debug_handler.c b/demos/c_simple/debug_handler.c index 1744b0498ec1..5c472fd61e4f 100644 --- a/demos/c_simple/debug_handler.c +++ b/demos/c_simple/debug_handler.c @@ -65,11 +65,11 @@ int main(void) /* Turn on verbose debug and call some library functions */ GP_SetDebugLevel(10); - GP_Context *ctx = GP_ContextAlloc(1000, 1000, 1); + GP_Pixmap *pixmap = GP_PixmapAlloc(1000, 1000, 1); - GP_FilterGaussianBlur(ctx, ctx, 10, 10, NULL); + GP_FilterGaussianBlur(pixmap, pixmap, 10, 10, NULL); - GP_ContextFree(ctx); + GP_PixmapFree(pixmap); return 0; } diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c index e33a74a33338..d5c870b65f8c 100644 --- a/demos/c_simple/fileview.c +++ b/demos/c_simple/fileview.c @@ -29,7 +29,7 @@ #include <GP.h> -static GP_Context *win; +static GP_Pixmap *win; static GP_Backend *backend; static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel, @@ -266,14 +266,14 @@ int main(int argc, char *argv[]) return 1; } - win = backend->context; + win = backend->pixmap; - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win); - gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win); - dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win); - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win); + gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win); + dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win); redraw_screen(); GP_BackendFlip(backend); diff --git a/demos/c_simple/filters_symmetry.c b/demos/c_simple/filters_symmetry.c index 735be56668ec..926445354f9a 100644 --- a/demos/c_simple/filters_symmetry.c +++ b/demos/c_simple/filters_symmetry.c @@ -48,7 +48,7 @@ static void usage_and_exit(int ret) int main(int argc, char *argv[]) { - GP_Context *src, *res; + GP_Pixmap *src, *res; const char *symmetry = NULL; int opt, sym, debug = 0; @@ -109,8 +109,8 @@ int main(int argc, char *argv[]) } /* Cleanup */ - GP_ContextFree(src); - GP_ContextFree(res); + GP_PixmapFree(src); + GP_PixmapFree(res); return 0; } diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c index 7d6a7ca073b8..e2e5dd6c2b82 100644 --- a/demos/c_simple/fonttest.c +++ b/demos/c_simple/fonttest.c @@ -101,7 +101,7 @@ static void print_font_properties(const GP_FontFace *font) void redraw_screen(void) { - GP_Fill(win->context, black_pixel); + GP_Fill(win->pixmap, black_pixel); GP_TextStyle style = GP_DEFAULT_TEXT_STYLE; @@ -144,29 +144,29 @@ void redraw_screen(void) style.pixel_yspace = 0; style.char_xspace = tracking; - GP_FillRectXYWH(win->context, + GP_FillRectXYWH(win->pixmap, 16, SPACING*i + 16, GP_TextWidth(&style, test_string), GP_FontHeight(style.font), dark_gray_pixel); - GP_RectXYWH(win->context, + GP_RectXYWH(win->pixmap, 15, SPACING*i + 15, GP_TextMaxWidth(&style, strlen(test_string)) + 1, GP_FontHeight(style.font) + 1, blue_pixel); - GP_Text(win->context, &style, 16, SPACING*i + 16, align, + GP_Text(win->pixmap, &style, 16, SPACING*i + 16, align, white_pixel, dark_gray_pixel, test_string); style.pixel_xmul = 2; style.pixel_ymul = 2; style.pixel_yspace = 1; - GP_Text(win->context, &style, 34, SPACING * i + 44, align, + GP_Text(win->pixmap, &style, 34, SPACING * i + 44, align, white_pixel, black_pixel, test_string); - GP_RectXYWH(win->context, 33, SPACING * i + 43, + GP_RectXYWH(win->pixmap, 33, SPACING * i + 43, GP_TextWidth(&style, test_string) + 1, GP_TextHeight(&style) + 1, dark_gray_pixel); @@ -184,7 +184,7 @@ void redraw_screen(void) style.pixel_yspace = 2; } - GP_Text(win->context, &style, 64, SPACING*i + 88, align, + GP_Text(win->pixmap, &style, 64, SPACING*i + 88, align, dark_gray_pixel, black_pixel, test_string); } } @@ -287,12 +287,12 @@ int main(int argc, char *argv[]) return 1; } - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - gray_pixel = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win->context); - dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context); - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + gray_pixel = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win->pixmap); + dark_gray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap); redraw_screen(); GP_BackendFlip(win); diff --git a/demos/c_simple/gaussian_noise.c b/demos/c_simple/gaussian_noise.c index 21425ce0bb79..8c0cb152ebc9 100644 --- a/demos/c_simple/gaussian_noise.c +++ b/demos/c_simple/gaussian_noise.c @@ -42,7 +42,7 @@ static void help(const char *app) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; float sigma = 0.1, mu = 0.1; int opt; @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) return 1; } - GP_Context *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL); + GP_Pixmap *res = GP_FilterGaussianNoiseAddAlloc(img, sigma, mu, NULL); if (GP_SaveImage(res, argv[optind + 1], NULL)) { fprintf(stderr, "Failed to save image '%s': %s", diff --git a/demos/c_simple/gfx_koch.c b/demos/c_simple/gfx_koch.c index c188f3adde71..615f2345ce9e 100644 --- a/demos/c_simple/gfx_koch.c +++ b/demos/c_simple/gfx_koch.c @@ -38,7 +38,7 @@ static int aa_flag = 0; /* * Generate color depending on distance from center * - * We could do this only and only because the context + * We could do this only and only because the pixmap * pixel type is fixed to GP_PIXEL_RGB888. */ static GP_Pixel do_color(int xc, int yc, float x, float y) @@ -66,7 +66,7 @@ static GP_Pixel do_color(int xc, int yc, float x, float y) return bmask | (gmask<<8) | (rmask << 16); } -static void draw(GP_Context *img, int level, float x0, float y0, float x1, float y1) +static void draw(GP_Pixmap *img, int level, float x0, float y0, float x1, float y1) { if (level == 0) { GP_Pixel pixel; @@ -106,13 +106,13 @@ static void draw(GP_Context *img, int level, float x0, float y0, float x1, float int main(void) { - GP_Context *img; + GP_Pixmap *img; /* Create RGB 24 bit image */ - img = GP_ContextAlloc(600, 600, GP_PIXEL_RGB888); + img = GP_PixmapAlloc(600, 600, GP_PIXEL_RGB888); if (img == NULL) { - fprintf(stderr, "Failed to allocate context"); + fprintf(stderr, "Failed to allocate pixmap"); return 1; } @@ -129,7 +129,7 @@ int main(void) } /* Cleanup */ - GP_ContextFree(img); + GP_PixmapFree(img); return 0; } diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c index 3a294d23e1f8..5ac76d302a1f 100644 --- a/demos/c_simple/input_example.c +++ b/demos/c_simple/input_example.c @@ -29,7 +29,7 @@ #include "GP.h" -static GP_Context *win; +static GP_Pixmap *win; static GP_Backend *backend; static GP_Pixel red, green, white, black; @@ -148,12 +148,12 @@ int main(int argc, char *argv[]) return 1; } - win = backend->context; + win = backend->pixmap; - red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win); - green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win); - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win); + red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win); + green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win); GP_Fill(win, black); GP_BackendFlip(backend); diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c index 27ce6744f8b0..b5558c06f9ab 100644 --- a/demos/c_simple/koch.c +++ b/demos/c_simple/koch.c @@ -40,7 +40,7 @@ #define sgn(x) ((x)>0 ? 1 : -1) static GP_Backend *backend; -static GP_Context *context; +static GP_Pixmap *pixmap; static int iter, l, way = 1, draw_edge = 1; static GP_Pixel black, blue, gray, red; @@ -49,11 +49,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) { double x2, y2, x3, y3, x5, y5; GP_Pixel pixel; - pixel = GP_RGBToPixel(0, 0, 255-16*iter, context->pixel_type); + pixel = GP_RGBToPixel(0, 0, 255-16*iter, pixmap->pixel_type); if (iter <= 0) { if (draw_edge) - GP_Line(context, x1, y1, x4, y4, black); + GP_Line(pixmap, x1, y1, x4, y4, black); return; } @@ -66,11 +66,11 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) x5 = (x1+x4)/2 + (y2 - y3)*sqrt(3.00/4); y5 = (y1+y4)/2 + (x3 - x2)*sqrt(3.00/4); - GP_FillTriangle(context, x2, y2, x3, y3, x5, y5, pixel); + GP_FillTriangle(pixmap, x2, y2, x3, y3, x5, y5, pixel); - GP_PutPixel(context, x2, y2, red); - GP_PutPixel(context, x3, y3, red); - GP_PutPixel(context, x5, y5, red); + GP_PutPixel(pixmap, x2, y2, red); + GP_PutPixel(pixmap, x3, y3, red); + GP_PutPixel(pixmap, x5, y5, red); sierpinsky(x1, y1, x2, y2, iter - 1); sierpinsky(x2, y2, x5, y5, iter - 1); @@ -81,8 +81,8 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) static void draw(int x, int y, int l, int iter) { double x1, y1, x2, y2, x3, y3; - int w = context->w; - int h = context->h; + int w = pixmap->w; + int h = pixmap->h; l = ((w < h ? w : h) - 20)/(5 - 1.00*iter/120); @@ -95,9 +95,9 @@ static void draw(int x, int y, int l, int iter) x3 = sin(1.00 * (iter+240)/57) * l + x; y3 = cos(1.00 * (iter+240)/57) * l + y; - GP_Fill(context, gray); + GP_Fill(pixmap, gray); - GP_FillTriangle(context, x1, y1, x2, y2, x3, y3, blue); + GP_FillTriangle(pixmap, x1, y1, x2, y2, x3, y3, blue); sierpinsky(x1, y1, x2, y2, iter/60%6); sierpinsky(x2, y2, x3, y3, iter/60%6); @@ -121,7 +121,7 @@ void redraw(void) if (iter < 0) way *= -1; - draw(context->w/2, context->h/2, l, iter); + draw(pixmap->w/2, pixmap->h/2, l, iter); } int main(void) @@ -136,15 +136,15 @@ int main(void) return 1; } - context = backend->context; + pixmap = backend->pixmap; - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - blue = GP_RGBToContextPixel(0x00, 0x00, 0xff, context); - gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, context); - red = GP_RGBToContextPixel(0xff, 0x00, 0x00, context); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + blue = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap); + gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, pixmap); + red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap); iter = 0; - draw(context->w/2, context->h/2, l, iter); + draw(pixmap->w/2, pixmap->h/2, l, iter); for (;;) { GP_Event ev; diff --git a/demos/c_simple/linetest.c b/demos/c_simple/linetest.c index 19a0244dc932..7e535df94a61 100644 --- a/demos/c_simple/linetest.c +++ b/demos/c_simple/linetest.c @@ -41,12 +41,12 @@ void redraw_screen(void) { double angle; int x, y; - int w = win->context->w; - int h = win->context->h; + int w = win->pixmap->w; + int h = win->pixmap->h; int xcenter = w/2; int ycenter = h/2; - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); for (angle = 0.0; angle < 2*M_PI; angle += 0.1) { x = (int) (w/2 * cos(start_angle + angle)); @@ -56,22 +56,22 @@ void redraw_screen(void) int b = 127.0 + 127.0 * sin(start_angle + angle); GP_Pixel pixel; - pixel = GP_RGBToPixel(r, 0, b, win->context->pixel_type); + pixel = GP_RGBToPixel(r, 0, b, win->pixmap->pixel_type); if (aa_flag) { - GP_LineAA_Raw(win->context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter), + GP_LineAA_Raw(win->pixmap, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter), GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel); } else { - GP_Line(win->context, xcenter + x, ycenter + y, xcenter, ycenter, pixel); - GP_Line(win->context, xcenter, ycenter, xcenter + x, ycenter + y, pixel); + GP_Line(win->pixmap, xcenter + x, ycenter + y, xcenter, ycenter, pixel); + GP_Line(win->pixmap, xcenter, ycenter, xcenter + x, ycenter + y, pixel); } } GP_BackendFlip(win); /* axes */ -// GP_HLineXYW(&context, 0, ycenter, display->w, white); -// GP_VLineXYH(&context, xcenter, 0, display->h, white); +// GP_HLineXYW(&pixmap, 0, ycenter, display->w, white); +// GP_VLineXYH(&pixmap, xcenter, 0, display->h, white); } void event_loop(void) @@ -135,8 +135,8 @@ int main(int argc, char *argv[]) return 1; } - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); redraw_screen(); diff --git a/demos/c_simple/loaders.c b/demos/c_simple/loaders.c index 369ec488c149..e9a3a306c1c3 100644 --- a/demos/c_simple/loaders.c +++ b/demos/c_simple/loaders.c @@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; struct callback_priv priv; GP_ProgressCallback callback = {.callback = progress_callback, .priv = &priv}; diff --git a/demos/c_simple/loaders_example.c b/demos/c_simple/loaders_example.c index 9c0a65ad4c94..b240aea952aa 100644 --- a/demos/c_simple/loaders_example.c +++ b/demos/c_simple/loaders_example.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; /* Turn on debug messages */ GP_SetDebugLevel(10); diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c index 5152d6b56e0b..4279c51f1014 100644 --- a/demos/c_simple/loaders_register.c +++ b/demos/c_simple/loaders_register.c @@ -37,7 +37,7 @@ /* * Saves 2 bpp grayscale image as ASCII Art */ -static int write_data(const GP_Context *img, GP_IO *io, +static int write_data(const GP_Pixmap *img, GP_IO *io, GP_ProgressCallback *callback) { GP_IO *bio; @@ -106,7 +106,7 @@ GP_Loader loader = { int main(int argc, char *argv[]) { - GP_Context *c, *gc; + GP_Pixmap *c, *gc; GP_LoaderRegister(&loader); diff --git a/demos/c_simple/memory_io.c b/demos/c_simple/memory_io.c index 873b27c7f420..57d09174473f 100644 --- a/demos/c_simple/memory_io.c +++ b/demos/c_simple/memory_io.c @@ -56,7 +56,7 @@ static char pgm[] = { int main(void) { GP_Backend *b; - GP_Context *img; + GP_Pixmap *img; GP_IO *io; io = GP_IOMem(pgm, sizeof(pgm), NULL); @@ -81,8 +81,8 @@ int main(void) return 1; } - GP_Fill(b->context, 0); - GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->context, + GP_Fill(b->pixmap, 0); + GP_Blit_Clipped(img, 0, 0, img->w, img->h, b->pixmap, (WIN_W - img->w)/2, (WIN_H - img->h)/2); GP_BackendFlip(b); diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c index 82e9d084c918..ddd79bbacd25 100644 --- a/demos/c_simple/pretty_print.c +++ b/demos/c_simple/pretty_print.c @@ -22,7 +22,7 @@ /* - Pretty print function for pixel and context. + Pretty print function for pixel and pixmap. */ @@ -30,14 +30,14 @@ int main(void) { - GP_Context *ctx = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888); + GP_Pixmap *pixmap = GP_PixmapAlloc(100, 100, GP_PIXEL_RGB888); GP_Pixel pix = ~(GP_Pixel)0; /* Pretty prints pixel values */ GP_PixelPrint(pix, GP_PIXEL_RGB888); - /* Pretty prints context info */ - GP_ContextPrintInfo(ctx); + /* Pretty prints pixmap info */ + GP_PixmapPrintInfo(pixmap); return 0; } diff --git a/demos/c_simple/randomshapetest.c b/demos/c_simple/randomshapetest.c index 6b970f0b5dae..766b48e5ee92 100644 --- a/demos/c_simple/randomshapetest.c +++ b/demos/c_simple/randomshapetest.c @@ -56,7 +56,7 @@ static int fill_flag = 1; /* Do a clipping test? */ static int cliptest_flag = 0; -void random_point(const GP_Context *c, int *x, int *y) +void random_point(const GP_Pixmap *c, int *x, int *y) { if (cliptest_flag) { *x = random() % (3*c->w) - c->w; @@ -67,7 +67,7 @@ void random_point(const GP_Context *c, int *x, int *y) } } -void random_point_AA(const GP_Context *c, int *x, int *y) +void random_point_AA(const GP_Pixmap *c, int *x, int *y) { *x = random() % (c->w<<8); *y = random() % (c->h<<8); @@ -76,70 +76,70 @@ void random_point_AA(const GP_Context *c, int *x, int *y) void draw_random_circle(GP_Pixel pixel) { int x, y; - random_point(win->context, &x, &y); + random_point(win->pixmap, &x, &y); int r = random() % 50; if (fill_flag) - GP_FillCircle(win->context, x, y, r, pixel); + GP_FillCircle(win->pixmap, x, y, r, pixel); if (outline_flag) - GP_Circle(win->context, x, y, r, white); + GP_Circle(win->pixmap, x, y, r, white); } void draw_random_ellipse(GP_Pixel pixel) { int x, y; - random_point(win->context, &x, &y); + random_point(win->pixmap, &x, &y); int rx = random() % 50; int ry = random() % 50; if (fill_flag) - GP_FillEllipse(win->context, x, y, rx, ry, pixel); + GP_FillEllipse(win->pixmap, x, y, rx, ry, pixel); if (outline_flag) - GP_Ellipse(win->context, x, y, rx, ry, white); + GP_Ellipse(win->pixmap, x, y, rx, ry, white); } void draw_random_triangle(GP_Pixel pixel) { int x0, y0, x1, y1, x2, y2; - random_point(win->context, &x0, &y0); - random_point(win->context, &x1, &y1); - random_point(win->context, &x2, &y2); + random_point(win->pixmap, &x0, &y0); + random_point(win->pixmap, &x1, &y1); + random_point(win->pixmap, &x2, &y2); if (fill_flag) - GP_FillTriangle(win->context, x0, y0, x1, y1, x2, y2, pixel); + GP_FillTriangle(win->pixmap, x0, y0, x1, y1, x2, y2, pixel); if (outline_flag) - GP_Triangle(win->context, x0, y0, x1, y1, x2, y2, white); + GP_Triangle(win->pixmap, x0, y0, x1, y1, x2, y2, white); } void draw_random_rectangle(GP_Pixel pixel) { int x0, y0, x1, y1; - random_point(win->context, &x0, &y0); - random_point(win->context, &x1, &y1); + random_point(win->pixmap, &x0, &y0); + random_point(win->pixmap, &x1, &y1); if (fill_flag) - GP_FillRect(win->context, x0, y0, x1, y1, pixel); + GP_FillRect(win->pixmap, x0, y0, x1, y1, pixel); if (outline_flag) - GP_Rect(win->context, x0, y0, x1, y1, white); + GP_Rect(win->pixmap, x0, y0, x1, y1, white); } void draw_random_tetragon(GP_Pixel pixel) { int x0, y0, x1, y1, x2, y2, x3, y3; - random_point(win->context, &x0, &y0); - random_point(win->context, &x1, &y1); - random_point(win->context, &x2, &y2); - random_point(win->context, &x3, &y3); + random_point(win->pixmap, &x0, &y0); + random_point(win->pixmap, &x1, &y1); + random_point(win->pixmap, &x2, &y2); + random_point(win->pixmap, &x3, &y3); if (fill_flag) - GP_FillTetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); + GP_FillTetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel); if (outline_flag) - GP_Tetragon(win->context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); + GP_Tetragon(win->pixmap, x0, y0, x1, y1, x2, y2, x3, y3, pixel); } void draw_random_polygon(GP_Pixel pixel) @@ -148,15 +148,15 @@ void draw_random_polygon(GP_Pixel pixel) int i; for (i = 0; i < 5; i++) { - random_point(win->context, xy + 2*i, xy + 2*i + 1); + random_point(win->pixmap, xy + 2*i, xy + 2*i + 1); } - GP_FillPolygon_Raw(win->context, 5, xy, pixel); + GP_FillPolygon_Raw(win->pixmap, 5, xy, pixel); } void clear_screen(void) { - GP_Fill(win->context, black); + GP_Fill(win->pixmap, black); GP_BackendFlip(win); } @@ -168,7 +168,7 @@ void redraw_screen(void) /* Pick a random color for drawing. */ GP_Pixel pixel; pixel = GP_RGBToPixel(random() % 256, random() % 256, - random() % 256, win->context->pixel_type); + random() % 256, win->pixmap->pixel_type); switch (shape) { case SHAPE_CIRCLE: @@ -258,8 +258,8 @@ int main(void) return 1; } - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); for (;;) { GP_BackendPoll(win); diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c index 14e832ce75ac..71d82c85af60 100644 --- a/demos/c_simple/shapetest.c +++ b/demos/c_simple/shapetest.c @@ -28,7 +28,7 @@ #include <GP.h> -static GP_Context *win; +static GP_Pixmap *win; static GP_Backend *backend; /* Basic colors in display-specific format. */ @@ -253,8 +253,8 @@ void redraw_screen(void) if (show_axes) { int w, h; - w = GP_ContextW(win); - h = GP_ContextH(win); + w = GP_PixmapW(win); + h = GP_PixmapH(win); GP_HLine(win, 0, w, center_y, gray); GP_HLine(win, 0, w, center_y-yradius, darkgray); @@ -310,7 +310,7 @@ void redraw_screen(void) static void xradius_add(int xradius_add) { if (xradius + xradius_add > 1 && - xradius + xradius_add < (int)GP_ContextW(win)) + xradius + xradius_add < (int)GP_PixmapW(win)) xradius += xradius_add; } @@ -318,21 +318,21 @@ static void xradius_add(int xradius_add) static void yradius_add(int yradius_add) { if (yradius + yradius_add > 1 && - yradius + yradius_add < (int)GP_ContextH(win)) + yradius + yradius_add < (int)GP_PixmapH(win)) yradius += yradius_add; } static void xcenter_add(int xcenter_add) { if (center_x + xcenter_add > 1 && - center_x + xcenter_add < (int)GP_ContextW(win)/2) + center_x + xcenter_add < (int)GP_PixmapW(win)/2) center_x += xcenter_add; } static void ycenter_add(int ycenter_add) { if (center_y + ycenter_add > 1 && - center_y + ycenter_add < (int)GP_ContextH(win)/2) + center_y + ycenter_add < (int)GP_PixmapH(win)/2) center_y += ycenter_add; } @@ -364,8 +364,8 @@ void event_loop(void) break; case GP_KEY_R: win->axes_swap = !win->axes_swap; - center_x = GP_ContextW(win) / 2; - center_y = GP_ContextH(win) / 2; + center_x = GP_PixmapW(win) / 2; + center_y = GP_PixmapH(win) / 2; break; case GP_KEY_F: fill = !fill; @@ -451,9 +451,9 @@ void event_loop(void) break; case GP_EV_SYS_RESIZE: GP_BackendResizeAck(backend); - win = backend->context; - center_x = GP_ContextW(win) / 2; - center_y = GP_ContextH(win) / 2; + win = backend->pixmap; + center_x = GP_PixmapW(win) / 2; + center_y = GP_PixmapH(win) / 2; break; } break; @@ -506,19 +506,19 @@ int main(int argc, char *argv[]) return 1; } - win = backend->context; + win = backend->pixmap; center_x = win->w / 2; center_y = win->h / 2; /* Load colors compatible with the display */ - black = GP_RGBToContextPixel(0x00, 0x00, 0x00, win); - white = GP_RGBToContextPixel(0xff, 0xff, 0xff, win); - yellow = GP_RGBToContextPixel(0xff, 0xff, 0x00, win); - green = GP_RGBToContextPixel(0x00, 0xff, 0x00, win); - red = GP_RGBToContextPixel(0xff, 0x00, 0x00, win); - gray = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win); - darkgray = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win); + black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win); + white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win); + yellow = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win); + green = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win); + red = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win); + gray = GP_RGBToPixmapPixel(0xbe, 0xbe, 0xbe, win); + darkgray = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win); print_instructions(); redraw_screen(); diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c index 4934d4cff423..4208b201c0b5 100644 --- a/demos/c_simple/showimage.c +++ b/demos/c_simple/showimage.c @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) { GP_Backend *backend; - GP_Context *image; + GP_Pixmap *image; if (argc != 2) { fprintf(stderr, "Takes image as an argument\n"); @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) } /* Blit image into the window and show it */ - GP_Blit(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_Blit(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0); GP_BackendFlip(backend); /* Wait for events */ @@ -78,11 +78,11 @@ int main(int argc, char *argv[]) GP_BackendResizeAck(backend); - cx = ((int)backend->context->w - (int)image->w) / 2; - cy = ((int)backend->context->h - (int)image->h) / 2; + cx = ((int)backend->pixmap->w - (int)image->w) / 2; + cy = ((int)backend->pixmap->h - (int)image->h) / 2; - GP_Fill(backend->context, 0); - GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, cx, cy); + GP_Fill(backend->pixmap, 0); + GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, cx, cy); GP_BackendFlip(backend); } } diff --git a/demos/c_simple/sin_AA.c b/demos/c_simple/sin_AA.c index 20e320276f3f..0191918a2e80 100644 --- a/demos/c_simple/sin_AA.c +++ b/demos/c_simple/sin_AA.c @@ -32,35 +32,35 @@ #include <GP.h> -static void redraw(GP_Context *context) +static void redraw(GP_Pixmap *pixmap) { static float param = 1; static float param2 = 0.01; static int flag = 1; - GP_Pixel b = GP_RGBToContextPixel(0xbe, 0xbe, 0x9e, context); + GP_Pixel b = GP_RGBToPixmapPixel(0xbe, 0xbe, 0x9e, pixmap); unsigned int y; - GP_Fill(context, b); + GP_Fill(pixmap, b); - for (y = 0; y < context->w; y++) { + for (y = 0; y < pixmap->w; y++) { GP_Coord x0, x1, l1, l2; - x0 = (context->w)<<7; - x1 = (context->w)<<7; + x0 = (pixmap->w)<<7; + x1 = (pixmap->w)<<7; - l1 = (context->w)<<5; - l2 = (context->w)<<3; + l1 = (pixmap->w)<<5; + l2 = (pixmap->w)<<3; - GP_Pixel p = GP_RGBToContextPixel(120 - 3 * param, abs(40 * param), 0, context); + GP_Pixel p = GP_RGBToPixmapPixel(120 - 3 * param, abs(40 * param), 0, pixmap); - l2 *= 4.00 * y / context->h; + l2 *= 4.00 * y / pixmap->h; l1 *= param; x0 += l1 * sin(param2 * y) + l2; x1 -= l1 * cos(param2 * y) + l2; - GP_HLineAA(context, x0, x1, y<<8, p); + GP_HLineAA(pixmap, x0, x1, y<<8, p); } if (flag) { @@ -97,7 +97,7 @@ int main(void) /* Wait for events */ for (;;) { if (!pause_flag) { - redraw(backend->context); + redraw(backend->pixmap); GP_BackendFlip(backend); } diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c index 0c08140ba9fa..9827ee6b96a0 100644 --- a/demos/c_simple/textaligntest.c +++ b/demos/c_simple/textaligntest.c @@ -41,11 +41,11 @@ static GP_Backend *win; void redraw_screen(void) { - GP_Fill(win->context, black_pixel); + GP_Fill(win->pixmap, black_pixel); /* draw axes intersecting in the middle, where text should be shown */ - GP_HLine(win->context, 0, X, Y/2, darkgray_pixel); - GP_VLine(win->context, X/2, 0, Y, darkgray_pixel); + GP_HLine(win->pixmap, 0, X, Y/2, darkgray_pixel); + GP_VLine(win->pixmap, X/2, 0, Y, darkgray_pixel); switch (font_flag) { case 0: @@ -68,17 +68,17 @@ void redraw_screen(void) break; } - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW, yellow_pixel, black_pixel, "bottom left"); - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, red_pixel, black_pixel, "bottom right"); - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE, blue_pixel, black_pixel, "top right"); - GP_Text(win->context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE, + GP_Text(win->pixmap, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE, green_pixel, black_pixel, "top left"); - GP_HLine(win->context, 0, X, Y/3, darkgray_pixel); - GP_Text(win->context, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE, + GP_HLine(win->pixmap, 0, X, Y/3, darkgray_pixel); + GP_Text(win->pixmap, &style, X/2, Y/3, GP_ALIGN_CENTER|GP_VALIGN_BASELINE, white_pixel, black_pixel, "x center y baseline"); } @@ -96,13 +96,13 @@ static void event_loop(void) switch (ev.val.key.key) { case GP_KEY_X: - win->context->x_swap = !win->context->x_swap; + win->pixmap->x_swap = !win->pixmap->x_swap; break; case GP_KEY_Y: - win->context->y_swap = !win->context->y_swap; + win->pixmap->y_swap = !win->pixmap->y_swap; break; case GP_KEY_R: - win->context->axes_swap = !win->context->axes_swap; + win->pixmap->axes_swap = !win->pixmap->axes_swap; GP_SWAP(X, Y); break; case GP_KEY_SPACE: @@ -146,8 +146,8 @@ static void event_loop(void) break; case GP_EV_SYS_RESIZE: GP_BackendResizeAck(win); - X = win->context->w; - Y = win->context->h; + X = win->pixmap->w; + Y = win->pixmap->h; break; } break; @@ -186,13 +186,13 @@ int main(int argc, char *argv[]) return 1; } - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context); - green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, win->context); - yellow_pixel = GP_RGBToContextPixel(0xff, 0xff, 0x00, win->context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context); - darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, win->pixmap); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, win->pixmap); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, win->pixmap); + green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, win->pixmap); + yellow_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0x00, win->pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, win->pixmap); + darkgray_pixel = GP_RGBToPixmapPixel(0x7f, 0x7f, 0x7f, win->pixmap); redraw_screen(); GP_BackendFlip(win); diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c index 443d6d4926cb..5f5dacf86c72 100644 --- a/demos/c_simple/v4l2_show.c +++ b/demos/c_simple/v4l2_show.c @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) for (;;) { if (GP_GrabberPoll(grabber) > 0) { - GP_Context *res, *img = grabber->frame; + GP_Pixmap *res, *img = grabber->frame; switch (mode) { case 0: @@ -113,14 +113,14 @@ int main(int argc, char *argv[]) break; } - unsigned int c_x = (backend->context->w - res->w) / 2; - unsigned int c_y = (backend->context->h - res->h) / 2; + unsigned int c_x = (backend->pixmap->w - res->w) / 2; + unsigned int c_y = (backend->pixmap->h - res->h) / 2; - GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, c_x, c_y); + GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->pixmap, c_x, c_y); GP_BackendFlip(backend); if (mode) - GP_ContextFree(res); + GP_PixmapFree(res); } usleep(1000); @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) case GP_EV_SYS: if (ev.code == GP_EV_SYS_RESIZE) { GP_BackendResizeAck(backend); - GP_Fill(backend->context, 0); + GP_Fill(backend->pixmap, 0); } break; } diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c index f59f4ec384c1..b1d8199f5b89 100644 --- a/demos/c_simple/virtual_backend_example.c +++ b/demos/c_simple/virtual_backend_example.c @@ -35,48 +35,48 @@ static GP_Pixel white_pixel, black_pixel, red_pixel, blue_pixel, green_pixel; static void redraw(GP_Backend *backend) { - GP_Context *context = backend->context; + GP_Pixmap *pixmap = backend->pixmap; /* Now draw some testing patters */ - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); - red_pixel = GP_RGBToContextPixel(0xff, 0x00, 0x00, context); - blue_pixel = GP_RGBToContextPixel(0x00, 0x00, 0xff, context); - green_pixel = GP_RGBToContextPixel(0x00, 0xff, 0x00, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); + red_pixel = GP_RGBToPixmapPixel(0xff, 0x00, 0x00, pixmap); + blue_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0xff, pixmap); + green_pixel = GP_RGBToPixmapPixel(0x00, 0xff, 0x00, pixmap); - GP_Fill(context, white_pixel); + GP_Fill(pixmap, white_pixel); unsigned int i, j; for (i = 0; i < 40; i++) { - GP_HLineXYW(context, 0, i, i, black_pixel); - GP_HLineXYW(context, 1, i + 40, i, black_pixel); - GP_HLineXYW(context, 2, i + 80, i, black_pixel); - GP_HLineXYW(context, 3, i + 120, i, black_pixel); - GP_HLineXYW(context, 4, i + 160, i, black_pixel); - GP_HLineXYW(context, 5, i + 200, i, black_pixel); - GP_HLineXYW(context, 6, i + 240, i, black_pixel); - GP_HLineXYW(context, 7, i + 280, i, black_pixel); + GP_HLineXYW(pixmap, 0, i, i, black_pixel); + GP_HLineXYW(pixmap, 1, i + 40, i, black_pixel); + GP_HLineXYW(pixmap, 2, i + 80, i, black_pixel); + GP_HLineXYW(pixmap, 3, i + 120, i, black_pixel); + GP_HLineXYW(pixmap, 4, i + 160, i, black_pixel); + GP_HLineXYW(pixmap, 5, i + 200, i, black_pixel); + GP_HLineXYW(pixmap, 6, i + 240, i, black_pixel); + GP_HLineXYW(pixmap, 7, i + 280, i, black_pixel); } for (i = 0; i < 256; i++) { for (j = 0; j < 256; j++) { uint8_t val = 1.00 * sqrt(i*i + j*j)/sqrt(2) + 0.5; - GP_Pixel pix = GP_RGBToContextPixel(i, j, val, context); - GP_PutPixel(context, i + 60, j + 10, pix); + GP_Pixel pix = GP_RGBToPixmapPixel(i, j, val, pixmap); + GP_PutPixel(pixmap, i + 60, j + 10, pix); } } - GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, black_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, red_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, green_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, + GP_Text(pixmap, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, blue_pixel, white_pixel, "Lorem Ipsum dolor sit..."); /* Update the backend screen */ diff --git a/demos/c_simple/weighted_median.c b/demos/c_simple/weighted_median.c index a0b09fd4f946..dc481603f9d5 100644 --- a/demos/c_simple/weighted_median.c +++ b/demos/c_simple/weighted_median.c @@ -53,7 +53,7 @@ static int progress_callback(GP_ProgressCallback *self) int main(int argc, char *argv[]) { - GP_Context *img; + GP_Pixmap *img; struct callback_priv priv; GP_ProgressCallback callback = {.callback = progress_callback, .priv = &priv}; @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) priv.op = "Weighted Median"; - GP_Context *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback); + GP_Pixmap *res = GP_FilterWeightedMedianAlloc(img, &weights, &callback); printf("\n"); diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c index aa37c7b20b67..da9d8d8b8041 100644 --- a/demos/c_simple/x11_windows.c +++ b/demos/c_simple/x11_windows.c @@ -29,16 +29,16 @@ #include <stdio.h> #include <GP.h> -static void redraw(struct GP_Context *context) +static void redraw(struct GP_Pixmap *pixmap) { GP_Pixel white_pixel, black_pixel; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, black_pixel); - GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel); - GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel); + GP_Fill(pixmap, black_pixel); + GP_Line(pixmap, 0, 0, pixmap->w - 1, pixmap->h - 1, white_pixel); + GP_Line(pixmap, 0, pixmap->h - 1, pixmap->w - 1, 0, white_pixel); } static int ev_loop(struct GP_Backend *backend, const char *name) @@ -68,7 +68,7 @@ static int ev_loop(struct GP_Backend *backend, const char *name) switch (ev.code) { case GP_EV_SYS_RESIZE: GP_BackendResizeAck(backend); - redraw(backend->context); + redraw(backend->pixmap); GP_BackendFlip(backend); break; case GP_EV_SYS_QUIT: @@ -99,8 +99,8 @@ int main(void) } /* Update the backend screen */ - redraw(win_1->context); - redraw(win_2->context); + redraw(win_1->pixmap); + redraw(win_2->pixmap); GP_BackendFlip(win_1); GP_BackendFlip(win_2); diff --git a/demos/c_simple/zip_container.c b/demos/c_simple/zip_container.c index 1fe5e36fceca..4cf77fd9aef1 100644 --- a/demos/c_simple/zip_container.c +++ b/demos/c_simple/zip_container.c @@ -33,7 +33,7 @@ #include <GP.h> static GP_Backend *backend; -static GP_Context *image; +static GP_Pixmap *image; static GP_Container *container; /* @@ -45,20 +45,20 @@ static GP_Container *container; */ static void load_next(void) { - GP_ContextFree(image); + GP_PixmapFree(image); image = GP_ContainerLoadNext(container, NULL); if (image == NULL) return; - if (image->w != backend->context->w || - image->h != backend->context->h) { + if (image->w != backend->pixmap->w || + image->h != backend->pixmap->h) { GP_BackendResize(backend, image->w, image->h); return; } - GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0); GP_BackendFlip(backend); } @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) } /* Blit image into the window and show it */ - GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_Blit_Clipped(image, 0, 0, image->w, image->h, backend->pixmap, 0, 0); GP_BackendFlip(backend); /* Wait for events */ @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) if (ev.code == GP_EV_SYS_RESIZE) { GP_BackendResizeAck(backend); GP_Blit_Clipped(image, 0, 0, image->w, image->h, - backend->context, 0, 0); + backend->pixmap, 0, 0); GP_BackendFlip(backend); } break; diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index 8c798d4cd5a1..fe40e2529e2a 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -106,7 +106,7 @@ static struct param resize_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int resize(GP_Context **c, const char *params) +static int resize(GP_Pixmap **c, const char *params) { int alg = 1; float ratio = -1; @@ -122,14 +122,14 @@ static int resize(GP_Context **c, const char *params) GP_Size w = ratio * (*c)->w; GP_Size h = ratio * (*c)->h; - GP_Context *res = NULL; + GP_Pixmap *res = NULL; res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback); if (res == NULL) return EINVAL; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; return 0; @@ -164,7 +164,7 @@ static struct param scale_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int scale(GP_Context **c, const char *params) +static int scale(GP_Pixmap **c, const char *params) { int alg = 1; int w = -1; @@ -185,14 +185,14 @@ static int scale(GP_Context **c, const char *params) if (h == -1) h = (*c)->h * (1.00 * w/(*c)->w) + 0.5; - GP_Context *res = NULL; + GP_Pixmap *res = NULL; res = GP_FilterResizeAlloc(*c, w, h, alg, progress_callback); if (res == NULL) return EINVAL; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; return 0; @@ -211,7 +211,7 @@ static struct param rotate_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int rotate(GP_Context **c, const char *params) +static int rotate(GP_Pixmap **c, const char *params) { int rot = -1; @@ -223,7 +223,7 @@ static int rotate(GP_Context **c, const char *params) return EINVAL; } - GP_Context *res = NULL; + GP_Pixmap *res = NULL; switch (rot) { case 0: @@ -240,7 +240,7 @@ static int rotate(GP_Context **c, const char *params) if (res == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; return 0; @@ -254,7 +254,7 @@ static struct param mirror_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int mirror(GP_Context **c, const char *params) +static int mirror(GP_Pixmap **c, const char *params) { int vert = 0, horiz = 0; @@ -277,7 +277,7 @@ static struct param bright_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int bright(GP_Context **c, const char *params) +static int bright(GP_Pixmap **c, const char *params) { float bright = 0; @@ -296,7 +296,7 @@ static struct param contrast_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int contrast(GP_Context **c, const char *params) +static int contrast(GP_Pixmap **c, const char *params) { float mul = 0; @@ -319,7 +319,7 @@ static struct param invert_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int invert(GP_Context **c, const char *params) +static int invert(GP_Pixmap **c, const char *params) { if (param_parse(params, invert_params, "invert", param_err)) return EINVAL; @@ -338,7 +338,7 @@ static struct param blur_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int blur(GP_Context **c, const char *params) +static int blur(GP_Pixmap **c, const char *params) { float sigma = 0; float sigma_x = 0; @@ -389,7 +389,7 @@ static struct param dither_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int dither(GP_Context **c, const char *params) +static int dither(GP_Pixmap **c, const char *params) { int fmt = -1; @@ -401,15 +401,15 @@ static int dither(GP_Context **c, const char *params) return EINVAL; } - GP_Context *bw; + GP_Pixmap *bw; bw = GP_FilterFloydSteinbergAlloc(*c, dither_pixel_types[fmt], progress_callback); - //TODO: so far we convert the context back to RGB888 + //TODO: so far we convert the pixmap back to RGB888 //(so we can do further work with it) - GP_Blit(bw, 0, 0, GP_ContextW(bw), GP_ContextH(bw), *c, 0, 0); + GP_Blit(bw, 0, 0, GP_PixmapW(bw), GP_PixmapH(bw), *c, 0, 0); - GP_ContextFree(bw); + GP_PixmapFree(bw); return 0; } @@ -421,7 +421,7 @@ static struct param save_jpg_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int save_jpg(GP_Context **c, const char *params) +static int save_jpg(GP_Pixmap **c, const char *params) { char *file = NULL; @@ -445,7 +445,7 @@ static struct param save_png_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int save_png(GP_Context **c, const char *params) +static int save_png(GP_Pixmap **c, const char *params) { char *file = NULL; @@ -471,7 +471,7 @@ static struct param median_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int median(GP_Context **c, const char *params) +static int median(GP_Pixmap **c, const char *params) { int rad = -1, rad_x, rad_y; @@ -486,12 +486,12 @@ static int median(GP_Context **c, const char *params) if (rad_x < 0 || rad_y < 0) return EINVAL; - GP_Context *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback); + GP_Pixmap *ret = GP_FilterMedianAlloc(*c, rad_x, rad_y, progress_callback); if (ret == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = ret; return 0; @@ -508,7 +508,7 @@ static struct param sigma_mean_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int sigma_mean(GP_Context **c, const char *params) +static int sigma_mean(GP_Pixmap **c, const char *params) { int rad = -1, rad_x, rad_y, min = 0; float sigma = 0.1; @@ -527,12 +527,12 @@ static int sigma_mean(GP_Context **c, const char *params) (*c)->gamma = GP_GammaAcquire((*c)->pixel_type, 1.2); - GP_Context *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback); + GP_Pixmap *ret = GP_FilterSigmaAlloc(*c, rad_x, rad_y, min, sigma, progress_callback); if (ret == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = ret; return 0; @@ -545,19 +545,19 @@ static struct param sharpen_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int sharpen(GP_Context **c, const char *params) +static int sharpen(GP_Pixmap **c, const char *params) { float weight = 0.1; if (param_parse(params, sharpen_params, "sigma", param_err, &weight)) return EINVAL; - GP_Context *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback); + GP_Pixmap *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback); if (ret == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = ret; return 0; @@ -571,7 +571,7 @@ static struct param gauss_noise_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int gauss_noise(GP_Context **c, const char *params) +static int gauss_noise(GP_Pixmap **c, const char *params) { float sigma = 0.1; float mu = 0; @@ -601,7 +601,7 @@ static struct param arithmetic_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int arithmetic(GP_Context **c, const char *params) +static int arithmetic(GP_Pixmap **c, const char *params) { char *file = NULL; int op = -1; @@ -614,7 +614,7 @@ static int arithmetic(GP_Context **c, const char *params) return EINVAL; } - GP_Context *img, *res = NULL; + GP_Pixmap *img, *res = NULL; if ((img = GP_LoadImage(file, progress_callback)) == NULL) { print_error("arithmetic: Invalid image."); @@ -642,7 +642,7 @@ static int arithmetic(GP_Context **c, const char *params) if (res == NULL) return ENOMEM; - GP_ContextFree(*c); + GP_PixmapFree(*c); *c = res; @@ -656,7 +656,7 @@ static struct param histogram_params[] = { {NULL, 0, NULL, NULL, NULL} }; -static int histogram(GP_Context **c, const char *params) +static int histogram(GP_Pixmap **c, const char *params) { char *file = "histogram.png"; @@ -678,7 +678,7 @@ struct filter { const char *name; const char *desc; struct param *param_desc; - int (*apply)(GP_Context **c, const char *params); + int (*apply)(GP_Pixmap **c, const char *params); }; static struct filter filter_table[] = { @@ -763,7 +763,7 @@ static void add_filter(char *params) filter_params[filter_cnt++] = params; } -static void apply_filters(GP_Context **src) +static void apply_filters(GP_Pixmap **src) { unsigned int i; int ret; @@ -845,7 +845,7 @@ static void check_fmt(const char *fmt) exit(1); } -static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char *fmt) +static void save_by_fmt(struct GP_Pixmap *bitmap, const char *name, const char *fmt) { int ret; @@ -874,7 +874,7 @@ static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char int main(int argc, char *argv[]) { - GP_Context *bitmap; + GP_Pixmap *bitmap; int opt, i; const char *out_fmt = "ppm"; diff --git a/demos/grinder/histogram.c b/demos/grinder/histogram.c index 9706315b0f99..d02f17518235 100644 --- a/demos/grinder/histogram.c +++ b/demos/grinder/histogram.c @@ -22,7 +22,7 @@ #include "histogram.h" -void histogram_to_png(const GP_Context *src, const char *filename) +void histogram_to_png(const GP_Pixmap *src, const char *filename) { GP_Histogram *hist; @@ -36,7 +36,7 @@ void histogram_to_png(const GP_Context *src, const char *filename) unsigned int i, j; - GP_Context *res = GP_ContextAlloc(257*4, 256, GP_PIXEL_RGB888); + GP_Pixmap *res = GP_PixmapAlloc(257*4, 256, GP_PIXEL_RGB888); GP_Fill(res, 0xffffff); @@ -76,6 +76,6 @@ void histogram_to_png(const GP_Context *src, const char *filename) GP_SavePNG(res, filename, NULL); - GP_ContextFree(res); + GP_PixmapFree(res); GP_HistogramFree(hist); } diff --git a/demos/grinder/histogram.h b/demos/grinder/histogram.h index d6fdb4e5331f..e58dfd4c4527 100644 --- a/demos/grinder/histogram.h +++ b/demos/grinder/histogram.h @@ -25,6 +25,6 @@ #include <GP.h> -void histogram_to_png(const GP_Context *src, const char *filename); +void histogram_to_png(const GP_Pixmap *src, const char *filename); #endif /* HISTOGRAM_H */ diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c index 46fafe299887..e4226c27114b 100644 --- a/demos/particle/particle_demo.c +++ b/demos/particle/particle_demo.c @@ -37,7 +37,7 @@ static GP_Pixel black_pixel; static GP_Pixel white_pixel; static GP_Backend *backend = NULL; -static GP_Context *context = NULL; +static GP_Pixmap *pixmap = NULL; static void sighandler(int signo) { @@ -88,16 +88,16 @@ int main(int argc, char *argv[]) init_backend(backend_opts); - context = backend->context; + pixmap = backend->pixmap; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, black_pixel); + GP_Fill(pixmap, black_pixel); GP_BackendFlip(backend); struct space *space; - space = space_create(particles, 10<<8, 10<<8, (context->w - 10)<<8, (context->h - 10)<<8); + space = space_create(particles, 10<<8, 10<<8, (pixmap->w - 10)<<8, (pixmap->h - 10)<<8); for (;;) { if (backend->Poll) @@ -146,8 +146,8 @@ int main(int argc, char *argv[]) space_destroy(space); space = space_create(particles, 10<<8, 10<<8, - (context->w - 10)<<8, - (context->h - 10)<<8); + (pixmap->w - 10)<<8, + (pixmap->h - 10)<<8); break; } break; @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) if (!pause_flag) { space_time_tick(space, 1); - space_draw_particles(context, space); + space_draw_particles(pixmap, space); GP_BackendFlip(backend); } } diff --git a/demos/particle/space.c b/demos/particle/space.c index c53b9e31b286..8dfc956d656a 100644 --- a/demos/particle/space.c +++ b/demos/particle/space.c @@ -67,11 +67,11 @@ void space_destroy(struct space *space) #define SQUARE(x) ((x) * (x)) -void space_draw_particles(GP_Context *context, struct space *space) +void space_draw_particles(GP_Pixmap *pixmap, struct space *space) { unsigned int i; - GP_Fill(context, 0x000000); + GP_Fill(pixmap, 0x000000); for (i = 0; i < space->particle_count; i++) { GP_Pixel color; @@ -88,9 +88,9 @@ void space_draw_particles(GP_Context *context, struct space *space) } */ - color = GP_RGBToContextPixel(0xee, 0xee, 0xee, context); + color = GP_RGBToPixmapPixel(0xee, 0xee, 0xee, pixmap); - GP_PutPixelAA(context, x, y, color); + GP_PutPixelAA(pixmap, x, y, color); int val = SQUARE(space->particles[i].vx) + SQUARE(space->particles[i].vy); @@ -99,29 +99,29 @@ void space_draw_particles(GP_Context *context, struct space *space) if (val > 255) val = 255; - color = GP_RGBToContextPixel(val, val, 0x40, context); + color = GP_RGBToPixmapPixel(val, val, 0x40, pixmap); /* Hexagons */ - GP_LineAA(context, x - a2, y - a1, x + a2, y - a1, color); - // GP_LineAA(context, x + a2, y - a1, x + a1, y - a2, color); - GP_LineAA(context, x + a1, y - a2, x + a1, y + a2, color); - // GP_LineAA(context, x + a1, y + a2, x + a2, y + a1, color); - GP_LineAA(context, x + a2, y + a1, x - a2, y + a1, color); - // GP_LineAA(context, x - a2, y + a1, x - a1, y + a2, color); - GP_LineAA(context, x - a1, y + a2, x - a1, y - a2, color); - // GP_LineAA(context, x - a1, y - a2, x - a2, y - a1, color); + GP_LineAA(pixmap, x - a2, y - a1, x + a2, y - a1, color); + // GP_LineAA(pixmap, x + a2, y - a1, x + a1, y - a2, color); + GP_LineAA(pixmap, x + a1, y - a2, x + a1, y + a2, color); + // GP_LineAA(pixmap, x + a1, y + a2, x + a2, y + a1, color); + GP_LineAA(pixmap, x + a2, y + a1, x - a2, y + a1, color); + // GP_LineAA(pixmap, x - a2, y + a1, x - a1, y + a2, color); + GP_LineAA(pixmap, x - a1, y + a2, x - a1, y - a2, color); + // GP_LineAA(pixmap, x - a1, y - a2, x - a2, y - a1, color); /* - GP_PutPixelAA(context, x + a2, y - a1, 0xffffff); - GP_PutPixelAA(context, x + a1, y - a2, 0xffffff); + GP_PutPixelAA(pixmap, x + a2, y - a1, 0xffffff); + GP_PutPixelAA(pixmap, x + a1, y - a2, 0xffffff); - GP_PutPixelAA(context, x + a1, y + a2, 0xffffff); - GP_PutPixelAA(context, x + a2, y + a1, 0xffffff); + GP_PutPixelAA(pixmap, x + a1, y + a2, 0xffffff); + GP_PutPixelAA(pixmap, x + a2, y + a1, 0xffffff); - GP_PutPixelAA(context, x - a2, y + a1, 0xffffff); - GP_PutPixelAA(context, x - a1, y + a2, 0xffffff); + GP_PutPixelAA(pixmap, x - a2, y + a1, 0xffffff); + GP_PutPixelAA(pixmap, x - a1, y + a2, 0xffffff); - GP_PutPixelAA(context, x - a1, y - a2, 0xffffff); - GP_PutPixelAA(context, x - a2, y - a1, 0xffffff); + GP_PutPixelAA(pixmap, x - a1, y - a2, 0xffffff); + GP_PutPixelAA(pixmap, x - a2, y - a1, 0xffffff); */ } } diff --git a/demos/particle/space.h b/demos/particle/space.h index 7878b11c2a69..021d615b36fc 100644 --- a/demos/particle/space.h +++ b/demos/particle/space.h @@ -69,7 +69,7 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h, void space_destroy(struct space *space); -void space_draw_particles(GP_Context *context, struct space *space); +void space_draw_particles(GP_Pixmap *pixmap, struct space *space); void space_time_tick(struct space *space, int time); diff --git a/demos/py_simple/backends.py b/demos/py_simple/backends.py index 31fb59d145d3..84715526aa2c 100755 --- a/demos/py_simple/backends.py +++ b/demos/py_simple/backends.py @@ -9,7 +9,7 @@ import gfxprim.text as text import gfxprim.input as input def redraw(bk): - c = bk.context + c = bk.pixmap black = c.RGBToPixel(0, 0, 0) white = c.RGBToPixel(0xff, 0xff, 0xff) diff --git a/demos/py_simple/blit.py b/demos/py_simple/blit.py index 2b3a6943c507..e76b8c08e0aa 100755 --- a/demos/py_simple/blit.py +++ b/demos/py_simple/blit.py @@ -21,13 +21,13 @@ class Ball: self.bg_img = bg_img def draw(self, bk): - self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h) + self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h) def move(self, bk): old_x = self.x; old_y = self.y; - self.bg_img.Blit(old_x, old_y, bk.context, old_x, old_y, self.ball.w, self.ball.h) + self.bg_img.Blit(old_x, old_y, bk.pixmap, old_x, old_y, self.ball.w, self.ball.h) self.x += self.dx self.y += self.dy @@ -38,7 +38,7 @@ class Ball: if (self.y <= 0 or self.y >= self.bg_img.h - self.ball.h): self.dy = -self.dy - self.ball.Blit(0, 0, bk.context, self.x, self.y, self.ball.w, self.ball.h) + self.ball.Blit(0, 0, bk.pixmap, self.x, self.y, self.ball.w, self.ball.h) bk.UpdateRect(min(old_x, self.x), min(self.y, old_y), max(old_x, self.x) + self.ball.w - 1, max(old_y, self.y) + self.ball.h - 1) @@ -59,7 +59,7 @@ def main(): # Create X11 window bk = backends.BackendX11Init(None, 0, 0, bg.w, bg.h, sys.argv[1], 0) assert(bk) - bg.Blit(0, 0, bk.context, 0, 0, bg.w, bg.h) + bg.Blit(0, 0, bk.pixmap, 0, 0, bg.w, bg.h) bk.Flip() diff --git a/demos/py_simple/cam_view.py b/demos/py_simple/cam_view.py index 6692abb914bb..dd7bcc88286c 100755 --- a/demos/py_simple/cam_view.py +++ b/demos/py_simple/cam_view.py @@ -25,7 +25,7 @@ def main(): sleep(0.01) if (grabber.Poll()): - grabber.frame.Blit(0, 0, bk.context, 0, 0, grabber.frame.w, grabber.frame.h) + grabber.frame.Blit(0, 0, bk.pixmap, 0, 0, grabber.frame.w, grabber.frame.h) bk.Flip() ev = bk.PollEvent() diff --git a/demos/py_simple/font_style.py b/demos/py_simple/font_style.py index 47d8e2cbff8e..1799253d8a10 100755 --- a/demos/py_simple/font_style.py +++ b/demos/py_simple/font_style.py @@ -9,7 +9,7 @@ import gfxprim.input as input import gfxprim.text as text def redraw(win): - c = win.context + c = win.pixmap black = c.RGBToPixel(0, 0, 0) white = c.RGBToPixel(0xff, 0xff, 0xff) diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py index c79d879e8600..0ee8dbe6517e 100755 --- a/demos/py_simple/gfx.py +++ b/demos/py_simple/gfx.py @@ -8,88 +8,88 @@ import gfxprim.backends as backends import gfxprim.input as input def fill(bk): - color = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bk.context.gfx.Fill(color) + color = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bk.pixmap.gfx.Fill(color) bk.Flip() def hline(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) - for i in range(0, bk.context.h, 10): - bk.context.gfx.HLine(0, bk.context.w, i, fg) + bk.pixmap.gfx.Fill(bg) + for i in range(0, bk.pixmap.h, 10): + bk.pixmap.gfx.HLine(0, bk.pixmap.w, i, fg) bk.Flip() def vline(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - for i in range(0, bk.context.w, 10): - bk.context.gfx.VLine(i, 0, bk.context.h, fg) + for i in range(0, bk.pixmap.w, 10): + bk.pixmap.gfx.VLine(i, 0, bk.pixmap.h, fg) bk.Flip() def line(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - for i in range(0, 2 * max(bk.context.w, bk.context.h), 13): - bk.context.gfx.Line(0, i, i, 0, fg) + for i in range(0, 2 * max(bk.pixmap.w, bk.pixmap.h), 13): + bk.pixmap.gfx.Line(0, i, i, 0, fg) bk.Flip() def rect(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) for i in range(10, 130, 10): - bk.context.gfx.Rect(i, i, bk.context.w - i, bk.context.h - i, fg) + bk.pixmap.gfx.Rect(i, i, bk.pixmap.w - i, bk.pixmap.h - i, fg) bk.Flip() def triangle(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - w = bk.context.w - h = bk.context.h + w = bk.pixmap.w + h = bk.pixmap.h for i in range(10, 90, 10): - bk.context.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg) + bk.pixmap.gfx.Triangle(2*i, i, w - 2*i, i, w//2, h - 2*i, fg) bk.Flip() def tetragon(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - w = bk.context.w - h = bk.context.h + w = bk.pixmap.w + h = bk.pixmap.h for i in range(10, 70, 10): - bk.context.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg) + bk.pixmap.gfx.Tetragon(i, i, w-2*i, i, w-i, h-i, 2*i, h-i, fg) bk.Flip() def polygon(bk): - fg = bk.context.RGBToPixel(0xee, 0xee, 0xee) - bg = bk.context.RGBToPixel(0, 0, 0); + fg = bk.pixmap.RGBToPixel(0xee, 0xee, 0xee) + bg = bk.pixmap.RGBToPixel(0, 0, 0); - bk.context.gfx.Fill(bg) + bk.pixmap.gfx.Fill(bg) - w = bk.context.w - h = bk.context.h + w = bk.pixmap.w + h = bk.pixmap.h polygon = [(10, 10), (10, (h-10)//3), ((w-10)//3, (h-10)//2), (10, 2*(h-10)//3), (10, h-10), ((w-10)//3, h-10), @@ -98,7 +98,7 @@ def polygon(bk): (w-10, (h-10)//3), (w-10, 10), (2*(w-10)//3, 10), ((w-10)//2, (h-10)//3), ((w-10)//3, 10)] - bk.context.gfx.Polygon(polygon, fg) + bk.pixmap.gfx.Polygon(polygon, fg) bk.Flip() diff --git a/demos/py_simple/gravplots_AA.py b/demos/py_simple/gravplots_AA.py index 747774402344..5de7bcc6a0a7 100755 --- a/demos/py_simple/gravplots_AA.py +++ b/demos/py_simple/gravplots_AA.py @@ -72,7 +72,7 @@ def main(): print(bk) print("Modify source for parameters,") print("Kill to terminate ;-)") - black = bk.context.RGBToPixel(0, 0, 0) + black = bk.pixmap.RGBToPixel(0, 0, 0) es = [elem() for i in range(N)] while True: @@ -86,18 +86,18 @@ def main(): x = int((e.x % W) * 0x100) y = int(e.y * 0x100) if e.vx > 0.2: - bk.context.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black) + bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x300, y + 0x300, black) if e.vx < -0.2: - bk.context.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black) - bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(e.r, e.g, e.b)) + bk.pixmap.gfx.VLineAA(x - 0x100, y - 0x300, y + 0x300, black) + bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b)) else: x = int(e.x % W) y = int(e.y) if e.vx > 0.2: - bk.context.gfx.VLine(x + 1, y - 2, y + 2, black) + bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black) if e.vx < -0.2: - bk.context.gfx.VLine(x - 1, y - 2, y + 2, black) - bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(e.r, e.g, e.b)) + bk.pixmap.gfx.VLine(x - 1, y - 2, y + 2, black) + bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(e.r, e.g, e.b)) bk.Poll() bk.Flip() global TIMEOUT @@ -106,7 +106,7 @@ def main(): if TIMEOUT == 0: break if SAVETO: - bk.context.Save(SAVETO) + bk.pixmap.Save(SAVETO) if __name__ == '__main__': main() diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py index 6c5e97c572a3..07c54b41913a 100755 --- a/demos/py_simple/showimage.py +++ b/demos/py_simple/showimage.py @@ -18,7 +18,7 @@ def main(): # Create X11 window bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0) assert(bk) - img.Blit(0, 0, bk.context, 0, 0, img.w, img.h) + img.Blit(0, 0, bk.pixmap, 0, 0, img.w, img.h) bk.Flip() # Event loop diff --git a/demos/py_simple/sinplots_AA.py b/demos/py_simple/sinplots_AA.py index e0933b562bd8..44afd21ecb7c 100755 --- a/demos/py_simple/sinplots_AA.py +++ b/demos/py_simple/sinplots_AA.py @@ -34,7 +34,7 @@ def main(): print(bk) print("Modify source for parameters,") print("Kill to terminate ;-)") - black = bk.context.RGBToPixel(0, 0, 0) + black = bk.pixmap.RGBToPixel(0, 0, 0) ps = [plotter() for i in range(N)] t = random.uniform(0.0, 10.0 * W) @@ -46,13 +46,13 @@ def main(): if AA: x = int(x * 0x100) y = int(y * 0x100) - bk.context.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black) - bk.context.gfx.PutPixelAA(x, y, bk.context.RGBToPixel(int(r), int(g), int(b))) + bk.pixmap.gfx.VLineAA(x + 0x100, y - 0x200, y + 0x200, black) + bk.pixmap.gfx.PutPixelAA(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b))) else: x = int(x) y = int(y) - bk.context.gfx.VLine(x + 1, y - 2, y + 2, black) - bk.context.core.PutPixel(x, y, bk.context.RGBToPixel(int(r), int(g), int(b))) + bk.pixmap.gfx.VLine(x + 1, y - 2, y + 2, black) + bk.pixmap.core.PutPixel(x, y, bk.pixmap.RGBToPixel(int(r), int(g), int(b))) bk.Flip() if __name__ == '__main__': diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py index 133be6e504b2..3c34ff7a941e 100755 --- a/demos/py_simple/x11_windows.py +++ b/demos/py_simple/x11_windows.py @@ -9,7 +9,7 @@ import gfxprim.input as input import gfxprim.text as text def redraw(bk, id): - c = bk.context + c = bk.pixmap black = c.RGBToPixel(0, 0, 0) white = c.RGBToPixel(0xff, 0xff, 0xff) diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c index 5f270a8a6e88..28ea5bbbfc22 100644 --- a/demos/spiv/image_cache.c +++ b/demos/spiv/image_cache.c @@ -26,7 +26,7 @@ #include "image_cache.h" struct image { - GP_Context *ctx; + GP_Pixmap *pixmap; GP_DataStorage *meta_data; struct image *prev; @@ -73,23 +73,23 @@ size_t image_cache_get_ram_size(void) /* * Reports correct image record size. */ -static size_t image_size2(GP_Context *ctx, GP_DataStorage *meta_data, +static size_t image_size2(GP_Pixmap *pixmap, GP_DataStorage *meta_data, const char *path) { size_t meta_data_size = 0; - size_t context_size = ctx->bytes_per_row * ctx->h + sizeof(GP_Context); + size_t pixmap_size = pixmap->bytes_per_row * pixmap->h + sizeof(GP_Pixmap); //TODO! 4096 is a size of single block, data storage may have more blocks if (meta_data) meta_data_size = 4096; - return meta_data_size + context_size + + return meta_data_size + pixmap_size + sizeof(struct image) + strlen(path) + 1; } static size_t image_size(struct image *img) { - return image_size2(img->ctx, NULL, img->path); + return image_size2(img->pixmap, NULL, img->path); } struct image_cache *image_cache_create(unsigned int max_size_kbytes) @@ -135,7 +135,7 @@ static void remove_img_free(struct image_cache *self, GP_DEBUG(2, "Freeing image '%s' size %zu", img->path, size); remove_img(self, img, size); - GP_ContextFree(img->ctx); + GP_PixmapFree(img->pixmap); GP_DataStorageDestroy(img->meta_data); free(img); } @@ -159,7 +159,7 @@ static void add_img(struct image_cache *self, struct image *img, size_t size) self->end = img; } -int image_cache_get(struct image_cache *self, GP_Context **img, +int image_cache_get(struct image_cache *self, GP_Pixmap **img, GP_DataStorage **meta_data, int elevate, const char *key) { struct image *i; @@ -189,7 +189,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img, } if (img) - *img = i->ctx; + *img = i->pixmap; if (meta_data) *meta_data = i->meta_data; @@ -197,7 +197,7 @@ int image_cache_get(struct image_cache *self, GP_Context **img, return 0; } -GP_Context *image_cache_get2(struct image_cache *self, int elevate, +GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate, const char *fmt, ...) { va_list va; @@ -246,7 +246,7 @@ GP_Context *image_cache_get2(struct image_cache *self, int elevate, if (len >= sizeof(buf)) free(key); - return i ? i->ctx : NULL; + return i ? i->pixmap : NULL; } void image_cache_print(struct image_cache *self) @@ -283,7 +283,7 @@ static int assert_size(struct image_cache *self, size_t size) return 0; } -int image_cache_put(struct image_cache *self, GP_Context *ctx, +int image_cache_put(struct image_cache *self, GP_Pixmap *pixmap, GP_DataStorage *meta_data, const char *key) { size_t size; @@ -291,7 +291,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, if (self == NULL) return 1; - size = image_size2(ctx, meta_data, key); + size = image_size2(pixmap, meta_data, key); /* * We try to create room for the image. If this fails we add the image @@ -307,7 +307,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, return 1; } - img->ctx = ctx; + img->pixmap = pixmap; img->meta_data = meta_data; img->elevated = 0; strcpy(img->path, key); @@ -319,7 +319,7 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, return 0; } -int image_cache_put2(struct image_cache *self, GP_Context *ctx, +int image_cache_put2(struct image_cache *self, GP_Pixmap *pixmap, GP_DataStorage *meta_data, const char *fmt, ...) { size_t size, len; @@ -333,7 +333,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx, va_end(va); //TODO: FIX THIS - size = image_size2(ctx, meta_data, "") + len + 1; + size = image_size2(pixmap, meta_data, "") + len + 1; /* * We try to create room for the image. If this fails we add the image @@ -349,7 +349,7 @@ int image_cache_put2(struct image_cache *self, GP_Context *ctx, return 1; } - img->ctx = ctx; + img->pixmap = pixmap; img->meta_data = meta_data; img->elevated = 0; diff --git a/demos/spiv/image_cache.h b/demos/spiv/image_cache.h index f2ea1fa16e35..5aa40021ed7c 100644 --- a/demos/spiv/image_cache.h +++ b/demos/spiv/image_cache.h @@ -47,20 +47,20 @@ struct image_cache *image_cache_create(unsigned int max_size_kbytes); * If elevate set and image is found, the image is elevated to the top so * it has lesser chance of being freed. */ -int image_cache_get(struct image_cache *self, GP_Context **img, +int image_cache_get(struct image_cache *self, GP_Pixmap **img, GP_DataStorage **meta_data, int elevate, const char *key); -GP_Context *image_cache_get2(struct image_cache *self, int elevate, +GP_Pixmap *image_cache_get2(struct image_cache *self, int elevate, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); /* * Puts an image into a cache. */ -int image_cache_put(struct image_cache *self, GP_Context *img, +int image_cache_put(struct image_cache *self, GP_Pixmap *img, GP_DataStorage *meta_data, const char *key); -int image_cache_put2(struct image_cache *self, GP_Context *img, +int image_cache_put2(struct image_cache *self, GP_Pixmap *img, GP_DataStorage *meta_data, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); diff --git a/demos/spiv/image_loader.c b/demos/spiv/image_loader.c index c7e0f9ba66fc..8f86f92fc259 100644 --- a/demos/spiv/image_loader.c +++ b/demos/spiv/image_loader.c @@ -22,7 +22,7 @@ #include <errno.h> -#include <core/GP_Context.h> +#include <core/GP_Pixmap.h> #include <core/GP_Debug.h> #include <loaders/GP_Loaders.h> @@ -34,7 +34,7 @@ static struct image_cache *img_cache; static struct image_list *img_list; -static GP_Context *cur_img; +static GP_Pixmap *cur_img; static GP_DataStorage *cur_meta_data; static GP_Container *cur_cont; @@ -57,11 +57,11 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes) return 0; } -GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate) +GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate) { struct cpu_timer timer; const char *path; - GP_Context *img; + GP_Pixmap *img; int err, ret; if (cur_img) @@ -154,7 +154,7 @@ static void drop_cur_img(void) * Currently loaded image is too big to be cached -> free it. */ if (image_cache_get(img_cache, NULL, NULL, 0, path)) { - GP_ContextFree(cur_img); + GP_PixmapFree(cur_img); GP_DataStorageDestroy(cur_meta_data); } diff --git a/demos/spiv/image_loader.h b/demos/spiv/image_loader.h index 9992bca70e50..5d2223ee1c7f 100644 --- a/demos/spiv/image_loader.h +++ b/demos/spiv/image_loader.h @@ -31,7 +31,7 @@ #ifndef __IMAGE_LOADER_H__ #define __IMAGE_LOADER_H__ -#include <core/GP_Context.h> +#include <core/GP_Pixmap.h> #include <core/GP_ProgressCallback.h> /* @@ -46,7 +46,7 @@ int image_loader_init(const char *args[], unsigned int cache_max_bytes); * * Note that the callback may not be called when the image is cached. */ -GP_Context *image_loader_get_image(GP_ProgressCallback *callback, int elevate); +GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate); /* * Retruns current image meta data or NULL there are none. diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 91b1a2a3c9e5..947390c964be 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -81,7 +81,7 @@ struct loader_params { static int image_loader_callback(GP_ProgressCallback *self) { static GP_Size size = 0; - GP_Context *c = backend->context; + GP_Pixmap *c = backend->pixmap; if (abort_flag) return 1; @@ -114,7 +114,7 @@ static int image_loader_callback(GP_ProgressCallback *self) return 0; } -static GP_Context *load_image(int elevate); +static GP_Pixmap *load_image(int elevate); static const char *img_name(const char *img_path) { @@ -140,9 +140,9 @@ static void set_caption(const char *path, float rat) /* * Loads image */ -static GP_Context *load_image(int elevate) +static GP_Pixmap *load_image(int elevate) { - GP_Context *img; + GP_Pixmap *img; GP_ProgressCallback callback = {.callback = image_loader_callback, .priv = "Loading image"}; @@ -151,13 +151,13 @@ static GP_Context *load_image(int elevate) if (img) return img; - GP_Context *ctx = backend->context; + GP_Pixmap *pixmap = backend->pixmap; - GP_Fill(ctx, black_pixel); - GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 - 10, + GP_Fill(pixmap, black_pixel); + GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 - 10, GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "'%s'", image_loader_img_path()); - GP_Print(ctx, config.style, ctx->w/2, ctx->h/2 + 10, + GP_Print(pixmap, config.style, pixmap->w/2, pixmap->h/2 + 10, GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "Failed to load image :( (%s)", strerror(errno)); GP_BackendFlip(backend); @@ -166,16 +166,16 @@ static GP_Context *load_image(int elevate) } /* - * Fill context with chessboard-like pattern. + * Fill pixmap with chessboard-like pattern. */ -static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0, +static void pattern_fill(GP_Pixmap *pixmap, unsigned int x0, unsigned int y0, unsigned int w, unsigned int h) { unsigned int x, y, i, j = 0; GP_Pixel col[2]; - col[0] = GP_RGBToContextPixel(0x64, 0x64, 0x64, ctx); - col[1] = GP_RGBToContextPixel(0x80, 0x80, 0x80, ctx); + col[0] = GP_RGBToPixmapPixel(0x64, 0x64, 0x64, pixmap); + col[1] = GP_RGBToPixmapPixel(0x80, 0x80, 0x80, pixmap); unsigned int wm = w/20 < 5 ? 5 : w/20; unsigned int hm = h/20 < 5 ? 5 : h/20; @@ -184,18 +184,18 @@ static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0, i = j; j = !j; for (x = 0; x < w; x += wm) { - GP_FillRectXYWH(ctx, x0 + x, y0 + y, wm, hm, col[i]); + GP_FillRectXYWH(pixmap, x0 + x, y0 + y, wm, hm, col[i]); i = !i; } } } -static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y, +static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); -static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y, +static void info_printf(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, const char *fmt, ...) { va_list va, vac; @@ -203,17 +203,17 @@ static void info_printf(GP_Context *ctx, GP_Coord x, GP_Coord y, va_start(va, fmt); va_copy(vac, va); - GP_VPrint(ctx, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, + GP_VPrint(pixmap, config.style, x-1, y-1, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, black_pixel, white_pixel, fmt, vac); va_end(vac); - GP_VPrint(ctx, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, + GP_VPrint(pixmap, config.style, x, y, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM|GP_TEXT_NOBG, white_pixel, black_pixel, fmt, va); va_end(va); } -static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context, +static unsigned int print_meta_data(GP_DataNode *node, GP_Pixmap *pixmap, unsigned int th, unsigned int y, int level) { GP_DataNode *i; @@ -224,21 +224,21 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context, x = th * level + 10; switch (i->type) { case GP_DATA_INT: - info_printf(context, x, y, "%s : %li", i->id, i->value.i); + info_printf(pixmap, x, y, "%s : %li", i->id, i->value.i); break; case GP_DATA_DOUBLE: - info_printf(context, x, y, "%s : %lf", i->id, i->value.d); + info_printf(pixmap, x, y, "%s : %lf", i->id, i->value.d); break; case GP_DATA_STRING: - info_printf(context, x, y, "%s : %s", i->id, i->value.str); + info_printf(pixmap, x, y, "%s : %s", i->id, i->value.str); break; case GP_DATA_RATIONAL: - info_printf(context, x, y, "%s : %li/%li", + info_printf(pixmap, x, y, "%s : %li/%li", i->id, i->value.rat.num, i->value.rat.den); break; case GP_DATA_DICT: - info_printf(context, x, y, "%s", i->id); - y = print_meta_data(i, context, th, y, level+1); + info_printf(pixmap, x, y, "%s", i->id); + y = print_meta_data(i, pixmap, th, y, level+1); break; } } @@ -246,10 +246,10 @@ static unsigned int print_meta_data(GP_DataNode *node, GP_Context *context, return y; } -static void show_info(struct loader_params *params, GP_Context *img, - GP_Context *orig_img) +static void show_info(struct loader_params *params, GP_Pixmap *img, + GP_Pixmap *orig_img) { - GP_Context *context = backend->context; + GP_Pixmap *pixmap = backend->pixmap; const char *img_path = image_loader_img_path(); set_caption(img_path, params->zoom_rat); @@ -259,17 +259,17 @@ static void show_info(struct loader_params *params, GP_Context *img, GP_Size th = GP_TextHeight(config.style), y = 10; - info_printf(context, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s", + info_printf(pixmap, 10, y, "%ux%u (%ux%u) 1:%3.3f %3.1f%% %s", img->w, img->h, orig_img->w, orig_img->h, params->zoom_rat, params->zoom_rat * 100, GP_PixelTypeName(img->pixel_type)); y += th + 2; - info_printf(context, 10, y, "%s", img_name(img_path)); + info_printf(pixmap, 10, y, "%s", img_name(img_path)); y += th + 2; if (params->zoom_rat != 1.00) { - info_printf(context, 10, y, "%s%s", + info_printf(pixmap, 10, y, "%s%s", params->use_low_pass && params->zoom_rat < 1 ? "Gaussian LP + " : "", GP_InterpolationTypeName(params->resampling_method)); y += th + 2; @@ -278,14 +278,14 @@ static void show_info(struct loader_params *params, GP_Context *img, unsigned int count = image_loader_count(); unsigned int pos = image_loader_pos() + 1; - info_printf(context, 10, y, "%u of %u", pos, count); + info_printf(pixmap, 10, y, "%u of %u", pos, count); y += th + 2; if (image_loader_is_in_dir()) { unsigned int dir_count = image_loader_dir_count(); unsigned int dir_pos = image_loader_dir_pos() + 1; - info_printf(context, 10, y, + info_printf(pixmap, 10, y, "%u of %u in directory", dir_pos, dir_count); } @@ -299,13 +299,13 @@ static void show_info(struct loader_params *params, GP_Context *img, if (node->type != GP_DATA_DICT) return; - print_meta_data(node, context, th + 2, y + th, 0); + print_meta_data(node, pixmap, th + 2, y + th, 0); } -static void update_display(struct loader_params *params, GP_Context *img, - GP_Context *orig_img) +static void update_display(struct loader_params *params, GP_Pixmap *img, + GP_Pixmap *orig_img) { - GP_Context *context = backend->context; + GP_Pixmap *pixmap = backend->pixmap; struct cpu_timer timer; GP_ProgressCallback callback = {.callback = image_loader_callback}; @@ -340,11 +340,11 @@ static void update_display(struct loader_params *params, GP_Context *img, */ if (config.win_strategy == ZOOM_WIN_FIXED) { - if (img->w < context->w) - cx = (context->w - img->w)/2; + if (img->w < pixmap->w) + cx = (pixmap->w - img->w)/2; - if (img->h < context->h) - cy = (context->h - img->h)/2; + if (img->h < pixmap->h) + cy = (pixmap->h - img->h)/2; } if (params->zoom_manual) { @@ -352,49 +352,49 @@ static void update_display(struct loader_params *params, GP_Context *img, cy = params->zoom_y_offset; } - GP_Context sub_display; + GP_Pixmap sub_display; cpu_timer_start(&timer, "Blitting"); if (config.floyd_steinberg) { callback.priv = "Dithering"; - GP_SubContext(context, &sub_display, cx, cy, img->w, img->h); + GP_SubPixmap(pixmap, &sub_display, cx, cy, img->w, img->h); GP_FilterFloydSteinberg(img, &sub_display, NULL); // GP_FilterHilbertPeano(img, &sub_display, NULL); } else { if (GP_PixelHasFlags(img->pixel_type, GP_PIXEL_HAS_ALPHA)) - pattern_fill(context, cx, cy, img->w, img->h); - GP_Blit_Clipped(img, 0, 0, img->w, img->h, context, cx, cy); + pattern_fill(pixmap, cx, cy, img->w, img->h); + GP_Blit_Clipped(img, 0, 0, img->w, img->h, pixmap, cx, cy); } cpu_timer_stop(&timer); /* clean up the rest of the display */ - GP_FillRectXYWH(context, 0, 0, cx, context->h, black_pixel); - GP_FillRectXYWH(context, 0, 0, context->w, cy, black_pixel); + GP_FillRectXYWH(pixmap, 0, 0, cx, pixmap->h, black_pixel); + GP_FillRectXYWH(pixmap, 0, 0, pixmap->w, cy, black_pixel); - int w = context->w - img->w - cx; + int w = pixmap->w - img->w - cx; if (w > 0) - GP_FillRectXYWH(context, img->w + cx, 0, w, context->h, black_pixel); + GP_FillRectXYWH(pixmap, img->w + cx, 0, w, pixmap->h, black_pixel); - int h = context->h - img->h - cy; + int h = pixmap->h - img->h - cy; if (h > 0) - GP_FillRectXYWH(context, 0, img->h + cy, context->w, h, black_pixel); + GP_FillRectXYWH(pixmap, 0, img->h + cy, pixmap->w, h, black_pixel); show_info(params, img, orig_img); if (config.combined_orientation) - GP_ContextFree(img); + GP_PixmapFree(img); GP_BackendFlip(backend); } -GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h) +GP_Pixmap *load_resized_image(struct loader_params *params, GP_Size w, GP_Size h) { - GP_Context *img, *res = NULL; + GP_Pixmap *img, *res = NULL; struct cpu_timer timer; GP_ProgressCallback callback = {.callback = image_loader_callback}; @@ -414,10 +414,10 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size if (params->show_nn_first) { /* Do simple interpolation and blit the result */ - GP_Context *nn = GP_FilterResizeNNAlloc(img, w, h, NULL); + GP_Pixmap *nn = GP_FilterResizeNNAlloc(img, w, h, NULL); if (nn != NULL) { update_display(params, nn, img); - GP_ContextFree(nn); + GP_PixmapFree(nn); } } @@ -441,7 +441,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size cpu_timer_start(&timer, "Resampling"); callback.priv = "Resampling Image"; - GP_Context *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback); + GP_Pixmap *i1 = GP_FilterResizeAlloc(img, w, h, params->resampling_method, &callback); img = i1; cpu_timer_stop(&timer); @@ -454,8 +454,8 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size } */ - /* Free low passed context if needed */ - GP_ContextFree(res); + /* Free low passed pixmap if needed */ + GP_PixmapFree(res); if (img == NULL) return NULL; @@ -593,7 +593,7 @@ static void *image_loader(void *ptr) { struct loader_params *params = ptr; struct cpu_timer sum_timer; - GP_Context *img, *orig_img, *context = backend->context; + GP_Pixmap *img, *orig_img, *pixmap = backend->pixmap; cpu_timer_start(&sum_timer, "sum"); @@ -609,7 +609,7 @@ static void *image_loader(void *ptr) GP_Size w, h; params->zoom_rat = calc_img_size(params, orig_img->w, orig_img->h, - context->w, context->h); + pixmap->w, pixmap->h); w = orig_img->w * params->zoom_rat + 0.5; h = orig_img->h * params->zoom_rat + 0.5; @@ -788,7 +788,7 @@ static uint32_t timer_callback(GP_Timer *self) int main(int argc, char *argv[]) { - GP_Context *context = NULL; + GP_Pixmap *pixmap = NULL; int shift_flag; int opts; @@ -853,13 +853,13 @@ int main(int argc, char *argv[]) GP_BACKEND_CALL_EXIT); } - context = backend->context; + pixmap = backend->pixmap; - black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); - gray_pixel = GP_RGBToContextPixel(0x33, 0x33, 0x33, context); + black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); + gray_pixel = GP_RGBToPixmapPixel(0x33, 0x33, 0x33, pixmap); - GP_Fill(context, black_pixel); + GP_Fill(pixmap, black_pixel); GP_BackendFlip(backend); params.show_progress_once = 1; @@ -1115,7 +1115,7 @@ int main(int argc, char *argv[]) /* stop loader thread before resizing backend buffer */ stop_loader(); GP_BackendResizeAck(backend); - GP_Fill(backend->context, 0); + GP_Fill(backend->pixmap, 0); params.show_progress_once = 1; show_image(¶ms); break; diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index 2d7eac9430d4..aad401055a93 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -234,9 +234,9 @@ static int last_line; static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff) { - GP_Context *c = backend->context; - GP_Pixel black = GP_RGBToContextPixel(0x00, 0x00, 0x00, c); - GP_Pixel white = GP_RGBToContextPixel(0xff, 0xff, 0xff, c); + GP_Pixmap *c = backend->pixmap; + GP_Pixel black = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, c); + GP_Pixel white = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, c); int i; int spacing = GP_TextHeight(config.style)/10 + 2; diff --git a/demos/ttf2img/ttf2img.c b/demos/ttf2img/ttf2img.c index deaa37a48fab..0e75546a7ebd 100644 --- a/demos/ttf2img/ttf2img.c +++ b/demos/ttf2img/ttf2img.c @@ -74,23 +74,23 @@ int main(int argc, char *argv[]) GP_SetDebugLevel(debug_level); - GP_Context *context = GP_ContextAlloc(img_w, img_h, GP_PIXEL_RGB888); + GP_Pixmap *pixmap = GP_PixmapAlloc(img_w, img_h, GP_PIXEL_RGB888); - GP_Pixel black_pixel = GP_RGBToContextPixel(0x00, 0x00, 0x00, context); - GP_Pixel white_pixel = GP_RGBToContextPixel(0xff, 0xff, 0xff, context); + GP_Pixel black_pixel = GP_RGBToPixmapPixel(0x00, 0x00, 0x00, pixmap); + GP_Pixel white_pixel = GP_RGBToPixmapPixel(0xff, 0xff, 0xff, pixmap); - GP_Fill(context, white_pixel); + GP_Fill(pixmap, white_pixel); GP_TextStyle style = GP_DEFAULT_TEXT_STYLE; style.font = GP_FontFaceLoad(font_path, 27, 0); - GP_Text(context, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER, + GP_Text(pixmap, &style, img_w/2, img_h/2, GP_ALIGN_CENTER|GP_VALIGN_CENTER, black_pixel, white_pixel, string); - GP_SavePNG(context, img_path, NULL); + GP_SavePNG(pixmap, img_path, NULL); - GP_ContextFree(context); + GP_PixmapFree(pixmap); return 0; } diff --git a/doc/Makefile b/doc/Makefile index 9c1bcfb73242..5da5636ad7ec 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,7 +1,7 @@ TOPDIR=.. include $(TOPDIR)/config.mk -SOURCES=index.html about.txt context.txt loaders.txt filters.txt \ +SOURCES=index.html about.txt pixmap.txt loaders.txt filters.txt \ basic_types.txt gfx.txt backends.txt gamma.txt grabbers.txt \ environment_variables.txt debug.txt core.txt input.txt \ gen.txt pixels.txt coordinate_system.txt coding_style.txt \ diff --git a/doc/about.txt b/doc/about.txt index 167425abe289..96f3652b7238 100644 --- a/doc/about.txt +++ b/doc/about.txt @@ -17,7 +17,7 @@ Core Core of the library contains minimal amount of code to define interface that is shared between all parts of the library. -The most important part of the core is link:context.html[CP_Context] structure +The most important part of the core is link:pixmap.html[GP_Pixmap] structure that represents in-memory pixmap. The Core also contains generated code for basic operations such as diff --git a/doc/backends.txt b/doc/backends.txt index 944c13f3e2db..a4834660817d 100644 --- a/doc/backends.txt +++ b/doc/backends.txt @@ -80,15 +80,15 @@ window resizable. [source,c] ------------------------------------------------------------------------------- -#include <backends/GP_SDL_Context.h> +#include <backends/GP_SDL_Pixmap.h> -int GP_ContextFromSDLSurface(GP_Context *c, const SDL_Surface *surf); +int GP_PixmapFromSDLSurface(GP_Pixmap *c, const SDL_Surface *surf); ------------------------------------------------------------------------------- This function allows you to mix 'SDL' and 'GFXprim' code. -It initializes a 'GFXprim' context from the 'SDL' surface using the pixel -buffer from surface as pixel buffer for the context. +It initializes a 'GFXprim' pixmap from the 'SDL' surface using the pixel +buffer from surface as pixel buffer for the pixmap. Function returns zero on success and non-zero on failure (i.e. there is no 'GFXprim' pixel type to match given surface). @@ -243,9 +243,9 @@ typdef struct GP_Backend { const char *name; /* - * Pointer to context APP should draw to. + * Pointer to pixmap APP should draw to. */ - GP_Context *context; + GP_Pixmap *pixmap; ... @@ -595,8 +595,8 @@ was successful (i.e. X server allowed us to resize the window) the resize event will be send and should be handled in your event loop. You must respond to it by the 'GP_BackendResizeAck()' described below. -NOTE: The backend->context pointer may change upon calling this function and - at least backend->context->pixels pointer will change. +NOTE: The backend->pixmap pointer may change upon calling this function and + at least backend->pixmap->pixels pointer will change. [[ResizeAck]] @@ -613,10 +613,10 @@ int GP_BackendResizeAck(GP_Backend *self); ------------------------------------------------------------------------------- If backend is resizable by user interaction (for example X Window) you will -get resize event for each change of window size, however the backend context +get resize event for each change of window size, however the backend pixmap will not be resized until you call this function. This is useful in multi-threaded application where one threads waits for events and others draws -into the buffer so you can stop the drawing threads before the backend context +into the buffer so you can stop the drawing threads before the backend pixmap size change. diff --git a/doc/backends_python.txt b/doc/backends_python.txt index 183b4c183ba4..b53b6bd74f61 100644 --- a/doc/backends_python.txt +++ b/doc/backends_python.txt @@ -87,8 +87,8 @@ import gfxprim.backends as backends # Assert that inicialization was successful assert(bk) - # Now you can draw into the backend via bk.context - bk.context.gfx.Fill(bk.context.RGBToPixel(0, 0, 0)); + # Now you can draw into the backend via bk.pixmap + bk.pixmap.gfx.Fill(bk.pixmap.RGBToPixel(0, 0, 0)); # If backend is buffered, changes are not propagated unless the screen is # updated via Flip() diff --git a/doc/blits.txt b/doc/blits.txt index d2e4e372de37..5a5373767e02 100644 --- a/doc/blits.txt +++ b/doc/blits.txt @@ -24,17 +24,17 @@ into destination pixel type to speed up the blitting. /* or */ #include <core/GP_Blit.h> -void GP_Blit(const GP_Context *src, +void GP_Blit(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -void GP_BlitXYWH(const GP_Context *src, +void GP_BlitXYWH(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -void GP_BlitXYXY(const GP_Context *src, +void GP_BlitXYXY(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, - GP_Context *dst, GP_Coord x2, GP_Coord y2); + GP_Pixmap *dst, GP_Coord x2, GP_Coord y2); -------------------------------------------------------------------------------- Blit functions to copy rectangular area from source to destination. @@ -54,18 +54,18 @@ WARNING: For these functions the behavior is undefined when you pass /* or */ #include <core/GP_Blit.h> -void GP_BlitXYXY_Clipped(const GP_Context *src, +void GP_BlitXYXY_Clipped(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, - GP_Context *dst, GP_Coord x2, GP_Coord y2); + GP_Pixmap *dst, GP_Coord x2, GP_Coord y2); -void GP_BlitXYWH_Clipped(const GP_Context *src, +void GP_BlitXYWH_Clipped(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -void GP_Blit_Clipped(const GP_Context *src, +void GP_Blit_Clipped(const GP_Pixmap *src, GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0, - GP_Context *dst, GP_Coord x1, GP_Coord y1); + GP_Pixmap *dst, GP_Coord x1, GP_Coord y1); -------------------------------------------------------------------------------- Blit functions to copy rectangular area from source to destination. Both diff --git a/doc/coding_style.txt b/doc/coding_style.txt index ebd0f3f11145..c23ad06bd524 100644 --- a/doc/coding_style.txt +++ b/doc/coding_style.txt @@ -108,14 +108,14 @@ GFXprim Specific Rules * Library external API uses CamelCase ** Together with mandatory 'GP_' prefix. -** For example 'GP_PixelType', 'GP_Context', etc. +** For example 'GP_PixelType', 'GP_Pixmap', etc. ** We will not change that, get over it. (It could have been worse, trust me.) * Basic library types are typedefed ** We have 'GP_Size' and 'GP_Coord' integer types to better distinguish roles of function parameters. -** The basic structures are also typedefed so you can wite 'GP_Context' - instead of 'struct GP_Context'. +** The basic structures are also typedefed so you can wite 'GP_Pixmap' + instead of 'struct GP_Pixmap'. ** Other uses of typedef are frowned upon. * When you add an externally visible symbol, i.e. new API function @@ -143,5 +143,5 @@ All constants are available in 'foo.C' submodules (i.e. 'core.C') to avoid clutter. Where this makes sense, functions should be available as methods of -an object (i.e. 'Context.Copy()' rather than 'Copy(context)'). Be Pythonic. +an object (i.e. 'Pixmap.Copy()' rather than 'Copy(pixmap)'). Be Pythonic. diff --git a/doc/context.txt b/doc/context.txt deleted file mode 100644 index 37287f7e8669..000000000000 --- a/doc/context.txt +++ /dev/null @@ -1,309 +0,0 @@ -Drawing Context ---------------- - -The 'GP_Context' structure describes an 'in memory' pixmap. The structure -contains all metadata needed for drawing, loaders and filters. - -Data Structure -~~~~~~~~~~~~~~ - -[source,c] -------------------------------------------------------------------------------- -typedef struct GP_Context { - uint8_t *pixels; /* pointer to image pixels */ - uint8_t bpp; /* pixel length in bits */ - uint32_t bytes_per_row; - uint32_t w; /* width in pixels */ - uint32_t h; /* height in pixels */ - /* - * Row bit offset. The offset is ignored for byte aligned pixels. - * Basically it's used for non aligned pixels with combination - * with subcontextes. - */ - uint8_t offset; - - enum GP_PixelType pixel_type; /* pixel format */ - - /* - * Pointer to optional Gamma correction tables. - */ - struct GP_Gamma *gamma; - - uint8_t axes_swap:1; /* swap axes */ - uint8_t x_swap:1; /* mirror x */ - uint8_t y_swap:1; /* mirror y */ - uint8_t bit_endian:1; /* GP_BIT_ENDIAN */ - uint8_t free_pixels:1; /* if set GP_ContextFree() calls free on context->pixels */ -} GP_Context; -------------------------------------------------------------------------------- - -The 'pixels' field points to the image data. - -The 'pixels' are stored as a one-dimensional array consisting of byte-aligned -lines (i.e. each image line starts at whole byte and ends at whole byte). - -The 'pixels' array starts exactly at upper left corner of the image and is -stored in horizontal lines (each line contains 'w' pixels and there is 'h' -lines). Each line is 'bytes_per_row' bytes long (which equals to 'w * bpp / -8' rouned up to the whole bytes). The first pixel may actually start at -'offset' bit in the first byte in each line (but only for some -<<Sub_Context,subcontexts>> for pixel types that are not byte aligned). - -The link:pixels.html[pixel_type enumeration] defines in which format and how -are pixel data stored in the 'pixels' buffer, i.e. organization and function -of the pixel channels. - -The optional pointer to link:gamma.html[gamma tables] describes per-channel -gamma correction. Unfortunatelly very few parts of the library use it at the -moment (this will be fixed in subsequent releases). - -The bitfield at the the end of the structure describes image orientation (see -below) and a flag that tell if 'pixels' data should be freed, which is -usefull for example for <<Sub_Context, subcontexts>>. - -Rotation -^^^^^^^^ - -The orientation flags affects the gfx and text drawing functions and blits. If -some of the flags is changed the origin and direction of the drawing is -changed accordingly. Note that the image pixels are not affected by this at -all only the coordinates passed to drawing functions are transformed. - -If you don't need this functionality just don't touch the flags the as -overhead of these transformations is not measurable. - -If you really need drawing primitives that do not use the orientation flags, -you could use variants with _Raw suffix (although this is not recommended). - -There are various helper macros for transforming coordinates and sizes in -'core/GP_Transform.h'. And context helper functions to "rotate" the flags -clock wise and counter clock wise as well as functions to get the context size -when taking into the account the width and height. - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Transform.h> -/* or */ -#include <GP.h> - -/* Transforms point user coordinates to bitmap coordinates */ -GP_TRANSFORM_POINT(context, x, y) - -/* Transforms rectangular area coordinates and size */ -GP_TRANSFORM_RECT(context, x, y, w, h) - -/* Inverse transformation, bitmap coordinates to user coordinates */ -GP_RETRANSFORM_POINT(context, x, y) -------------------------------------------------------------------------------- - -[source,c] ------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -/* - * Rotate context flags clock wise. - */ -void GP_ContextRotateCW(GP_Context *context); - -/* - * Rotate context flags counter clock wise. - */ -void GP_ContextRotateCCW(GP_Context *context); - -/* - * Retruns 1 if rotation flags are equal. - */ -int GP_ContextRotationEqual(const GP_Context *c1, const GP_Context *c2); - -/* - * Sets context rotation flags. - */ -void GP_ContextSetRotation(GP_Context *dst, int axes_swap, - int x_swap, int y_swap); - -/* - * Copies rotation flags. - */ -void GP_ContextCopyRotation(const GP_Context *src, GP_Context *dst); - -/* - * Returns context width and height taking the rotation flags into the account. - */ -GP_Size GP_ContextW(const GP_Context *context); -GP_Size GP_ContextH(const GP_Context *context); -------------------------------------------------------------------------------- - -Basic context functions -~~~~~~~~~~~~~~~~~~~~~~~ - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -GP_Context *GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h, - GP_PixelType type, void *pixels); -------------------------------------------------------------------------------- - -Initialize given context accordingly to parameters, the rest of context -parameters are set to the default values (i.e. rotation flags are all set to -zero, 'free_pixels' flag is not set). Number of bits per pixel and -bytes per row are computed from the given pixel type and size. - -The 'pixels' pointer can be NULL and can be changed later manually (the call -will *not* try to allocate the pixel memory automatically). - -The function returns a pointer to the initialized context (i.e. the same -pointer you passed as second argument). - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type); -------------------------------------------------------------------------------- - -The 'GP_ContextAlloc()' allocates and initializes a context. - -The orientation flags are all set to zero, the 'free_pixels' flag is set and the -rest of the metadata are calculated accordingly to width, height and -pixel_type.The 'pixels' pointer will point to a newly allocated bitmap with -appropriate size; the initial contents of the bitmap are undefined. - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -enum GP_ContextCopyFlags { - /* - * Copy bitmap pixels too. If not set pixels are uninitialized. - */ - GP_COPY_WITH_PIXELS = 0x01, - /* - * Copy image rotation flags. If not set flags are set to (0, 0, 0). - */ - GP_COPY_WITH_ROTATION = 0x02, -}; - -GP_Context *GP_ContextCopy(const GP_Context *src, int flags); -------------------------------------------------------------------------------- - -The 'GP_ContextCopy()' allocates and initializes a copy of the context passed -as arguments. - -The call returns pointer to newly allocated context or in case of 'malloc()' -failure NULL. - -If 'GP_COPY_WITH_PIXELS' is set, the bitmap contents ('src->pixels') are also -copied; otherwise the copy will have the same dimensions but undefined -contents. - -If 'GP_COPY_WITH_ROTATION' is set rotation flags are copied; otherwise rotation -flags are set to zero. - -The 'free_pixels' flag for the resulting context is set. - -[[ContextFree]] -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -void GP_ContextFree(GP_Context *context); -------------------------------------------------------------------------------- - -Frees the context memory. - -If 'free_pixels' flag is set, the pixels buffer is freed too. - -If gamma pointer is not NULL the 'GP_GammaRelease()' is called. - -[[Sub_Context]] -Subcontext -~~~~~~~~~~ - -A subcontext is a context that refers to a rectangular area within another -context. Subcontexts can be used as any other contexts (including subcontext -creation). - -WARNING: If you create overlaping subcontexts the result is undefined. - -Calling 'GP_ContextFree()' on a allocated subcontext is safe; the bitmap is -not freed as it belongs to another context; it will be freed when the parent -context is freed (i.e. the 'free_pixels' flag is not set when creating -subcontext). - -CAUTION: The subcontext doesn't hold a reference to the original context, so - once the parent context is freed the subcontext pixels pointer is not - valid anymore. - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -GP_Context *GP_SubContext(const GP_Context *context, GP_Context *subcontext, - GP_Coord x, GP_Coord y, GP_Size w, GP_Size h); - -GP_Context *GP_SubContextAlloc(const GP_Context *context, - GP_Coord x, GP_Coord y, GP_Size w, GP_Size h); -------------------------------------------------------------------------------- - -Creates subcontext of a context. The rectangular area must fit into the parent -context. - -The 'GP_SubContext()' function initializes the passed pointer as a subcontext -of a context and returns pointer to the initialized subcontext (i.e. the same -pointer you passed as the subcontext parameter). - -The 'GP_SubContextAlloc()' function allocates 'GP_Context' structure and -initializes it as a subcontext. This function may return NULL in case of -'malloc()' failure and the newly created context should be later freed with -'GP_ContextFree()'. - -Conversions -~~~~~~~~~~~ - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -GP_Context *GP_ContextConvertAlloc(const GP_Context *src, - GP_PixelType dst_pixel_type); - -GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst); - -------------------------------------------------------------------------------- - -Converts a context to different pixel type. - -This is naive implementation that only multiplies/divides the pixel values. - -To get a better result use link:filters.html#Dithering[dithering filters] instead. - -Misc -~~~~ - -[source,c] -------------------------------------------------------------------------------- -#include <core/GP_Context.h> -/* or */ -#include <GP.h> - -void GP_ContextPrintInfo(const GP_Context *self); -------------------------------------------------------------------------------- - -This function prints the content of a 'GP_Context' structure, in a readable -format, into the stdout. - diff --git a/doc/convert.txt b/doc/convert.txt index f11f932a4c42..a534ecb56b5a 100644 --- a/doc/convert.txt +++ b/doc/convert.txt @@ -14,11 +14,11 @@ GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b, GP_PixelType type); GP_Pixel GP_RGBAToPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, GP_PixelType type); -GP_Pixel GP_RGBToContextPixel(uint8_t r, uint8_t g, uint8_t b, - const GP_Context *context); +GP_Pixel GP_RGBToPixmapPixel(uint8_t r, uint8_t g, uint8_t b, + const GP_Pixmap *pixmap); -GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, - const GP_Context *context); +GP_Pixel GP_RGBAToPixmapPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, + const GP_Pixmap *pixmap); ------------------------------------------------------------------------------- Simple functions to convert RGB or RGBA 8 bit values into the specific diff --git a/doc/core.txt b/doc/core.txt index 1ae253a6d293..439494a6021d 100644 --- a/doc/core.txt +++ b/doc/core.txt @@ -4,7 +4,7 @@ Library Core Library core contains all basic data structures and functions that forms the glue which holds the GFXprim libraries together. -The most important data structure is a link:context.html[Context] which +The most important data structure is a link:pixmap.html[Pixmap] which describes in-memory pixmap which is used extensively in all parts of the library. @@ -20,7 +20,7 @@ or link:progress_callback.html[Progress callback]. [grid="rows"] [options="autowidth"] |============================================================================= -| link:context.html[Context] | Describes in-memory pixmap +| link:pixmap.html[Pixmap] | Describes in-memory pixmap | link:basic_types.html[Basic types] | Types for size, lenght, pixel and color @@ -30,7 +30,7 @@ or link:progress_callback.html[Progress callback]. | link:get_put_pixel.html[GetPixel and PutPixel] | Macros and functions to get and put pixels -| link:blits.html[Blits] | Blits (copies) a rectangular area from one context to +| link:blits.html[Blits] | Blits (copies) a rectangular area from one pixmap to another as well as simple pixel format conversions | link:progress_callback.html[Progress Callback] | Progress callback passed diff --git a/doc/core_python.txt b/doc/core_python.txt index 108c8594360c..0b960007a586 100644 --- a/doc/core_python.txt +++ b/doc/core_python.txt @@ -3,28 +3,28 @@ Python Core module The python binding maps mostly to the C API with the 'GP_' prefix stripped. -However structures as 'GP_Context' are not created by the 'GP_ContextAlloc()' +However structures as 'GP_Pixmap' are not created by the 'GP_PixmapAlloc()' function but have proper constructor and destructor to keep the Python reference counting happy. Then there are a bit more tricky solutions, such as 'GP_ProgressCallback' which needs a proxy function to call the python callback from the C code. -Context +Pixmap ~~~~~~~ [source,python] ------------------------------------------------------------------------------- import gfxprim.core as core - # Create 100x100 RGB888 context - c = core.Context(100, 100, core.C.PIXEL_RGB888) + # Create 100x100 RGB888 pixmap + c = core.Pixmap(100, 100, core.C.PIXEL_RGB888) print("w={} h={} bpp={}".format(c.w, c.h, c.bpp)) ------------------------------------------------------------------------------- -Creates a context of a particular size and pixel type. +Creates a pixmap of a particular size and pixel type. First two parameters are 'width' and 'height' third is pixel type which is an enumeration @@ -41,7 +41,7 @@ enumeration ------------------------------------------------------------------------------- import gfxprim.core as core - pixel = context.GetPixel(x, y) + pixel = pixmap.GetPixel(x, y) ------------------------------------------------------------------------------- @@ -52,7 +52,7 @@ returned. ------------------------------------------------------------------------------- import gfxprim.core as core - context.PutPixel(x, y, pixel) + pixmap.PutPixel(x, y, pixel) ------------------------------------------------------------------------------- @@ -66,11 +66,11 @@ NOTE: You may want to see link:coordinate_system.html[coordinate system] ------------------------------------------------------------------------------- import gfxprim.core as core - grayscale = context.Convert(core.C.PIXEL_G8) + grayscale = pixmap.Convert(core.C.PIXEL_G8) ------------------------------------------------------------------------------- -Returns context converted into the desired pixel format. +Returns pixmap converted into the desired pixel format. The conversion is naive i.e. the values are just divided/multiplied. @@ -80,15 +80,15 @@ The conversion is naive i.e. the values are just divided/multiplied. ------------------------------------------------------------------------------- import gfxprim.core as core - # Blits context to target starting at - # sx and sy in the source context + # Blits pixmap to target starting at + # sx and sy in the source pixmap # tx and ty in in the target - context.Blit(sx, sy, target, tx, ty, w, h) + pixmap.Blit(sx, sy, target, tx, ty, w, h) # Alternatively the size can be described by # coordinates in the source or target - context.Blit(sx, sy, target, tx, ty, sx2=, sy2=) - context.Blit(sx, sy, target, tx, ty, tx2=, ty2=) + pixmap.Blit(sx, sy, target, tx, ty, sx2=, sy2=) + pixmap.Blit(sx, sy, target, tx, ty, tx2=, ty2=) ------------------------------------------------------------------------------- @@ -118,8 +118,8 @@ import gfxprim.core as core # You can create a pixel from RGB and pixel type black = core.RGBToPixel(0, 0, 0, core.C.PIXEL_G1) - # Or using shortcut from context - black = context.RGBToPixel(0, 0, 0) + # Or using shortcut from pixmap + black = pixmap.RGBToPixel(0, 0, 0) ------------------------------------------------------------------------------- @@ -170,5 +170,5 @@ import gfxprim.core as core Sets and gets the GFXprim debug level. See link:debug.html[debug messages] description for more details. -These are basic 'Context' methods from core module. Importing other modules +These are basic 'Pixmap' methods from core module. Importing other modules will add some other (for example gfx module adds all drawing functions). diff --git a/doc/debug.txt b/doc/debug.txt index 09c80aa0e560..b209b53a56c6 100644 --- a/doc/debug.txt +++ b/doc/debug.txt @@ -5,7 +5,7 @@ The GFXprim library includes a debug message infrastructure in order to ease the debugging. Many places of the library uses debug messages to report warnings, bugs, or -generally important events (i.e. context has been allocated, filter function +generally important events (i.e. pixmap has been allocated, filter function has been called). Debug messages are printed into the stderr and could be redirected to custom diff --git a/doc/environment_variables.txt b/doc/environment_variables.txt index 5ce7488a02f8..216f19f1e8a3 100644 --- a/doc/environment_variables.txt +++ b/doc/environment_variables.txt @@ -48,13 +48,13 @@ The output is, by default, written to stderr and will look like: 1: GP_Loader.c:loader_by_filename():222: Loading file by filename extension 'pgm' 1: GP_Loader.c:loader_by_extension():198: Found loader 'Netpbm portable Graymap' 1: GP_PNM.c:load_header():244: Have header P2 (ASCII encoded PGM) 24x7 depth=15 -1: GP_Context.c:GP_ContextAlloc():62: Allocating context 24 x 7 - G4 +1: GP_Pixmap.c:GP_PixmapAlloc():62: Allocating pixmap 24 x 7 - G4 4: GP_X11.c:x11_update_rect():71: Updating rect 222x458-418x479 4: GP_X11.c:x11_update_rect():71: Updating rect 214x458-426x479 2: GP_Blit.c:GP_BlitXYXY_Clipped():129: Blitting 23x6, available 332x244 2: GP_Blit.c:GP_BlitXYXY_Clipped():139: Blitting 0x0->23x6 in 24x7 to 308x236 in 640x480 3: GP_X11.c:x11_set_attributes():225: Setting window caption to 'Spiv ~ test.pgm 1:1.000' - 4: GP_X11.c:x11_flip():91: Flipping context -1: GP_Context.c:GP_ContextFree():102: Freeing context (0x7f5008000b60) + 4: GP_X11.c:x11_flip():91: Flipping pixmap +1: GP_Pixmap.c:GP_PixmapFree():102: Freeing pixmap (0x7f5008000b60) 1: GP_X11_Conn.h:x11_close():72: Closing X11 display ------------------------------------------------------------------------------ diff --git a/doc/example_SDL_glue.txt b/doc/example_SDL_glue.txt index 804898f4b74b..5e12aac6ce32 100644 --- a/doc/example_SDL_glue.txt +++ b/doc/example_SDL_glue.txt @@ -1,7 +1,7 @@ SDL Glue -------- -You can easily mix SDL and GFXprim code using 'GP_ContextFromSDLSurface()' +You can easily mix SDL and GFXprim code using 'GP_PixmapFromSDLSurface()' function. [source,c] diff --git a/doc/filters.txt b/doc/filters.txt index c0cc54666c31..da1cf5aa4f0d 100644 --- a/doc/filters.txt +++ b/doc/filters.txt @@ -1,12 +1,12 @@ -Context filters +Pixmap filters --------------- -Pixel filters for 'GP_Context'. +Pixel filters for 'GP_Pixmap'. -The context filter is basically a function that operates on context pixels. +The pixmap filter is basically a function that operates on pixmap pixels. The result may be stored into a new bitmap or placed to bitmap passed as argument or, in some cases, the filter could be used 'in place' so the result -is stored into the same context as the one passed as filter source. +is stored into the same pixmap as the one passed as filter source. Common filter API ~~~~~~~~~~~~~~~~~ @@ -22,21 +22,21 @@ For convenience, the filters API is unified: * And the last argument is link:progress_callback.html[progress callback] When using allocating version of the filter, pointer to the newly allocated -context is returned, or in case of failure NULL is returned. +pixmap is returned, or in case of failure NULL is returned. If 'malloc()' has failed NULL is returned. If filter has been interrupted by a callback, all allocated memory is freed, and NULL is returned. -When using non-allocating variant of the filter, the destination context must +When using non-allocating variant of the filter, the destination pixmap must have correct pixel type and the size must be big enough to store the result. The return value from such filter is either zero, in case of success, or non-zero when filter was interrupted by a callback. For filters that work 'in-place' (which is explicitly said for each filter) -the source and the destination could be the same context. Note that this is -not expected to work if you do several overlapping sub-contexts and pass these +the source and the destination could be the same pixmap. Note that this is +not expected to work if you do several overlapping sub-pixmaps and pass these as arguments. [source,c] @@ -44,11 +44,11 @@ as arguments. /* * Filter common API. */ -int GP_FilterFoo(const GP_Context *src, GP_Context *dst, +int GP_FilterFoo(const GP_Pixmap *src, GP_Pixmap *dst, foo params ..., GP_ProgressCallback *callback); -GP_Context *GP_FilterFooAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterFooAlloc(const GP_Pixmap *src, foo params ..., GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -71,10 +71,10 @@ Invert /* or */ #include <filters/GP_Point.h> -int GP_FilterInvert(const GP_Context *src, GP_Context *dst, +int GP_FilterInvert(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterInvertAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterInvertAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -91,10 +91,10 @@ Brightness /* or */ #include <filters/GP_Point.h> -int GP_FilterBrightness(const GP_Context *src, GP_Context *dst, +int GP_FilterBrightness(const GP_Pixmap *src, GP_Pixmap *dst, float p, GP_ProgressCallback *callback); -GP_Context *GP_FilterBrightnessAlloc(const GP_Context *src, float p, +GP_Pixmap *GP_FilterBrightnessAlloc(const GP_Pixmap *src, float p, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -111,10 +111,10 @@ Contrast /* or */ #include <filters/GP_Point.h> -int GP_FilterContrast(const GP_Context *src, GP_Context *dst, +int GP_FilterContrast(const GP_Pixmap *src, GP_Pixmap *dst, float p, GP_ProgressCallback *callback); -GP_Context *GP_FilterContrastAlloc(const GP_Context *src, float p, +GP_Pixmap *GP_FilterContrastAlloc(const GP_Pixmap *src, float p, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -131,11 +131,11 @@ BrightnessContrast /* or */ #include <filters/GP_Point.h> -int GP_FilterBrightnessContrast(const GP_Context *src, GP_Context *dst, +int GP_FilterBrightnessContrast(const GP_Pixmap *src, GP_Pixmap *dst, float b, float c, GP_ProgressCallback *callback); -GP_Context *GP_FilterBrightnessContrastAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterBrightnessContrastAlloc(const GP_Pixmap *src, float b, float c, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -153,10 +153,10 @@ Posterize /* or */ #include <filters/GP_Point.h> -int GP_FilterPosterize(const GP_Context *src, GP_Context *dst, +int GP_FilterPosterize(const GP_Pixmap *src, GP_Pixmap *dst, unsigned int levels, GP_ProgressCallback *callback); -GP_Context *GP_FilterPosterizeAlloc(const GP_Context *src, unsigned int levels, +GP_Pixmap *GP_FilterPosterizeAlloc(const GP_Pixmap *src, unsigned int levels, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -174,27 +174,27 @@ Gaussian additive noise filter /* or */ #include <filters/GP_GaussianNoise.h> -int GP_FilterGaussianNoiseAddEx(const GP_Context *src, +int GP_FilterGaussianNoiseAddEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float sigma, float mu, GP_ProgressCallback *callback); -GP_Context *GP_FilterGaussianNoiseAddExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterGaussianNoiseAddExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, float sigma, float mu, GP_ProgressCallback *callback); -static inline int GP_FilterGaussianNoiseAdd(const GP_Context *src, - GP_Context *dst, +static inline int GP_FilterGaussianNoiseAdd(const GP_Pixmap *src, + GP_Pixmap *dst, float sigma, float mu, GP_ProgressCallback *callback); -static inline GP_Context * -GP_FilterGaussianNoiseAddAlloc(const GP_Context *src, +static inline GP_Pixmap * +GP_FilterGaussianNoiseAddAlloc(const GP_Pixmap *src, float sigma, float mu, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -210,12 +210,12 @@ include::images/gaussian_noise/images.txt[] Arithmetic filters ~~~~~~~~~~~~~~~~~~ -Arithmetic filters do take two contexts as an input and combines them into one -output context. +Arithmetic filters do take two pixmaps as an input and combines them into one +output pixmap. -The pixel type of both input contexts must match. +The pixel type of both input pixmaps must match. -If size of the input contexts differs, minimum is used. +If size of the input pixmaps differs, minimum is used. [source,c] ------------------------------------------------------------------------------- @@ -223,17 +223,17 @@ If size of the input contexts differs, minimum is used. /* or */ #include <GP.h> -int GP_FilterAddition(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterAddition(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterAdditionAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterAdditionAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Produces saturated (clamped) addition of two contexts. +Produces saturated (clamped) addition of two pixmaps. [source,c] ------------------------------------------------------------------------------- @@ -241,17 +241,17 @@ Produces saturated (clamped) addition of two contexts. /* or */ #include <GP.h> -int GP_FilterMultiply(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterMultiply(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMultiplyAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterMultiplyAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Produces saturated (clamped) multiplication of two contexts. +Produces saturated (clamped) multiplication of two pixmaps. [source,c] ------------------------------------------------------------------------------- @@ -259,13 +259,13 @@ Produces saturated (clamped) multiplication of two contexts. /* or */ #include <GP.h> -int GP_FilterDifference(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterDifference(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterDifferenceAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterDifferenceAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -278,22 +278,22 @@ Produces symmetric difference (i.e. abs(a - b)). /* or */ #include <GP.h> -int GP_FilterMax(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterMax(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMaxAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterMaxAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); -int GP_FilterMin(const GP_Context *src_a, - const GP_Context *src_b, - GP_Context *dst, +int GP_FilterMin(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, + GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMinAlloc(const GP_Context *src_a, - const GP_Context *src_b, +GP_Pixmap *GP_FilterMinAlloc(const GP_Pixmap *src_a, + const GP_Pixmap *src_b, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -308,14 +308,14 @@ Rotation and Symmetry filters /* or */ #include <GP.h> -int GP_FilterMirrorH(const GP_Context *src, GP_Context *dst, +int GP_FilterMirrorH(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMirrorHAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMirrorHAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Mirrors context horizontally. +Mirrors pixmap horizontally. Works 'in-place'. @@ -330,14 +330,14 @@ include::images/mirror_h/images.txt[] /* or */ #include <GP.h> -int GP_FilterMirrorV(const GP_Context *src, GP_Context *dst, +int GP_FilterMirrorV(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterMirrorVAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMirrorVAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Mirrors context vertically. +Mirrors pixmap vertically. Works 'in-place'. @@ -352,19 +352,19 @@ include::images/mirror_v/images.txt[] /* or */ #include <GP.h> -int GP_FilterRotate90(const GP_Context *src, GP_Context *dst, +int GP_FilterRotate90(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterRotate90Alloc(const GP_Context *src, +GP_Pixmap *GP_FilterRotate90Alloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Rotate context by 90 degrees. +Rotate pixmap by 90 degrees. Doesn't work 'in-place' (yet). The destination has to have the same pixel type and size must be large enough to -fit rotated context (i.e. W and H are swapped). +fit rotated pixmap (i.e. W and H are swapped). include::images/rotate_90/images.txt[] @@ -374,14 +374,14 @@ include::images/rotate_90/images.txt[] /* or */ #include <GP.h> -int GP_FilterRotate180(const GP_Context *src, GP_Context *dst, +int GP_FilterRotate180(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterRotate180Alloc(const GP_Context *src, +GP_Pixmap *GP_FilterRotate180Alloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Rotate context by 180 degrees. +Rotate pixmap by 180 degrees. Doesn't work 'in-place' (yet). @@ -396,19 +396,19 @@ include::images/rotate_180/images.txt[] /* or */ #include <GP.h> -int GP_FilterRotate270(const GP_Context *src, GP_Context *dst, +int GP_FilterRotate270(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterRotate270Alloc(const GP_Context *src, +GP_Pixmap *GP_FilterRotate270Alloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Rotate context by 270 degrees. +Rotate pixmap by 270 degrees. Doesn't work 'in-place' (yet). The destination has to have the same pixel type and destination size must be -large enough to fit rotated context (i.e. W and H are swapped). +large enough to fit rotated pixmap (i.e. W and H are swapped). include::images/rotate_270/images.txt[] @@ -428,11 +428,11 @@ typedef enum GP_FilterSymmetries { GP_MIRROR_V, } GP_FilterSymmetries; -GP_Context *GP_FilterSymmetry(const GP_Context *src, +GP_Pixmap *GP_FilterSymmetry(const GP_Pixmap *src, GP_FilterSymmetries symmetry, GP_ProgressCallback *callback); -int GP_FilterSymmetry(const GP_Context *src, GP_Context *dst, +int GP_FilterSymmetry(const GP_Pixmap *src, GP_Pixmap *dst, GP_FilterSymmetries symmetry, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -481,10 +481,10 @@ ready-to-use filters. /* or */ #include <GP.h> -int GP_FilterLinearConvolution_Raw(const GP_Context *src, +int GP_FilterLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float kernel[], uint32_t kw, uint32_t kh, float kern_div, GP_ProgressCallback *callback); @@ -493,10 +493,10 @@ int GP_FilterLinearConvolution_Raw(const GP_Context *src, Internal generic convolution filter, this is a base for all linear convolution filters with non-separable kernel. -The src coordinate and sizes denotes rectangle in the source context that the +The src coordinate and sizes denotes rectangle in the source pixmap that the filter operates on. -The dst coordinates defines offset into the dst context. +The dst coordinates defines offset into the dst pixmap. The kernel is two-dimensional array of a size kw * kh indexed as kernel[x + y*kw]. @@ -539,26 +539,26 @@ include::images/convolution/images.txt[] /* or */ #include <GP.h> -int GP_FilterHLinearConvolution_Raw(const GP_Context *src, +int GP_FilterHLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float kernel[], uint32_t kw, float kern_div, GP_ProgressCallback *callback); -int GP_FilterVLinearConvolution_Raw(const GP_Context *src, +int GP_FilterVLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float kernel[], uint32_t kh, float kern_div, GP_ProgressCallback *callback); -int GP_FilterVHLinearConvolution_Raw(const GP_Context *src, +int GP_FilterVHLinearConvolution_Raw(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float hkernel[], uint32_t kw, float hkern_div, float vkernel[], uint32_t kh, float vkern_div, @@ -570,7 +570,7 @@ void GP_FilterKernelPrint_Raw(float kernel[], int kw, int kh, float kern_div); Internal special functions for one dimensional vertical and horizontal convolution these two functions are base for all separable convolution filters. -The src coordinate and sizes denotes rectangle in the source context that the +The src coordinate and sizes denotes rectangle in the source pixmap that the filter operates on. The dst coordinates are offset into the dst. @@ -640,25 +640,25 @@ typedef struct GP_FilterKernel2D { float *kernel; } GP_FilterKernel2D; -int GP_FilterConvolutionEx(const GP_Context *src, +int GP_FilterConvolutionEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Coord h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); -GP_Context *GP_FilterConvolutionExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterConvolutionExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); -int GP_FilterConvolution(const GP_Context *src, GP_Context *dst, +int GP_FilterConvolution(const GP_Pixmap *src, GP_Pixmap *dst, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); -GP_Context *GP_FilterConvolutionAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterConvolutionAlloc(const GP_Pixmap *src, const GP_FilterKernel2D *kernel, GP_ProgressCallback *callback); @@ -690,7 +690,7 @@ WARNING: If filter is executed in-place the work cannot be distributed between /* * Example box smoothing filter. */ -static void box_smoothing(GP_Context *img) +static void box_smoothing(GP_Pixmap *img) { float box_filter[] = { 1, 1, 1, @@ -720,10 +720,10 @@ Laplace Filter /* or */ #include <GP.h> -int GP_FilterLaplace(const GP_Context *src, GP_Context *dst, +int GP_FilterLaplace(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterLaplaceAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterLaplaceAlloc(const GP_Pixmap *src, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -767,10 +767,10 @@ Laplacian Edge Sharpening /* or */ #include <GP.h> -int GP_FilterEdgeSharpening(const GP_Context *src, GP_Context *dst, +int GP_FilterEdgeSharpening(const GP_Pixmap *src, GP_Pixmap *dst, float w, GP_ProgressCallback *callback); -GP_Context *GP_FilterEdgeSharpeningAlloc(const GP_Context *src, float w, +GP_Pixmap *GP_FilterEdgeSharpeningAlloc(const GP_Pixmap *src, float w, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -798,25 +798,25 @@ Gaussian Blur /* or */ #include <GP.h> -int GP_FilterGaussianBlurEx(const GP_Context *src, +int GP_FilterGaussianBlurEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, float x_sigma, float y_sigma, GP_ProgressCallback *callback); -GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterGaussianBlurExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, float x_sigma, float y_sigma, GP_ProgressCallback *callback); -int GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, +int GP_FilterGaussianBlur(const GP_Pixmap *src, GP_Pixmap *dst, float x_sigma, float y_sigma, GP_ProgressCallback *callback) -GP_Context *GP_FilterGaussianBlurAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterGaussianBlurAlloc(const GP_Pixmap *src, float x_sigma, float y_sigma, GP_ProgressCallback *callback) ------------------------------------------------------------------------------- @@ -879,26 +879,26 @@ Median /* or */ #include <GP.h> -int GP_FilterMedianEx(const GP_Context *src, +int GP_FilterMedianEx(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, - GP_Context *dst, + GP_Pixmap *dst, GP_Coord x_dst, GP_Coord y_dst, int xmed, int ymed, GP_ProgressCallback *callback); -GP_Context *GP_FilterMedianExAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMedianExAlloc(const GP_Pixmap *src, GP_Coord x_src, GP_Coord y_src, GP_Size w_src, GP_Size h_src, int xmed, int ymed, GP_ProgressCallback *callback); -int GP_FilterMedian(const GP_Context *src, - GP_Context *dst, +int GP_FilterMedian(const GP_Pixmap *src, + GP_Pixmap *dst, int xmed, int ymed, GP_ProgressCallback *callback); -GP_Context *GP_FilterMedianAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterMedianAlloc(const GP_Pixmap *src, int xmed, int ymed, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- diff --git a/doc/filters_dithering.txt b/doc/filters_dithering.txt index 94c8203315bc..c7cf060b694a 100644 --- a/doc/filters_dithering.txt +++ b/doc/filters_dithering.txt @@ -27,11 +27,11 @@ And is throwed away at the image borders. /* or */ #include <filters/GP_Dither.h> -int GP_FilterFloydSteinberg(const GP_Context *src, GP_Context *dst, +int GP_FilterFloydSteinberg(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Renders Floyd Steinberg dithering directly into passed context. The +Renders Floyd Steinberg dithering directly into passed pixmap. The destination must be at least as large as source. If operation was aborted by a callback, non-zero is returned. @@ -45,12 +45,12 @@ the function returns non-zero and sets errno to 'ENOSYS'. /* or */ #include <filters/GP_Dither.h> -GP_Context *GP_FilterFloydSteinbergAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterFloydSteinbergAlloc(const GP_Pixmap *src, GP_PixelType pixel_type, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Returns pointer to allocated context of given pixel_type. +Returns pointer to allocated pixmap of given pixel_type. If 'malloc(2)' has failed, or operation was aborted by a callback NULL is returned. @@ -75,11 +75,11 @@ edges tend to be less sharp. /* or */ #include <filters/GP_Dither.h> -int GP_FilterHilbertPeano(const GP_Context *src, GP_Context *dst, +int GP_FilterHilbertPeano(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Renders Hilbert Peano dithering directly into passed context. The +Renders Hilbert Peano dithering directly into passed pixmap. The destination must be at least as large as source. If operation was aborted by a callback, non-zero is returned. @@ -93,12 +93,12 @@ the function returns NULL and sets errno to 'ENOSYS'. /* or */ #include <filters/GP_Dither.h> -GP_Context *GP_FilterHilbertPeanoAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterHilbertPeanoAlloc(const GP_Pixmap *src, GP_PixelType pixel_type, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Returns pointer to allocated context of given pixel_type. +Returns pointer to allocated pixmap of given pixel_type. If 'malloc(2)' has failed, or operation was aborted by a callback NULL is returned. diff --git a/doc/filters_resize.txt b/doc/filters_resize.txt index 6cf656447e6b..349ad2a71590 100644 --- a/doc/filters_resize.txt +++ b/doc/filters_resize.txt @@ -21,17 +21,17 @@ typedef enum GP_InterpolationType { const char *GP_InterpolationTypeName(enum GP_InterpolationType interp_type); -int GP_FilterResize(const GP_Context *src, GP_Context *dst, +int GP_FilterResize(const GP_Pixmap *src, GP_Pixmap *dst, GP_InterpolationType type, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_InterpolationType type, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- -Interpolate (resize) the context. +Interpolate (resize) the pixmap. Resize image given size and interpolation type. @@ -49,7 +49,7 @@ GP_FilterResizeAlloc The +GP_FilterResizeAlloc()+ allocates the destination give it's size. -Returns pointer to newly allocated context or NULL in case of failure and +Returns pointer to newly allocated pixmap or NULL in case of failure and errno is set. Nearest Neighbour Interpolation @@ -61,10 +61,10 @@ Nearest Neighbour Interpolation /* or */ #include <filters/GP_ResizeNN.h> -int GP_FilterResizeNN(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeNN(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -static inline GP_Context *GP_FilterResizeNNAlloc(const GP_Context *src, +static inline GP_Pixmap *GP_FilterResizeNNAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -87,17 +87,17 @@ Bilinear Interpolation /* or */ #include <filters/GP_ResizeLinear.h> -int GP_FilterResizeLinearInt(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeLinearInt(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -int GP_FilterResizeLinearLFInt(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeLinearLFInt(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeLinearIntAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeLinearIntAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeLinearLFIntAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeLinearLFIntAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- @@ -115,17 +115,17 @@ Bicubic Interpolation /* or */ #include <filters/GP_ResizeCubic.h> -int GP_FilterResizeCubicInt(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeCubicInt(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -int GP_FilterResizeCubic(const GP_Context *src, GP_Context *dst, +int GP_FilterResizeCubic(const GP_Pixmap *src, GP_Pixmap *dst, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeCubicIntAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeCubicIntAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); -GP_Context *GP_FilterResizeCubicAlloc(const GP_Context *src, +GP_Pixmap *GP_FilterResizeCubicAlloc(const GP_Pixmap *src, GP_Size w, GP_Size h, GP_ProgressCallback *callback); ------------------------------------------------------------------------------- diff --git a/doc/gamma.txt b/doc/gamma.txt index a38518bd2c76..521306a76962 100644 --- a/doc/gamma.txt +++ b/doc/gamma.txt @@ -38,7 +38,7 @@ and text still use legacy gamma support.) Implementation ~~~~~~~~~~~~~~ -The 'GP_Gamma' structure defines per context, per channel, gamma tables. +The 'GP_Gamma' structure defines per pixmap, per channel, gamma tables. The tables for particular gamma are reference counted. There is only one table for particular gamma value and bit depth in memory at a time. diff --git a/doc/get_put_pixel.txt b/doc/get_put_pixel.txt index 86d90c7f35f3..db9893f04e96 100644 --- a/doc/get_put_pixel.txt +++ b/doc/get_put_pixel.txt @@ -7,17 +7,17 @@ GetPixel and PutPixel /* or */ #include <core/GP_GetPutPixel.h> -GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y); +GP_Pixel GP_GetPixel(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y); -void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p); +void GP_PutPixel(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p); -------------------------------------------------------------------------------- Gets, puts a pixel value. GP_Pixel is a number which holds a pixel value. -This functions are clipped, GetPixel outside of the context returns zero, -PutPixel outside the context is no-op. +This functions are clipped, GetPixel outside of the pixmap returns zero, +PutPixel outside the pixmap is no-op. -This functions honour link:context.html[context rotation flags]. +This functions honour link:pixmap.html[pixmap rotation flags]. Generally these function are safe to use but rather slow in innner cycles. @@ -27,23 +27,23 @@ Generally these function are safe to use but rather slow in innner cycles. /* or */ #include <core/GP_GetPutPixel.h> -GP_Pixel GP_GetPixel_Raw(const GP_Context *context, GP_Coord x, GP_Coord y); +GP_Pixel GP_GetPixel_Raw(const GP_Pixmap *pixmap, GP_Coord x, GP_Coord y); -void GP_PutPixel_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p); +void GP_PutPixel_Raw(GP_Pixmap *pixmap, GP_Coord x, GP_Coord y, GP_Pixel p); /* * Substitute {{ bpp }} for specific bits per pixel (1BPP_LE, 24BPP, ...) * * These macros are generated to core/GP_GetPutPixel.gen.h */ -GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Context *c, int x, int y); +GP_Pixel GP_GetPixel_Raw_{{ bpp }}(const GP_Pixmap *c, int x, int y); -void GP_PutPixel_Raw_{{ bpp }}(GP_Context *c, GP_Coord x, GP_Coord y, +void GP_PutPixel_Raw_{{ bpp }}(GP_Pixmap *c, GP_Coord x, GP_Coord y, GP_Pixel p); -------------------------------------------------------------------------------- -These functions are generally fast, but does not honour context rotation flags -and do not check that coordinates are inside of the context. +These functions are generally fast, but does not honour pixmap rotation flags +and do not check that coordinates are inside of the pixmap. They are intended as basic building blocks for other GFX primitives, filters, etc. diff --git a/doc/gfx.txt b/doc/gfx.txt index 14cb7d8b2fa5..35f75d234303 100644 --- a/doc/gfx.txt +++ b/doc/gfx.txt @@ -11,7 +11,7 @@ See also RGB tripplet to pixel link:convert.html[conversions]. Rotation Flags ~~~~~~~~~~~~~~ -Drawing orientation is affected by the link:context.html[context rotation +Drawing orientation is affected by the link:pixmap.html[pixmap rotation flags]. The parameters passed to the functions are transformed accordingly to the flags before the drawing, which allows for fast and transparent rotated or mirrored rendering. @@ -28,10 +28,10 @@ Fill [source,c] -------------------------------------------------------------------------------- -void GP_Fill(GP_Context *context, GP_Pixel pixel); +void GP_Fill(GP_Pixmap *pixmap, GP_Pixel pixel); -------------------------------------------------------------------------------- -Fills the whole context bitmap with the specified pixel value. +Fills the whole pixmap bitmap with the specified pixel value. NOTE: GP_Fill is implemented in the library Core rather than in GFX so that it's available to all library parts. @@ -41,10 +41,10 @@ Lines [source,c] -------------------------------------------------------------------------------- -void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y, +void GP_HLineXXY(GP_Pixmap *pixmap, GP_Coord x0, GP_Coord x1, GP_Coord y, GP_Pixel pixel); ...e-mail trimmed, has been too large.
1
0
0
0
Results per page:
10
25
50
100
200