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 d4b06d880a619f82d52e6de8dafddd36f84b76ac (commit)
from ccb2bc826483c0465f6671654e4c45259a029b04 (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/d4b06d880a619f82d52e6de8dafddd36f84b…
commit d4b06d880a619f82d52e6de8dafddd36f84b76ac
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 21:06:57 2013 +0100
input: X11: Ignore out-of-window relative events.
diff --git a/include/input/GP_InputDriverX11.h b/include/input/GP_InputDriverX11.h
index 117a3e0..87d4030 100644
--- a/include/input/GP_InputDriverX11.h
+++ b/include/input/GP_InputDriverX11.h
@@ -34,6 +34,6 @@
/*
* Converts X11 event to GFXprim event and puts it into the queue.
*/
-void GP_InputDriverX11EventPut(XEvent *ev);
+void GP_InputDriverX11EventPut(XEvent *ev, int w, int h);
#endif /* GP_INPUT_DRIVER_X11_H */
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c
index 63d8162..9d5a3e1 100644
--- a/libs/backends/GP_X11.c
+++ b/libs/backends/GP_X11.c
@@ -181,7 +181,8 @@ static void x11_ev(GP_Backend *self, XEvent *ev)
/* Window has been resized, set flag. */
x11->resized_flag = 1;
default:
- GP_InputDriverX11EventPut(ev);
+ //TODO: More accurate window w and h?
+ GP_InputDriverX11EventPut(ev, x11->context.w, x11->context.h);
break;
}
}
diff --git a/libs/input/GP_Event.c b/libs/input/GP_Event.c
index efd82c9..13c400b 100644
--- a/libs/input/GP_Event.c
+++ b/libs/input/GP_Event.c
@@ -135,7 +135,9 @@ static void dump_rel(struct GP_Event *ev)
switch (ev->code) {
case GP_EV_REL_POS:
- printf("Position %u %un", ev->cursor_x, ev->cursor_y);
+ printf("Position %u %u dx=%i dy=%in",
+ ev->cursor_x, ev->cursor_y,
+ ev->val.rel.rx, ev->val.rel.ry);
break;
case GP_EV_REL_WHEEL:
printf("Wheel %in", ev->val.val);
@@ -237,6 +239,11 @@ static uint32_t clip_rel(uint32_t val, uint32_t max, int32_t rel)
void GP_EventPushRelTo(uint32_t x, uint32_t y, struct timeval *time)
{
+ if (x > screen_w || y > screen_h) {
+ GP_WARN("x > screen_w or y > screen_h, forgot to set screen size?");
+ return;
+ }
+
int32_t rx = x - cur_state.cursor_x;
int32_t ry = y - cur_state.cursor_y;
diff --git a/libs/input/GP_InputDriverX11.c b/libs/input/GP_InputDriverX11.c
index cbfb0c9..a63896c 100644
--- a/libs/input/GP_InputDriverX11.c
+++ b/libs/input/GP_InputDriverX11.c
@@ -63,7 +63,7 @@ static uint16_t keycode_table[] = {
static const uint16_t keycode_table_size = sizeof(keycode_table)/2;
-void GP_InputDriverX11EventPut(XEvent *ev)
+void GP_InputDriverX11EventPut(XEvent *ev, int w, int h)
{
int key = 0, keycode, press = 0;
@@ -106,6 +106,11 @@ void GP_InputDriverX11EventPut(XEvent *ev)
break;
break;
case MotionNotify:
+ /* Ignore all pointer events that are out of the window */
+ if (ev->xmotion.x < 0 || ev->xmotion.y < 0 ||
+ ev->xmotion.x > w || ev->xmotion.y > h)
+ return;
+
GP_EventPushRelTo(ev->xmotion.x, ev->xmotion.y, NULL);
break;
case KeyPress:
-----------------------------------------------------------------------
Summary of changes:
include/input/GP_InputDriverX11.h | 2 +-
libs/backends/GP_X11.c | 3 ++-
libs/input/GP_Event.c | 9 ++++++++-
libs/input/GP_InputDriverX11.c | 7 ++++++-
4 files changed, 17 insertions(+), 4 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.")
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 ccb2bc826483c0465f6671654e4c45259a029b04 (commit)
via 8843d798cc4a68fa83faf2a379f4c3a8b69d7a74 (commit)
via 7b98da7be97c5d98afdc406fda8d0c3cf82a47c0 (commit)
from 3823b1a0ac199ae9243df287e7bcc424bf5da243 (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/ccb2bc826483c0465f6671654e4c45259a02…
commit ccb2bc826483c0465f6671654e4c45259a029b04
Merge: 7b98da7 8843d79
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 20:28:26 2013 +0100
Merge ssh://192.168.1.100/home/metan/Devel/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/8843d798cc4a68fa83faf2a379f4c3a8b69d…
commit 8843d798cc4a68fa83faf2a379f4c3a8b69d7a74
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 20:14:14 2013 +0100
build: configure: Add pthread flags (fixes builds)
diff --git a/configure b/configure
index 44bcc96..4e23935 100755
--- a/configure
+++ b/configure
@@ -136,10 +136,19 @@ class libraries:
# (module may be core, loaders, backends, etc...
#
def get_linker_flags(self, module):
- res = ""
+ res = ''
for i in self.libraries:
if module in i[5] and self.results[i[0]]:
- res += " " + i[4]
+ res += ' ' + i[4]
+ return res
+ #
+ # Returns list of cflags needed to build module
+ #
+ def get_cflags(self, module):
+ res = ''
+ for i in self.libraries:
+ if module in i[5] and self.results[i[0]]:
+ res += ' ' + i[3]
return res
def die_screaming(msg):
@@ -204,7 +213,8 @@ def write_gfxprim_config(cfg, libs):
# General switches cflags and ldflags
f.write('t--help) echo "$USAGE"; exit 0;;n')
f.write('t--list-modules) echo "%s"; exit 0;;n' % ' '.join(modules))
- f.write('t--cflags) echo -n "-I/usr/include/GP/ ";;n')
+ f.write('t--cflags) echo -n "-I/usr/include/GP/%s";;n' %
+ libs.get_cflags('core'))
f.write('t--libs) echo -n "-lGP %s ";;n' % libs.get_linker_flags('core'))
# ldflags for specific modules
@@ -268,6 +278,9 @@ if __name__ == '__main__':
["V4L2",
"Video for linux 2",
[header_exists, "linux/videodev2.h"], "", "", ["grabbers"]],
+ ["pthread",
+ "Posix Threads",
+ [header_exists, "pthread.h"], "-pthread", "-pthread", ["core"]],
["backtrace",
"C stack trace writeout",
[c_try_compile, "#include <execinfo.h>nint main(void) { backtrace(0, 0); }",
http://repo.or.cz/w/gfxprim.git/commit/7b98da7be97c5d98afdc406fda8d0c3cf82a…
commit 7b98da7be97c5d98afdc406fda8d0c3cf82a47c0
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 13:00:46 2013 +0100
demos: input_example: Show relative rx and ry too.
diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c
index 38cc1e3..cb4877b 100644
--- a/demos/c_simple/input_example.c
+++ b/demos/c_simple/input_example.c
@@ -97,8 +97,9 @@ static void event_loop(void)
GP_TextClear(win, NULL, 20, 40, align,
black, size);
size = GP_Print(win, NULL, 20, 40, align,
- white, black, "X=%3u Y=%3u",
- ev.cursor_x, ev.cursor_y);
+ white, black, "X=%3u Y=%3u dX=%3i dY=%3i",
+ ev.cursor_x, ev.cursor_y,
+ ev.val.rel.rx, ev.val.rel.ry);
GP_BackendFlip(backend);
break;
}
-----------------------------------------------------------------------
Summary of changes:
configure | 19 ++++++++++++++++---
demos/c_simple/input_example.c | 5 +++--
2 files changed, 19 insertions(+), 5 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.")
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 3823b1a0ac199ae9243df287e7bcc424bf5da243 (commit)
via 1fc43f8a9ad452719c10c9e1ccc144220eb707ec (commit)
via ee2c2bb211e71593b9897778e2d9ed1f75cf1a51 (commit)
via a428e50430bd5cbd9eb30a3a0b8083fe92920bc5 (commit)
from 5759fa17dee0ab8b382bb02aa0f7969543e0a4c1 (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/3823b1a0ac199ae9243df287e7bcc424bf5d…
commit 3823b1a0ac199ae9243df287e7bcc424bf5da243
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 12:06:40 2013 +0100
filters: Mirror & Rotate: use static for local functions.
diff --git a/libs/filters/GP_MirrorV.gen.c.t b/libs/filters/GP_MirrorV.gen.c.t
index a54d949..03f4bb6 100644
--- a/libs/filters/GP_MirrorV.gen.c.t
+++ b/libs/filters/GP_MirrorV.gen.c.t
@@ -11,7 +11,8 @@ Vertical Mirror alogorithm
#include "GP_Rotate.h"
%% for ps in pixelsizes
-int GP_MirrorV_Raw_{{ ps.suffix }}(const GP_Context *src, GP_Context *dst,
+static int GP_MirrorV_Raw_{{ ps.suffix }}(const GP_Context *src,
+ GP_Context *dst,
GP_ProgressCallback *callback)
{
uint32_t x, y;
diff --git a/libs/filters/GP_Rotate.gen.c.t b/libs/filters/GP_Rotate.gen.c.t
index af2e679..ee6e6a4 100644
--- a/libs/filters/GP_Rotate.gen.c.t
+++ b/libs/filters/GP_Rotate.gen.c.t
@@ -11,7 +11,7 @@ Vertical Mirror alogorithm
#include "GP_Rotate.h"
%% for ps in pixelsizes
-int GP_FilterRotate90_Raw_{{ ps.suffix }}(const GP_Context *src, GP_Context *dst,
+static int GP_FilterRotate90_Raw_{{ ps.suffix }}(const GP_Context *src, GP_Context *dst,
GP_ProgressCallback *callback)
{
uint32_t x, y;
@@ -42,7 +42,7 @@ int GP_FilterRotate90_Raw(const GP_Context *src, GP_Context *dst,
}
%% for ps in pixelsizes
-int GP_FilterRotate270_Raw_{{ ps.suffix }}(const GP_Context *src, GP_Context *dst,
+static int GP_FilterRotate270_Raw_{{ ps.suffix }}(const GP_Context *src, GP_Context *dst,
GP_ProgressCallback *callback)
{
uint32_t x, y;
http://repo.or.cz/w/gfxprim.git/commit/1fc43f8a9ad452719c10c9e1ccc144220eb7…
commit 1fc43f8a9ad452719c10c9e1ccc144220eb707ec
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 12:06:15 2013 +0100
build: Add TIFF functions to exported symbols.
diff --git a/build/syms/Loaders_symbols.txt b/build/syms/Loaders_symbols.txt
index bce6650..5d56104 100644
--- a/build/syms/Loaders_symbols.txt
+++ b/build/syms/Loaders_symbols.txt
@@ -29,6 +29,11 @@ GP_LoadGIF
GP_ReadGIF
GP_OpenGIF
+GP_MatchTIFF
+GP_OpenTIFF
+GP_ReadTIFF
+GP_LoadTIFF
+
GP_SavePPM
GP_LoadPPM
http://repo.or.cz/w/gfxprim.git/commit/ee2c2bb211e71593b9897778e2d9ed1f75cf…
commit ee2c2bb211e71593b9897778e2d9ed1f75cf1a51
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 20 12:04:10 2013 +0100
loaders: TIFF: use static for local function.
diff --git a/libs/loaders/GP_TIFF.c b/libs/loaders/GP_TIFF.c
index 058f4e2..f88d21e 100644
--- a/libs/loaders/GP_TIFF.c
+++ b/libs/loaders/GP_TIFF.c
@@ -66,7 +66,7 @@ int GP_OpenTIFF(const char *src_path, void **t)
return 0;
}
-const char *compression_name(uint16_t compression)
+static const char *compression_name(uint16_t compression)
{
switch (compression) {
case COMPRESSION_NONE:
http://repo.or.cz/w/gfxprim.git/commit/a428e50430bd5cbd9eb30a3a0b8083fe9292…
commit a428e50430bd5cbd9eb30a3a0b8083fe92920bc5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 19 16:03:34 2013 +0100
doc; backends: specify GP_BackendPoll more precisely.
diff --git a/doc/backends.txt b/doc/backends.txt
index aca70f6..501baca 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -262,6 +262,7 @@ Polls for backend events. For backends that do not expose file descriptor
(namely SDL) this should be called repeatedly. For other backend it may be
called either repeatedly or when data are ready on file-descriptor.
+This call returns immediately after queued backend events were processed.
[source,c]
-------------------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
build/syms/Loaders_symbols.txt | 5 +++++
doc/backends.txt | 1 +
libs/filters/GP_MirrorV.gen.c.t | 3 ++-
libs/filters/GP_Rotate.gen.c.t | 4 ++--
libs/loaders/GP_TIFF.c | 2 +-
5 files changed, 11 insertions(+), 4 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.")
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 5759fa17dee0ab8b382bb02aa0f7969543e0a4c1 (commit)
from d2137791166e8469f0671c4081260c7a9bff3235 (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/5759fa17dee0ab8b382bb02aa0f7969543e0…
commit 5759fa17dee0ab8b382bb02aa0f7969543e0a4c1
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 19 14:19:42 2013 +0100
backends: X11: Flush the connection after set_attributes().
Otherwise the window title may stay unchanged util you have
received xevent (if you are using select on the X11 fd).
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c
index 696cc0e..63d8162 100644
--- a/libs/backends/GP_X11.c
+++ b/libs/backends/GP_X11.c
@@ -247,7 +247,9 @@ static int x11_set_attributes(struct GP_Backend *self,
GP_DEBUG(3, "Setting window size to %ux%u", w, h);
XResizeWindow(x11->dpy, x11->win, w, h);
}
-
+
+ XFlush(x11->dpy);
+
XUnlockDisplay(x11->dpy);
return 0;
-----------------------------------------------------------------------
Summary of changes:
libs/backends/GP_X11.c | 4 +++-
1 files changed, 3 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.")
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 5e3a5fc7952aa8e2b8ab0337d87d053fa69cec76 (commit)
from 9343d659869c792243a9ebb1ff6ea1e84323ead8 (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/5e3a5fc7952aa8e2b8ab0337d87d053fa69c…
commit 5e3a5fc7952aa8e2b8ab0337d87d053fa69cec76
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 13 21:31:56 2013 +0100
pywrap: Remove forgotten hardcoded -lSDL.
This fixes build on machines without SDL devel libraries.
diff --git a/pylib/gfxprim/backends/Makefile b/pylib/gfxprim/backends/Makefile
index 4d2649e..7ecff0c 100644
--- a/pylib/gfxprim/backends/Makefile
+++ b/pylib/gfxprim/backends/Makefile
@@ -1,7 +1,6 @@
TOPDIR=../../..
LIBNAME=backends
INCLUDE=core
-LDLIBS+=-lGP_backends -lSDL
include $(TOPDIR)/pre.mk
include $(TOPDIR)/pywrap.mk
-----------------------------------------------------------------------
Summary of changes:
pylib/gfxprim/backends/Makefile | 1 -
1 files changed, 0 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.")
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 9343d659869c792243a9ebb1ff6ea1e84323ead8 (commit)
via 85c87f6ee96aff1c67e18736a6a4d03e00df2f32 (commit)
from 150cfc91b719470c2f7beedd4f67e974ab755dd2 (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/9343d659869c792243a9ebb1ff6ea1e84323…
commit 9343d659869c792243a9ebb1ff6ea1e84323ead8
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 13 16:16:34 2013 +0100
loaders: Start TIFF loader, currently broken.
diff --git a/configure b/configure
index d2f2d43..44bcc96 100755
--- a/configure
+++ b/configure
@@ -250,6 +250,9 @@ if __name__ == '__main__':
["giflib",
"Library to handle, display and manipulate GIF images",
[header_exists, "gif_lib.h"], "", "-lgif", ["loaders"]],
+ ["tiff",
+ "Tag Image File Format (TIFF) library",
+ [header_exists, "tiffio.h"], "", "-ltiff", ["loaders"]],
["libX11",
"X11 library",
[header_exists, "X11/Xlib.h"], "", "-lX11", ["backends"]],
@@ -262,13 +265,13 @@ if __name__ == '__main__':
["dl",
"Dynamic linker",
[header_exists, "dlfcn.h"], "", "-ldl", ["core"]],
+ ["V4L2",
+ "Video for linux 2",
+ [header_exists, "linux/videodev2.h"], "", "", ["grabbers"]],
["backtrace",
"C stack trace writeout",
[c_try_compile, "#include <execinfo.h>nint main(void) { backtrace(0, 0); }",
- "Checking for backtrace() ... "], "", "", ["core"]],
- ["V4L2",
- "Video for linux 2",
- [header_exists, "linux/videodev2.h"], "", "", ["grabbers"]]], cfg)
+ "Checking for backtrace() ... "], "", "", ["core"]]], cfg)
parser = OptionParser();
diff --git a/include/loaders/GP_Loaders.h b/include/loaders/GP_Loaders.h
index d523494..5ee30b3 100644
--- a/include/loaders/GP_Loaders.h
+++ b/include/loaders/GP_Loaders.h
@@ -19,7 +19,7 @@
* Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -43,6 +43,7 @@
#include "GP_PNG.h"
#include "GP_JPG.h"
#include "GP_GIF.h"
+#include "GP_TIFF.h"
#include "GP_PSP.h"
#include "GP_TmpFile.h"
diff --git a/include/loaders/GP_Loaders.h b/include/loaders/GP_TIFF.h
similarity index 58%
copy from include/loaders/GP_Loaders.h
copy to include/loaders/GP_TIFF.h
index d523494..f6cb428 100644
--- a/include/loaders/GP_Loaders.h
+++ b/include/loaders/GP_TIFF.h
@@ -16,39 +16,54 @@
* 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> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
- /*
-
- Core include file for loaders API.
-
- */
-
-#ifndef LOADERS_GP_LOADERS_H
-#define LOADERS_GP_LOADERS_H
+#ifndef LOADERS_GP_TIFF_H
+#define LOADERS_GP_TIFF_H
#include "core/GP_Context.h"
#include "core/GP_ProgressCallback.h"
-#include "GP_PBM.h"
-#include "GP_PGM.h"
-#include "GP_PPM.h"
+/*
+ * The possible errno values:
+ *
+ * - Anything FILE operation may return (fopen(), fclose(), fseek(), ...).
+ * - EIO for fread()/fwrite() failure
+ * - ENOSYS for not implemented bitmap format
+ * - ENOMEM from malloc()
+ * - EILSEQ for wrong image signature/data
+ * - ECANCELED when call was aborted from callback
+ */
-#include "GP_BMP.h"
-#include "GP_PNG.h"
-#include "GP_JPG.h"
-#include "GP_GIF.h"
-#include "GP_PSP.h"
+/*
+ * Opens up a bmp file, checks signature, parses metadata.
+ *
+ * The file, width, height and pixel type are filled upon succcessful return.
+ *
+ * Upon failure, non zero return value is returned and errno is filled.
+ */
+int GP_OpenTIFF(const char *src_path, void **t);
-#include "GP_TmpFile.h"
+/*
+ * Reads a TIFF from a opened file.
+ *
+ * Upon successful return, context to store bitmap is allocated and image is
+ * loaded.
+ *
+ * Upon failure NULL is returned and errno is filled.
+ */
+GP_Context *GP_ReadTIFF(void *t, GP_ProgressCallback *callback);
-#include "GP_MetaData.h"
+/*
+ * Does both GP_OpenTIFF and GP_ReadTIFF.
+ */
+GP_Context *GP_LoadTIFF(const char *src_path, GP_ProgressCallback *callback);
-#include "GP_Loader.h"
+/*
+ * Match TIFF signature.
+ */
+int GP_MatchTIFF(const void *buf);
-#endif /* LOADERS_GP_LOADERS_H */
+#endif /* LOADERS_GP_TIFF_H */
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index c3769a6..0cce654 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -93,12 +93,21 @@ static GP_Loader gif_loader = {
.extensions = {"gif", NULL},
};
+static GP_Loader tiff_loader = {
+ .Load = GP_LoadTIFF,
+ .Save = NULL,
+ .Match = GP_MatchTIFF,
+ .fmt_name = "Tag Image File Format",
+ .next = &gif_loader,
+ .extensions = {"tif", "tiff", NULL},
+};
+
static GP_Loader png_loader = {
.Load = GP_LoadPNG,
.Save = GP_SavePNG,
.Match = GP_MatchPNG,
.fmt_name = "Portable Network Graphics",
- .next = &gif_loader,
+ .next = &tiff_loader,
.extensions = {"png", NULL},
};
diff --git a/libs/loaders/GP_TIFF.c b/libs/loaders/GP_TIFF.c
new file mode 100644
index 0000000..058f4e2
--- /dev/null
+++ b/libs/loaders/GP_TIFF.c
@@ -0,0 +1,222 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+/*
+
+ TIFF image support using libtiff.
+
+ */
+
+#include <stdint.h>
+#include <inttypes.h>
+
+#include <errno.h>
+#include <string.h>
+
+#include "../../config.h"
+#include "core/GP_Debug.h"
+
+#include "GP_TIFF.h"
+
+#ifdef HAVE_TIFF
+
+#include <tiffio.h>
+
+#define TIFF_HEADER_LITTLE "IIx2a0"
+#define TIFF_HEADER_BIG "BB0x2a"
+
+int GP_MatchTIFF(const void *buf)
+{
+ if (!memcmp(buf, TIFF_HEADER_LITTLE, 4))
+ return 1;
+
+ if (!memcmp(buf, TIFF_HEADER_BIG, 4))
+ return 1;
+
+ return 0;
+}
+
+int GP_OpenTIFF(const char *src_path, void **t)
+{
+ TIFF *tiff = TIFFOpen(src_path, "r");
+
+ if (tiff == NULL)
+ return 1;
+
+ *t = tiff;
+ return 0;
+}
+
+const char *compression_name(uint16_t compression)
+{
+ switch (compression) {
+ case COMPRESSION_NONE:
+ return "None";
+ case COMPRESSION_CCITTRLE:
+ return "CCITT modified Huffman RLE";
+ /* COMPRESSION_CCITTFAX3 == COMPRESSION_CCITT_T4 */
+ case COMPRESSION_CCITTFAX3:
+ return "CCITT Group 3 fax encoding / CCITT T.4 (TIFF 6 name)";
+ /* COMPRESSION_CCITTFAX4 == COMPRESSION_CCITT_T6 */
+ case COMPRESSION_CCITTFAX4:
+ return "CCITT Group 4 fax encoding / CCITT T.6 (TIFF 6 name)";
+ case COMPRESSION_LZW:
+ return "LZW";
+ case COMPRESSION_OJPEG:
+ return "JPEG 6.0";
+ case COMPRESSION_JPEG:
+ return "JPEG DCT";
+ case COMPRESSION_NEXT:
+ return "NeXT 2 bit RLE";
+ case COMPRESSION_CCITTRLEW:
+ return "#1 w/ word alignment";
+ case COMPRESSION_PACKBITS:
+ return "Macintosh RLE";
+ case COMPRESSION_THUNDERSCAN:
+ return "ThunderScan RLE";
+ }
+
+ return "Unknown";
+}
+
+GP_Context *GP_ReadTIFF(void *t, GP_ProgressCallback *callback)
+{
+ uint32_t w, h, y, tile_w, tile_h, rows_per_strip;
+ uint16_t compression, bpp;
+ TIFF *tiff = t;
+ TIFFRGBAImage img;
+ GP_Context *res;
+ int err;
+
+ /* all these fields are compulsory in tiff image */
+ TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
+ TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
+ TIFFGetField(tiff, TIFFTAG_COMPRESSION, &compression);
+ TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bpp);
+
+ GP_DEBUG(1, "TIFF image %ux%u compression: %s, bpp: %u",
+ w, h, compression_name(compression), bpp);
+
+ /* If set tiff is saved in tiles */
+ if (TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_w) &&
+ TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_h)) {
+ GP_DEBUG(1, "TIFF is tiled in %ux%u", tile_w, tile_h);
+ err = ENOSYS;
+ goto err1;
+ }
+
+ if (!TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip)) {
+ GP_DEBUG(1, "TIFF is not stored in strips");
+ err = ENOSYS;
+ goto err1;
+ } else {
+ GP_DEBUG(1, "TIFF rows_per_strip = %u", rows_per_strip);
+ }
+
+ res = GP_ContextAlloc(w, h, GP_PIXEL_xRGB8888);
+
+ if (res == NULL) {
+ err = errno;
+ GP_WARN("Malloc failed");
+ goto err1;
+ }
+
+ char emsg[1024];
+
+ if (TIFFRGBAImageBegin(&img, tiff, 0, emsg) != 1) {
+ GP_DEBUG(1, "TIFFRGBAImageBegin failed: %s", emsg);
+ err = EINVAL;
+ goto err2;
+ }
+
+ for (y = 0; y < h; y += rows_per_strip) {
+ void *row = GP_PIXEL_ADDR(res, 0, y);
+
+ if (TIFFReadRGBAStrip(tiff, y, row) != 1) {
+ err = EINVAL;
+ goto err2;
+ }
+
+ if (GP_ProgressCallbackReport(callback, y, h, w)) {
+ GP_DEBUG(1, "Operation aborted");
+ err = ECANCELED;
+ goto err2;
+ }
+ }
+
+ TIFFRGBAImageEnd(&img);
+
+ GP_ProgressCallbackDone(callback);
+ return res;
+
+err2:
+ GP_ContextFree(res);
+err1:
+ errno = err;
+ return NULL;
+}
+
+GP_Context *GP_LoadTIFF(const char *src_path, GP_ProgressCallback *callback)
+{
+ void *t;
+ GP_Context *res;
+
+ if (GP_OpenTIFF(src_path, &t))
+ return NULL;
+
+ res = GP_ReadTIFF(t, callback);
+
+ TIFFClose(t);
+
+ return res;
+}
+
+#else
+
+int GP_MatchTIFF(const void GP_UNUSED(*buf))
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int GP_OpenTIFF(const char GP_UNUSED(*src_path),
+ void GP_UNUSED(**t))
+{
+ errno = ENOSYS;
+ return 1;
+}
+
+GP_Context *GP_ReadTIFF(void GP_UNUSED(*t),
+ GP_ProgressCallback GP_UNUSED(*callback))
+{
+ errno = ENOSYS;
+ return NULL;
+}
+
+GP_Context *GP_LoadTIFF(const char GP_UNUSED(*src_path),
+ GP_ProgressCallback GP_UNUSED(*callback))
+{
+ errno = ENOSYS;
+ return NULL;
+}
+
+#endif /* HAVE_TIFF */
http://repo.or.cz/w/gfxprim.git/commit/85c87f6ee96aff1c67e18736a6a4d03e00df…
commit 85c87f6ee96aff1c67e18736a6a4d03e00df2f32
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 13 14:33:34 2013 +0100
doc: Finish rewrite of general information page.
diff --git a/doc/Makefile b/doc/Makefile
index a43432d..db44fbc 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -2,7 +2,7 @@ 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 api.txt input.txt gen.txt pixels.txt coordinate_system.txt coding_style.txt - get_put_pixel.txt blits.txt progress_callback.txt
+ get_put_pixel.txt blits.txt progress_callback.txt text_api.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
@@ -44,7 +44,7 @@ toolcheck:
$(PAGES): %.html: %.txt
asciidoc $(ASCIIDOC_PARAMS) $<
-examples.html: examples.txt ../demos/c_simple/*.c ../demos/py_simple/*.py
+examples.html: examples.txt ../demos/c_simple/*.c ../demos/py_simple/*.py asciidoc.conf
asciidoc $(ASCIIDOC_PARAMS) -a toc examples.txt
#
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index 1b4a0b6..4294c56 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -45,6 +45,16 @@ endif::disable-javascript[]
<li><a href="api.html">API</a></li>
<li><a href="examples.html">Examples</a></li>
</ul>
+
+ <h4>API Pages</h4>
+ <ul>
+ <li><a href="drawing_api.html">Gfx</a></li>
+ <li><a href="text_api.html">Text</a></li>
+ <li><a href="filters.html">Filters</a></li>
+ <li><a href="loaders.html">Loaders</a></li>
+ <li><a href="backends.html">Backends</a></li>
+ <li><a href="input.html">Input</a></li>
+ </ul>
</div>
# Rest of the content
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt
index e2e50db..948dea0 100644
--- a/doc/drawing_api.txt
+++ b/doc/drawing_api.txt
@@ -227,73 +227,3 @@ void GP_FillTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0,
--------------------------------------------------------------------------------
Draws a filled tetragon.
-
-Text
-~~~~
-
-Text drawing is controlled by the 'GP_TextStyle' structure defined in
-'core/GP_TextStyle.h'. This structure carries the information about font,
-letter spacing and pixel multiplication and spacing. (If no font is specified,
-the default monospace font is used.)
-
-[source,c]
---------------------------------------------------------------------------------
-/* Where the text should be drawn relatively to the specified point */
-typedef enum GP_TextAlign {
- GP_ALIGN_LEFT = 0x01, /* to the left from the point */
- GP_ALIGN_CENTER = 0x02, /* centered on the point */
- GP_ALIGN_RIGHT = 0x03, /* to the right from the point */
- GP_VALIGN_ABOVE = 0x10, /* above the point */
- GP_VALIGN_CENTER = 0x20, /* centered on the point */
- GP_VALIGN_BASELINE = 0x30, /* baseline is on the point */
- GP_VALIGN_BELOW = 0x40 /* below the point */
-} GP_TextAlign;
-
-void GP_Text(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int align, const char *str, GP_Pixel pixel);
---------------------------------------------------------------------------------
-
-Draws text at the position x and y; the alignment of the text in relation
-to the point is specified by alignment flags.
-If the 'style' argument is 'NULL', a default style is used.
-
-The text size can be computed by following functions:
-
-[source,c]
---------------------------------------------------------------------------------
-unsigned int GP_TextWidth(const GP_TextStyle *style, const char *str);
---------------------------------------------------------------------------------
-
-Returns the width (in pixels) that would be occupied by the string if rendered
-using the specified style.
-
-[source,c]
---------------------------------------------------------------------------------
-unsigned int GP_TextMaxWidth(const GP_TextStyle *style, unsigned int len);
---------------------------------------------------------------------------------
-
-Returns maximum text width, in pixels, for string with 'len' letters. This call
-is useful for variable letter size fonts.
-
-[source,c]
---------------------------------------------------------------------------------
-unsigned int GP_TextAscent(const GP_TextStyle *style);
---------------------------------------------------------------------------------
-
-The Ascent is the height in pixels from the top to the baseline.
-
-[source,c]
---------------------------------------------------------------------------------
-unsigned int GP_TextDescent(const GP_TextStyle *style);
---------------------------------------------------------------------------------
-
-The Descent is the height in pixels from baseline to the bottom.
-
-[source,c]
---------------------------------------------------------------------------------
-unsigned int GP_TextHeight(const GP_TextStyle *style);
---------------------------------------------------------------------------------
-
-The Height is size of the font from top to the bottom, i.e. equals exactly to
-the sum of ascent and descent.
-
diff --git a/doc/general.txt b/doc/general.txt
index 2cd8776..34bc888 100644
--- a/doc/general.txt
+++ b/doc/general.txt
@@ -1,5 +1,6 @@
General information
--------------------
+===================
+
Gfxprim is simple modular 2D bitmap graphics library with emphasis on speed
and correctness.
@@ -10,11 +11,8 @@ programmming language. Creating code that works with less usuall pixel types
should be as easy as adding pixel definition into the configuration and
rebuilding the library. Read more link:gen.html[here].
-Parts of the library
-~~~~~~~~~~~~~~~~~~~~
-
Core
-^^^^
+----
Core of the library contains minimal amount of code to define interface that
is shared between all parts of the library.
@@ -47,77 +45,163 @@ not all parts of library use it at the moment.
And last but not least Core is a home for some link:core.html[common macros]
that are used from different parts of the library.
-Graphics Rendering
-^^^^^^^^^^^^^^^^^^
-* Basic Graphics Primitives (with and without fill)
-** PutPixel/GetPixel
-** Lines
-** Circles
-** Ellipses
-** Polygons
-
-* Text Drawing
-** Supports both proportional and non proportional fonts
-** Basic fonts are compiled in the library
-** Font rendering can be altered by style attributes
-** Supports, for example, pixel multiplication and tracking
-** Includes basic support for freetype
-
-* Bitmaps and Blitting
-** Create, Destroy bitmap
-** Subcontext, rectangular region in one context could be used as a context
-** Fast specialized blits (with 90, 180 and 270 degree rotation)
-
-* Image loading/saving
-** Read and Write support for PNG
-** Read and Write support for JPEG
-** Read support for BMP
-** Read support for GIF
-
-* Graphic backed input event handling
-** Linux Frame-buffer
-** SDL support
-** Experimental X11 support
-
-Bitmap Filters
-^^^^^^^^^^^^^^
-* Point filters
-** Brightness
-** Contrast
-** General Point filter
-
-* Linear filters
-** Specialized Gaussian blur
-** Separable Convolution
-** General Convolution
-
-* Arithmetics filters
-** Addition
-** Multiplication
-** Difference
-** Maximum, Minimum
-
-* Floyd Steinberg dithering
-
-* Bitmap resampling algorithms
-** Nearest Neighbour
-** Bilinear
-** Cubic
-
-* Bitmap rotation and mirroring
-** 90 180 and 170 degree rotation
-
-* Histogram generator
+Gfx
+---
+
+link:drawing_api.html[Gfx] is part of the library that implements basic
+graphics primitives such as lines, circles, polygons, etc. Clasicall
+primitives are nearly finished. Work on anti aliased primitives has been
+started.
+
+Text
+----
+
+link:text_api.html[Text] part of the library implements basic support for
+printing text into the bitmap. There are two bitmap fonts compiled directly
+into the library and we support True Type fonts through
+link:http://freetype.org[FreeType] (so far ASCII printable characters only).
+
+Loaders
+-------
+
+link:loaders.html[Loaders] are part that is resposible for loading and saving
+images into various standard formats (PNG, JPEG, GIF, BMP, PNM, etc...).
+
+.Currently supported formats
+[width="100%",options="header"]
+|=============================================================================
+| Extension | Format Name | Signature | Read Support | Write Support
+
+| JPEG | | [green]*Yes* | [green]*Yes* | [green]*Yes*
+
+| PNG |
+ Portable Network Graphics |
+ [green]*Yes* |
+ [green]#16 Bit RGB not supported# |
+ [green]#16 Bit RGB not supported#
+
+| GIF |
+ Graphics Interchange Format |
+ [green]*Yes* |
+ [green]*Yes* |
+ [black]*No*
+
+| BMP | |
+ [green]*Yes* |
+ [green]#RLE and RGB Bitfields not implemented# |
+ [black]*No*
+
+| PSP |
+ Paint Shop Pro Image |
+ [green]*Yes* |
+ [green]#Composite image only for newer formats than 3.0# |
+ [black]*No*
+
+| PBM PGM PNM |
+ Netpbm portable bitmap |
+ [black]*No* |
+ [gray]#Not finished# |
+ [gray]#Not finished#
+
+|=============================================================================
+
+
+Filters
+-------
+
+link:filters.html[Filters] are part of the library that implements bitmap
+image filters.
+
+.Currently Implemented Point Filters
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Multithreaded
+| Brightness | All | No
+| Contrast | All | No
+|=============================================================================
+
+.Currently Implemented Linear Filters
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Mutithreaded
+| Convolution | RGB888 | Yes
+| Separable Convolution | RGB888 | Yes
+| Gaussian Blur | RGB888 | Yes
+| Sobel Edge Detection | RGB888 | Yes
+| Prewitt Edge Detection | RGB888 | Yes
+|=============================================================================
+
+NOTE: Linear filters are implemented using generic convolution filters, once
+ convolution is rewritten to run for all pixel types the rest of filters
+ will support them automatically.
+
+
+.Currently Implemented Linear Filters
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Multithreaded
+| Addition | All | No
+| Multiplication | All | No
+| Difference | All | No
+| Max, Min | All | No
+|=============================================================================
+
+.Currently Implemented Ditherings
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Multithreaded
+| Floyd Steinberg | RGB888 -> Any | No
+| Hilbert Peano | RGB888 -> Any | No
+|=============================================================================
+
+.Currently Implemented Resamplings
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Multithreaded
+| Nearest Neighbour | All | No
+| Bilinear (Integer Arithmetics) | RGB888 | No
+| Bicubic (Integer Arithmetics) | All | No
+| Bicubic (Float Arithmetics) | RGB888 | No
+|=============================================================================
+
+.Rotation and mirroring
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Multithreaded
+| Rotate 90 | All | No
+| Rotate 180 | All | No
+| Rotate 270 | All | No
+| Mirror Vertically | All | No
+| Mirror Horizontally | All | No
+|=============================================================================
+
+.Misc filters
+[width="100%",options="header"]
+|=============================================================================
+| Filter Name | Supported Pixel Type | Multithreaded
+| Histogram | All | No
+| Additive Gaussian Noise | All | No
+| Median | RGB888 | No
+| Weighted Median | RGB888 | No
+| Sigma Lee | RGB888 | No
+|=============================================================================
+
+Backends
+--------
+
+link:backends.html[Backends] together with link:input.html[Input] are API for
+drawing on screen (or into a window) and for getting keystrokes/mouse
+coordinates. So far we support X11, linux framebuffer and SDL as a graphics
+backend.
+
Work in progress
-~~~~~~~~~~~~~~~~
+----------------
* Python bindings
-** basic support works now
-** could be combined with PyGTK for GUI drawing (experimental)
* Anti Aliased drawing
-** Line and PutPixel are finished
* Gamma correction and color profiles
+* Alfa channel blits
diff --git a/doc/text_api.txt b/doc/text_api.txt
new file mode 100644
index 0000000..0f3484c
--- /dev/null
+++ b/doc/text_api.txt
@@ -0,0 +1,74 @@
+Text
+----
+
+NOTE: You may want to see the link:coordinate_system.html[coordinate system] first.
+
+Text
+~~~~
+
+Text drawing is controlled by the 'GP_TextStyle' structure defined in
+'core/GP_TextStyle.h'. This structure carries the information about font,
+letter spacing and pixel multiplication and spacing. (If no font is specified,
+the default monospace font is used.)
+
+[source,c]
+--------------------------------------------------------------------------------
+/* Where the text should be drawn relatively to the specified point */
+typedef enum GP_TextAlign {
+ GP_ALIGN_LEFT = 0x01, /* to the left from the point */
+ GP_ALIGN_CENTER = 0x02, /* centered on the point */
+ GP_ALIGN_RIGHT = 0x03, /* to the right from the point */
+ GP_VALIGN_ABOVE = 0x10, /* above the point */
+ GP_VALIGN_CENTER = 0x20, /* centered on the point */
+ GP_VALIGN_BASELINE = 0x30, /* baseline is on the point */
+ GP_VALIGN_BELOW = 0x40 /* below the point */
+} GP_TextAlign;
+
+void GP_Text(GP_Context *context, const GP_TextStyle *style,
+ int x, int y, int align, const char *str, GP_Pixel pixel);
+--------------------------------------------------------------------------------
+
+Draws text at the position x and y; the alignment of the text in relation
+to the point is specified by alignment flags.
+If the 'style' argument is 'NULL', a default style is used.
+
+The text size can be computed by following functions:
+
+[source,c]
+--------------------------------------------------------------------------------
+unsigned int GP_TextWidth(const GP_TextStyle *style, const char *str);
+--------------------------------------------------------------------------------
+
+Returns the width (in pixels) that would be occupied by the string if rendered
+using the specified style.
+
+[source,c]
+--------------------------------------------------------------------------------
+unsigned int GP_TextMaxWidth(const GP_TextStyle *style, unsigned int len);
+--------------------------------------------------------------------------------
+
+Returns maximum text width, in pixels, for string with 'len' letters. This call
+is useful for variable letter size fonts.
+
+[source,c]
+--------------------------------------------------------------------------------
+unsigned int GP_TextAscent(const GP_TextStyle *style);
+--------------------------------------------------------------------------------
+
+The Ascent is the height in pixels from the top to the baseline.
+
+[source,c]
+--------------------------------------------------------------------------------
+unsigned int GP_TextDescent(const GP_TextStyle *style);
+--------------------------------------------------------------------------------
+
+The Descent is the height in pixels from baseline to the bottom.
+
+[source,c]
+--------------------------------------------------------------------------------
+unsigned int GP_TextHeight(const GP_TextStyle *style);
+--------------------------------------------------------------------------------
+
+The Height is size of the font from top to the bottom, i.e. equals exactly to
+the sum of ascent and descent.
+
-----------------------------------------------------------------------
Summary of changes:
configure | 11 +-
doc/Makefile | 4 +-
doc/asciidoc.conf | 10 ++
doc/drawing_api.txt | 70 ----------
doc/general.txt | 224 +++++++++++++++++++++----------
doc/text_api.txt | 74 ++++++++++
include/loaders/GP_Loaders.h | 3 +-
include/loaders/{GP_BMP.h => GP_TIFF.h} | 23 ++--
libs/loaders/GP_Loader.c | 13 ++-
libs/loaders/GP_TIFF.c | 222 ++++++++++++++++++++++++++++++
10 files changed, 493 insertions(+), 161 deletions(-)
create mode 100644 doc/text_api.txt
copy include/loaders/{GP_BMP.h => GP_TIFF.h} (81%)
create mode 100644 libs/loaders/GP_TIFF.c
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 150cfc91b719470c2f7beedd4f67e974ab755dd2 (commit)
from 32789015536313fb5dd49b14c5acbf28f8959027 (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/150cfc91b719470c2f7beedd4f67e974ab75…
commit 150cfc91b719470c2f7beedd4f67e974ab755dd2
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 12 15:30:38 2013 +0100
doc: Fix ascidoc css style.
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index d7cd14c..1b4a0b6 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -48,7 +48,6 @@ endif::disable-javascript[]
</div>
# Rest of the content
-<div>
<div class="logo">
<h1>GFXprim documentation</h1>
</div>
@@ -75,7 +74,6 @@ ifdef::toc,toc2[{template:toc}]
<div id="footer">
<div id="footer-text">
template::[footer-text]
- </div>
</div>
ifdef::badges[]
<div id="footer-badges">
diff --git a/doc/asciidoc.css b/doc/asciidoc.css
index 4a1cada..20b466f 100644
--- a/doc/asciidoc.css
+++ b/doc/asciidoc.css
@@ -117,9 +117,9 @@ pre {
div.left-menu {
position: relative;
- top: 140pt;
+ top: 90pt;
left: -100pt;
- width: 30pt;
+ height: 0;
}
div.logo h1 {
-----------------------------------------------------------------------
Summary of changes:
doc/asciidoc.conf | 2 --
doc/asciidoc.css | 4 ++--
2 files changed, 2 insertions(+), 4 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.")
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 32789015536313fb5dd49b14c5acbf28f8959027 (commit)
via 63d359a15e81ae6f4aee95e3d771240869a68b15 (commit)
from e5413bf88214d6a7a13b0ad251befe8098a5e387 (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/32789015536313fb5dd49b14c5acbf28f895…
commit 32789015536313fb5dd49b14c5acbf28f8959027
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 12 14:32:22 2013 +0100
doc: Add simple floating menu.
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index bf03dc0..d7cd14c 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -31,54 +31,51 @@ asciidoc.install({toc,toc2?{toclevels}});
/*]]>*/
</script>
endif::disable-javascript[]
-ifdef::asciimath[]
-<script type="text/javascript" src="{scriptsdir=.}/ASCIIMathML.js"></script>
-endif::asciimath[]
-ifdef::latexmath[]
-<script type="text/javascript" src="{scriptsdir=.}/LaTeXMathML.js"></script>
-endif::latexmath[]
{docinfo1,docinfo2#}{include:{docdir}/docinfo.html}
{docinfo,docinfo2#}{include:{docdir}/{docname}-docinfo.html}
</head>
<body class="{doctype}" style="max-width:55em; margin-left: auto; margin-right: auto;">
+
# Article, book header.
-<div class="logo">
-<h1>GFXprim documentation</h1>
+# Left menu
+<div class="left-menu">
+ <h4>Navigation</h4>
+ <ul>
+ <li><a href="general.html">Home</a></li>
+ <li><a href="api.html">API</a></li>
+ <li><a href="examples.html">Examples</a></li>
+ </ul>
</div>
-ifndef::doctype-manpage[]
-<div id="header">
+
+# Rest of the content
+<div>
+ <div class="logo">
+ <h1>GFXprim documentation</h1>
+ </div>
+
+ <div id="header">
+
ifndef::notitle[<h1>{doctitle}</h1>]
ifdef::doctitle[]
-<span id="author">{author}</span><br />
-<span id="email"><tt><<a href="mailto:{email}">{email}</a>></tt></span><br />
-<span id="revnumber">version {revnumber}{revdate?,}</span>
-<span id="revdate">{revdate}</span>
-<br /><span id="revremark">{revremark}</span>
+ <span id="author">{author}</span><br />
+ <span id="email"><tt><<a href="mailto:{email}">{email}</a>></tt></span><br />
+ <span id="revnumber">version {revnumber}{revdate?,}</span>
+ <span id="revdate">{revdate}</span>
+ <br /><span id="revremark">{revremark}</span>
endif::doctitle[]
+
ifdef::toc,toc2[{template:toc}]
-</div>
-endif::doctype-manpage[]
-# Man page header.
-ifdef::doctype-manpage[]
-<div id="header">
-<h1>
-{doctitle} Manual Page
-</h1>
-ifdef::toc,toc2[{template:toc}]
-<h2>{manname-title}</h2>
-<div class="sectionbody">
-<p>{manname} -
- {manpurpose}
-</p>
-</div>
-</div>
-endif::doctype-manpage[]
-<div class="content">
+
+ </div>
+
+ <div class="content">
+
[footer]
-<div id="footer">
-<div id="footer-text">
+ <div id="footer">
+ <div id="footer-text">
template::[footer-text]
+ </div>
</div>
ifdef::badges[]
<div id="footer-badges">
diff --git a/doc/asciidoc.css b/doc/asciidoc.css
index 4b19932..4a1cada 100644
--- a/doc/asciidoc.css
+++ b/doc/asciidoc.css
@@ -115,6 +115,13 @@ pre {
margin-bottom: 1.5em;
}
+div.left-menu {
+ position: relative;
+ top: 140pt;
+ left: -100pt;
+ width: 30pt;
+}
+
div.logo h1 {
border-bottom: 0px;
margin-top: 1em;
http://repo.or.cz/w/gfxprim.git/commit/63d359a15e81ae6f4aee95e3d771240869a6…
commit 63d359a15e81ae6f4aee95e3d771240869a68b15
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 12 13:58:12 2013 +0100
doc: More work on the Core docs.
diff --git a/doc/Makefile b/doc/Makefile
index 23d87e7..a43432d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +1,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 core.txt api.txt input.txt - gen.txt pixels.txt coordinate_system.txt coding_style.txt
+ gen.txt pixels.txt coordinate_system.txt coding_style.txt + get_put_pixel.txt blits.txt progress_callback.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
diff --git a/doc/blits.txt b/doc/blits.txt
new file mode 100644
index 0000000..e2982e6
--- /dev/null
+++ b/doc/blits.txt
@@ -0,0 +1,75 @@
+Blits
+-----
+
+NOTE: You may want to see the link:coordinate_system.html[coordinate system] first.
+
+Blit copies a rectangular area from one pixmap into the another one. Blits can
+do automatic pixel conversion i.e. swap R a B in blit from RGB888 to BGR888 or
+even convert RGB image into grayscale.
+
+The conversion however may not be ideal as the pixel channel values are just
+divided/multiplied before they are written into the destination bitmap. For
+down-sampling (i.e. size or number of channels of destination bitmap is
+smaller) you should consider using the link:filters.html#Dithering[dithering
+filters] first to convert the source bitmap into destination format.
+
+Also blits that do conversions are significantly slower than blits with equal
+pixel sizes. If you need to blit a pixmap several times consider converting it
+into destination pixel type to speed up the blitting.
+
+
+[source,c]
+--------------------------------------------------------------------------------
+#include <GP.h>
+/* or */
+#include <core/GP_Blit.h>
+
+void GP_Blit(const GP_Context *src,
+ GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
+ GP_Context *dst, GP_Coord x1, GP_Coord y1);
+
+void GP_BlitXYWH(const GP_Context *src,
+ GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
+ GP_Context *dst, GP_Coord x1, GP_Coord y1);
+
+void GP_BlitXYXY(const GP_Context *src,
+ GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1,
+ GP_Context *dst, GP_Coord x2, GP_Coord y2);
+--------------------------------------------------------------------------------
+
+Blit functions to copy rectangular area from source to destination.
+
+As you may see the 'GP_Blit()' function is just alias for 'GP_BlitXYWH()'.
+
+WARNING: For these functions the behavior is undefined when you pass
+ coordinates or width or height outside of the source or destination
+ pixmap. If you need safe variant that automatically clips the
+ coordinates and rectangle to fit both the source and destination use
+ the Clipped variants described bellow.
+
+
+[source,c]
+--------------------------------------------------------------------------------
+#include <GP.h>
+/* or */
+#include <core/GP_Blit.h>
+
+void GP_BlitXYXY_Clipped(const GP_Context *src,
+ GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1,
+ GP_Context *dst, GP_Coord x2, GP_Coord y2);
+
+
+void GP_BlitXYWH_Clipped(const GP_Context *src,
+ GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
+ GP_Context *dst, GP_Coord x1, GP_Coord y1);
+
+void GP_Blit_Clipped(const GP_Context *src,
+ GP_Coord x0, GP_Coord y0, GP_Size w0, GP_Size h0,
+ GP_Context *dst, GP_Coord x1, GP_Coord y1);
+--------------------------------------------------------------------------------
+
+Blit functions to copy rectangular area from source to destination. Both
+source and destination coordinates and sizes are clipped to fit the pixmaps.
+
+As you may see the 'GP_Blit_Clipped()' function is just alias for
+'GP_BlitXYWH_Clipped()'.
diff --git a/doc/core.txt b/doc/core.txt
index a59938d..eb38437 100644
--- a/doc/core.txt
+++ b/doc/core.txt
@@ -1,14 +1,8 @@
-Library Core
-------------
+Common code in 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.
+NOTE: Some of the interfaces described here (most notably the allocator) are
+ semi-internal interfaces and as such API is not considered stable.
Common Macros and Inline Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -56,39 +50,6 @@ 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.
-
-TIP: For example usage see progress callback
-link:example_loaders_progress_callback.html[example].
-
Temporary Buffer Allocator
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/general.txt b/doc/general.txt
index d71ec1f..2cd8776 100644
--- a/doc/general.txt
+++ b/doc/general.txt
@@ -3,18 +3,49 @@ General information
Gfxprim is simple modular 2D bitmap graphics library with emphasis on speed
and correctness.
-One of the key points of the library is code generation. Most of the graphics
-operations are written using 'jinja' templating engine which is used to
-generate specialized C code. So, for an example, once you add pixel
-definition into configuration file, creating specialized filters, loaders and
-conversions to other pixel formats is just a matter of typing "make && make
-clean".
+One of the key points of the library is meta-programming. Most of the
+operations and filters are wriiten in http://jinja.pocoo.org/[Jinja]
+templating language that is used to generate specialized code in C
+programmming language. Creating code that works with less usuall pixel types
+should be as easy as adding pixel definition into the configuration and
+rebuilding the library. Read more link:gen.html[here].
+
+Parts of the library
+~~~~~~~~~~~~~~~~~~~~
-The library also includes, fairly optimized, fixed-point image filters, namely
-various resampling algorithms used to resize images, low pass filters, etc...
+Core
+^^^^
-Implemented features
-~~~~~~~~~~~~~~~~~~~~
+Core of the library contains minimal amount of code to define interface that
+is shared between all parts of the library.
+
+The most important part of the core is link:context.html[CP_Context] structure
+that represents in-memory pixmap.
+
+The Core also contains generated code for basic operations such as
+link:get_put_pixel.html[GetPixel] and link:get_put_pixel.html[PutPixel] and
+optimized code for writing continous line of pixels 'GP_WritePixels' that are
+base for the more complex drawing primitives in GFX or for graphics operations
+in Filters.
+
+link:blits.html[Blits] are functions used to copy part of one bitmap into
+another bitmap. The blits be also used for primitive bitmap pixel type
+conversions (i.e. RGB888 vs BGR888).
+
+link:progress_callback.html[Progress Callback] is an interface that allows you
+to monitor progress of an operation it is mainly used in loaders and filters.
+Generally any operation that is not really quick takes optional pointer to
+progress callback that allows your program to monitor and possibly abort the
+operation.
+
+link:debug.html[Debug] interface is used as unified facility to print debug
+messages, control debug level, etc.
+
+There is also support for link:gamma.html[Gamma] correction. Unfortunatelly
+not all parts of library use it at the moment.
+
+And last but not least Core is a home for some link:core.html[common macros]
+that are used from different parts of the library.
Graphics Rendering
^^^^^^^^^^^^^^^^^^
diff --git a/doc/get_put_pixel.txt b/doc/get_put_pixel.txt
new file mode 100644
index 0000000..f96354f
--- /dev/null
+++ b/doc/get_put_pixel.txt
@@ -0,0 +1,15 @@
+GetPixel and PutPixel
+---------------------
+
+[source,c]
+--------------------------------------------------------------------------------
+#include <GP.h>
+/* or */
+#include <core/GP_GetPutPixel.h>
+
+GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y);
+
+void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p);
+--------------------------------------------------------------------------------
+
+TODO: This is stub.
diff --git a/doc/progress_callback.txt b/doc/progress_callback.txt
new file mode 100644
index 0000000..38719e7
--- /dev/null
+++ b/doc/progress_callback.txt
@@ -0,0 +1,35 @@
+Progress Callback
+-----------------
+
+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.
+
+TIP: For example usage see progress callback
+link:example_loaders_progress_callback.html[example].
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 3 +-
doc/asciidoc.conf | 67 +++++++++++++++++++---------------------
doc/asciidoc.css | 7 ++++
doc/blits.txt | 75 +++++++++++++++++++++++++++++++++++++++++++++
doc/core.txt | 47 ++-------------------------
doc/general.txt | 51 ++++++++++++++++++++++++------
doc/get_put_pixel.txt | 15 +++++++++
doc/progress_callback.txt | 35 +++++++++++++++++++++
8 files changed, 211 insertions(+), 89 deletions(-)
create mode 100644 doc/blits.txt
create mode 100644 doc/get_put_pixel.txt
create mode 100644 doc/progress_callback.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.")