Gfxprim
Threads by month
- ----- 2026 -----
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
November 2012
- 2 participants
- 28 discussions
[repo.or.cz] gfxprim.git branch master updated: 22301c3c370f269b10b84582ee524b46abf70019
by metan 21 Nov '12
by metan 21 Nov '12
21 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 22301c3c370f269b10b84582ee524b46abf70019 (commit)
from ec5c8093c73872736480da4c97cbce5245fd6dc5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/22301c3c370f269b10b84582ee524b46abf7…
commit 22301c3c370f269b10b84582ee524b46abf70019
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 23:29:15 2012 +0100
loaders: Provide GP_MatchXXX ENOSYS stubs.
diff --git a/libs/loaders/GP_GIF.c b/libs/loaders/GP_GIF.c
index c4e2d2e..8eba747 100644
--- a/libs/loaders/GP_GIF.c
+++ b/libs/loaders/GP_GIF.c
@@ -358,6 +358,12 @@ GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback)
#else
+int GP_MatchGIF(const void GP_UNUSED(*buf))
+{
+ errno = ENOSYS;
+ return -1;
+}
+
int GP_OpenGIF(const char GP_UNUSED(*src_path),
void GP_UNUSED(**f))
{
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c
index bc47c4b..0e04ce6 100644
--- a/libs/loaders/GP_JPG.c
+++ b/libs/loaders/GP_JPG.c
@@ -407,6 +407,12 @@ err0:
#else
+int GP_MatchJPG(const void GP_UNUSED(*buf))
+{
+ errno = ENOSYS;
+ return -1;
+}
+
int GP_OpenJPG(const char GP_UNUSED(*src_path), FILE GP_UNUSED(**f))
{
errno = ENOSYS;
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index 275d4be..87d9eca 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -551,6 +551,12 @@ err0:
#else
+int GP_MatchPNG(const void GP_UNUSED(*buf))
+{
+ errno = ENOSYS;
+ return -1;
+}
+
int GP_OpenPNG(const char GP_UNUSED(*src_path),
FILE GP_UNUSED(**f))
{
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_GIF.c | 6 ++++++
libs/loaders/GP_JPG.c | 6 ++++++
libs/loaders/GP_PNG.c | 6 ++++++
3 files changed, 18 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: ec5c8093c73872736480da4c97cbce5245fd6dc5
by metan 21 Nov '12
by metan 21 Nov '12
21 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via ec5c8093c73872736480da4c97cbce5245fd6dc5 (commit)
from a1c7fb9eab833787770f97497d38a17799d490c8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/ec5c8093c73872736480da4c97cbce5245fd…
commit ec5c8093c73872736480da4c97cbce5245fd6dc5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 23:16:29 2012 +0100
filters: Silence wrongly generated warnings.
Some older gcc wrongly thinks that x and y
are used uninitialized. Silence the warning
by initializing them to 0.
diff --git a/include/filters/GP_HilbertCurve.h b/include/filters/GP_HilbertCurve.h
index fecac22..f5283c8 100644
--- a/include/filters/GP_HilbertCurve.h
+++ b/include/filters/GP_HilbertCurve.h
@@ -55,7 +55,11 @@ static inline void GP_HilbertCurveInit(struct GP_CurveState *state, int n)
static inline void GP_HilbertCurveGetXY(struct GP_CurveState *state)
{
int sa, sb;
- unsigned int i, temp, x, y;
+ /*
+ * Older gcc thinks that x and y are used uninitialized that is not
+ * true so we silence the warning by initializing them.
+ */
+ unsigned int i, temp, x = 0, y = 0;
for (i = 0; i < 2 * state->n; i += 2) {
sa = (state->s >> (i+1)) & 0x01;
-----------------------------------------------------------------------
Summary of changes:
include/filters/GP_HilbertCurve.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: a1c7fb9eab833787770f97497d38a17799d490c8
by metan 21 Nov '12
by metan 21 Nov '12
21 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via a1c7fb9eab833787770f97497d38a17799d490c8 (commit)
via 6a14d2a8a7056ffdf6ed6ee04b2a441795d38b5f (commit)
from d2cdbe621395f3e2f5cf5f814491a33f814bb4eb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/a1c7fb9eab833787770f97497d38a17799d4…
commit a1c7fb9eab833787770f97497d38a17799d490c8
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 23:08:36 2012 +0100
tests: framework: Include correct header for malloc
diff --git a/tests/framework/tst_alloc_barriers.c b/tests/framework/tst_alloc_barriers.c
index c5aa7ad..315480e 100644
--- a/tests/framework/tst_alloc_barriers.c
+++ b/tests/framework/tst_alloc_barriers.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <sys/mman.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <unistd.h>
#include "tst_alloc_barriers.h"
http://repo.or.cz/w/gfxprim.git/commit/6a14d2a8a7056ffdf6ed6ee04b2a441795d3…
commit 6a14d2a8a7056ffdf6ed6ee04b2a441795d38b5f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 23:07:35 2012 +0100
core: Remove unused include endian.h
diff --git a/include/core/GP_WritePixel.h b/include/core/GP_WritePixel.h
index 18a4ef6..0d1a875 100644
--- a/include/core/GP_WritePixel.h
+++ b/include/core/GP_WritePixel.h
@@ -26,7 +26,6 @@
#ifndef GP_WRITEPIXEL_H
#define GP_WRITEPIXEL_H
-#include <endian.h>
#include <stdint.h>
#include <unistd.h>
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_WritePixel.h | 1 -
tests/framework/tst_alloc_barriers.c | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: d2cdbe621395f3e2f5cf5f814491a33f814bb4eb
by metan 21 Nov '12
by metan 21 Nov '12
21 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via d2cdbe621395f3e2f5cf5f814491a33f814bb4eb (commit)
via 047ce730dcb1c40acf586439be2fc64352e74621 (commit)
via 0ddba05bdb8c901c75b4797e9d281ce1d6307e5e (commit)
from e90eda658220809b70c37e954d2624e3cfdcd5ea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/d2cdbe621395f3e2f5cf5f814491a33f814b…
commit d2cdbe621395f3e2f5cf5f814491a33f814bb4eb
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 23:34:24 2012 +0100
tests: Port blittest to backends.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile
index 03c91c5..708a3ca 100644
--- a/demos/c_simple/Makefile
+++ b/demos/c_simple/Makefile
@@ -9,7 +9,7 @@ LDLIBS+=-lrt `$(TOPDIR)/gfxprim-config --libs --libs-backends`
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch virtual_backend_example meta_data meta_data_dump tmp_file showimage v4l2_show v4l2_grab convolution weighted_median shapetest koch input- fileview linetest randomshapetest fonttest loaders_register
+ fileview linetest randomshapetest fonttest loaders_register blittest
v4l2_show: LDLIBS+=-lGP_grabbers
v4l2_grab: LDLIBS+=-lGP_grabbers
diff --git a/tests/SDL/ball.ppm b/demos/c_simple/ball.ppm
similarity index 100%
rename from tests/SDL/ball.ppm
rename to demos/c_simple/ball.ppm
diff --git a/tests/SDL/blittest.c b/demos/c_simple/blittest.c
similarity index 51%
rename from tests/SDL/blittest.c
rename to demos/c_simple/blittest.c
index c23776c..013bf07 100644
--- a/tests/SDL/blittest.c
+++ b/demos/c_simple/blittest.c
@@ -23,48 +23,25 @@
* *
*****************************************************************************/
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <SDL/SDL.h>
-
-#include "GP.h"
-#include "GP_SDL.h"
+#include <GP.h>
static GP_Pixel black;
static GP_Pixel white;
-SDL_Surface *display = NULL;
-GP_Context context;
-GP_Context *bitmap, *bitmap_raw, *bitmap_conv;
-
-SDL_TimerID timer;
-
-SDL_UserEvent timer_event;
-
-static int pause_flag = 0;
+static GP_Backend *win;
+static GP_Context *bitmap, *bitmap_raw, *bitmap_conv;
static int bitmap_x, bitmap_y, bitmap_vx = -3, bitmap_vy = -3;
-
-Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
- __attribute__((unused)) void *param)
-{
- timer_event.type = SDL_USEREVENT;
- SDL_PushEvent((SDL_Event *) &timer_event);
- return 10;
-}
+static int pause_flag = 0;
static char text_buf[255];
void redraw_screen(void)
{
- if (pause_flag)
- return;
-
bitmap_x += bitmap_vx;
bitmap_y += bitmap_vy;
- if (bitmap_x + GP_ContextW(bitmap) > context.w) {
+ if (bitmap_x + GP_ContextW(bitmap) > win->context->w) {
bitmap_vx = -bitmap_vx;
bitmap_x += bitmap_vx;
}
@@ -74,7 +51,7 @@ void redraw_screen(void)
bitmap_x += bitmap_vx;
}
- if (bitmap_y + GP_ContextH(bitmap) > context.h) {
+ if (bitmap_y + GP_ContextH(bitmap) > win->context->h) {
bitmap_vy = -bitmap_vy;
bitmap_y += bitmap_vy;
}
@@ -84,25 +61,21 @@ void redraw_screen(void)
bitmap_y += bitmap_vy;
}
- SDL_LockSurface(display);
-
- GP_FillRectXYWH(&context, 20, 20, 300, 50, black);
+ GP_FillRectXYWH(win->context, 20, 20, 300, 50, black);
- GP_Text(&context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_Text(win->context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
white, black, text_buf);
- GP_Print(&context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM,
+ GP_Print(win->context, 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),
- &context, bitmap_x, bitmap_y);
-
- SDL_UpdateRect(display, bitmap_x, bitmap_y,
- GP_ContextW(bitmap), GP_ContextH(bitmap));
- SDL_UpdateRect(display, 20, 20, 400, 50);
+ win->context, bitmap_x, bitmap_y);
- SDL_UnlockSurface(display);
+ GP_BackendUpdateRectXYWH(win, bitmap_x, bitmap_y,
+ GP_ContextW(bitmap), GP_ContextH(bitmap));
+ GP_BackendUpdateRectXYWH(win, 20, 20, 400, 50);
}
static void change_bitmap(void)
@@ -113,48 +86,52 @@ static void change_bitmap(void)
bitmap = bitmap_raw;
snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'",
- GP_PixelTypes[bitmap->pixel_type].name,
- GP_PixelTypes[context.pixel_type].name);
+ GP_PixelTypeName(bitmap->pixel_type),
+ GP_PixelTypeName(win->context->pixel_type));
}
void event_loop(void)
{
- SDL_Event event;
-
- while (SDL_WaitEvent(&event) > 0) {
-
- switch (event.type) {
-
- case SDL_USEREVENT:
- redraw_screen();
- break;
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym) {
- case SDLK_p:
- pause_flag = !pause_flag;
- break;
- case SDLK_x:
+ GP_Event ev;
+
+ while (GP_EventGet(&ev)) {
+ GP_EventDump(&ev);
+
+ switch (ev.type) {
+ case GP_EV_KEY:
+ if (ev.code != GP_EV_KEY_DOWN)
+ continue;
+
+ switch (ev.val.key.key) {
+ case GP_KEY_X:
bitmap->x_swap = !bitmap->x_swap;
break;
- case SDLK_y:
+ case GP_KEY_Y:
bitmap->y_swap = !bitmap->y_swap;
break;
- case SDLK_a:
+ case GP_KEY_R:
bitmap->axes_swap = !bitmap->axes_swap;
break;
- case SDLK_SPACE:
+ case GP_KEY_P:
+ pause_flag = !pause_flag;
+ break;
+ case GP_KEY_SPACE:
change_bitmap();
break;
- case SDLK_ESCAPE:
- return;
- default:
- break;
- }
+ case GP_KEY_ESC:
+ GP_BackendExit(win);
+ exit(0);
break;
- case SDL_QUIT:
- return;
- default:
+ }
+ break;
+ case GP_EV_SYS:
+ switch(ev.code) {
+ case GP_EV_SYS_QUIT:
+ GP_BackendExit(win);
+ exit(0);
break;
+ }
+ break;
}
}
}
@@ -162,78 +139,48 @@ void event_loop(void)
void print_instructions(void)
{
printf("Use the following keys to control the test:n");
- printf(" Esc ................. exitn");
- printf(" Space ............... converts bitmap to screen pixel formatn");
- printf(" A ................... swap sprite axesn");
- printf(" X ................... mirror sprite Xn");
- printf(" Y ................... mirror sprite Yn");
- printf(" P ................... pausen");
+ printf(" Esc ............. exitn");
+ printf(" Space ........... converts bitmap to screen pixel formatn");
+ printf(" R ............... swap sprite axesn");
+ printf(" X ............... mirror sprite Xn");
+ printf(" Y ............... mirror sprite Yn");
+ printf(" P ............... pausen");
}
int main(int argc, char *argv[])
{
- int display_bpp = 0;
const char *sprite = "ball.ppm";
+ const char *backend_opts = "X11";
print_instructions();
-
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-16") == 0) {
- display_bpp = 16;
- } else if (strcmp(argv[i], "-24") == 0) {
- display_bpp = 24;
- } else if (strcmp(argv[i], "-32") == 0) {
- display_bpp = 32;
- } else {
- sprite = argv[i];
- }
- }
-
- GP_SetDebugLevel(10);
-
- if ((bitmap_raw = GP_LoadImage(sprite, NULL)) == NULL) {
- fprintf(stderr, "Failed to load bitmap: %sn", strerror(errno));
- return 1;
- }
- /* Initialize SDL */
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
- fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError());
+ win = GP_BackendInit(backend_opts, "Line Test", stderr);
+
+ if (win == NULL) {
+ fprintf(stderr, "Failed to initalize backend '%s'n",
+ backend_opts);
return 1;
}
- /* Create a window with a software back surface */
- display = SDL_SetVideoMode(640, 480, display_bpp, SDL_SWSURFACE);
- if (display == NULL) {
- fprintf(stderr, "Could not open display: %sn", SDL_GetError());
- goto fail;
- }
+ bitmap_raw = GP_LoadImage(sprite, NULL);
- GP_SDL_ContextFromSurface(&context, display);
-
- bitmap_conv = GP_ContextConvertAlloc(bitmap_raw, context.pixel_type);
+ bitmap_conv = GP_ContextConvertAlloc(bitmap_raw,
+ win->context->pixel_type);
change_bitmap();
- black = GP_ColorToContextPixel(GP_COL_BLACK, &context);
- white = GP_ColorToContextPixel(GP_COL_WHITE, &context);
+ black = GP_ColorToContextPixel(GP_COL_BLACK, win->context);
+ white = GP_ColorToContextPixel(GP_COL_WHITE, win->context);
- /* Set up the refresh timer */
- timer = SDL_AddTimer(60, timer_callback, NULL);
- if (timer == 0) {
- fprintf(stderr, "Could not set up timer: %sn", SDL_GetError());
- goto fail;
- }
-
- /* Enter the event loop */
- event_loop();
+ for (;;) {
+ GP_BackendPoll(win);
+ event_loop();
+
+ usleep(8000);
- /* We're done */
- SDL_Quit();
- return 0;
+ if (pause_flag)
+ continue;
-fail:
- SDL_Quit();
- return 1;
+ redraw_screen();
+ }
}
diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile
index bea9cd3..ce12dcb 100644
--- a/tests/SDL/Makefile
+++ b/tests/SDL/Makefile
@@ -7,7 +7,7 @@ LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL
ifeq ($(HAVE_LIBSDL),yes)
CSOURCES=$(shell echo *.c)
-APPS=textaligntest blittest subcontext+APPS=textaligntest subcontext mixpixeltest
endif
diff --git a/tests/SDL/ball.pgm b/tests/SDL/ball.pgm
deleted file mode 100644
index 9f9487f..0000000
--- a/tests/SDL/ball.pgm
+++ /dev/null
@@ -1,10004 +0,0 @@
-P2
-# CREATOR: GIMP PNM Filter Version 1.1
-100 100
-255
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-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-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-6
-9
-12
-16
-19
-22
-25
-28
-30
-32
-35
-37
-38
-40
-42
-43
-43
-43
-44
-44
-44
-44
-43
-42
-41
-40
-39
-36
-35
-33
-30
-27
-25
-22
-19
-16
-13
-9
-6
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-7
-12
-15
-19
-23
-25
-29
-31
-34
-37
-39
-41
-43
-45
-46
-48
-49
-50
-50
-51
-51
-51
-51
-50
-49
-48
-47
-45
-43
-42
-39
-37
-34
-32
-29
-26
-23
-19
-15
-11
-7
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-4
-9
-13
-17
-21
-25
-29
-31
-35
-38
-41
-43
-46
-48
-50
-52
-53
-55
-56
-57
-57
-59
-58
-58
-58
-57
-56
-55
-53
-52
-50
-48
-46
-44
-41
-38
-35
-32
-29
-25
-21
-17
-13
-9
-5
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-5
-10
-14
-19
-23
-27
-31
-34
-38
-41
-44
-48
-50
-52
-54
-57
-59
-61
-62
-63
-64
-64
-65
-66
-65
-64
-64
-63
-62
-61
-59
-57
-55
-53
-50
-47
-44
-41
-38
-34
-31
-27
-23
-19
-14
-10
-6
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-7
-11
-16
-20
-24
-29
-33
-37
-41
-44
-47
-51
-54
-57
-59
-62
-63
-66
-67
-69
-70
-71
-72
-72
-72
-72
-71
-71
-70
-69
-68
-66
-64
-62
-59
-57
-54
-51
-47
-44
-40
-36
-33
-29
-25
-20
-15
-11
-7
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-6
-11
-16
-21
-26
-30
-35
-38
-43
-46
-50
-53
-56
-60
-63
-66
-68
-70
-72
-75
-76
-77
-78
-79
-80
-80
-79
-78
-78
-77
-76
-74
-72
-70
-68
-66
-63
-60
-56
-53
-50
-46
-43
-39
-34
-30
-25
-21
-16
-12
-7
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-7
-12
-16
-21
-26
-30
-36
-40
-44
-48
-52
-56
-59
-63
-66
-69
-72
-75
-78
-79
-81
-82
-84
-85
-86
-86
-86
-86
-86
-85
-84
-83
-81
-79
-77
-75
-72
-69
-67
-64
-60
-56
-52
-48
-44
-40
-35
-30
-26
-21
-16
-11
-6
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-6
-11
-16
-21
-27
-31
-36
-40
-45
-50
-54
-58
-62
-65
-70
-73
-76
-78
-81
-84
-86
-88
-90
-91
-92
-92
-93
-93
-93
-93
-92
-91
-89
-88
-86
-84
-81
-79
-76
-72
-70
-65
-62
-58
-54
-50
-46
-41
-36
-31
-26
-22
-16
-11
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-10
-16
-21
-26
-31
-37
-41
-46
-51
-56
-60
-64
-68
-72
-75
-79
-82
-85
-87
-90
-93
-94
-97
-98
-99
-100
-101
-100
-101
-100
-99
-98
-96
-95
-93
-90
-88
-85
-82
-79
-75
-72
-68
-64
-60
-55
-51
-46
-41
-36
-31
-26
-21
-16
-10
-5
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-9
-15
-20
-25
-31
-36
-41
-46
-52
-56
-61
-65
-69
-74
-78
-81
-85
-89
-91
-95
-97
-99
-101
-103
-104
-106
-106
-107
-107
-107
-107
-106
-104
-104
-101
-99
-97
-94
-91
-88
-85
-81
-78
-73
-70
-65
-60
-55
-51
-46
-42
-36
-31
-25
-20
-15
-9
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-8
-14
-18
-24
-30
-36
-41
-46
-52
-57
-61
-66
-71
-75
-80
-83
-87
-91
-95
-98
-100
-103
-106
-108
-110
-112
-113
-114
-114
-114
-114
-114
-113
-112
-110
-108
-106
-104
-101
-98
-94
-92
-87
-84
-80
-75
-71
-66
-61
-56
-51
-46
-41
-35
-29
-24
-18
-13
-8
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-11
-17
-22
-29
-34
-40
-46
-51
-56
-61
-66
-71
-75
-80
-84
-89
-93
-97
-101
-104
-107
-110
-113
-115
-117
-119
-120
-121
-121
-121
-121
-121
-120
-118
-117
-115
-112
-110
-108
-104
-100
-97
-93
-89
-85
-81
-76
-71
-66
-61
-56
-51
-45
-40
-35
-28
-23
-17
-11
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-9
-15
-21
-27
-33
-39
-44
-50
-55
-60
-66
-71
-77
-81
-85
-90
-95
-99
-103
-107
-110
-113
-116
-119
-122
-124
-126
-127
-128
-128
-129
-128
-128
-127
-126
-123
-122
-119
-116
-114
-110
-107
-103
-99
-95
-90
-86
-81
-76
-71
-65
-61
-55
-49
-44
-39
-33
-26
-21
-15
-9
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-7
-13
-19
-25
-31
-37
-42
-48
-54
-60
-65
-70
-75
-81
-86
-91
-96
-100
-104
-108
-112
-116
-120
-122
-126
-128
-130
-132
-133
-134
-135
-135
-136
-134
-133
-132
-131
-129
-125
-123
-120
-116
-112
-109
-105
-100
-95
-91
-86
-81
-75
-70
-65
-60
-53
-48
-42
-37
-30
-25
-19
-13
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-10
-16
-22
-28
-34
-40
-46
-52
-58
-64
-69
-75
-80
-85
-91
-96
-101
-106
-110
-115
-119
-122
-126
-130
-132
-135
-137
-139
-141
-141
-142
-143
-142
-142
-140
-140
-137
-135
-132
-130
-126
-122
-119
-115
-110
-106
-100
-96
-91
-86
-81
-75
-69
-64
-58
-52
-46
-40
-34
-28
-23
-16
-10
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-7
-13
-19
-25
-31
-38
-44
-50
-56
-62
-68
-73
-79
-85
-91
-96
-101
-106
-111
-116
-119
-124
-129
-132
-136
-139
-141
-144
-146
-148
-148
-149
-150
-149
-148
-148
-146
-144
-141
-139
-135
-132
-128
-125
-120
-115
-111
-106
-101
-96
-90
-85
-79
-73
-68
-62
-56
-50
-44
-37
-32
-26
-20
-13
-7
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-9
-16
-22
-29
-35
-41
-47
-53
-60
-66
-72
-78
-83
-90
-95
-100
-105
-111
-116
-121
-125
-130
-134
-138
-141
-144
-148
-150
-152
-154
-156
-156
-157
-156
-156
-154
-152
-151
-148
-145
-142
-138
-134
-130
-125
-120
-115
-111
-105
-100
-95
-89
-84
-78
-71
-66
-60
-54
-47
-41
-35
-29
-22
-16
-10
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-6
-12
-19
-25
-31
-38
-44
-51
-56
-63
-70
-75
-82
-88
-94
-99
-105
-110
-116
-120
-125
-130
-135
-140
-144
-147
-151
-154
-157
-159
-161
-163
-163
-164
-164
-162
-161
-160
-157
-154
-151
-148
-144
-140
-135
-131
-126
-121
-116
-110
-105
-99
-93
-88
-81
-76
-69
-63
-57
-51
-44
-38
-32
-25
-19
-12
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-8
-14
-21
-27
-35
-40
-47
-54
-60
-67
-73
-78
-85
-91
-97
-103
-109
-114
-120
-125
-131
-136
-141
-145
-149
-153
-157
-161
-164
-166
-168
-170
-171
-170
-170
-169
-168
-166
-164
-161
-158
-154
-150
-145
-140
-135
-131
-126
-120
-115
-109
-103
-97
-91
-85
-79
-72
-66
-60
-54
-47
-40
-35
-28
-21
-15
-8
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-11
-17
-23
-30
-37
-44
-50
-57
-63
-69
-76
-82
-89
-95
-100
-106
-113
-118
-125
-130
-135
-141
-146
-150
-155
-159
-163
-167
-170
-173
-175
-177
-177
-178
-177
-177
-175
-172
-170
-167
-163
-159
-155
-151
-145
-141
-135
-130
-124
-119
-112
-107
-101
-95
-88
-82
-75
-69
-63
-57
-50
-44
-37
-31
-24
-17
-10
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-6
-12
-20
-26
-33
-39
-46
-53
-59
-66
-72
-79
-85
-91
-97
-104
-110
-116
-122
-128
-134
-140
-145
-150
-155
-160
-164
-169
-173
-176
-180
-182
-184
-184
-185
-184
-183
-181
-179
-177
-173
-169
-165
-160
-155
-150
-145
-139
-134
-129
-123
-116
-110
-104
-98
-91
-85
-79
-72
-66
-60
-53
-46
-40
-32
-26
-19
-13
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-7
-15
-21
-28
-35
-41
-48
-55
-61
-68
-75
-82
-88
-95
-100
-108
-114
-120
-126
-132
-138
-144
-150
-155
-161
-166
-170
-175
-179
-182
-186
-188
-190
-191
-191
-191
-190
-189
-186
-183
-179
-175
-170
-165
-160
-155
-149
-144
-138
-132
-126
-119
-114
-107
-100
-94
-88
-81
-75
-69
-61
-55
-48
-42
-35
-28
-21
-15
-8
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-10
-17
-23
-30
-36
-43
-50
-57
-64
-71
-77
-83
-90
-98
-104
-110
-116
-123
-129
-136
-142
-147
-153
-160
-165
-171
-175
-180
-185
-189
-192
-195
-197
-199
-199
-199
-197
-195
-192
-189
-185
-180
-176
-171
-165
-159
-153
-148
-141
-135
-129
-123
-117
-110
-103
-97
-91
-84
-77
-70
-64
-57
-50
-44
-37
-30
-23
-17
-9
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-4
-11
-18
-25
-32
-39
-45
-53
-59
-66
-73
-79
-86
-93
-100
-106
-112
-119
-126
-132
-138
-145
-151
-158
-164
-169
-175
-181
-186
-191
-195
-199
-201
-204
-205
-206
-205
-204
-201
-199
-194
-190
-185
-180
-175
-169
-163
-157
-151
-145
-139
-132
-126
-119
-113
-106
-99
-93
-86
-79
-73
-65
-59
-52
-45
-38
-31
-25
-18
-11
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-13
-20
-26
-33
-40
-47
-54
-60
-67
-74
-81
-87
-95
-102
-108
-115
-121
-128
-134
-142
-148
-155
-161
-167
-173
-179
-184
-190
-196
-200
-204
-207
-210
-212
-213
-212
-210
-208
-204
-200
-195
-190
-184
-179
-173
-167
-161
-155
-148
-141
-134
-128
-122
-115
-108
-101
-94
-88
-82
-74
-67
-60
-54
-47
-40
-33
-26
-19
-12
-5
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-7
-13
-20
-28
-34
-41
-49
-55
-61
-69
-76
-83
-90
-97
-103
-110
-117
-124
-131
-137
-144
-150
-157
-164
-170
-176
-182
-189
-194
-200
-205
-210
-214
-217
-219
-220
-219
-217
-214
-210
-205
-200
-194
-188
-183
-176
-170
-164
-157
-150
-144
-137
-130
-124
-117
-110
-103
-96
-90
-83
-75
-69
-62
-55
-49
-42
-35
-28
-20
-14
-7
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-7
-14
-21
-29
-36
-42
-49
-56
-63
-70
-77
-84
-91
-98
-104
-112
-118
-125
-132
-139
-146
-153
-159
-166
-173
-179
-185
-192
-198
-205
-210
-215
-220
-224
-226
-227
-226
-223
-220
-216
-210
-204
-198
-192
-186
-179
-172
-166
-159
-153
-146
-139
-132
-125
-119
-111
-105
-98
-91
-84
-77
-70
-63
-56
-49
-42
-35
-28
-22
-14
-7
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-8
-15
-22
-29
-36
-43
-50
-57
-64
-71
-78
-85
-92
-99
-106
-113
-120
-126
-133
-141
-148
-154
-161
-168
-175
-182
-188
-195
-201
-208
-214
-220
-225
-230
-232
-234
-233
-230
-225
-220
-214
-208
-202
-195
-189
-182
-175
-169
-161
-154
-147
-141
-134
-126
-120
-113
-105
-99
-92
-85
-78
-71
-64
-57
-50
-43
-36
-29
-22
-15
-8
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-9
-16
-23
-30
-37
-44
-51
-57
-65
-71
-79
-85
-93
-100
-107
-114
-121
-127
-135
-141
-148
-155
-163
-169
-176
-183
-190
-197
-204
-210
-217
-223
-230
-235
-239
-241
-240
-235
-230
-223
-217
-211
-204
-197
-191
-184
-176
-169
-162
-156
-149
-142
-135
-127
-120
-114
-107
-99
-92
-85
-79
-72
-65
-57
-50
-44
-36
-30
-23
-16
-8
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-9
-16
-23
-30
-37
-44
-51
-58
-65
-73
-79
-86
-93
-100
-108
-114
-121
-128
-135
-143
-149
-157
-164
-171
-177
-184
-191
-198
-205
-212
-219
-226
-233
-239
-245
-248
-245
-239
-233
-226
-219
-212
-205
-198
-192
-184
-178
-170
-163
-157
-149
-143
-135
-128
-122
-114
-107
-100
-93
-86
-79
-72
-65
-58
-51
-44
-37
-30
-23
-15
-9
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-9
-16
-23
-30
-37
-44
-51
-58
-65
-72
-79
-86
-93
-101
-107
-115
-121
-129
-135
-143
-149
-157
-163
-170
-178
-184
-192
-199
-206
-213
-219
-227
-234
-241
-248
-255
-248
-241
-234
-226
-220
-213
-206
-198
-192
-184
-178
-171
-163
-157
-149
-143
-135
-129
-122
-115
-108
-101
-93
-86
-79
-72
-66
-59
-51
-44
-37
-30
-23
-16
-9
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-9
-16
-23
-29
-36
-44
-51
-58
-65
-72
-79
-87
-93
-100
-107
-114
-121
-128
-135
-142
-150
-156
-164
-170
-177
-184
-191
-199
-205
-213
-220
-226
-233
-240
-245
-248
-245
-239
-233
-226
-219
-212
-205
-198
-192
-185
-177
-170
-163
-157
-150
-142
-136
-129
-121
-114
-107
-100
-93
-86
-80
-73
-65
-58
-51
-44
-37
-30
-23
-16
-9
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-8
-16
-22
-30
-37
-43
-51
-57
-64
-72
-79
-86
-92
-100
-106
-114
-121
-128
-135
-142
-149
-156
-163
-169
-176
-183
-190
-197
-204
-210
-217
-223
-229
-235
-240
-241
-239
-235
-230
-223
-217
-211
-204
-197
-190
-183
-176
-169
-162
-156
-149
-142
-135
-128
-121
-114
-106
-100
-93
-86
-78
-72
-65
-58
-50
-44
-37
-29
-23
-16
-8
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-8
-15
-22
-29
-36
-43
-50
-57
-64
-71
-78
-85
-92
-99
-106
-113
-120
-126
-134
-141
-148
-154
-161
-168
-174
-181
-189
-195
-201
-208
-214
-220
-226
-230
-233
-234
-232
-229
-225
-220
-214
-208
-201
-195
-189
-182
-175
-168
-161
-155
-147
-140
-134
-127
-120
-113
-106
-98
-92
-85
-78
-71
-64
-57
-50
-43
-36
-29
-22
-15
-8
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-8
-14
-21
-29
-36
-42
-50
-56
-64
-70
-77
-84
-91
-98
-105
-111
-119
-125
-132
-139
-146
-153
-159
-166
-173
-180
-185
-192
-198
-204
-210
-216
-220
-223
-226
-227
-226
-224
-220
-215
-210
-204
-199
-192
-186
-179
-173
-166
-159
-153
-146
-139
-132
-126
-119
-111
-105
-98
-91
-84
-77
-70
-63
-56
-50
-42
-36
-29
-21
-15
-7
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-6
-13
-21
-27
-34
-41
-48
-55
-62
-69
-75
-82
-90
-97
-103
-110
-117
-123
-131
-137
-143
-151
-158
-163
-170
-176
-183
-189
-194
-200
-206
-210
-214
-217
-219
-219
-219
-217
-214
-210
-205
-200
-195
-189
-183
-176
-170
-164
-157
-151
-144
-138
-131
-124
-117
-110
-103
-97
-90
-82
-75
-69
-62
-55
-48
-41
-35
-27
-21
-13
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-12
-20
-26
-33
-40
-47
-54
-61
-68
-74
-81
-88
-95
-102
-109
-115
-122
-128
-135
-141
-148
-154
-161
-167
-173
-179
-184
-190
-195
-200
-205
-208
-211
-212
-213
-212
-211
-208
-204
-200
-196
-190
-184
-179
-173
-167
-161
-154
-148
-142
-135
-128
-121
-115
-108
-101
-95
-87
-81
-74
-68
-61
-53
-47
-39
-33
-26
-20
-13
-5
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-4
-11
-18
-25
-31
-39
-45
-53
-58
-66
-72
-79
-86
-93
-99
-106
-113
-120
-125
-132
-139
-145
-151
-157
-163
-169
-175
-181
-185
-190
-194
-198
-202
-204
-205
-206
-205
-204
-201
-199
-194
-190
-186
-180
-175
-170
-163
-158
-151
-145
-139
-132
-126
-119
-113
-106
-100
-93
-86
-80
-73
-65
-59
-52
-45
-39
-31
-25
-18
-11
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-10
-17
-23
-30
-37
-44
-50
-57
-64
-70
-77
-83
-90
-97
-103
-110
-116
-123
-129
-135
-142
-147
-154
-160
-165
-170
-176
-180
-185
-189
-192
-195
-197
-199
-199
-198
-197
-195
-192
-189
-185
-180
-175
-170
-165
-159
-154
-148
-142
-135
-129
-123
-116
-110
-103
-97
-90
-84
-77
-70
-64
-57
-50
-44
-36
-30
-23
-16
-9
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-8
-15
-22
-29
-35
-42
-48
-55
-61
-69
-75
-81
-88
-95
-101
-107
-114
-119
-126
-132
-138
-144
-149
-155
-160
-165
-170
-175
-179
-183
-186
-188
-190
-191
-192
-191
-190
-189
-186
-182
-179
-175
-170
-166
-160
-155
-149
-144
-138
-132
-126
-119
-113
-108
-101
-95
-88
-81
-75
-68
-62
-55
-48
-41
-35
-29
-21
-15
-7
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-6
-13
-20
-26
-32
-39
-46
-52
-60
-65
-73
-79
-85
-92
-97
-104
-111
-117
-122
-128
-134
-140
-145
-151
-156
-160
-165
-169
-173
-177
-179
-182
-183
-184
-185
-184
-183
-182
-179
-176
-173
-169
-165
-161
-156
-150
-146
-140
-134
-128
-122
-117
-111
-104
-98
-91
-86
-79
-72
-66
-59
-52
-46
-39
-32
-26
-19
-12
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-10
-18
-24
-30
-36
-44
-50
-57
-63
-69
-76
-82
-88
-95
-101
-107
-113
-119
-125
-129
-135
-140
-146
-150
-155
-159
-163
-167
-170
-173
-174
-177
-178
-177
-177
-176
-175
-173
-170
-167
-163
-159
-155
-151
-146
-141
-136
-130
-124
-118
-112
-107
-100
-95
-88
-82
-76
-70
-63
-57
-50
-44
-37
-31
-24
-17
-11
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-8
-15
-21
-28
-34
-41
-47
-54
-60
-67
-73
-79
-85
-91
-97
-103
-108
-115
-120
-125
-131
-136
-141
-146
-150
-154
-158
-161
-163
-166
-169
-169
-170
-171
-170
-169
-168
-166
-164
-161
-158
-153
-150
-145
-141
-136
-131
-125
-120
-114
-109
-102
-97
-91
-85
-78
-72
-66
-60
-54
-47
-40
-35
-28
-21
-14
-8
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-13
-18
-25
-32
-38
-45
-51
-57
-63
-69
-75
-81
-88
-93
-99
-104
-110
-115
-121
-126
-130
-135
-140
-144
-148
-151
-154
-157
-159
-161
-163
-163
-164
-163
-162
-161
-160
-157
-155
-151
-147
-143
-139
-135
-131
-126
-120
-115
-110
-104
-99
-93
-87
-82
-76
-69
-63
-57
-51
-45
-38
-32
-25
-18
-12
-5
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-9
-16
-22
-29
-35
-41
-47
-53
-60
-66
-72
-78
-83
-89
-95
-100
-105
-111
-116
-121
-126
-130
-134
-138
-142
-145
-147
-151
-152
-154
-156
-156
-156
-157
-156
-154
-153
-151
-148
-145
-141
-138
-134
-130
-125
-121
-116
-111
-105
-100
-95
-89
-83
-78
-72
-65
-60
-53
-48
-41
-35
-29
-23
-15
-9
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-7
-13
-19
-25
-32
-38
-44
-50
-57
-62
-68
-73
-79
-85
-91
-96
-100
-105
-111
-115
-120
-124
-128
-132
-135
-138
-142
-143
-146
-147
-149
-150
-149
-150
-149
-148
-146
-144
-141
-139
-136
-133
-128
-124
-120
-115
-111
-106
-100
-95
-90
-85
-79
-74
-68
-62
-56
-50
-44
-38
-32
-25
-19
-12
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-10
-16
-22
-29
-35
-41
-47
-52
-58
-63
-70
-75
-80
-85
-91
-96
-101
-106
-110
-115
-119
-123
-126
-129
-132
-135
-137
-139
-140
-142
-142
-143
-142
-142
-141
-139
-137
-135
-133
-129
-126
-123
-118
-114
-110
-105
-101
-96
-91
-85
-81
-75
-70
-64
-58
-52
-46
-40
-34
-29
-22
-16
-10
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-6
-13
-18
-24
-31
-36
-42
-48
-54
-59
-65
-70
-76
-81
-86
-91
-96
-100
-105
-109
-113
-116
-120
-123
-126
-128
-130
-132
-134
-134
-135
-136
-135
-135
-133
-132
-130
-128
-126
-123
-119
-116
-113
-109
-105
-100
-95
-91
-86
-81
-76
-70
-65
-60
-54
-49
-43
-36
-31
-25
-19
-12
-7
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-9
-15
-21
-27
-33
-39
-44
-50
-55
-60
-66
-71
-76
-81
-85
-90
-94
-99
-103
-107
-110
-113
-116
-119
-122
-124
-125
-127
-128
-128
-129
-128
-128
-127
-126
-124
-122
-119
-116
-113
-110
-106
-103
-99
-95
-91
-86
-81
-76
-71
-66
-61
-56
-50
-44
-39
-32
-27
-21
-15
-9
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-11
-17
-22
-29
-34
-40
-46
-51
-56
-61
-66
-71
-76
-81
-85
-89
-93
-97
-101
-104
-107
-110
-113
-114
-117
-118
-120
-121
-121
-122
-121
-121
-120
-119
-117
-115
-113
-110
-107
-105
-100
-97
-94
-89
-85
-80
-76
-71
-66
-61
-56
-50
-46
-40
-34
-29
-23
-17
-11
-5
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-7
-13
-19
-24
-30
-35
-41
-46
-51
-56
-61
-66
-71
-75
-79
-83
-87
-91
-94
-98
-101
-104
-106
-108
-110
-112
-113
-114
-114
-114
-114
-114
-113
-111
-110
-108
-106
-104
-101
-98
-95
-92
-87
-83
-79
-75
-71
-66
-61
-56
-52
-46
-41
-36
-30
-24
-18
-13
-7
-2
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-4
-9
-15
-20
-25
-31
-36
-41
-46
-51
-56
-61
-65
-69
-73
-78
-81
-85
-88
-91
-94
-97
-100
-101
-103
-104
-106
-106
-107
-108
-107
-106
-106
-105
-103
-101
-100
-97
-94
-91
-88
-84
-82
-77
-74
-69
-65
-61
-56
-51
-46
-41
-36
-30
-25
-20
-15
-9
-3
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-4
-10
-16
-21
-26
-31
-37
-41
-46
-50
-55
-59
-64
-68
-72
-75
-79
-82
-85
-88
-91
-93
-95
-97
-98
-99
-100
-100
-100
-100
-100
-99
-98
-96
-94
-93
-91
-88
-85
-82
-79
-75
-71
-68
-64
-59
-56
-50
-46
-41
-36
-31
-26
-21
-15
-10
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-6
-11
-16
-21
-26
-31
-36
-41
-45
-50
-54
-58
-62
-66
-70
-72
-75
-79
-81
-84
-86
-88
-90
-91
-92
-93
-93
-93
-93
-93
-91
-91
-90
-88
-85
-84
-81
-78
-75
-72
-70
-66
-62
-58
-54
-50
-46
-41
-36
-31
-26
-21
-16
-11
-6
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-6
-11
-17
-22
-27
-31
-36
-39
-44
-49
-53
-56
-59
-63
-66
-69
-72
-75
-77
-79
-81
-82
-84
-85
-86
-86
-86
-86
-86
-84
-84
-83
-81
-79
-77
-74
-72
-70
-66
-63
-59
-56
-52
-48
-45
-40
-35
-31
-26
-21
-16
-11
-6
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-2
-6
-12
-16
-21
-26
-30
-34
-38
-42
-46
-50
-54
-57
-60
-63
-65
-68
-70
-73
-75
-76
-77
-78
-79
-80
-79
-79
-78
-78
-77
-76
-74
-72
-70
-68
-66
-63
-60
-57
-54
-50
-46
-43
-38
-34
-30
-26
-21
-16
-11
-6
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-6
-11
-16
-20
-24
-28
-33
-37
-41
-44
-48
-51
-54
-56
-59
-61
-63
-66
-67
-68
-70
-71
-71
-72
-72
-72
-71
-71
-70
-69
-67
-66
-64
-62
-59
-57
-54
-51
-47
-44
-41
-37
-33
-29
-24
-20
-15
-11
-6
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-5
-10
-15
-19
-23
-27
-31
-35
-38
-41
-45
-47
-51
-52
-55
-57
-59
-61
-62
-63
-64
-64
-65
-65
-65
-64
-64
-63
-62
-60
-58
-57
-55
-53
-51
-47
-44
-41
-38
-34
-31
-27
-23
-19
-14
-10
-5
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-5
-9
-13
-17
-21
-25
-29
-32
-35
-38
-41
-44
-46
-48
-50
-52
-53
-55
-56
-58
-58
-58
-58
-58
-58
-57
-56
-55
-54
-52
-50
-48
-46
-44
-41
-38
-35
-31
-29
-25
-21
-17
-13
-9
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-4
-8
-12
-15
-18
-22
-25
-28
-32
-35
-37
-40
-41
-44
-46
-47
-48
-49
-50
-51
-51
-51
-51
-51
-50
-49
-48
-47
-45
-43
-41
-39
-37
-34
-32
-29
-25
-22
-19
-15
-11
-7
-4
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-1
-5
-9
-12
-16
-20
-22
-25
-28
-30
-33
-35
-37
-39
-40
-41
-42
-43
-44
-44
-45
-44
-44
-43
-43
-41
-40
-38
-36
-35
-32
-30
-28
-25
-23
-19
-16
-12
-9
-6
-1
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-3
-7
-10
-13
-16
-18
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
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
http://repo.or.cz/w/gfxprim.git/commit/047ce730dcb1c40acf586439be2fc64352e7…
commit 047ce730dcb1c40acf586439be2fc64352e74621
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 23:33:27 2012 +0100
backends: Add GP_BackendUpdateXYWH().
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h
index 159892d..64b504d 100644
--- a/include/backends/GP_Backend.h
+++ b/include/backends/GP_Backend.h
@@ -139,9 +139,23 @@ static inline void GP_BackendFlip(GP_Backend *backend)
/*
* Calls backend->UpdateRect().
*/
-void GP_BackendUpdateRect(GP_Backend *backend,
- GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1);
+void GP_BackendUpdateRectXYXY(GP_Backend *backend,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1);
+
+static inline void GP_BackendUpdateRect(GP_Backend *backend,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1)
+{
+ return GP_BackendUpdateRectXYXY(backend, x0, y0, x1, y1);
+}
+
+static inline void GP_BackendUpdateRectXYWH(GP_Backend *backend,
+ GP_Coord x, GP_Coord y,
+ GP_Size w, GP_Size h)
+{
+ GP_BackendUpdateRectXYXY(backend, x, y, x + w, y + h);
+}
/*
* Calls backend->Exit().
diff --git a/libs/backends/GP_Backend.c b/libs/backends/GP_Backend.c
index 88b52a3..036fd56 100644
--- a/libs/backends/GP_Backend.c
+++ b/libs/backends/GP_Backend.c
@@ -25,16 +25,16 @@
#include "backends/GP_Backend.h"
-void GP_BackendUpdateRect(GP_Backend *backend,
- GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1)
+void GP_BackendUpdateRectXYXY(GP_Backend *backend,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1)
{
GP_TRANSFORM_POINT(backend->context, x0, y0);
GP_TRANSFORM_POINT(backend->context, x1, y1);
if (x1 < x0)
GP_SWAP(x0, x1);
-
+
if (y1 < y0)
GP_SWAP(y0, y1);
http://repo.or.cz/w/gfxprim.git/commit/0ddba05bdb8c901c75b4797e9d281ce1d630…
commit 0ddba05bdb8c901c75b4797e9d281ce1d6307e5e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Nov 21 20:55:17 2012 +0100
tests: SDL: Remove aatest.c.
diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile
index 1a27121..bea9cd3 100644
--- a/tests/SDL/Makefile
+++ b/tests/SDL/Makefile
@@ -8,7 +8,7 @@ ifeq ($(HAVE_LIBSDL),yes)
CSOURCES=$(shell echo *.c)
APPS=textaligntest blittest subcontext- aatest mixpixeltest
+ mixpixeltest
endif
include $(TOPDIR)/app.mk
diff --git a/tests/SDL/aatest.c b/tests/SDL/aatest.c
deleted file mode 100644
index 6eba9a6..0000000
--- a/tests/SDL/aatest.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <SDL/SDL.h>
-
-#include "GP.h"
-#include "GP_SDL.h"
-
-SDL_Surface *display = NULL;
-GP_Context context;
-
-static GP_Coord x = 10 * GP_FP_1 + GP_FP_1_2;
-static GP_Coord y = 10 * GP_FP_1 + GP_FP_1_2;
-
-SDL_UserEvent timer_event;
-
-GP_Pixel red_pixel, green_pixel, blue_pixel, white_pixel;
-
-static void draw(void)
-{
- GP_Context *ctx = &context;
-
- GP_Fill(ctx, white_pixel);
-
- GP_Coord i;
-
- for (i = 0; i < 24; i++) {
- // GP_FillRect(ctx, (x>>8), (y + (10*i<<8) - 128)>>8,
- // (x>>8) + 60, (y + ((10*i)<<8) + 64*i + 64 + 128)>>8, green_pixel);
-
- GP_FillRect_AA(ctx, x, y + ((10*i)<<8),
- x + (60<<8), y + ((10*i)<<8) + 64*i + 64, 0);
-
- GP_FillRect_AA(ctx, x + (80<<8), y + ((10*i)<<8) + 64,
- x + (140<<8), y + ((10*i)<<8) + 64*i + 128, 0);
-
- GP_FillRect_AA(ctx, x + (160<<8), y + ((10*i)<<8) + 128,
- x + (220<<8), y + ((10*i)<<8) + 64*i + 192, 0);
-
- GP_FillRect_AA(ctx, x + (240<<8), y + ((10*i)<<8) + 192,
- x + (300<<8), y + ((10*i)<<8) + 64*i + 256, 0);
- printf("%i --------------------------------------------------------n", i);
- }
-
- SDL_Flip(display);
-}
-
-void event_loop(void)
-{
- SDL_Event event;
-
- while (SDL_WaitEvent(&event) > 0) {
- switch (event.type) {
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym) {
- case SDLK_DOWN:
- y += 64;
- draw();
- break;
- case SDLK_UP:
- y -= 64;
- draw();
- break;
- case SDLK_LEFT:
- x -= 64;
- draw();
- break;
- case SDLK_RIGHT:
- x += 64;
- draw();
- break;
- case SDLK_x:
- context.x_swap = !context.x_swap;
- draw();
- break;
- case SDLK_y:
- context.y_swap = !context.y_swap;
- draw();
- break;
- case SDLK_r:
- context.axes_swap = !context.axes_swap;
- draw();
- break;
- case SDLK_ESCAPE:
- case SDLK_q:
- return;
- default:
- break;
- }
- break;
- case SDL_QUIT:
- return;
- }
- }
-}
-
-int main(int argc, char **argv)
-{
- int display_bpp = 0;
-
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-16") == 0) {
- display_bpp = 16;
- } else if (strcmp(argv[i], "-24") == 0) {
- display_bpp = 24;
- }
- }
-
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
- fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError());
- return 1;
- }
-
- display = SDL_SetVideoMode(320, 320, display_bpp, SDL_SWSURFACE);
- if (display == NULL) {
- fprintf(stderr, "Could not open display: %sn", SDL_GetError());
- goto fail;
- }
-
-
- printf("Display surface properties:n");
- printf(" width: %4d, height: %4d, pitch: %4dn",
- display->w, display->h, display->pitch);
- printf(" bits per pixel: %2d, bytes per pixel: %2dn",
- display->format->BitsPerPixel, display->format->BytesPerPixel);
-
- GP_SDL_ContextFromSurface(&context, display);
-
- red_pixel = GP_ColorToContextPixel(GP_COL_RED, &context);
- green_pixel = GP_ColorToContextPixel(GP_COL_GREEN, &context);
- blue_pixel = GP_ColorToContextPixel(GP_COL_BLUE, &context);
- white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, &context);
-
- draw();
-
- event_loop();
- SDL_Quit();
- return 0;
-
-fail:
- SDL_Quit();
- return 1;
-}
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/Makefile | 2 +-
{tests/SDL => demos/c_simple}/ball.ppm | Bin 30054 -> 30054 bytes
{tests/SDL => demos/c_simple}/blittest.c | 195 +-
include/backends/GP_Backend.h | 20 +-
libs/backends/GP_Backend.c | 8 +-
tests/SDL/Makefile | 4 +-
tests/SDL/aatest.c | 168 -
tests/SDL/ball.pgm |10004 ------------------------------
8 files changed, 95 insertions(+), 10306 deletions(-)
rename {tests/SDL => demos/c_simple}/ball.ppm (100%)
rename {tests/SDL => demos/c_simple}/blittest.c (51%)
delete mode 100644 tests/SDL/aatest.c
delete mode 100644 tests/SDL/ball.pgm
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
[repo.or.cz] gfxprim.git branch master updated: e90eda658220809b70c37e954d2624e3cfdcd5ea
by metan 10 Nov '12
by metan 10 Nov '12
10 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via e90eda658220809b70c37e954d2624e3cfdcd5ea (commit)
from aaa7f50197c97d3b9b7f5d30cbe1f91c51f52384 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/e90eda658220809b70c37e954d2624e3cfdc…
commit e90eda658220809b70c37e954d2624e3cfdcd5ea
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 17:27:32 2012 +0100
doc: Move ProgressCallback to core, add example.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index f02688a..1542083 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -88,33 +88,3 @@ void GP_ColorLoadContextPixels(GP_Pixel pixels[], GP_Context *context);
Loads array of 'GP_Pixel' of size 'GP_COL_MAX', the array is then used with
the GP_Color enum as 'pixels[GP_COL_BLACK]'.
-Progress Callback
-~~~~~~~~~~~~~~~~~
-
-The 'GP_ProgressCallback' is a structure that stores user-defined callback
-function and user-defined pointer and percentage.
-
-It is passed as last parameter to functions that would take some time to
-complete and adds capability to track the operation progress as well as to
-abort the operation.
-
-Currently it's used for filters and loaders.
-
-[source,c]
--------------------------------------------------------------------------------
-typdedef struct GP_ProgressCallback {
- float percentage;
- int (*callback)(struct GP_ProgressCallback *self);
- void *priv;
-} GP_ProgressCallback;
--------------------------------------------------------------------------------
-
-If non 'NULL' progress callback structure is passed to a function, the
-callback function is periodically called and the percentage is updated.
-
-The return value from callback could abort the function execution. If non zero
-value is returned operation is aborted, all memory freed etc. and in case of
-bitmap loaders 'errno' is set to 'ECANCELED'.
-
-The callback, if supported, is the last parameter of a function.
-
diff --git a/doc/core.txt b/doc/core.txt
index fdb8056..3e20ee2 100644
--- a/doc/core.txt
+++ b/doc/core.txt
@@ -56,6 +56,39 @@ Value clamping macros.
NOTE: this header is not included by including the 'GP.h' header.
+Progress Callback
+~~~~~~~~~~~~~~~~~
+
+The 'GP_ProgressCallback' is a structure that stores user-defined callback
+function and user-defined pointer and percentage.
+
+It is passed as last parameter to functions that would take some time to
+complete and adds capability to track the operation progress as well as to
+abort the operation.
+
+Currently it's used for filters and loaders.
+
+[source,c]
+-------------------------------------------------------------------------------
+typdedef struct GP_ProgressCallback {
+ float percentage;
+ int (*callback)(struct GP_ProgressCallback *self);
+ void *priv;
+} GP_ProgressCallback;
+-------------------------------------------------------------------------------
+
+If non 'NULL' progress callback structure is passed to a function, the
+callback function is periodically called and the percentage is updated.
+
+The return value from callback could abort the function execution. If non zero
+value is returned operation is aborted, all memory freed etc. and in case of
+bitmap loaders 'errno' is set to 'ECANCELED'.
+
+The callback, if supported, is the last parameter of a function.
+
+For example usage see progress callback
+link:example_loaders_progress_callback.html[example].
+
Temporary Buffer Allocator
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/example_loaders_progress_callback.txt b/doc/example_loaders_progress_callback.txt
new file mode 100644
index 0000000..7da5160
--- /dev/null
+++ b/doc/example_loaders_progress_callback.txt
@@ -0,0 +1,7 @@
+Graphics Backend Example
+------------------------
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/loaders.c[]
+------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
doc/basic_types.txt | 30 ------------------
doc/core.txt | 33 ++++++++++++++++++++
...d.txt => example_loaders_progress_callback.txt} | 2 +-
3 files changed, 34 insertions(+), 31 deletions(-)
copy doc/{example_backend.txt => example_loaders_progress_callback.txt} (80%)
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
[repo.or.cz] gfxprim.git branch master updated: aaa7f50197c97d3b9b7f5d30cbe1f91c51f52384
by metan 10 Nov '12
by metan 10 Nov '12
10 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via aaa7f50197c97d3b9b7f5d30cbe1f91c51f52384 (commit)
via 5c61bb13e751a867d68d1443e20b80a992ae1e11 (commit)
from fd437dffad5c449ae3dff083562b0db30ea1eb8e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/aaa7f50197c97d3b9b7f5d30cbe1f91c51f5…
commit aaa7f50197c97d3b9b7f5d30cbe1f91c51f52384
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 17:07:02 2012 +0100
doc: Add more examples and links.
diff --git a/doc/backends.txt b/doc/backends.txt
index 66728f7..a471652 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -10,6 +10,8 @@ controlling the drawing.
So far there are three backends implemented, Linux mmaped frame-buffer, libSDL
and X11 backend.
+For example usage see backend link:example_backend.html[example].
+
Initialization functions
~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/example_backend.txt b/doc/example_backend.txt
new file mode 100644
index 0000000..ed13dea
--- /dev/null
+++ b/doc/example_backend.txt
@@ -0,0 +1,7 @@
+Graphics Backend Example
+------------------------
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/backend_example.c[]
+------------------------------------------------------------------
diff --git a/doc/example_v4l2.txt b/doc/example_v4l2.txt
new file mode 100644
index 0000000..2f1e389
--- /dev/null
+++ b/doc/example_v4l2.txt
@@ -0,0 +1,17 @@
+Graphics Backend Example
+------------------------
+
+Simple grabber that saves images taken from v4l2 device.
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/v4l2_grab.c[]
+------------------------------------------------------------------
+
+More sophisticated example utilizing v4l2 device and
+link:backends.html[backends].
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/v4l2_show.c[]
+------------------------------------------------------------------
diff --git a/doc/grabbers.txt b/doc/grabbers.txt
index 93af01b..a794847 100644
--- a/doc/grabbers.txt
+++ b/doc/grabbers.txt
@@ -8,6 +8,8 @@ There is currently V4L2 driver that implements a grabber.
To link against grabbers use +-lGP_grabbers+ or better
+`gfxprim-config --libs-grabbers`+ in your linker flags.
+For example usage see grabber link:example_v4l2.html[examples].
+
Grabber API
~~~~~~~~~~~
http://repo.or.cz/w/gfxprim.git/commit/5c61bb13e751a867d68d1443e20b80a992ae…
commit 5c61bb13e751a867d68d1443e20b80a992ae1e11
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 16:55:08 2012 +0100
doc: Remove the all-in-one page API docs.
diff --git a/doc/Makefile b/doc/Makefile
index 19b89d2..4160ae0 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,6 +1,6 @@
SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt backends.txt gamma.txt grabbers.txt - environment_variables.txt debug.txt core.txt
+ environment_variables.txt debug.txt core.txt api.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
@@ -14,13 +14,7 @@ GENIMAGES=discrete_linear_1D_convolution_alg1 discrete_linear_1D_convolution_alg
PAGES=$(subst .txt,.html,$(SOURCES))
PAGES+=$(subst .txt,.html,$(EXAMPLE_SOURCES))
-all: api.html examples.html $(PAGES) api_links.html
-
-#
-# Create all in one API page
-#
-api.html: $(SOURCES) api.txt
- asciidoc -a toc api.txt
+all: examples.html $(PAGES) api.html
#
# Create page for each part of API description
@@ -28,17 +22,9 @@ api.html: $(SOURCES) api.txt
$(PAGES): %.html: %.txt
asciidoc $<
-api_links.html: api_links.txt
- asciidoc $<
-
examples.html: examples.txt ../demos/c_simple/*.c ../demos/py_simple/*.py
asciidoc -a toc examples.txt
-api.pdf: api.txt
- asciidoc -b docbook api.txt
- xsltproc /usr/share/sgml/docbook/xsl-stylesheets/fo/docbook.xsl api.xml > api.fo
- fop api.fo -pdf api.pdf
-
#
# Clean up generated images
#
diff --git a/doc/README b/doc/README
index 87e78a6..ae93336 100644
--- a/doc/README
+++ b/doc/README
@@ -3,7 +3,3 @@ This directory contains asciidoc documentation.
The html pages are generated by typing 'make'.
In order to do that asciidoc and source-highlight, latex and dvipng must be installed.
-
-
-The pdf documentation could be generated by typing 'make api.pdf' for that fop
-and xsltproc must be installed.
diff --git a/doc/api.txt b/doc/api.txt
index 899df1c..aff68ea 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -2,17 +2,56 @@ GFXprim API
===========
Cyril Hrubis <metan(a)ucw.cz>
-This documentation is also available link:api_links.html[divided into several
-pages].
-
-include::general.txt[]
-include::basic_types.txt[]
-include::environment_variables.txt[]
-include::debug.txt[]
-include::context.txt[]
-include::gamma.txt[]
-include::drawing_api.txt[]
-include::filters.txt[]
-include::loaders.txt[]
-include::backends.txt[]
-include::grabbers.txt[]
+. link:basic_types.html[Basic library types]
+ +
+ Describes how colors and pixels are handled also describes progress callback
+ in great detail.
+ +
+. link:core.html[Library Core overview]
+ +
+ Describes functions and macros in library core.
+ +
+. link:debug.html[Debug Messages]
+ +
+ Interface to debug layer.
+ +
+. link:context.html[Context]
+ +
+ The Context is description of in-memory bitmap including some meta-data
+ (size, pixel format, etc...).
+ +
+. link:environment_variables.html[Environment Variables]
+ +
+ Description of environment variables that affects GFXprim behavior.
+ +
+. link:gamma.html[Gamma correction]
+ +
+ The gama correction description and handling in GFXprim.
+ +
+. link:drawing_api.html[Drawing primitives]
+ +
+ Drawing API for primitives such as lines, polygons and circles as well as
+ text drawing.
+ +
+. link:filters.html[Context filters]
+ +
+ Context filters, basically all algorithms that takes an Context as an input
+ and returns Context as output.
+ +
+ Includes resampling, convolutions, low pass (blur) filters, dithering and
+ more.
+ +
+. link:loaders.html[Context loaders]
+ +
+ Handles loading and saving images in standard formats.
+ +
+. link:backends.html[Backends]
+ +
+ Backends API for drawing on the screen or into a window.
+ +
+. link:grabbers.html[Grabbers]
+ +
+ Video grabbers interface such as V4L2.
+ +
+
+There is also a nice page with code link:examples.html[examples].
diff --git a/doc/api_links.txt b/doc/api_links.txt
deleted file mode 100644
index 3aff6f9..0000000
--- a/doc/api_links.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-GFXprim API
-===========
-Cyril Hrubis <metan(a)ucw.cz>
-
-Also available in link:api.html[all in one page form].
-
-
-. link:basic_types.html[Basic library types]
- +
- Describes how colors and pixels are handled also describes progress callback
- in great detail.
- +
-. link:core.html[Library Core overview]
- +
- Describes functions and macros in library core.
- +
-. link:debug.html[Debug Messages]
- +
- Interface to debug layer.
- +
-. link:context.html[Context]
- +
- The Context is description of in-memory bitmap including some meta-data
- (size, pixel format, etc...).
- +
-. link:environment_variables.html[Environment Variables]
- +
- Description of environment variables that affects GFXprim behavior.
- +
-. link:gamma.html[Gamma correction]
- +
- The gama correction description and handling in GFXprim.
- +
-. link:drawing_api.html[Drawing primitives]
- +
- Drawing API for primitives such as lines, polygons and circles as well as
- text drawing.
- +
-. link:filters.html[Context filters]
- +
- Context filters, basically all algorithms that takes an Context as an input
- and returns Context as output.
- +
- Includes resampling, convolutions, low pass (blur) filters, dithering and
- more.
- +
-. link:loaders.html[Context loaders]
- +
- Handles loading and saving images in standard formats.
- +
-. link:backends.html[Backends]
- +
- Backends API for drawing on the screen or into a window.
- +
-. link:grabbers.html[Grabbers]
- +
- Video grabbers interface such as V4L2.
- +
-
-There is also a nice page with code link:examples.html[examples].
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 18 +-----
doc/README | 4 -
doc/api.txt | 67 +++++++++++++++----
doc/api_links.txt | 60 -----------------
doc/backends.txt | 2 +
...loader_registration.txt => example_backend.txt} | 6 +-
doc/example_v4l2.txt | 17 +++++
doc/grabbers.txt | 2 +
8 files changed, 79 insertions(+), 97 deletions(-)
delete mode 100644 doc/api_links.txt
copy doc/{example_loader_registration.txt => example_backend.txt} (55%)
create mode 100644 doc/example_v4l2.txt
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
[repo.or.cz] gfxprim.git branch master updated: fd437dffad5c449ae3dff083562b0db30ea1eb8e
by metan 10 Nov '12
by metan 10 Nov '12
10 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via fd437dffad5c449ae3dff083562b0db30ea1eb8e (commit)
via b455c46c4d84d1ac66113db48722d9247cb2fc34 (commit)
via 03e092e8d75543e3446afe498e359bb1e4be6856 (commit)
via 03b001ae92a7ad29e60bcaa3ca1bb93e46963048 (commit)
from 80d1a231acdf63c758e84a257c20aaffca6550e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/fd437dffad5c449ae3dff083562b0db30ea1…
commit fd437dffad5c449ae3dff083562b0db30ea1eb8e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 16:49:36 2012 +0100
doc: Library core functions and macros docs.
diff --git a/doc/Makefile b/doc/Makefile
index acdade4..19b89d2 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,6 +1,6 @@
SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt backends.txt gamma.txt grabbers.txt - environment_variables.txt debug.txt
+ environment_variables.txt debug.txt core.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
diff --git a/doc/api_links.txt b/doc/api_links.txt
index 2e41996..3aff6f9 100644
--- a/doc/api_links.txt
+++ b/doc/api_links.txt
@@ -10,6 +10,10 @@ Also available in link:api.html[all in one page form].
Describes how colors and pixels are handled also describes progress callback
in great detail.
+
+. link:core.html[Library Core overview]
+ +
+ Describes functions and macros in library core.
+ +
. link:debug.html[Debug Messages]
+
Interface to debug layer.
diff --git a/doc/core.txt b/doc/core.txt
new file mode 100644
index 0000000..fdb8056
--- /dev/null
+++ b/doc/core.txt
@@ -0,0 +1,140 @@
+Library Core
+------------
+
+The core of the library contains the 'GP_Context' structure which describes
+in-memory bitmap (see context) as well as the most basic functionality (i.e.
+reading/writing pixels, gamma handling, blits, progress callback, debug
+printing...). More complex parts of the core library are discussed in separate
+pages.
+
+Some of the interfaces described here (most notably the allocator) are
+semi-internal interfaces and as such the API may change in the future.
+
+Common Macros and Inline Functions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Common.h>
+/* or */
+#include <GP.h>
+
+GP_MIN(a, b);
+
+GP_MAX(a, b);
+
+GP_ABS(a);
+
+GP_SWAP(a, b);
+
+GP_SIGN(a);
+
+-------------------------------------------------------------------------------
+
+These common macros implements basic functions such as minimum, maximum,
+absolute value, swap and sign.
+
+All macros use 'typeof()' in order to evaluate their arguments exactly once.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Clamp.h>
+
+/*
+ * Clamps integer value to 8 bit unsigned value.
+ */
+GP_CLAMP_INT_0_255(val);
+
+/*
+ * Clamps integer value.
+ */
+GP_CLAMP(val, min, max);
+
+-------------------------------------------------------------------------------
+
+Value clamping macros.
+
+NOTE: this header is not included by including the 'GP.h' header.
+
+Temporary Buffer Allocator
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Temporary buffer allocator is used to allocate temporary buffer needed for
+certain operations (mostly used in image filters).
+
+The intended usage of temporary buffers is:
+
+* Count sum of the size needed for all buffers
+* Allocate temporary buffer of this size
+* Partition the buffer into smaller blocks
+* Use the blocks as needed
+* Once operation is done, free the buffer
+
+The allocator code greatly simplifies these steps. Moreover it avoids memory
+fragmentation by creating small buffers on the process stack (current theshold
+is set to 2kB) and by grouping the temporary buffers into one continuous
+region.
+
+NOTE: The allocator itself does not align the resulting blocks. It's your
+ responsibility to allocate the buffers in a way that the result is
+ adequately aligned (hint: the start of the block is aligned, so
+ get blocks that needs to be aligned first).
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_TempAlloc.h>
+
+/*
+ * A macro that creates block allocator.
+ *
+ * The name must be unique among variable and functions names.
+ *
+ * The bsize is actual size of the block allocated.
+ */
+GP_TempAllocCreate(name, bsize);
+
+/*
+ * A macro that returns pointer to the start of a block of a bsize
+ * partioned from the block allocator passed as self argument.
+ */
+GP_TempAllocGet(self, bsize);
+
+/*
+ * Free the allocator memory.
+ */
+GP_TempAllocFree(self);
+-------------------------------------------------------------------------------
+
+Example usage of the allocator:
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_TempAlloc.h>
+
+int foo(...)
+{
+ GP_TempAllocCreate(tmp, 3 * img->width);
+
+ uint8_t *R = GP_TempAllocGet(tmp, img->width);
+ uint8_t *G = GP_TempAllocGet(tmp, img->width);
+ uint8_t *B = GP_TempAllocGet(tmp, img->width);
+
+ /* start of the code that uses the buffers */
+
+ ...
+
+ if (error) {
+ GP_TempAllocFree(self);
+ return -1;
+ }
+
+ ...
+
+ /* end of the code that uses the buffers */
+
+ GP_TempAllocFree(self);
+
+ return 0;
+}
+-------------------------------------------------------------------------------
+
http://repo.or.cz/w/gfxprim.git/commit/b455c46c4d84d1ac66113db48722d9247cb2…
commit b455c46c4d84d1ac66113db48722d9247cb2fc34
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 16:32:43 2012 +0100
doc: Update loaders documentation.
diff --git a/doc/Makefile b/doc/Makefile
index bda6964..acdade4 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -2,6 +2,8 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt backends.txt gamma.txt grabbers.txt environment_variables.txt debug.txt
+EXAMPLE_SOURCES=$(wildcard example_*.txt)
+
#
# Names of generated images for cleanup
#
@@ -10,7 +12,7 @@ GENIMAGES=discrete_linear_1D_convolution_alg1 discrete_linear_1D_convolution_alg
discrete_linear_convolution_alg2 laplacian_edge_sharpening laplacian_kernel
PAGES=$(subst .txt,.html,$(SOURCES))
-
+PAGES+=$(subst .txt,.html,$(EXAMPLE_SOURCES))
all: api.html examples.html $(PAGES) api_links.html
diff --git a/doc/example_loader_registration.txt b/doc/example_loader_registration.txt
new file mode 100644
index 0000000..b287560
--- /dev/null
+++ b/doc/example_loader_registration.txt
@@ -0,0 +1,7 @@
+Image Loader Registration Example
+---------------------------------
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/loaders_register.c[]
+------------------------------------------------------------------
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 99ed35d..e12c6f8 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -3,14 +3,25 @@ Context loaders
This part of GFXprim library aims to create API to load and save images
from/to common image file formats.
+Currently we support JPEG, PNG and some PNM images for loading and saving and
+BMP, GIF and PSP for loading.
+
+Loaders API
+~~~~~~~~~~~
+
All loading functions returns a pointer to allocated and loaded image or upon
-a failure 'NULL' and 'errno' is set.
+a failure 'NULL'.
+
+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 filesystem before the call returns.
+
+In case of a failure 'errno' is set.
-All saving functions returns zero on success and non-zero on failure and
-'errno' is set. If image saving is aborted by a callback, the opened file is
-closed and removed from a filesystem before the call returns.
+The signature matching functions takes a 32 bytes long buffer and looks for a
+valid image signature. If signature is found 1 is returned.
-The possible 'errno' values (for both loading and saving) are:
+The possible 'errno' values are:
* anything returned by +open()+, +close()+, +lseek()+, +read()+, +write()+, ...
- 'ENOENT' if file doesn't exist
@@ -22,8 +33,11 @@ The possible 'errno' values (for both loading and saving) are:
* 'EIO' invalid image data (wrong signature, header or image data)
* 'ECANCELED' action canceled by returning non-zero from within a callback
-Common Loader
-~~~~~~~~~~~~~
+You can get more information about the error condition by turning on GFXprim
+debug messages.
+
+Image Loader
+~~~~~~~~~~~~
[source,c]
-------------------------------------------------------------------------------
@@ -34,9 +48,21 @@ Common Loader
GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads image from a file. The format is now matched by an image file extension.
-Fallback to file signature if file content doesn't match it's extension is on
-the TODO.
+Loads image from a file.
+
+The image format is first guessed by the file extension. If loader for the
+file extension is found it's called and if it succedes the image data is
+returned.
+
+If extension based guess fails either because the extension wasn't matched or
+if the loader for the extension failed; the signature based method is used.
+The loader loads several bytes (currently 32) from the file and calls
+signature matching functions for each format that implements signature
+matching. If image signature is found particular image loader it is called
+and the result is returned.
+
+If file extension disagrees with file signature a warning is printed into the
+stdout.
[source,c]
-------------------------------------------------------------------------------
@@ -48,16 +74,115 @@ int GP_SaveImage(GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves a context into a file. The file format is matched accordingly to the
-file extension, if extension is invalid or if support for requested image
-format wasn't compiled in, non-zero is returned and 'errno' is set to
-'ENOSYS'.
+Saves a context into a file.
+
+The file format is matched accordingly to the file extension. If extension is
+not found non-zero is returned and 'errno' is set to 'EINVAL'. If extension
+was found but support for saving the image format is not implemented 'errno'
+is set to 'ENOSYS'.
+
+
+Advanced usage
+^^^^^^^^^^^^^^
+
+[source,c]
+-------------------------------------------------------------------------------
+typedef struct GP_Loader {
+ /*
+ * Loads an image.
+ *
+ * Returns allocated and initialized bitmap on success, NULL on failure
+ * and errno must be set.
+ */
+ GP_Context *(*Load)(const char *src_path, GP_ProgressCallback *callback);
+
+ /*
+ * Save an image.
+ *
+ * Returns zero on succes, non-zero on failure and errno must be set.
+ */
+ int (*Save)(const GP_Context *src, const char *dst_path,
+ GP_ProgressCallback *callback);
+
+ /*
+ * The buffer is filled with 32 bytes from an image start, returns 1 if
+ * image signature was found zero otherwise.
+ */
+ int (*Match)(const void *buf);
+
+ /*
+ * Short format name.
+ */
+ const char *fmt_name;
+
+ /* don't touch */
+ struct GP_Loader *next;
+
+ /*
+ * NULL terminated array of file extensions.
+ */
+ const char *extensions[];
+} GP_Loader;
+
+/*
+ * List loaders into the stdout.
+ */
+void GP_ListLoaders(void);
+
+/*
+ * Register a loader.
+ */
+void GP_LoaderRegister(GP_Loader *self);
+
+/*
+ * Unregister loader.
+ */
+void GP_LoaderUnregister(GP_Loader *self);
+-------------------------------------------------------------------------------
+
+The 'GP_Loader' structure describes an image loader.
+
+The 'Load', 'Save' and 'Match' functions could be 'NULL' if the particular
+functionality is not implemented.
+
+The 'fmt_name' is a short string that describes the format. For example:
+'Netbpm portable pixmap'.
+
+The extensions is 'NULL'-terminated array of strings that holds all possible
+extensions that are commonly used for this image format.
+
+All internal loaders are all described in list of this structures which is
+used to implement functions such as 'GP_LoadImage()'.
+
+You can print currently active loaders via the 'GP_ListLoaders()' register and
+unregister your own loaders by 'GP_LoaderRegister()' and
+'GP_LoaderUnregister()'. Once image loader is registered the generic loading
+functions could use it to load and save images.
+
+For example usage see image loader registration
+link:example_loader_registration.html[example].
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_Loaders.h>
+/* or */
+#include <GP.h>
+
+const GP_Loader *GP_MatchSignature(const void *buf)
+-------------------------------------------------------------------------------
+
+Returns pointer to image loader accordingly to image signature or 'NULL' if no
+suitable loader was found. The buf pointer must point to a buffer at least 32
+bytes long.
+
+WARNING: If you attempt to modify the content of the strucutre the behavior is
+ undefined. Most likely the program will crash.
-PNG
-~~~
+PNG Loader
+~~~~~~~~~~
The 'PNG' image support is implemented by the libpng library.
-WARNING: PNG images with alpha channel are not supported yet.
+NOTE: PNG images with alpha channel are not supported yet.
[source,c]
-------------------------------------------------------------------------------
@@ -114,8 +239,19 @@ Currently only 'RGB888' format is supported, you should convert the
'GP_Context' to 'RGB888' before calling this function otherwise non-zero is
returned and 'errno' is set to 'ENOSYS'.
-JPEG
-~~~~
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_PNG.h>
+/* or */
+#include <GP.h>
+
+int GP_MatchPNG(const void *buf);
+-------------------------------------------------------------------------------
+
+Matches a PNG signature.
+
+JPEG Loader
+~~~~~~~~~~~
The 'JPEG' image support is implemented by the jpeg library.
[source,c]
@@ -180,8 +316,19 @@ is closed and removed before the call returns non-zero and 'errno' is set to
The 'JPG' format could store either 'G8' or 'RGB888' pixeltypes and you must
convert the context into one of them before this functions is called.
-GIF
-~~~
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_JPG.h>
+/* or */
+#include <GP.h>
+
+int GP_MatchJPG(const void *buf);
+-------------------------------------------------------------------------------
+
+Matches a JPG signature.
+
+GIF Loader
+~~~~~~~~~~
The 'GIF' image support is implemented by the giflib library.
@@ -229,8 +376,19 @@ GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback);
Same as above but takes path to the file as a parameter and check for the
signature. Basically this combines both of the calls above.
-BMP
-~~~
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_GIF.h>
+/* or */
+#include <GP.h>
+
+int GP_MatchGIF(const void *buf);
+-------------------------------------------------------------------------------
+
+Matches a GIF signature.
+
+BMP Loader
+~~~~~~~~~~
The 'BMP' loading support is nearly complete the only missing features should
be fancy RGB compressions and RLE support.
@@ -280,9 +438,72 @@ GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback);
Same as above but takes path to the file as a parameter and check for the
signature. Basically this combines both of the calls above.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_BMP.h>
+/* or */
+#include <GP.h>
+
+int GP_MatchBMP(const void *buf);
+-------------------------------------------------------------------------------
+
+Matches a BMP signature.
+
+PSP Loader
+~~~~~~~~~~
+
+The 'PSP' loader can load a composite image from a Paint Shop Pro Image Files.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_PSP.h>
+/* or */
+#include <GP.h>
+
+int GP_OpenPSP(const char *src_path, FILE **f);
+-------------------------------------------------------------------------------
+
+Opens file and checks for 'PSP' signature. Upon successful return (file could
+be opened, signature matches) zero is returned. Upon failure non-zero is
+returned and 'errno' is set.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_PSP.h>
+/* or */
+#include <GP.h>
+
+GP_Context *GP_ReadPSP(FILE *f, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Reads 'PSP' image into a context.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_PSP.h>
+/* or */
+#include <GP.h>
+
+GP_Context *GP_LoadPSP(const char *src_path, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Same as above but takes path to the file as a parameter and check for the
+signature. Basically this combines both of the calls above.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_PSP.h>
+/* or */
+#include <GP.h>
+
+int GP_MatchPSP(const void *buf);
+-------------------------------------------------------------------------------
+
+Matches a PSP signature.
+
PBM, PGM, PPM
~~~~~~~~~~~~~
There is a code do load and write 'PBM', 'PGM' and 'PPM' images too. However
it's not finished and its API is outdated. Use at your own risk.
-
http://repo.or.cz/w/gfxprim.git/commit/03e092e8d75543e3446afe498e359bb1e4be…
commit 03e092e8d75543e3446afe498e359bb1e4be6856
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 15:07:30 2012 +0100
loaders: Add GP_MatchImage().
diff --git a/include/loaders/GP_Loader.h b/include/loaders/GP_Loader.h
index ef7add1..6730613 100644
--- a/include/loaders/GP_Loader.h
+++ b/include/loaders/GP_Loader.h
@@ -102,6 +102,12 @@ typedef struct GP_Loader {
const char *extensions[];
} GP_Loader;
+/*
+ * Takes pointer to buffer at least 32 bytes long and returns a pointer to
+ * matched loader or NULL.
+ */
+const GP_Loader *GP_MatchSignature(const void *buf);
+
void GP_LoaderRegister(GP_Loader *self);
void GP_LoaderUnregister(GP_Loader *self);
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index b1769be..3d626a6 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -199,13 +199,13 @@ static struct GP_Loader *loader_by_filename(const char *path)
return loader_by_extension(ext);
}
-static struct GP_Loader *loader_by_signature(const char *path)
+static const GP_Loader *loader_by_signature(const char *path)
{
uint8_t buf[32];
FILE *f;
int err;
- GP_DEBUG(1, "Trying to match file signature");
+ GP_DEBUG(1, "Trying to load a file by signature");
f = fopen(path, "rb");
@@ -224,16 +224,7 @@ static struct GP_Loader *loader_by_signature(const char *path)
fclose(f);
- struct GP_Loader *i;
-
- for (i = loaders; i != NULL; i = i->next) {
- if (i->Match && i->Match(buf)) {
- GP_DEBUG(1, "Found loader '%s'", i->fmt_name);
- return i;
- }
- }
-
- return NULL;
+ return GP_MatchSignature(buf);
}
GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
@@ -253,7 +244,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
}
GP_Context *img;
- struct GP_Loader *ext_load = NULL, *sig_load;
+ const GP_Loader *ext_load = NULL, *sig_load;
ext_load = loader_by_filename(src_path);
@@ -431,3 +422,19 @@ int GP_SaveImage(const GP_Context *src, const char *dst_path,
errno = ENOSYS;
return 1;
}
+
+const GP_Loader *GP_MatchSignature(const void *buf)
+{
+ struct GP_Loader *i;
+
+ for (i = loaders; i != NULL; i = i->next) {
+ if (i->Match && i->Match(buf) == 1) {
+ GP_DEBUG(1, "Found loader '%s'", i->fmt_name);
+ return i;
+ }
+ }
+
+ GP_DEBUG(1, "Loader not found");
+
+ return NULL;
+}
http://repo.or.cz/w/gfxprim.git/commit/03b001ae92a7ad29e60bcaa3ca1bb93e4696…
commit 03b001ae92a7ad29e60bcaa3ca1bb93e46963048
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 14:39:44 2012 +0100
loaders: Now we aren't fooled by wrong filename extension.
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index 0ef1024..b1769be 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -236,6 +236,48 @@ static struct GP_Loader *loader_by_signature(const char *path)
return NULL;
}
+GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
+{
+ int saved_errno;
+
+ if (access(src_path, R_OK)) {
+
+ saved_errno = errno;
+
+ GP_DEBUG(1, "Failed to access file '%s' : %s",
+ src_path, strerror(errno));
+
+ errno = saved_errno;
+
+ return NULL;
+ }
+
+ GP_Context *img;
+ struct GP_Loader *ext_load = NULL, *sig_load;
+
+ ext_load = loader_by_filename(src_path);
+
+ if (ext_load != NULL) {
+ img = ext_load->Load(src_path, callback);
+
+ if (img)
+ return img;
+ }
+
+ sig_load = loader_by_signature(src_path);
+
+ if (ext_load && sig_load) {
+ GP_WARN("File '%s': Extension says %s but signature %s",
+ src_path, ext_load->fmt_name, sig_load->fmt_name);
+ }
+
+ if (sig_load)
+ return sig_load->Load(src_path, callback);
+
+ errno = ENOSYS;
+ return NULL;
+}
+
enum GP_ImageFmt {
GP_FMT_UNKNOWN,
GP_FMT_PNG,
@@ -341,61 +383,6 @@ enum GP_ImageFmt filename_to_fmt(const char *path)
return GP_FMT_UNKNOWN;
}
-GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
-{
- int saved_errno;
-
- if (access(src_path, R_OK)) {
-
- saved_errno = errno;
-
- GP_DEBUG(1, "Failed to access file '%s' : %s",
- src_path, strerror(errno));
-
- errno = saved_errno;
-
- return NULL;
- }
-
- enum GP_ImageFmt fmt = filename_to_fmt(src_path);
-
- switch (fmt) {
- case GP_FMT_JPG:
- return GP_LoadJPG(src_path, callback);
- case GP_FMT_PNG:
- return GP_LoadPNG(src_path, callback);
- case GP_FMT_GIF:
- return GP_LoadGIF(src_path, callback);
- case GP_FMT_PSP:
- return GP_LoadPSP(src_path, callback);
- case GP_FMT_BMP:
- return GP_LoadBMP(src_path, callback);
- case GP_FMT_PBM:
- return GP_LoadPBM(src_path, callback);
- case GP_FMT_PGM:
- return GP_LoadPGM(src_path, callback);
- case GP_FMT_PPM:
- return GP_LoadPPM(src_path, callback);
- case GP_FMT_UNKNOWN:
- break;
- }
-
- struct GP_Loader *l;
-
- l = loader_by_filename(src_path);
-
- if (l != NULL)
- return l->Load(src_path, callback);
-
- l = loader_by_signature(src_path);
-
- if (l != NULL)
- return l->Load(src_path, callback);
-
- errno = ENOSYS;
- return NULL;
-}
-
int GP_LoadMetaData(const char *src_path, GP_MetaData *data)
{
int saved_errno;
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 6 +-
doc/api_links.txt | 4 +
doc/core.txt | 140 ++++++++++++++++++
doc/example_loader_registration.txt | 7 +
doc/loaders.txt | 269 +++++++++++++++++++++++++++++++---
include/loaders/GP_Loader.h | 6 +
libs/loaders/GP_Loader.c | 120 ++++++++--------
7 files changed, 463 insertions(+), 89 deletions(-)
create mode 100644 doc/core.txt
create mode 100644 doc/example_loader_registration.txt
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
[repo.or.cz] gfxprim.git branch master updated: 80d1a231acdf63c758e84a257c20aaffca6550e3
by metan 10 Nov '12
by metan 10 Nov '12
10 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 80d1a231acdf63c758e84a257c20aaffca6550e3 (commit)
via 21bb72c7f2b7a1dc55c551a9cafe65fab22fb899 (commit)
via 697c44509ec28ec94d453c84be6d9292affd83f4 (commit)
via 5afca4870b21f2204799a5a113637968cb98090e (commit)
via a5f1f49a610ffd5f59cc3404d14efd03edd8be32 (commit)
from 6793b01905a9072059080e70fa79c685e43a945c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/80d1a231acdf63c758e84a257c20aaffca65…
commit 80d1a231acdf63c758e84a257c20aaffca6550e3
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 14:01:00 2012 +0100
examples: Add loader registration example.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile
index 8cc06a0..03c91c5 100644
--- a/demos/c_simple/Makefile
+++ b/demos/c_simple/Makefile
@@ -9,7 +9,7 @@ LDLIBS+=-lrt `$(TOPDIR)/gfxprim-config --libs --libs-backends`
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch virtual_backend_example meta_data meta_data_dump tmp_file showimage v4l2_show v4l2_grab convolution weighted_median shapetest koch input- fileview linetest randomshapetest fonttest
+ fileview linetest randomshapetest fonttest loaders_register
v4l2_show: LDLIBS+=-lGP_grabbers
v4l2_grab: LDLIBS+=-lGP_grabbers
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c
new file mode 100644
index 0000000..2140af5
--- /dev/null
+++ b/demos/c_simple/loaders_register.c
@@ -0,0 +1,139 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+ /*
+
+ Shows how to register custom image loader/saver.
+
+ Feed it with small image (cca 60x60 pixels) to produce ascii art version.
+
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <GP.h>
+
+/*
+ * Saves 2 bpp grayscale image as ASCII Art
+ */
+static int save(const GP_Context *img, const char *dst_path,
+ GP_ProgressCallback *callback)
+{
+ if (img->pixel_type != GP_PIXEL_G2) {
+ errno = ENOSYS;
+ return 1;
+ }
+
+ FILE *f = fopen(dst_path, "w");
+
+ if (f == NULL)
+ return 1;
+
+ unsigned int i, j;
+
+ for (j = 0; j < img->h; j++) {
+ for (i = 0; i < img->w; i++) {
+ GP_Pixel p = GP_GetPixel_Raw(img, i, j);
+
+ switch (p) {
+ case 0:
+ fprintf(f, " ");
+ break;
+ case 1:
+ fprintf(f, "..");
+ break;
+ case 2:
+ fprintf(f, "()");
+ break;
+ case 3:
+ fprintf(f, "OO");
+ break;
+ }
+ }
+
+ fprintf(f, "n");
+
+ if (GP_ProgressCallbackReport(callback, img->h, j, img->w)) {
+ fclose(f);
+ unlink(dst_path);
+ errno = ECANCELED;
+ return 1;
+ }
+ }
+
+ if (fclose(f))
+ return 1;
+
+ GP_ProgressCallbackDone(callback);
+
+ return 0;
+}
+
+GP_Loader loader = {
+ .Load = NULL,
+ .Save = save,
+ .Match = NULL,
+ .fmt_name = "ASCII Art",
+ .extensions = {"txt", NULL},
+};
+
+int main(int argc, char *argv[])
+{
+ GP_Context *c, *gc;
+
+ GP_LoaderRegister(&loader);
+
+ /* List all loaders */
+ GP_ListLoaders();
+ printf("nn");
+
+ if (argc != 2) {
+ fprintf(stderr, "ERROR: Takes image as an argumentn");
+ return 1;
+ }
+
+ /* Now load image and save it using our loader */
+ c = GP_LoadImage(argv[1], NULL);
+
+ if (c == NULL) {
+ fprintf(stderr, "Failed to load image: %sn", strerror(errno));
+ return 1;
+ }
+
+ gc = GP_FilterFloydSteinberg_RGB888_Alloc(c, GP_PIXEL_G2, NULL);
+
+ if (gc == NULL) {
+ fprintf(stderr, "FloydSteinberg: %sn", strerror(errno));
+ return 1;
+ }
+
+ printf("Saving to test.txtn");
+
+ if (GP_SaveImage(gc, "test.txt", NULL)) {
+ fprintf(stderr, "Failed to save image: %sn", strerror(errno));
+ return 1;
+ }
+
+ return 0;
+}
http://repo.or.cz/w/gfxprim.git/commit/21bb72c7f2b7a1dc55c551a9cafe65fab22f…
commit 21bb72c7f2b7a1dc55c551a9cafe65fab22fb899
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 13:58:12 2012 +0100
loaders: Add the rest of loaders to GP_Loader list
diff --git a/include/loaders/GP_Loader.h b/include/loaders/GP_Loader.h
index a5ef06b..ef7add1 100644
--- a/include/loaders/GP_Loader.h
+++ b/include/loaders/GP_Loader.h
@@ -106,4 +106,9 @@ void GP_LoaderRegister(GP_Loader *self);
void GP_LoaderUnregister(GP_Loader *self);
+/*
+ * List loaders into the stdout
+ */
+void GP_ListLoaders(void);
+
#endif /* LOADERS_GP_LOADER_H */
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index 597cfe9..0ef1024 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -45,12 +45,39 @@ static GP_Loader psp_loader = {
.extensions = {"psp", "pspimage", NULL},
};
+static GP_Loader pbm_loader = {
+ .Load = GP_LoadPBM,
+ .Save = GP_SavePBM,
+ .Match = NULL,
+ .fmt_name = "Netpbm portable bitmap",
+ .next = &psp_loader,
+ .extensions = {"pbm", NULL},
+};
+
+static GP_Loader pgm_loader = {
+ .Load = GP_LoadPGM,
+ .Save = GP_SavePGM,
+ .Match = NULL,
+ .fmt_name = "Netpbm portable graymap",
+ .next = &pbm_loader,
+ .extensions = {"pgm", NULL},
+};
+
+static GP_Loader ppm_loader = {
+ .Load = GP_LoadPPM,
+ .Save = NULL,
+ .Match = NULL,
+ .fmt_name = "Netpbm portable pixmap",
+ .next = &pgm_loader,
+ .extensions = {"ppm", NULL},
+};
+
static GP_Loader bmp_loader = {
.Load = GP_LoadBMP,
.Save = NULL,
.Match = GP_MatchBMP,
.fmt_name = "BMP",
- .next = &psp_loader,
+ .next = &ppm_loader,
.extensions = {"bmp", "dib", NULL},
};
@@ -115,6 +142,26 @@ void GP_LoaderUnregister(GP_Loader *self)
i->next = self->next;
}
+void GP_ListLoaders(void)
+{
+ struct GP_Loader *i;
+ int j;
+
+ for (i = loaders; i != NULL; i = i->next) {
+ printf("Format: %sn", i->fmt_name);
+ printf("Load:t%sn", i->Load ? "Yes" : "No");
+ printf("Save:t%sn", i->Save ? "Yes" : "No");
+ printf("Match:t%sn", i->Match ? "Yes" : "No");
+ printf("Extensions: ");
+ for (j = 0; i->extensions[j] != NULL; j++)
+ printf("%s ", i->extensions[j]);
+ printf("n");
+
+ if (i->next != NULL)
+ printf("n");
+ }
+}
+
static struct GP_Loader *loader_by_extension(const char *ext)
{
struct GP_Loader *i;
http://repo.or.cz/w/gfxprim.git/commit/697c44509ec28ec94d453c84be6d9292affd…
commit 697c44509ec28ec94d453c84be6d9292affd83f4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 12:55:56 2012 +0100
doc: Fix Makefile, update .gitignore
diff --git a/doc/.gitignore b/doc/.gitignore
index 2d19fc7..4b4703c 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1 +1,11 @@
*.html
+*.md5
+
+discrete_linear_1D_convolution_alg1.png
+discrete_linear_1D_convolution_alg2.png
+discrete_linear_convolution.png
+discrete_linear_convolution_alg1.png
+discrete_linear_convolution_alg2.png
+laplacian_edge_sharpening.png
+laplacian_kernel.png
+
diff --git a/doc/Makefile b/doc/Makefile
index 2b6df43..bda6964 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -2,6 +2,13 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt backends.txt gamma.txt grabbers.txt environment_variables.txt debug.txt
+#
+# Names of generated images for cleanup
+#
+GENIMAGES=discrete_linear_1D_convolution_alg1 discrete_linear_1D_convolution_alg2 + discrete_linear_convolution discrete_linear_convolution_alg1 + discrete_linear_convolution_alg2 laplacian_edge_sharpening laplacian_kernel
+
PAGES=$(subst .txt,.html,$(SOURCES))
@@ -30,6 +37,18 @@ api.pdf: api.txt
xsltproc /usr/share/sgml/docbook/xsl-stylesheets/fo/docbook.xsl api.xml > api.fo
fop api.fo -pdf api.pdf
+#
+# Clean up generated images
+#
+CLEAN+=$(patsubst %,%.md5,$(GENIMAGES))
+CLEAN+=$(patsubst %,%.png,$(GENIMAGES))
+
+#
+# Clean up generated pages
+#
+CLEAN+=$(PAGES)
+
clean:
- rm -f api.html examples.html
+ rm -f $(CLEAN)
+ rm -f api_links.html api.html examples.html
rm -f api.xml api.fo api.pdf
http://repo.or.cz/w/gfxprim.git/commit/5afca4870b21f2204799a5a113637968cb98…
commit 5afca4870b21f2204799a5a113637968cb98090e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 12:42:31 2012 +0100
loaders: Fix PBM and PGM loading API.
diff --git a/include/loaders/GP_PBM.h b/include/loaders/GP_PBM.h
index 82cd45b..1603aff 100644
--- a/include/loaders/GP_PBM.h
+++ b/include/loaders/GP_PBM.h
@@ -43,7 +43,7 @@ GP_Context *GP_LoadPBM(const char *src_path, GP_ProgressCallback *callback);
* EINVAL - context pixel type was not 1 bit grayscale.
*
*/
-int GP_SavePBM(const char *res_path, GP_Context *src,
+int GP_SavePBM(const GP_Context *src, const char *res_path,
GP_ProgressCallback *callback);
#endif /* LOADERS_GP_PBM_H */
diff --git a/include/loaders/GP_PGM.h b/include/loaders/GP_PGM.h
index f949cde..7b930cd 100644
--- a/include/loaders/GP_PGM.h
+++ b/include/loaders/GP_PGM.h
@@ -31,7 +31,7 @@
GP_Context *GP_LoadPGM(const char *src_path,
GP_ProgressCallback *callback);
-int GP_SavePGM(const char *res_path, GP_Context *src,
+int GP_SavePGM(const GP_Context *src, const char *res_path,
GP_ProgressCallback *callback);
#endif /* LOADERS_GP_PGM_H */
diff --git a/libs/loaders/GP_PBM.c b/libs/loaders/GP_PBM.c
index 2c11138..e481684 100644
--- a/libs/loaders/GP_PBM.c
+++ b/libs/loaders/GP_PBM.c
@@ -93,7 +93,7 @@ err1:
return NULL;
}
-int GP_SavePBM(const char *res_path, GP_Context *src,
+int GP_SavePBM(const GP_Context *src, const char *res_path,
GP_ProgressCallback *callback)
{
FILE *f;
diff --git a/libs/loaders/GP_PGM.c b/libs/loaders/GP_PGM.c
index 055df97..4a2321d 100644
--- a/libs/loaders/GP_PGM.c
+++ b/libs/loaders/GP_PGM.c
@@ -186,7 +186,7 @@ err0:
return NULL;
}
-int GP_SavePGM(const char *res_path, GP_Context *src,
+int GP_SavePGM(const GP_Context *src, const char *res_path,
GP_ProgressCallback *callback)
{
FILE *f;
diff --git a/libs/loaders/GP_PXMCommon.c b/libs/loaders/GP_PXMCommon.c
index 48bc361..e2738ab 100644
--- a/libs/loaders/GP_PXMCommon.c
+++ b/libs/loaders/GP_PXMCommon.c
@@ -238,7 +238,7 @@ int GP_PXMLoad8bpp(FILE *f, GP_Context *context)
#define BITMASK(byte, bit) (!!((byte)&(0x80>>(bit))))
-static int write_line_1bpp(FILE *f, const uint8_t *data, GP_Context *src)
+static int write_line_1bpp(FILE *f, const uint8_t *data, const GP_Context *src)
{
uint32_t x, max = src->bytes_per_row;
int ret;
@@ -278,7 +278,7 @@ static int write_line_1bpp(FILE *f, const uint8_t *data, GP_Context *src)
return 0;
}
-int GP_PXMSave1bpp(FILE *f, GP_Context *context)
+int GP_PXMSave1bpp(FILE *f, const GP_Context *context)
{
uint32_t y;
int ret;
@@ -296,7 +296,7 @@ int GP_PXMSave1bpp(FILE *f, GP_Context *context)
#define MASK_2BPP(byte, pix) (0x03 & (byte>>((3 - pix)<<1)))
-static int write_line_2bpp(FILE *f, const uint8_t *data, GP_Context *src)
+static int write_line_2bpp(FILE *f, const uint8_t *data, const GP_Context *src)
{
uint32_t x, max = src->bytes_per_row;
int ret;
@@ -332,7 +332,7 @@ static int write_line_2bpp(FILE *f, const uint8_t *data, GP_Context *src)
return EIO;
}
-int GP_PXMSave2bpp(FILE *f, GP_Context *context)
+int GP_PXMSave2bpp(FILE *f, const GP_Context *context)
{
uint32_t y;
int ret;
@@ -348,7 +348,7 @@ int GP_PXMSave2bpp(FILE *f, GP_Context *context)
return EIO;
}
-static int write_line_8bpp(FILE *f, const uint8_t *data, GP_Context *src)
+static int write_line_8bpp(FILE *f, const uint8_t *data, const GP_Context *src)
{
uint32_t x;
int ret;
@@ -371,7 +371,7 @@ static int write_line_8bpp(FILE *f, const uint8_t *data, GP_Context *src)
return 0;
}
-int GP_PXMSave8bpp(FILE *f, GP_Context *context)
+int GP_PXMSave8bpp(FILE *f, const GP_Context *context)
{
uint32_t y;
int ret;
diff --git a/libs/loaders/GP_PXMCommon.h b/libs/loaders/GP_PXMCommon.h
index 7ed531e..1780eec 100644
--- a/libs/loaders/GP_PXMCommon.h
+++ b/libs/loaders/GP_PXMCommon.h
@@ -40,10 +40,10 @@
*
* The pixel type is not checked here as these are internal funcitons.
*/
-int GP_PXMSave1bpp(FILE *f, GP_Context *context);
-int GP_PXMSave2bpp(FILE *f, GP_Context *context);
-int GP_PXMSave4bpp(FILE *f, GP_Context *context);
-int GP_PXMSave8bpp(FILE *f, GP_Context *context);
+int GP_PXMSave1bpp(FILE *f, const GP_Context *context);
+int GP_PXMSave2bpp(FILE *f, const GP_Context *context);
+int GP_PXMSave4bpp(FILE *f, const GP_Context *context);
+int GP_PXMSave8bpp(FILE *f, const GP_Context *context);
/*
* Load context from ascii file.
http://repo.or.cz/w/gfxprim.git/commit/a5f1f49a610ffd5f59cc3404d14efd03edd8…
commit a5f1f49a610ffd5f59cc3404d14efd03edd8be32
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Nov 10 00:37:31 2012 +0100
loaders: More work on loaders, BMP signature.
diff --git a/include/loaders/GP_BMP.h b/include/loaders/GP_BMP.h
index e44d787..63473ea 100644
--- a/include/loaders/GP_BMP.h
+++ b/include/loaders/GP_BMP.h
@@ -62,4 +62,9 @@ GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback);
*/
GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback);
+/*
+ * Match BMP signature.
+ */
+int GP_MatchBMP(const void *buf);
+
#endif /* LOADERS_GP_BMP_H */
diff --git a/libs/loaders/GP_BMP.c b/libs/loaders/GP_BMP.c
index 0b1f7f5..3ed5161 100644
--- a/libs/loaders/GP_BMP.c
+++ b/libs/loaders/GP_BMP.c
@@ -514,6 +514,11 @@ static int read_bitmap_pixels(FILE *f, struct bitmap_info_header *header,
return ENOSYS;
}
+int GP_MatchBMP(const void *buf)
+{
+ return !memcmp(buf, "BM", 2);
+}
+
int GP_OpenBMP(const char *src_path, FILE **f,
GP_Size *w, GP_Size *h, GP_PixelType *pixel_type)
{
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index 226d388..597cfe9 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -48,7 +48,7 @@ static GP_Loader psp_loader = {
static GP_Loader bmp_loader = {
.Load = GP_LoadBMP,
.Save = NULL,
- .Match = NULL,
+ .Match = GP_MatchBMP,
.fmt_name = "BMP",
.next = &psp_loader,
.extensions = {"bmp", "dib", NULL},
@@ -142,6 +142,9 @@ static struct GP_Loader *loader_by_filename(const char *path)
if (path[i] == '.')
break;
+ if (path[i] != '.')
+ return NULL;
+
ext = path + i + 1;
GP_DEBUG(1, "Loading file by filename extension '%s'", ext);
@@ -342,7 +345,6 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
if (l != NULL)
return l->Load(src_path, callback);
- //TODO file signature based check
errno = ENOSYS;
return NULL;
}
@@ -382,17 +384,15 @@ int GP_LoadMetaData(const char *src_path, GP_MetaData *data)
int GP_SaveImage(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback)
{
- enum GP_ImageFmt fmt = filename_to_fmt(dst_path);
-
- switch (fmt) {
- case GP_FMT_JPG:
- return GP_SaveJPG(src, dst_path, callback);
- case GP_FMT_PNG:
- return GP_SavePNG(src, dst_path, callback);
+ struct GP_Loader *l = loader_by_filename(dst_path);
- default:
- break;
+ if (l == NULL) {
+ errno = EINVAL;
+ return 1;
}
+
+ if (l->Save)
+ return l->Save(src, dst_path, callback);
errno = ENOSYS;
return 1;
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/Makefile | 2 +-
demos/c_simple/{tmp_file.c => loaders_register.c} | 129 +++++++++++++--------
doc/.gitignore | 10 ++
doc/Makefile | 21 +++-
include/loaders/GP_BMP.h | 5 +
include/loaders/GP_Loader.h | 5 +
include/loaders/GP_PBM.h | 2 +-
include/loaders/GP_PGM.h | 2 +-
libs/loaders/GP_BMP.c | 5 +
libs/loaders/GP_Loader.c | 71 ++++++++++--
libs/loaders/GP_PBM.c | 2 +-
libs/loaders/GP_PGM.c | 2 +-
libs/loaders/GP_PXMCommon.c | 12 +-
libs/loaders/GP_PXMCommon.h | 8 +-
14 files changed, 198 insertions(+), 78 deletions(-)
copy demos/c_simple/{tmp_file.c => loaders_register.c} (53%)
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
[repo.or.cz] gfxprim.git branch master updated: 6793b01905a9072059080e70fa79c685e43a945c
by metan 06 Nov '12
by metan 06 Nov '12
06 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 6793b01905a9072059080e70fa79c685e43a945c (commit)
from 156709b6343ea54485a3d662ddc66448e3337c76 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/6793b01905a9072059080e70fa79c685e43a…
commit 6793b01905a9072059080e70fa79c685e43a945c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Nov 6 19:54:09 2012 +0100
loaders: Add forgotten header, ouch.
I will not forgot to add the headers.
I will not forgot to add the headers.
I will not forgot to add the headers.
I will not forgot to add the headers.
diff --git a/include/loaders/GP_Loader.h b/include/loaders/GP_Loader.h
new file mode 100644
index 0000000..a5ef06b
--- /dev/null
+++ b/include/loaders/GP_Loader.h
@@ -0,0 +1,109 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+ /*
+
+ Core include file for loaders API.
+
+ */
+
+#ifndef LOADERS_GP_LOADER_H
+#define LOADERS_GP_LOADER_H
+
+#include "core/GP_Context.h"
+#include "core/GP_ProgressCallback.h"
+
+#include "GP_MetaData.h"
+
+/*
+ * Tries to load image accordingly to the file extension.
+ *
+ * If operation fails NULL is returned and errno is filled.
+ */
+GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
+
+/*
+ * Loads image Meta Data (if possible).
+ */
+int GP_LoadMetaData(const char *src_path, GP_MetaData *data);
+
+/*
+ * Simple saving function, the image format is matched by file extension.
+ *
+ * Retruns zero on succes.
+ *
+ * On failure non-zero is returned.
+ *
+ * When file type wasn't recognized by extension or if support for requested
+ * image format wasn't compiled in non-zero is returned and errno is set to
+ * ENOSYS.
+ *
+ * The resulting errno may also be set to any possible error from fopen(3), open(3),
+ * write(3), fwrite(3), seek(3), etc..
+ */
+int GP_SaveImage(const GP_Context *src, const char *dst_path,
+ GP_ProgressCallback *callback);
+
+/*
+ * You can register your own loader here.
+ */
+typedef struct GP_Loader {
+ /*
+ * Loads an image.
+ *
+ * Returns allocated and initialized bitmap on success, NULL on failure
+ * and errno must be set.
+ */
+ GP_Context *(*Load)(const char *src_path, GP_ProgressCallback *callback);
+
+ /*
+ * Save an image.
+ *
+ * Returns zero on succes, non-zero on failure and errno must be set.
+ */
+ int (*Save)(const GP_Context *src, const char *dst_path, GP_ProgressCallback *callback);
+
+ /*
+ * The buffer is filled with 32 bytes from an image start, returns 1 if
+ * image signature was found zero otherwise.
+ */
+ int (*Match)(const void *buf);
+
+ /*
+ * Short format name.
+ */
+ const char *fmt_name;
+
+ /* don't touch */
+ struct GP_Loader *next;
+
+ /*
+ * NULL terminated array of file extensions.
+ */
+ const char *extensions[];
+} GP_Loader;
+
+void GP_LoaderRegister(GP_Loader *self);
+
+void GP_LoaderUnregister(GP_Loader *self);
+
+#endif /* LOADERS_GP_LOADER_H */
-----------------------------------------------------------------------
Summary of changes:
include/loaders/GP_Loader.h | 109 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 109 insertions(+), 0 deletions(-)
create mode 100644 include/loaders/GP_Loader.h
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 156709b6343ea54485a3d662ddc66448e3337c76
by metan 04 Nov '12
by metan 04 Nov '12
04 Nov '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 156709b6343ea54485a3d662ddc66448e3337c76 (commit)
from a960a02a7e253fcdd2ec0cfa64f7d2f513719961 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/156709b6343ea54485a3d662ddc66448e333…
commit 156709b6343ea54485a3d662ddc66448e3337c76
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Nov 4 22:39:30 2012 +0100
loaders: More signature matching, yay!
diff --git a/include/loaders/GP_GIF.h b/include/loaders/GP_GIF.h
index 1eb87ff..62284d0 100644
--- a/include/loaders/GP_GIF.h
+++ b/include/loaders/GP_GIF.h
@@ -58,4 +58,9 @@ GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback);
*/
GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback);
+/*
+ * Match GIF signature.
+ */
+int GP_MatchGIF(const void *buf);
+
#endif /* LOADERS_GP_GIF_H */
diff --git a/include/loaders/GP_JPG.h b/include/loaders/GP_JPG.h
index 73113c4..5906b11 100644
--- a/include/loaders/GP_JPG.h
+++ b/include/loaders/GP_JPG.h
@@ -62,4 +62,9 @@ int GP_LoadJPGMetaData(const char *src_path, GP_MetaData *data);
int GP_SaveJPG(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
+/*
+ * Match JPG signature.
+ */
+int GP_MatchJPG(const void *buf);
+
#endif /* LOADERS_GP_JPG_H */
diff --git a/include/loaders/GP_PNG.h b/include/loaders/GP_PNG.h
index 3a8f2f8..4b6e3bb 100644
--- a/include/loaders/GP_PNG.h
+++ b/include/loaders/GP_PNG.h
@@ -79,4 +79,9 @@ int GP_LoadPNGMetaData(const char *src_path, GP_MetaData *data);
int GP_SavePNG(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
+/*
+ * Match PNG signature.
+ */
+int GP_MatchPNG(const void *buf);
+
#endif /* LOADERS_GP_PNG_H */
diff --git a/libs/loaders/GP_GIF.c b/libs/loaders/GP_GIF.c
index 262e5d9..c4e2d2e 100644
--- a/libs/loaders/GP_GIF.c
+++ b/libs/loaders/GP_GIF.c
@@ -44,6 +44,23 @@
#include <gif_lib.h>
+#define GIF_SIGNATURE1 "GIF87a"
+#define GIF_SIGNATURE1_LEN 6
+
+#define GIF_SIGNATURE2 "GIF89a"
+#define GIF_SIGNATURE2_LEN 6
+
+int GP_MatchGIF(const void *buf)
+{
+ if (!memcmp(buf, GIF_SIGNATURE1, GIF_SIGNATURE1_LEN))
+ return 1;
+
+ if (!memcmp(buf, GIF_SIGNATURE2, GIF_SIGNATURE2_LEN))
+ return 1;
+
+ return 0;
+}
+
int GP_OpenGIF(const char *src_path, void **f)
{
GifFileType *gf;
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c
index bece7d5..bc47c4b 100644
--- a/libs/loaders/GP_JPG.c
+++ b/libs/loaders/GP_JPG.c
@@ -43,6 +43,18 @@
#include <jpeglib.h>
+/*
+ * 0xff 0xd8 - start of image
+ * 0xff 0xe0 - APP0 JFIF meta data
+ */
+#define JPEG_SIGNATURE "xffxd8xffxe0"
+#define JPEG_SIGNATURE_LEN 4
+
+int GP_MatchJPG(const void *buf)
+{
+ return !memcmp(buf, JPEG_SIGNATURE, JPEG_SIGNATURE_LEN);
+}
+
int GP_OpenJPG(const char *src_path, FILE **f)
{
int err;
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index ab374c4..226d388 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -36,7 +36,7 @@
#include "GP_Loader.h"
-static GP_Loader psp_image = {
+static GP_Loader psp_loader = {
.Load = GP_LoadPSP,
.Save = NULL,
.Match = GP_MatchPSP,
@@ -45,8 +45,44 @@ static GP_Loader psp_image = {
.extensions = {"psp", "pspimage", NULL},
};
-static GP_Loader *loaders = &psp_image;
-static GP_Loader *loaders_last = &psp_image;
+static GP_Loader bmp_loader = {
+ .Load = GP_LoadBMP,
+ .Save = NULL,
+ .Match = NULL,
+ .fmt_name = "BMP",
+ .next = &psp_loader,
+ .extensions = {"bmp", "dib", NULL},
+};
+
+static GP_Loader gif_loader = {
+ .Load = GP_LoadGIF,
+ .Save = NULL,
+ .Match = GP_MatchGIF,
+ .fmt_name = "Graphics Interchange Format",
+ .next = &bmp_loader,
+ .extensions = {"gif", NULL},
+};
+
+static GP_Loader png_loader = {
+ .Load = GP_LoadPNG,
+ .Save = GP_SavePNG,
+ .Match = GP_MatchPNG,
+ .fmt_name = "Portable Network Graphics",
+ .next = &gif_loader,
+ .extensions = {"png", NULL},
+};
+
+static GP_Loader jpeg_loader = {
+ .Load = GP_LoadJPG,
+ .Save = GP_SaveJPG,
+ .Match = GP_MatchJPG,
+ .fmt_name = "JPEG",
+ .next = &png_loader,
+ .extensions = {"jpg", "jpeg", NULL},
+};
+
+static GP_Loader *loaders = &jpeg_loader;
+static GP_Loader *loaders_last = &psp_loader;
void GP_LoaderRegister(GP_Loader *self)
{
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index 7cf7441..275d4be 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -43,6 +43,11 @@
#include "core/GP_BitSwap.h"
+int GP_MatchPNG(const void *buf)
+{
+ return !png_sig_cmp(buf, 0, 8);
+}
+
int GP_OpenPNG(const char *src_path, FILE **f)
{
uint8_t sig[8];
-----------------------------------------------------------------------
Summary of changes:
include/loaders/GP_GIF.h | 5 +++++
include/loaders/GP_JPG.h | 5 +++++
include/loaders/GP_PNG.h | 5 +++++
libs/loaders/GP_GIF.c | 17 +++++++++++++++++
libs/loaders/GP_JPG.c | 12 ++++++++++++
libs/loaders/GP_Loader.c | 42 +++++++++++++++++++++++++++++++++++++++---
libs/loaders/GP_PNG.c | 5 +++++
7 files changed, 88 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0