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
May 2012
- 2 participants
- 55 discussions
[repo.or.cz] gfxprim.git branch master updated: d5b0a7ec7f7f9a3552742911a9d7528d5adf86c5
by bluebear 07 May '12
by bluebear 07 May '12
07 May '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 d5b0a7ec7f7f9a3552742911a9d7528d5adf86c5 (commit)
from 0b9e5475cc8db3e7b8c5555744c7b29ca3dbbed3 (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/d5b0a7ec7f7f9a3552742911a9d7528d5adf…
commit d5b0a7ec7f7f9a3552742911a9d7528d5adf86c5
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Mon May 7 15:21:56 2012 +0200
A few more wording clarifications and typo fixes.
diff --git a/doc/context.txt b/doc/context.txt
index 1edcc1f..294d026 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -33,7 +33,9 @@ typedef struct GP_Context {
-------------------------------------------------------------------------------
The 'pixels' field points to the image data, stored as a one-dimensional
-array of byte-aligned lines.
+array of byte-aligned lines. (There can be some unused space at the end of
+each line; this is reflected by the 'bytes_per_row' value being greater
+than what would be needed for that pixel format).
Rotation
^^^^^^^^
@@ -47,7 +49,7 @@ If you don't need this functionality just don't touch the flags the as
overhead of these transformations is not measurable.
If you really need drawing primitives that do not use the orientation flags,
-you could use variants with _Raw suffix (altghoug this is not recommended).
+you could use variants with _Raw suffix (although this is not recommended).
There are various helper macros for transforming coordinates and sizes in
'core/GP_Transform.h'. And context helper functions to "rotate" the flags
@@ -87,7 +89,7 @@ void GP_ContextFlagsRotateCW(GP_Context *context);
void GP_ContextFlagsRotateCCW(GP_Context *context);
/*
- * Returns context W and H taking the rotation flags into the account.
+ * Returns context width and height taking the rotation flags into the account.
*/
GP_Size GP_ContextW(const GP_Context *context);
GP_Size GP_ContextH(const GP_Context *context);
@@ -153,7 +155,7 @@ undefined contents.
void GP_ContextFree(GP_Context *context);
-------------------------------------------------------------------------------
-Frees the context memory. If free_pixels flag is set, the pixels buffer is
+Frees the context memory. If 'free_pixels' flag is set, the pixels buffer is
freed too.
Subcontext
@@ -163,7 +165,7 @@ A subcontext is a context that refers to a rectangular area within another
context. Subcontexts can be used as any other context (including creating
another subcontexts).
-Calling GP_ContextFree() on a subcontext is safe; the bitmap is not freed as
+Calling 'GP_ContextFree()' on a subcontext is safe; the bitmap is not freed as
it belongs to another context; it will be freed with the hosting context.
[source,c]
@@ -201,6 +203,6 @@ GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst,
Provides basic context conversion functionality. A newly allocated context is
returned.
-This fuction does no error distribution it only multiplies or rounds the pixel
+This fuction does no error distribution, it only multiplies or rounds the pixel
values. If you need something better use Floyd Steinberg dithering instead.
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt
index f83bad0..d836680 100644
--- a/doc/drawing_api.txt
+++ b/doc/drawing_api.txt
@@ -94,7 +94,7 @@ void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
Draws a filled circle.
The set of pixels affected by 'GP_FillCircle()' is exactly the same as if
-drawing the circle boundary using GP_Circle() and then filling all pixels
+drawing the circle boundary using 'GP_Circle()' and then filling all pixels
within the boundary with the same color.
Rings
-----------------------------------------------------------------------
Summary of changes:
doc/context.txt | 14 ++++++++------
doc/drawing_api.txt | 2 +-
2 files changed, 9 insertions(+), 7 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: 0b9e5475cc8db3e7b8c5555744c7b29ca3dbbed3
by metan 06 May '12
by metan 06 May '12
06 May '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 0b9e5475cc8db3e7b8c5555744c7b29ca3dbbed3 (commit)
via 4315c42da30f2217b38c6d63862211dcd78db68c (commit)
via 8d81d6e61f6efa9d6782397a95890e500cd547e4 (commit)
from 09faee6cdc1fd7401ed8343a7539d4f547a5b7ec (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/0b9e5475cc8db3e7b8c5555744c7b29ca3db…
commit 0b9e5475cc8db3e7b8c5555744c7b29ca3dbbed3
Merge: 4315c42 09faee6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 6 18:03:27 2012 +0200
Merge ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/4315c42da30f2217b38c6d63862211dcd78d…
commit 4315c42da30f2217b38c6d63862211dcd78db68c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 6 15:03:32 2012 +0200
build: Add core linker flags to --libs.
diff --git a/configure b/configure
index 5d25409..aa1d268 100755
--- a/configure
+++ b/configure
@@ -192,7 +192,7 @@ def write_gfxprim_config(cfg, libs):
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--libs) echo -n "-lGP ";;n')
+ f.write('t--libs) echo -n "-lGP %s ";;n' % libs.get_linker_flags('core'))
# ldflags for specific modules
@@ -240,7 +240,7 @@ if __name__ == '__main__':
[header_exists, "X11/Xlib.h"], "", "-lX11", {"backends"}],
["freetype",
"A high-quality and portable font engine",
- [header_exists, "ft2build.h"], "", "`freetype-config --libs`", {"text"}]], cfg)
+ [header_exists, "ft2build.h"], "", "`freetype-config --libs`", {"core"}]], cfg)
parser = OptionParser();
http://repo.or.cz/w/gfxprim.git/commit/8d81d6e61f6efa9d6782397a95890e500cd5…
commit 8d81d6e61f6efa9d6782397a95890e500cd547e4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 6 14:54:23 2012 +0200
build: The backends module needs to add -lGP_backends.
diff --git a/configure b/configure
index a83d654..5d25409 100755
--- a/configure
+++ b/configure
@@ -191,14 +191,18 @@ 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--libs) echo -n "-lGP";;n')
+ f.write('t--cflags) echo -n "-I/usr/include/GP/ ";;n')
+ f.write('t--libs) echo -n "-lGP ";;n')
# ldflags for specific modules
for i in modules:
- f.write('t--libs-%s) echo -n "%s";;n' %
- (i, libs.get_linker_flags(i)))
+ ldflags = ''
+ if i == 'backends':
+ ldflags += '-lGP_backends '
+ ldflags += libs.get_linker_flags(i)
+ f.write('t--libs-%s) echo -n "%s ";;n' % (i, ldflags))
+
f.write('tesacntshiftndonenechon')
f.close()
-----------------------------------------------------------------------
Summary of changes:
configure | 14 +++++++++-----
1 files changed, 9 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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 09faee6cdc1fd7401ed8343a7539d4f547a5b7ec
by bluebear 06 May '12
by bluebear 06 May '12
06 May '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 09faee6cdc1fd7401ed8343a7539d4f547a5b7ec (commit)
from 53c95916722f2cf7bf6bf0c768cf4e9ec79d6fb3 (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/09faee6cdc1fd7401ed8343a7539d4f547a5…
commit 09faee6cdc1fd7401ed8343a7539d4f547a5b7ec
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sun May 6 17:55:57 2012 +0200
Fixed (hopefully) a few small wording issues.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index 32a8294..cab5435 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -21,12 +21,10 @@ supported pixel value.
Color
~~~~~
-The 'GP_Color', in gfxprim is enumeration of symbolic color names.
+The 'GP_Color' enumeration holds symbolic constants for basic colors.
-Color could be converted for a given 'GP_PixelType' which will result into
-'GP_Pixel' value suitable for usage with drawing functions. The color could be
-also converted to color name (C string in English language) and C string may
-be matched against table of color names.
+A 'GP_Color' can be converted into a 'GP_Pixel' for a given 'GP_PixelType'.
+Symbolic values can also be converted to/from strings (color name in English).
The 'GP_Color' enum is defined as follows:
@@ -49,9 +47,6 @@ typedef enum GP_Color {
} GP_Color;
--------------------------------------------------------------------------------
-Color and Pixel conversion functions, the last one returns 'true' in case of
-successful match and conversion and false otherwise.
-
[source,c]
--------------------------------------------------------------------------------
#include <core/GP_Color.h>
@@ -70,7 +65,7 @@ bool GP_ColorNameToContextPixel(const char *color_name, GP_Context *context,
GP_Pixel *pixel);
--------------------------------------------------------------------------------
-Functions to convert color to pixel and color to context pixel. The last two
+Functions for conversion between colors, pixels and color names. The last two
returns true if color with such name was found.
[source,c]
diff --git a/doc/context.txt b/doc/context.txt
index d7b6b21..1edcc1f 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -1,7 +1,8 @@
Drawing Context
---------------
-The 'GP_Context' is data structure for storing 'in memory' bitmaps.
+The 'GP_Context' structure describes a bitmap in memory. It contains all
+metadata needed for drawing into a bitmap.
Data Structure
~~~~~~~~~~~~~~
@@ -31,8 +32,8 @@ typedef struct GP_Context {
} GP_Context;
-------------------------------------------------------------------------------
-The 'GP_Context' holds meta-data needed for bitmap drawing. The bitmap is
-stored in one dimensional array in byte-aligned lines.
+The 'pixels' field points to the image data, stored as a one-dimensional
+array of byte-aligned lines.
Rotation
^^^^^^^^
@@ -92,8 +93,8 @@ GP_Size GP_ContextW(const GP_Context *context);
GP_Size GP_ContextH(const GP_Context *context);
-------------------------------------------------------------------------------
-Context base functions
-~~~~~~~~~~~~~~~~~~~~~~
+Basic context functions
+~~~~~~~~~~~~~~~~~~~~~~~
[source,c]
-------------------------------------------------------------------------------
@@ -106,10 +107,12 @@ void GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h,
-------------------------------------------------------------------------------
Initalize given context accordingly to parameters, the rest of context
-parameters are set to the default values. Eg. rotation flags are all set to
-zero as well as the free_pixels flag. The bpp and bytes_per_row are computed
-from the given pixel type and size. The pixels pointer may be 'NULL' and could
-be changed later manually.
+parameters are set to the default values (i.e. rotation flags are all set to
+zero, 'free_pixels' flag is not set). Number of bits per pixel and
+bytes per row are computed from the given pixel type and size.
+
+The 'pixels' pointer can be 'NULL' and can be changed later manually (the call
+will *not* try to allocate the pixel memory automatically).
[source,c]
-------------------------------------------------------------------------------
@@ -122,9 +125,9 @@ GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type);
The 'GP_ContextAlloc()' allocates and initalizes a context.
-The orientation flags are all set to zero, the free_pixels flag is set and the
+The orientation flags are all set to zero, the 'free_pixels' flag is set and the
rest of the metadata are calculated accordingly to width, height and
-pixel_type.The contxt->pixels pointer points to newly allocated bitmap with
+pixel_type.The 'pixels' pointer will point to a newly allocated bitmap with
appropriate size; the initial contents of the bitmap are undefined.
[source,c]
@@ -137,8 +140,9 @@ GP_Context *GP_ContextCopy(const GP_Context *src, int flag);
-------------------------------------------------------------------------------
The 'GP_ContextCopy()' allocates and initalizes a copy of the context passed
-as argument. If 'flag' is not zero, the bitmap (context->pixels) is copied
-otherwise it's left uninitalized.
+as argument. If 'flag' is set, the bitmap contents ('src->pixels')
+are also copied; otherwise the copy will have the same dimensions but
+undefined contents.
[source,c]
-------------------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
doc/basic_types.txt | 13 ++++---------
doc/context.txt | 30 +++++++++++++++++-------------
2 files changed, 21 insertions(+), 22 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: 53c95916722f2cf7bf6bf0c768cf4e9ec79d6fb3
by metan 06 May '12
by metan 06 May '12
06 May '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 53c95916722f2cf7bf6bf0c768cf4e9ec79d6fb3 (commit)
from 2bf4d0ec1f74e70434a7d93cf643bcbe7b855c78 (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/53c95916722f2cf7bf6bf0c768cf4e9ec79d…
commit 53c95916722f2cf7bf6bf0c768cf4e9ec79d6fb3
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 6 14:01:38 2012 +0200
build: Make configure genereate gfxprim-config script.
diff --git a/configure b/configure
index 6011867..a83d654 100755
--- a/configure
+++ b/configure
@@ -131,6 +131,17 @@ class libraries:
else:
f.write("HAVE_%s=non" % i[0].upper())
+ #
+ # Return list of linker flags needed to build particular module
+ # (module may be core, loaders, backends, etc...
+ #
+ def get_linker_flags(self, module):
+ res = ""
+ for i in self.libraries:
+ if module in i[5] and self.results[i[0]]:
+ res += " " + i[4]
+ return res
+
def basic_checks(cfg):
sys.stderr.write("Basic checksn")
sys.stderr.write("------------n")
@@ -160,6 +171,39 @@ def write_config_mk(cfg, libs):
f.close()
sys.stderr.write("Config 'config.gen.mk' writtenn")
+#
+# Generate app compilation helper
+#
+def write_gfxprim_config(cfg, libs):
+ modules = ['loaders', 'backends']
+
+ f = open('gfxprim-config', 'w')
+ f.write('#!/bin/shn'
+ '#n# Generated by configure, do not edit directlyn#nn'
+ 'USAGE="Usage: $0 --list-modules --cflags --libs --libs-module_foo"n'
+ 'nif test $# -eq 0; thenn'
+ 'techo "$USAGE"n'
+ 'texit 1n'
+ 'finn'
+ 'while test -n "$1"; don'
+ 'tcase "$1" inn')
+
+ # 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--libs) echo -n "-lGP";;n')
+
+
+ # ldflags for specific modules
+ for i in modules:
+ f.write('t--libs-%s) echo -n "%s";;n' %
+ (i, libs.get_linker_flags(i)))
+
+ f.write('tesacntshiftndonenechon')
+ f.close()
+ os.system('chmod +x gfxprim-config')
+
if __name__ == '__main__':
#
# Dictionary for default configuration parameters
@@ -173,26 +217,26 @@ if __name__ == '__main__':
#
# Library detection/enable disable
#
- # name, description, [detection], cflags, ldflags
+ # name, description, [detection], cflags, ldflags, dict of modules library is needed for
#
l = libraries([["libpng",
"Portable Network Graphics Library",
- [header_exists, "png.h"], "", "-lpng"],
+ [header_exists, "png.h"], "", "-lpng", {"loaders"}],
["libsdl",
"Simple Direct Media Layer",
- [header_exists, "SDL/SDL.h"], "", ""],
+ [header_exists, "SDL/SDL.h"], "", "`sdl-config --libs`", {"backends"}],
["jpeg",
"Library to load, handle and manipulate images in the JPEG format",
- [header_exists, "jpeglib.h"], "", "-ljpeg"],
+ [header_exists, "jpeglib.h"], "", "-ljpeg", {"loaders"}],
["giflib",
"Library to handle, display and manipulate GIF images",
- [header_exists, "gif_lib.h"], "", "-lgif"],
+ [header_exists, "gif_lib.h"], "", "-lgif", {"loaders"}],
["libX11",
"X11 library",
- [header_exists, "X11/Xlib.h"], "", "-lX11"],
+ [header_exists, "X11/Xlib.h"], "", "-lX11", {"backends"}],
["freetype",
"A high-quality and portable font engine",
- [header_exists, "ft2build.h"], "", "`freetype-config --libs`"]], cfg)
+ [header_exists, "ft2build.h"], "", "`freetype-config --libs`", {"text"}]], cfg)
parser = OptionParser();
@@ -228,5 +272,6 @@ if __name__ == '__main__':
l.check()
l.print_summary()
- write_config_h(cfg, l);
- write_config_mk(cfg, l);
+ write_config_h(cfg, l)
+ write_config_mk(cfg, l)
+ write_gfxprim_config(cfg, l)
diff --git a/install.sh b/install.sh
index ee5403f..c0273e0 100755
--- a/install.sh
+++ b/install.sh
@@ -2,8 +2,13 @@
INSTALL_PREFIX="$1"
-HEADER_LOC="$INSTALL_PREFIX/usr/include/"
-LIB_LOC="$INSTALL_PREFIX/usr/lib/"
+if test -z "$INSTALL_PREFIX"; then
+ INSTALL_PREFIX="/usr/"
+fi
+
+HEADER_LOC="$INSTALL_PREFIX/include/"
+LIB_LOC="$INSTALL_PREFIX/lib/"
+BIN_LOC="$INSTALL_PREFIX/bin/"
# Headers
echo "INSTALL headers"
@@ -22,3 +27,7 @@ done
echo "INSTALL libraries"
install -m 775 -d "$LIB_LOC"
install -m 664 build/*.so build/*.so.0 build/*.a "$LIB_LOC"
+
+# Binaries
+echo "INSTALL binaries"
+install -m 755 gfxprim-config "$BIN_LOC"
-----------------------------------------------------------------------
Summary of changes:
configure | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
install.sh | 13 ++++++++++-
2 files changed, 65 insertions(+), 11 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: 2bf4d0ec1f74e70434a7d93cf643bcbe7b855c78
by metan 05 May '12
by metan 05 May '12
05 May '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 2bf4d0ec1f74e70434a7d93cf643bcbe7b855c78 (commit)
via c306b8911beab3de6c3c4d6fc8ccec23802ebdc4 (commit)
from 7d47aaf60dd83f10d1478eb99ec10f29b6407795 (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/2bf4d0ec1f74e70434a7d93cf643bcbe7b85…
commit 2bf4d0ec1f74e70434a7d93cf643bcbe7b855c78
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 20:33:53 2012 +0200
doc: Add gfxprim pages into git.
diff --git a/doc/asteroids-corner.png b/doc/asteroids-corner.png
new file mode 100644
index 0000000..2e4cf0b
Binary files /dev/null and b/doc/asteroids-corner.png differ
diff --git a/doc/favicon.png b/doc/favicon.png
new file mode 100644
index 0000000..3ceab57
Binary files /dev/null and b/doc/favicon.png differ
diff --git a/doc/gfxprim_logo.png b/doc/gfxprim_logo.png
new file mode 100644
index 0000000..bee1c8b
Binary files /dev/null and b/doc/gfxprim_logo.png differ
diff --git a/doc/gfxprim_logo_prim.png b/doc/gfxprim_logo_prim.png
new file mode 100644
index 0000000..677ee0c
Binary files /dev/null and b/doc/gfxprim_logo_prim.png differ
diff --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..6132e6c
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,94 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
+ <link rel="icon" type="image/png" href="favicon.png">
+ <title>GFXprim</title>
+ <style type="text/css" title="currentStyle" media="screen">
+ @import "style.css";
+ </style>
+ </head>
+ <body>
+ <div id="body">
+ <div id="logo">
+ <h1>
+ <div id="logo_picture">
+ <img src="gfxprim_logo.png" alt="GFXprim">
+ </div>
+ <div id="logo_picture_prim">
+ <img src="gfxprim_logo_prim.png" alt="">
+ </div>
+ <div id="clever_line">
+ <div style="display: block; text-align: right;">
+ <img src="asteroids-corner.png" alt="asteroids" style="position: relative; right: 1em;">
+ </div>
+ What would you like to draw today...
+ </div>
+ </h1>
+ </div>
+ <div id="menu">
+ <ul class="menu-tree">
+ <li class="menu-tree-item"><a href="index.html">Home</a></li>
+ <li class="menu-tree-item"><a href="api.html">API</a></li>
+ <li class="menu-tree-item"><a href="examples.html">Code Examples</a></li>
+ <li class="menu-tree-item"><a href="http://repo.or.cz/w/gfxprim.git">GIT</a></li>
+ </ul>
+ </div>
+ <div id="content">
+ <h2>GFXprim</h2>
+ <p>
+ <i>GFXprim</i> is Open-source modular 2D bitmap graphics library
+ with emphasis on speed and correctness.
+ </p>
+ <h3>License</h3>
+ <p>
+ The code is licenced under LGPL 2.1 or (at your opinion) any later.
+ </p>
+ <h3>About</h3>
+ <p>
+ Once upon the time <i>GFXprim</i> had started as an simple attempt to
+ replace SDL_gfx which was unusable at the time we started. Soon it outgrew
+ the initial purpose and yielded into library that could be used as
+ replacement for SDL library. In constrast with SDL <i>GFXprim</i> is
+ not aiming for abstracting the operating system interface. Instead of
+ that <i>GFXprim</i> provides means for keeping the system dependend
+ parts in well defined and isolated parts.
+ </p>
+ <p>
+ One of the key points of the library is code generation. Most of the
+ graphics operations are written using <a href="http://jinja.pocoo.org/">jinja</a>
+ 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".
+ </p>
+ <p>
+ The code is stored in <a href="http://repo.or.cz/w/gfxprim.git">git</a>
+ and although we haven't done release yet; first alpha release may be done
+ later this year once rest of the API stabilizes (the core code has been
+ stable for quite some time).
+ </p>
+ <h3>Contact</h3>
+ <p>
+ We do have a <a href="http://www.ucw.cz/mailman/listinfo/gfxprim">mailing list</a>
+ and although there not much of discussion there now, we are there and listeing.
+ </p>
+ <h3>Documentation</h3>
+ <p>
+ For more information about internal structure and features look at the
+ <a href="api.html">API Description</a>.
+ </p>
+ <p>
+ There are also some nice C and Python
+ <a href="examples.html">Code Examples</a>.
+ </p>
+ </div>
+ <div id="cleaner"> </div>
+ <div id="footer">
+ <a href="http://repo.or.cz/w/gfxprim.git">git</a> |
+ <a href="http://atrey.karlin.mff.cuni.cz/~gavento/GfxPrimWiki/">wiki</a> |
+ <a href="http://www.ucw.cz/mailman/listinfo/gfxprim">mailing list</a>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/doc/style.css b/doc/style.css
new file mode 100644
index 0000000..27fa6f6
--- /dev/null
+++ b/doc/style.css
@@ -0,0 +1,151 @@
+body {
+ background-color: #aaa;
+ margin: 10pt;
+ padding-left: 8%;
+ padding-right: 8%;
+}
+
+h1 {
+ background-color: transparent;
+ border-top: 1px solid #bc8517;
+ border-bottom: 1px solid #bc8517;
+}
+
+h2 {
+ color: #bc6217;
+ padding-bottom: .2em;
+ border-bottom: 1px solid #db7521;
+ font-weight: bolder;
+}
+
+h3 {
+ color: Black;
+ padding-top: 1em;
+}
+
+a, a:visited {
+ color: #333;
+ font-style: oblique;
+ font-weight: bolder;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #aaa;
+ font-style: oblique;
+ font-weight: bolder;
+ text-decoration: none;
+}
+
+li {
+ list-style-type: disc;
+ margin-bottom: 4px;
+}
+
+pre {
+ padding: .5em .5em .5em .5em;
+ border: 1px solid Black;
+ border-style: dashed;
+ background-color: #bbc;
+ display: inline-block;
+}
+
+/* main div */
+#body {
+ color: Black;
+ background-color: #ffffc7;
+}
+
+#logo_picture {
+ position: relative;
+ top: 0.1em;
+ left: 0.5em;
+ display: inline;
+}
+
+#logo_picture_prim {
+ position: relative;
+ display: inline;
+ left: 0.2em;
+ top: 30px;
+}
+
+#logo {
+ background-color: #f7e177;
+}
+
+#clever_line {
+ font-size: 40%;
+ color: #bc6217;
+ float: right;
+ position: relative;
+ top: 10px;
+}
+
+#content {
+ padding: 0 2em 1em 12em;
+}
+
+#menu {
+ float: left;
+ color: #eee;
+ width: 10em;
+ margin: 0em 0em 1em 1em;
+ padding: 0;
+ border: 1px solid #bc6217;
+ background-color: #f7e177;
+}
+
+#cleaner {
+ clear: both;
+}
+
+#footer {
+ background-color: #f7e177;
+ text-align: center;
+ padding-top: .3em;
+ padding-bottom: .3em;
+ color: #bc6217;
+ border-top: 1px solid #bc6217;
+ border-bottom: 1px solid #bc6217;
+}
+
+/* text markers */
+#term {
+ font-variant: small-caps;
+}
+
+#path {
+ font-style: italic;
+}
+
+#command {
+ font-style: oblique;
+}
+
+/* right menu basic style */
+.menu-tree {
+ line-height: 2em;
+ margin: 0 0 0 1em;
+ padding: 0;
+}
+
+.menu-tree-item {
+ font-size: 89%;
+ display: block;
+ margin: 0;
+ padding: 0;
+}
+
+.menu-tree-item a {
+ font-variant: small-caps;
+ text-decoration: none;
+ font-style: normal;
+ padding-top: 0.2em;
+ padding-bottom: 0.25em;
+ color: #db7521;
+}
+
+.menu-tree-item a:hover {
+ color: #eee;
+}
http://repo.or.cz/w/gfxprim.git/commit/c306b8911beab3de6c3c4d6fc8ccec23802e…
commit c306b8911beab3de6c3c4d6fc8ccec23802ebdc4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 20:33:26 2012 +0200
doc: Fix make clean.
diff --git a/doc/Makefile b/doc/Makefile
index c81b39d..4bb74ee 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -13,5 +13,5 @@ api.pdf: api.txt
fop api.fo -pdf api.pdf
clean:
- rm -f api.html
+ rm -f api.html examples.html
rm -f api.xml api.fo api.pdf
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +-
doc/asteroids-corner.png | Bin 0 -> 5241 bytes
doc/favicon.png | Bin 0 -> 768 bytes
doc/gfxprim_logo.png | Bin 0 -> 11242 bytes
doc/gfxprim_logo_prim.png | Bin 0 -> 4751 bytes
doc/index.html | 94 ++++++++++++++++++++++++++++
doc/style.css | 151 +++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 246 insertions(+), 1 deletions(-)
create mode 100644 doc/asteroids-corner.png
create mode 100644 doc/favicon.png
create mode 100644 doc/gfxprim_logo.png
create mode 100644 doc/gfxprim_logo_prim.png
create mode 100644 doc/index.html
create mode 100644 doc/style.css
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: 7d47aaf60dd83f10d1478eb99ec10f29b6407795
by metan 05 May '12
by metan 05 May '12
05 May '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 7d47aaf60dd83f10d1478eb99ec10f29b6407795 (commit)
via 22f1747c69692d0769e2c4bc6e288c95c517d205 (commit)
via 5cb7ab4228726c1193cfa5378a2751608ee7b2ac (commit)
via 933fdbbd2f09c3ab6869dbbc6c30c698576eb3fd (commit)
via 4124b65e9f3c2ba8984e0727d13f955fc04ae7e0 (commit)
via db71e716da4792f972540c31b2d3d24aeede6825 (commit)
from 6f8f6b43ebf8f58d705e3c6e9499d279f20e7b0b (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/7d47aaf60dd83f10d1478eb99ec10f29b640…
commit 7d47aaf60dd83f10d1478eb99ec10f29b6407795
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 20:30:13 2012 +0200
doc: Add more info to general docs.
diff --git a/doc/general.txt b/doc/general.txt
index c8b6262..96310bb 100644
--- a/doc/general.txt
+++ b/doc/general.txt
@@ -23,7 +23,7 @@ Graphics Rendering
** Lines
** Circles
** Elipses
-** Polygon
+** Polygons
* Text Drawing
** Supports both proportional and non proportional fonts
@@ -37,6 +37,17 @@ Graphics Rendering
** 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 Framebuffer
+** SDL support
+** Experimental X11 support
+
Bitmap Filters
^^^^^^^^^^^^^^
* Point filters
http://repo.or.cz/w/gfxprim.git/commit/22f1747c69692d0769e2c4bc6e288c95c517…
commit 22f1747c69692d0769e2c4bc6e288c95c517d205
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 19:37:26 2012 +0200
doc: More small doc fixes.
diff --git a/doc/backends.txt b/doc/backends.txt
index f476b10..ced9548 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -77,14 +77,14 @@ GP_Backend *GP_BackendInit(const char *params, const char *caption, FILE *help);
This function takes a params string as an parameter which is used for
determining backend-dependend parametrs. The format is
-'backend_name:backend_parameters' where backend parameters may be size (either
-'WxH' or 'FS' in case of SDL backend). The caption is window caption (which is
-ignored in most of the cases) and the FILE is file, where an error is printed
-in case of failure, you should mostly use 'stderr' for that purpose. If params
-is set to NULL the the call only prints help into the passed help FILE. If
-intitalizaton was succesfull pointer to allocated and initalized backend is
-returned otherwise NULL is returned and some helpful infomation should be
-printed into the passed help FILE.
+'backend_name:backend_parameters' where backend parameters may be window size
+(either 'WxH' or 'FS' in case of SDL backend). The caption is window caption
+(which is ignored in some of the cases) and the 'FILE' is file, where an error
+is printed in case of failure, you should mostly use 'stderr' for that
+purpose. If params is set to 'NULL' the the call only prints help into the
+passed help 'FILE'. If intitalizaton was succesfull pointer to allocated and
+initalized backend is returned otherwise 'NULL' is returned and some helpful
+infomation should be printed into the passed help 'FILE'.
Drawing Backend API
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index 2a14c95..32a8294 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -28,7 +28,7 @@ Color could be converted for a given 'GP_PixelType' which will result into
also converted to color name (C string in English language) and C string may
be matched against table of color names.
-The 'GP_Color' enmum is defined as follows:
+The 'GP_Color' enum is defined as follows:
[source,c]
--------------------------------------------------------------------------------
@@ -92,7 +92,7 @@ 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 could take some time to
+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.
@@ -111,7 +111,7 @@ 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 the filter is aborted, all memory freed etc. and in case of
+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/context.txt b/doc/context.txt
index 6395eee..d7b6b21 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -26,7 +26,7 @@ typedef struct GP_Context {
uint8_t axes_swap:1; /* swap axes */
uint8_t x_swap:1; /* mirror x */
uint8_t y_swap:1; /* mirror y */
- uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
+ uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
uint8_t free_pixels:1; /* if set GP_ContextFree() calls free on context->pixels */
} GP_Context;
-------------------------------------------------------------------------------
@@ -49,7 +49,7 @@ If you really need drawing primitives that do not use the orientation flags,
you could use variants with _Raw suffix (altghoug this is not recommended).
There are various helper macros for transforming coordinates and sizes in
-'core/GP_Transform.h'. And helper functions to "rotate" the context flags
+'core/GP_Transform.h'. And context helper functions to "rotate" the flags
clock wise and counter clock wise as well as functions to get the context size
when taking into the accout the widht and height.
@@ -108,7 +108,7 @@ void GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h,
Initalize given context accordingly to parameters, the rest of context
parameters are set to the default values. Eg. rotation flags are all set to
zero as well as the free_pixels flag. The bpp and bytes_per_row are computed
-from the given pixel type and size. The pixels pointer may be NULL and could
+from the given pixel type and size. The pixels pointer may be 'NULL' and could
be changed later manually.
[source,c]
@@ -120,7 +120,7 @@ be changed later manually.
GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type);
-------------------------------------------------------------------------------
-The 'GP_ContextAlloc()' allocates context and initalizes a context.
+The 'GP_ContextAlloc()' allocates and initalizes a context.
The orientation flags are all set to zero, the free_pixels flag is set and the
rest of the metadata are calculated accordingly to width, height and
@@ -149,7 +149,7 @@ otherwise it's left uninitalized.
void GP_ContextFree(GP_Context *context);
-------------------------------------------------------------------------------
-Frees the context memory. If free_pixels flag is set, the pixels datada are
+Frees the context memory. If free_pixels flag is set, the pixels buffer is
freed too.
Subcontext
@@ -197,6 +197,6 @@ GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst,
Provides basic context conversion functionality. A newly allocated context is
returned.
-This fuction does no error distribution but only multiply or rounds the pixel
+This fuction does no error distribution it only multiplies or rounds the pixel
values. If you need something better use Floyd Steinberg dithering instead.
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt
index e73a07c..f83bad0 100644
--- a/doc/drawing_api.txt
+++ b/doc/drawing_api.txt
@@ -52,6 +52,7 @@ y0, y1 can be specified in any order.
'GP_VLine()' is an alias for 'GP_VLineXYY()'.
+[source,c]
--------------------------------------------------------------------------------
void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
GP_Pixel pixel);
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 7d5d0c5..472a735 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -267,5 +267,5 @@ PBM, PGM, PPM
~~~~~~~~~~~~~
There is a code do load and write 'PBM', 'PGM' and 'PPM' images too. However
-it's not finished and it's API is outdated. Use at your own risk.
+it's not finished and its API is outdated. Use at your own risk.
http://repo.or.cz/w/gfxprim.git/commit/5cb7ab4228726c1193cfa5378a2751608ee7…
commit 5cb7ab4228726c1193cfa5378a2751608ee7b2ac
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 19:36:08 2012 +0200
docs: Add more examples.
diff --git a/doc/Makefile b/doc/Makefile
index 5286512..c81b39d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -4,7 +4,7 @@ api.html: general.txt api.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt
asciidoc -a toc api.txt
-examples.html: examples.txt ../demos/simple/*.c
+examples.html: examples.txt ../demos/simple/*.c ../demos/py_simple/*.py
asciidoc -a toc examples.txt
api.pdf: api.txt
diff --git a/doc/examples.txt b/doc/examples.txt
index 520d5d9..c4566f2 100644
--- a/doc/examples.txt
+++ b/doc/examples.txt
@@ -19,3 +19,17 @@ Loads an image and saves it into 'out.png' png image.
include::../demos/simple/loaders_example.c[]
------------------------------------------------------------------
+And the same in python
+
+[source,python]
+------------------------------------------------------------------
+include::../demos/py_simple/loaders_example.py[]
+------------------------------------------------------------------
+
+GFXprim + PyGTK
+---------------
+
+[source,python]
+------------------------------------------------------------------
+include::../demos/py_simple/pygtk_example.py[]
+------------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/933fdbbd2f09c3ab6869dbbc6c30c698576e…
commit 933fdbbd2f09c3ab6869dbbc6c30c698576eb3fd
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 19:35:45 2012 +0200
examples: Add very simple loaders python example.
diff --git a/demos/py_simple/loaders_example.py b/demos/py_simple/loaders_example.py
new file mode 100755
index 0000000..1bf9c2c
--- /dev/null
+++ b/demos/py_simple/loaders_example.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+import sys
+
+import gfxprim.core as core
+import gfxprim.loaders as loaders
+import gfxprim.filters as filters
+
+def main():
+ if len(sys.argv) != 2:
+ print("Takes an image as an argument")
+ sys.exit(1)
+
+ # Load Image
+ img = loaders.LoadImage(sys.argv[2], None)
+ # Save result
+ loaders.SavePNG("out.png", img, None)
+
+if __name__ == '__main__':
+ main()
http://repo.or.cz/w/gfxprim.git/commit/4124b65e9f3c2ba8984e0727d13f955fc04a…
commit 4124b65e9f3c2ba8984e0727d13f955fc04ae7e0
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 19:31:18 2012 +0200
doc: Add examples docs.
diff --git a/doc/Makefile b/doc/Makefile
index fd95a7b..5286512 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,9 +1,12 @@
-all: api.html
+all: api.html examples.html
api.html: general.txt api.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt
asciidoc -a toc api.txt
+examples.html: examples.txt ../demos/simple/*.c
+ 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
diff --git a/doc/examples.txt b/doc/examples.txt
new file mode 100644
index 0000000..520d5d9
--- /dev/null
+++ b/doc/examples.txt
@@ -0,0 +1,21 @@
+Simple backend example
+----------------------
+
+Basic backend code example. Initalizes backends, draws a cross and dumps
+events.
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/simple/backend_example.c[]
+------------------------------------------------------------------
+
+Simple loaders example
+----------------------
+
+Loads an image and saves it into 'out.png' png image.
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/simple/loaders_example.c[]
+------------------------------------------------------------------
+
http://repo.or.cz/w/gfxprim.git/commit/db71e716da4792f972540c31b2d3d24aeede…
commit db71e716da4792f972540c31b2d3d24aeede6825
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 19:30:31 2012 +0200
examples: Add a very simple examples.
diff --git a/demos/Makefile b/demos/Makefile
index 1d61deb..6cbebf6 100644
--- a/demos/Makefile
+++ b/demos/Makefile
@@ -1,3 +1,3 @@
TOPDIR=..
-SUBDIRS=grinder spiv particle ttf2img
+SUBDIRS=grinder spiv particle ttf2img simple
include $(TOPDIR)/post.mk
diff --git a/demos/simple/Makefile b/demos/simple/Makefile
new file mode 100644
index 0000000..7fd7505
--- /dev/null
+++ b/demos/simple/Makefile
@@ -0,0 +1,12 @@
+TOPDIR=../..
+
+CSOURCES=$(shell echo *.c)
+
+INCLUDE=
+LDLIBS+=-lGP -lGP_backends -lSDL -L$(TOPDIR)/build/
+
+APPS=backend_example loaders_example
+
+include $(TOPDIR)/pre.mk
+include $(TOPDIR)/app.mk
+include $(TOPDIR)/post.mk
diff --git a/demos/simple/backend_example.c b/demos/simple/backend_example.c
new file mode 100644
index 0000000..838726b
--- /dev/null
+++ b/demos/simple/backend_example.c
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * 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> *
+ * *
+ *****************************************************************************/
+
+ /*
+
+ Simple backend example.
+
+ */
+
+#include <GP.h>
+#include <backends/GP_Backends.h>
+
+int main(int argc, char *argv[])
+{
+ GP_Backend *backend;
+ GP_Context *context;
+ GP_Pixel white_pixel, black_pixel;
+ const char *backend_opts = "X11:100x100";
+ int opt;
+
+ while ((opt = getopt(argc, argv, "b:h")) != -1) {
+ switch (opt) {
+ case 'b':
+ backend_opts = optarg;
+ break;
+ case 'h':
+ GP_BackendInit(NULL, NULL, stderr);
+ return 0;
+ break;
+ default:
+ fprintf(stderr, "Invalid paramter '%c'n", opt);
+ }
+ }
+
+ /* Turn on debug messages */
+ GP_SetDebugLevel(10);
+
+ backend = GP_BackendInit(backend_opts, "Backend Example", stderr);
+
+ context = backend->context;
+
+ GP_EventSetScreenSize(context->w, context->h);
+
+ black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context);
+ white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, context);
+
+ GP_Fill(context, black_pixel);
+ GP_Line(context, 0, 0, context->w - 1, context->h - 1, white_pixel);
+ GP_Line(context, 0, context->h - 1, context->w - 1, 0, white_pixel);
+
+ /* Update the backend screen */
+ GP_BackendFlip(backend);
+
+ for (;;) {
+ if (backend->Poll)
+ GP_BackendPoll(backend);
+
+ usleep(1000);
+
+ /* Read and parse events */
+ GP_Event ev;
+
+ while (GP_EventGet(&ev)) {
+
+ GP_EventDump(&ev);
+
+ switch (ev.type) {
+ case GP_EV_KEY:
+ switch (ev.val.key.key) {
+ case GP_KEY_ESC:
+ case GP_KEY_Q:
+ GP_BackendExit(backend);
+ return 0;
+ break;
+ }
+ }
+ }
+ }
+
+ GP_BackendExit(backend);
+
+ return 0;
+}
diff --git a/demos/simple/loaders_example.c b/demos/simple/loaders_example.c
new file mode 100644
index 0000000..b05c0b5
--- /dev/null
+++ b/demos/simple/loaders_example.c
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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> *
+ * *
+ *****************************************************************************/
+
+ /*
+
+ Simple loaders example.
+
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <GP.h>
+
+int main(int argc, char *argv[])
+{
+ GP_Context *img;
+
+ /* Turn on debug messages */
+ GP_SetDebugLevel(10);
+
+ if (argc != 2) {
+ fprintf(stderr, "Takes an image as an parametern");
+ return 0;
+ }
+
+ img = GP_LoadImage(argv[1], NULL);
+
+ if (img == NULL) {
+ fprintf(stderr, "Failed to load image '%s':%sn", argv[1],
+ strerror(errno));
+ return 1;
+ }
+
+ if (GP_SavePNG("out.png", img, NULL)) {
+ fprintf(stderr, "Failed to save image %s", strerror(errno));
+ return 1;
+ }
+
+ return 0;
+}
-----------------------------------------------------------------------
Summary of changes:
demos/Makefile | 2 +-
demos/py_simple/{blur.py => loaders_example.py} | 10 +--
demos/{particle => simple}/Makefile | 4 +-
.../particle_demo.c => simple/backend_example.c} | 83 +++++---------------
.../simple/loaders_example.c | 41 +++++-----
doc/Makefile | 5 +-
doc/backends.txt | 16 ++--
doc/basic_types.txt | 6 +-
doc/context.txt | 12 ++--
doc/drawing_api.txt | 1 +
doc/examples.txt | 35 ++++++++
doc/general.txt | 13 +++-
doc/loaders.txt | 2 +-
13 files changed, 114 insertions(+), 116 deletions(-)
copy demos/py_simple/{blur.py => loaders_example.py} (54%)
copy demos/{particle => simple}/Makefile (83%)
copy demos/{particle/particle_demo.c => simple/backend_example.c} (65%)
copy tests/drivers/linux_input.c => demos/simple/loaders_example.c (76%)
create mode 100644 doc/examples.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: 6f8f6b43ebf8f58d705e3c6e9499d279f20e7b0b
by metan 05 May '12
by metan 05 May '12
05 May '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
discards f68afbebe846cbdba887cd1f19a26de2f130a182 (commit)
via 6f8f6b43ebf8f58d705e3c6e9499d279f20e7b0b (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (f68afbebe846cbdba887cd1f19a26de2f130a182)
N -- N -- N (6f8f6b43ebf8f58d705e3c6e9499d279f20e7b0b)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/6f8f6b43ebf8f58d705e3c6e9499d279f20e…
commit 6f8f6b43ebf8f58d705e3c6e9499d279f20e7b0b
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 14:40:43 2012 +0200
doc: A few fixes.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index b3328e9..2a14c95 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -111,7 +111,8 @@ 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 the filter is aborted, all memory freed etc.
+value is returned the filter 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/loaders.txt b/doc/loaders.txt
index 409c940..7d5d0c5 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -4,15 +4,15 @@ This part of gfxprim library aims to create API to load/save images from/to
common image file formats.
All loading functions returns a pointer to allocated and loaded image or upon
-a failure NULL is returned and errno is set.
+a failure 'NULL' is returned and 'errno' is set.
The possible errno values are:
* anything returned by fopen(), fclose(), fseek(), ...
-* ENOSYS if library wasn't compiled with particual library support
-* ENOMEM as returned by malloc()
-* EIO/EILSEQ invalid image data
-* ECANCELED loading canceled from callback
+* 'ENOSYS' if library wasn't compiled with particual library support
+* 'ENOMEM' as returned by malloc()
+* 'EIO'/'EILSEQ' invalid image data
+* 'ECANCELED' loading canceled from callback
Common Loader
~~~~~~~~~~~~~
@@ -49,7 +49,7 @@ Opens file and checks for 'PNG' signature. Returns zero on success (file
could be opened, signature matches), the opened file is returned and the file
possition points right after the end of the 'PNG' signature.
-Upon failure errno is filled.
+Upon failure 'errno' is filled.
This function is semi-internal, you should rather use functions listed below.
@@ -90,12 +90,12 @@ int GP_SavePNG(const char *dst_path, const GP_Context *src,
-------------------------------------------------------------------------------
Writes a Context into a 'PNG' image. If aborted by a callback, the opened file
-is closed and removed before the call returns non-zero and errno is set to
-ECANCELED.
+is closed and removed before the call returns non-zero and 'errno' is set to
+'ECANCELED'.
-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.
+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
~~~~
@@ -131,8 +131,8 @@ GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback);
Loads 'JPG' file into context the file pointer must point to the start of the
'JPG' data stream (eg. should point right after the signature). The context,
to store the image to, is allocated. The loading process could by aborted by a
-callback, in such case all memory is freed and the call returns NULL and errno
-is set to ECANCELED.
+callback, in such case all memory is freed and the call returns 'NULL' and
+'errno' is set to 'ECANCELED'.
[source,c]
-------------------------------------------------------------------------------
@@ -157,8 +157,8 @@ int GP_SaveJPG(const char *dst_path, const GP_Context *src,
-------------------------------------------------------------------------------
Writes a Context into a 'JPG' image. If aborted by a callback, the opened file
-is closed and removed before the call returns non-zero and errno is set to
-ECANCELED.
+is closed and removed before the call returns non-zero and 'errno' is set to
+'ECANCELED'.
The 'JPG' format could store either 'G8' or 'RGB888' pixeltypes and you must
convert the context into one of them before this fucntions is called.
@@ -179,7 +179,7 @@ int GP_OpenGIF(const char *src_path, void **f);
Opens file and checks for 'GIF' signature upon successful return (file could
be opened, signature matches) zero is returned and gif handle f is set
-otherwise non-zero is returned and errno is set.
+otherwise non-zero is returned and 'errno' is set.
This function is semi-internal, you should rather use functions listed below.
@@ -195,7 +195,8 @@ GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback);
Loads 'GIF' file into context. The pointer must point to the 'GIF' handle as
returned by 'GP_OpenGIF()' function. The context, to store the image to, is
allocated. The loading process could by aborted by a callback, in such case
-all memory is freed and the call returns NULL and errno is set to ECANCELED.
+all memory is freed and the call returns 'NULL' and 'errno' is set to
+'ECANCELED'.
Currently this function loads only first image from the gif container.
@@ -228,8 +229,9 @@ int GP_OpenBMP(const char *src_path, FILE **f,
-------------------------------------------------------------------------------
Opens file and checks for 'BMP' signature upon successful return (file could
-be opened, signature matches) zero is returned and the parameters, if not
-NULL, are initalized. Upon failure non-zero is returned and errno is set.
+be opened, signature matches) zero is returned and the parameters, if
+non-'NULL', are initalized. Upon failure non-zero is returned and 'errno' is
+set.
This function is semi-internal, you should rather use functions listed below.
@@ -242,10 +244,10 @@ This function is semi-internal, you should rather use functions listed below.
GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads 'BMP' file into context. The FILE pointer must point to opened 'BMP'
+Loads 'BMP' file into context. The 'FILE' pointer must point to opened 'BMP'
file. The context, to store the image to, is allocated. The loading process
could by aborted by a callback, in such case all memory is freed and the call
-returns NULL and errno is set to ECANCELED.
+returns 'NULL' and 'errno' is set to 'ECANCELED'.
Currently this function loads only first image from the 'GIF' container.
@@ -264,6 +266,6 @@ signature. Basically this combines both of the calls above.
PBM, PGM, PPM
~~~~~~~~~~~~~
-There is a code do load and write PBM, PGM and PPM images too. However it's
-not finished and it's API is outdated. Use at your own risk.
+There is a code do load and write 'PBM', 'PGM' and 'PPM' images too. However
+it's not finished and it's API is outdated. Use at your own risk.
-----------------------------------------------------------------------
Summary of changes:
doc/basic_types.txt | 1 +
1 files changed, 1 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: f68afbebe846cbdba887cd1f19a26de2f130a182
by metan 05 May '12
by metan 05 May '12
05 May '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 f68afbebe846cbdba887cd1f19a26de2f130a182 (commit)
from a1a8790a15c07510bf5d309448cf1a9b460ec344 (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/f68afbebe846cbdba887cd1f19a26de2f130…
commit f68afbebe846cbdba887cd1f19a26de2f130a182
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 14:40:43 2012 +0200
doc: A few fixes.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index b3328e9..14ae62e 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -111,7 +111,7 @@ 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 the filter is aborted, all memory freed etc.
+value is returned the filter 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/loaders.txt b/doc/loaders.txt
index 409c940..7d5d0c5 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -4,15 +4,15 @@ This part of gfxprim library aims to create API to load/save images from/to
common image file formats.
All loading functions returns a pointer to allocated and loaded image or upon
-a failure NULL is returned and errno is set.
+a failure 'NULL' is returned and 'errno' is set.
The possible errno values are:
* anything returned by fopen(), fclose(), fseek(), ...
-* ENOSYS if library wasn't compiled with particual library support
-* ENOMEM as returned by malloc()
-* EIO/EILSEQ invalid image data
-* ECANCELED loading canceled from callback
+* 'ENOSYS' if library wasn't compiled with particual library support
+* 'ENOMEM' as returned by malloc()
+* 'EIO'/'EILSEQ' invalid image data
+* 'ECANCELED' loading canceled from callback
Common Loader
~~~~~~~~~~~~~
@@ -49,7 +49,7 @@ Opens file and checks for 'PNG' signature. Returns zero on success (file
could be opened, signature matches), the opened file is returned and the file
possition points right after the end of the 'PNG' signature.
-Upon failure errno is filled.
+Upon failure 'errno' is filled.
This function is semi-internal, you should rather use functions listed below.
@@ -90,12 +90,12 @@ int GP_SavePNG(const char *dst_path, const GP_Context *src,
-------------------------------------------------------------------------------
Writes a Context into a 'PNG' image. If aborted by a callback, the opened file
-is closed and removed before the call returns non-zero and errno is set to
-ECANCELED.
+is closed and removed before the call returns non-zero and 'errno' is set to
+'ECANCELED'.
-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.
+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
~~~~
@@ -131,8 +131,8 @@ GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback);
Loads 'JPG' file into context the file pointer must point to the start of the
'JPG' data stream (eg. should point right after the signature). The context,
to store the image to, is allocated. The loading process could by aborted by a
-callback, in such case all memory is freed and the call returns NULL and errno
-is set to ECANCELED.
+callback, in such case all memory is freed and the call returns 'NULL' and
+'errno' is set to 'ECANCELED'.
[source,c]
-------------------------------------------------------------------------------
@@ -157,8 +157,8 @@ int GP_SaveJPG(const char *dst_path, const GP_Context *src,
-------------------------------------------------------------------------------
Writes a Context into a 'JPG' image. If aborted by a callback, the opened file
-is closed and removed before the call returns non-zero and errno is set to
-ECANCELED.
+is closed and removed before the call returns non-zero and 'errno' is set to
+'ECANCELED'.
The 'JPG' format could store either 'G8' or 'RGB888' pixeltypes and you must
convert the context into one of them before this fucntions is called.
@@ -179,7 +179,7 @@ int GP_OpenGIF(const char *src_path, void **f);
Opens file and checks for 'GIF' signature upon successful return (file could
be opened, signature matches) zero is returned and gif handle f is set
-otherwise non-zero is returned and errno is set.
+otherwise non-zero is returned and 'errno' is set.
This function is semi-internal, you should rather use functions listed below.
@@ -195,7 +195,8 @@ GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback);
Loads 'GIF' file into context. The pointer must point to the 'GIF' handle as
returned by 'GP_OpenGIF()' function. The context, to store the image to, is
allocated. The loading process could by aborted by a callback, in such case
-all memory is freed and the call returns NULL and errno is set to ECANCELED.
+all memory is freed and the call returns 'NULL' and 'errno' is set to
+'ECANCELED'.
Currently this function loads only first image from the gif container.
@@ -228,8 +229,9 @@ int GP_OpenBMP(const char *src_path, FILE **f,
-------------------------------------------------------------------------------
Opens file and checks for 'BMP' signature upon successful return (file could
-be opened, signature matches) zero is returned and the parameters, if not
-NULL, are initalized. Upon failure non-zero is returned and errno is set.
+be opened, signature matches) zero is returned and the parameters, if
+non-'NULL', are initalized. Upon failure non-zero is returned and 'errno' is
+set.
This function is semi-internal, you should rather use functions listed below.
@@ -242,10 +244,10 @@ This function is semi-internal, you should rather use functions listed below.
GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads 'BMP' file into context. The FILE pointer must point to opened 'BMP'
+Loads 'BMP' file into context. The 'FILE' pointer must point to opened 'BMP'
file. The context, to store the image to, is allocated. The loading process
could by aborted by a callback, in such case all memory is freed and the call
-returns NULL and errno is set to ECANCELED.
+returns 'NULL' and 'errno' is set to 'ECANCELED'.
Currently this function loads only first image from the 'GIF' container.
@@ -264,6 +266,6 @@ signature. Basically this combines both of the calls above.
PBM, PGM, PPM
~~~~~~~~~~~~~
-There is a code do load and write PBM, PGM and PPM images too. However it's
-not finished and it's API is outdated. Use at your own risk.
+There is a code do load and write 'PBM', 'PGM' and 'PPM' images too. However
+it's not finished and it's API is outdated. Use at your own risk.
-----------------------------------------------------------------------
Summary of changes:
doc/basic_types.txt | 4 ++--
doc/loaders.txt | 48 +++++++++++++++++++++++++-----------------------
2 files changed, 27 insertions(+), 25 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: a1a8790a15c07510bf5d309448cf1a9b460ec344
by metan 05 May '12
by metan 05 May '12
05 May '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 a1a8790a15c07510bf5d309448cf1a9b460ec344 (commit)
via bd082cac18a091c462b65f1f2d9a0adacb9b35fe (commit)
via 115391b21612956d9ed1f541d9272001e15c3c83 (commit)
via 473dac1a93ecc9a00bcbdc4c3fc1acd110afbd53 (commit)
via 268542916484c84a4b205bba09a9b700f3530b76 (commit)
via 075f6abdea6c012df7201450896669431336b6eb (commit)
from e77e1ccb700947ccd7286bf64c06d2d21d73c175 (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/a1a8790a15c07510bf5d309448cf1a9b460e…
commit a1a8790a15c07510bf5d309448cf1a9b460ec344
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 14:11:40 2012 +0200
doc: Update context docs.
diff --git a/doc/context.txt b/doc/context.txt
index 38a8efb..6395eee 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -1,7 +1,7 @@
Drawing Context
---------------
-GP_Context is data structure for storing 'in memory' bitmaps.
+The 'GP_Context' is data structure for storing 'in memory' bitmaps.
Data Structure
~~~~~~~~~~~~~~
@@ -26,6 +26,7 @@ typedef struct GP_Context {
uint8_t axes_swap:1; /* swap axes */
uint8_t x_swap:1; /* mirror x */
uint8_t y_swap:1; /* mirror y */
+ uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
uint8_t free_pixels:1; /* if set GP_ContextFree() calls free on context->pixels */
} GP_Context;
-------------------------------------------------------------------------------
@@ -36,12 +37,12 @@ stored in one dimensional array in byte-aligned lines.
Rotation
^^^^^^^^
-The orientation flags affects the gfx and text drawing functions. If some of
-the flags is changed the origin and direction of the drawing is changed. Note
-that the image pixels are not affected by this at all only the coordinates
-passed to drawing functions are transformed accordingly.
+The orientation flags affects the gfx and text drawing functions and blits. If
+some of the flags is changed the origin and direction of the drawing is
+changed. Note that the image pixels are not affected by this at all only the
+coordinates passed to drawing functions are transformed accordingly.
-If you don't need this functionality just don't touch these flags the as
+If you don't need this functionality just don't touch the flags the as
overhead of these transformations is not measurable.
If you really need drawing primitives that do not use the orientation flags,
@@ -54,6 +55,10 @@ when taking into the accout the widht and height.
[source,c]
-------------------------------------------------------------------------------
+#include <core/GP_Transform.h>
+/* or */
+#include <GP.h>
+
/* Transforms point user coordinates to bitmap coordinates */
GP_TRANSFORM_POINT(context, x, y)
@@ -65,7 +70,11 @@ GP_RETRANSFORM_POINT(context, x, y)
-------------------------------------------------------------------------------
[source,c]
--------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
+#include <GP.h>
+
/*
* Rotate context flags clock wise.
*/
@@ -88,27 +97,60 @@ Context base functions
[source,c]
-------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
+#include <GP.h>
+
+void GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h,
+ GP_PixelType type, void *pixels);
+-------------------------------------------------------------------------------
+
+Initalize given context accordingly to parameters, the rest of context
+parameters are set to the default values. Eg. rotation flags are all set to
+zero as well as the free_pixels flag. The bpp and bytes_per_row are computed
+from the given pixel type and size. The pixels pointer may be NULL and could
+be changed later manually.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
#include <GP.h>
GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type);
+-------------------------------------------------------------------------------
-GP_Context *GP_ContextCopy(const GP_Context *src, int flag);
+The 'GP_ContextAlloc()' allocates context and initalizes a context.
-void GP_ContextFree(GP_Context *context);
+The orientation flags are all set to zero, the free_pixels flag is set and the
+rest of the metadata are calculated accordingly to width, height and
+pixel_type.The contxt->pixels pointer points to newly allocated bitmap with
+appropriate size; the initial contents of the bitmap are undefined.
+
+[source,c]
-------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
+#include <GP.h>
-The 'GP_ContextAlloc()' allocates context and initalizes the context
-structure. The orientation flags are all set to 0 and the rest of the metadata
-are calculated accordingly to width, height and pixel_type. A bitmap with
-appropriate size is allocated and stored in context->pixels; the initial
-contents of the bitmap are undefined.
+GP_Context *GP_ContextCopy(const GP_Context *src, int flag);
+-------------------------------------------------------------------------------
The 'GP_ContextCopy()' allocates and initalizes a copy of the context passed
as argument. If 'flag' is not zero, the bitmap (context->pixels) is copied
otherwise it's left uninitalized.
-In both cases the resulting context should later be freed with
-'GP_ContextFree()'.
+[source,c]
+-------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
+#include <GP.h>
+
+void GP_ContextFree(GP_Context *context);
+-------------------------------------------------------------------------------
+
+Frees the context memory. If free_pixels flag is set, the pixels datada are
+freed too.
Subcontext
~~~~~~~~~~
@@ -122,6 +164,8 @@ it belongs to another context; it will be freed with the hosting context.
[source,c]
-------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
#include <GP.h>
GP_Context *GP_ContextSubContext(GP_Context *context, GP_Context *subcontext,
@@ -142,15 +186,17 @@ Conversions
[source,c]
-------------------------------------------------------------------------------
+#include <core/GP_Context.h>
+/* or */
#include <GP.h>
GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst,
GP_PixelType dst_pixel_type);
-------------------------------------------------------------------------------
-Provides basic context conversion functionality.
-A newly allocated context is returned.
+Provides basic context conversion functionality. A newly allocated context is
+returned.
-This fuction does no error distribution but only integer
-division/multiplication for each pixel channel.
+This fuction does no error distribution but only multiply or rounds the pixel
+values. If you need something better use Floyd Steinberg dithering instead.
http://repo.or.cz/w/gfxprim.git/commit/bd082cac18a091c462b65f1f2d9a0adacb9b…
commit bd082cac18a091c462b65f1f2d9a0adacb9b35fe
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 14:02:03 2012 +0200
doc: Fix a few typos in basic types.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index 0ef0930..b3328e9 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -54,7 +54,7 @@ successful match and conversion and false otherwise.
[source,c]
--------------------------------------------------------------------------------
-#include <GP_Color.h>
+#include <core/GP_Color.h>
/* or */
#include <GP.h>
@@ -75,7 +75,7 @@ returns true if color with such name was found.
[source,c]
--------------------------------------------------------------------------------
-#include <GP_Color.h>
+#include <core/GP_Color.h>
/* or */
#include <GP.h>
http://repo.or.cz/w/gfxprim.git/commit/115391b21612956d9ed1f541d9272001e15c…
commit 115391b21612956d9ed1f541d9272001e15c3c83
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 14:01:27 2012 +0200
doc: Fix a few typos in loaders.
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 4b9422c..409c940 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -19,6 +19,8 @@ Common Loader
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_Loaders.h>
+/* or */
#include <GP.h>
GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
@@ -36,6 +38,8 @@ are not supported yet.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_PNG.h>
+/* or */
#include <GP.h>
int GP_OpenPNG(const char *src_path, FILE **f);
@@ -51,6 +55,8 @@ This function is semi-internal, you should rather use functions listed below.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_PNG.h>
+/* or */
#include <GP.h>
GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback);
@@ -63,6 +69,8 @@ callback, in such case all memory is freed.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_PNG.h>
+/* or */
#include <GP.h>
GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback);
@@ -73,6 +81,8 @@ signature. Basically this combines both of the calls above.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_PNG.h>
+/* or */
#include <GP.h>
int GP_SavePNG(const char *dst_path, const GP_Context *src,
@@ -87,12 +97,14 @@ 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.
-JPG
-~~~
-The 'PNG' loading support is optionaly implemented by jpeg library.
+JPEG
+~~~~
+The 'JPEG' loading support is optionaly implemented by jpeg library.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_JPG.h>
+/* or */
#include <GP.h>
int GP_OpenJPG(const char *src_path, FILE **f);
@@ -109,6 +121,8 @@ file and the 'GP_ReadJPG()' reads the signature instead.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_JPG.h>
+/* or */
#include <GP.h>
GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback);
@@ -122,6 +136,8 @@ is set to ECANCELED.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_JPG.h>
+/* or */
#include <GP.h>
GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback);
@@ -132,6 +148,8 @@ signature. Basically this combines both of the calls above.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_JPG.h>
+/* or */
#include <GP.h>
int GP_SaveJPG(const char *dst_path, const GP_Context *src,
@@ -152,6 +170,8 @@ The 'GIF' format is supported optionaly by giflib library.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_GIF.h>
+/* or */
#include <GP.h>
int GP_OpenGIF(const char *src_path, void **f);
@@ -165,6 +185,8 @@ This function is semi-internal, you should rather use functions listed below.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_GIF.h>
+/* or */
#include <GP.h>
GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback);
@@ -179,6 +201,8 @@ Currently this function loads only first image from the gif container.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_GIF.h>
+/* or */
#include <GP.h>
GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback);
@@ -195,6 +219,8 @@ be fancy RGB compressions and RLE support.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_BMP.h>
+/* or */
#include <GP.h>
int GP_OpenBMP(const char *src_path, FILE **f,
@@ -209,6 +235,8 @@ This function is semi-internal, you should rather use functions listed below.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_BMP.h>
+/* or */
#include <GP.h>
GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback);
@@ -223,6 +251,8 @@ Currently this function loads only first image from the 'GIF' container.
[source,c]
-------------------------------------------------------------------------------
+#include <loaders/GP_BMP.h>
+/* or */
#include <GP.h>
GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback);
http://repo.or.cz/w/gfxprim.git/commit/473dac1a93ecc9a00bcbdc4c3fc1acd110af…
commit 473dac1a93ecc9a00bcbdc4c3fc1acd110afbd53
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 13:51:55 2012 +0200
doc: Update basic types docs.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index 8f7283c..0ef0930 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -1,63 +1,50 @@
Basic types
-----------
-Return Code
-~~~~~~~~~~~
+Coordinates and Size/Length
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Some gfxprim function returns one of following return codes (may be removed in
-future):
+Most of the drawing functions use typedefed 'GP_Coord' and 'GP_Size' integer
+types for parameters.
-[source,c]
---------------------------------------------------------------------------------
-typedef enum GP_RetCode {
- GP_ESUCCESS,
- GP_EINVAL,
- GP_ENOIMPL,
- GP_EUNPRECISE,
- GP_ENULLPTR, /* some argument was unexpectedly NULL */
- GP_EBACKENDLOST,
- GP_EBADCONTEXT, /* context contains invalid data */
- GP_EBADFILE, /* error in file, or bad file format */
- GP_ENOENT, /* no such file or another object */
- GP_ENOMEM, /* not enough memory */
- GP_EINTR, /* interrupted by a callback */
- GP_EMAX,
-} GP_RetCode;
---------------------------------------------------------------------------------
-
-Return codes could be translated into an error messages.
-
-[source,c]
---------------------------------------------------------------------------------
-const char *GP_RetCodeName(GP_RetCode code);
---------------------------------------------------------------------------------
+The 'GP_Coord' is signed integer which is used for coordinates and the
+'GP_Size' is unsigned integer type used for object size, length and so.
-Coord and Size
-~~~~~~~~~~~~~~
-For drawing API there are two integer types defined the 'GP_Coord' for
-coordinates and 'GP_Size' for size, length or so.
+Pixel
+~~~~~
-Color and pixel types
-~~~~~~~~~~~~~~~~~~~~~
+Pixel value in 'GFXprim' is an integer big enough to hold the actual pixel
+values. The default typedef for 'GP_Pixel' is set to 32 bit integer, which may
+be changed at compile time to support colors with more than 10 bits per
+channel. The 'GP_Pixel' is thus used as opaque value big enough to hold any
+supported pixel value.
-The color, in gfxprim is enumeration of symbolic color names while pixel is
-integer value or you may say color in format of the target bitmap.
+Color
+~~~~~
-Color could be converted into given pixel type which will result in integer
-value suitable for usage with drawing functions. The color could be also
-converted to color name (C string in English language) and C string may be
-matched against table of color names.
+The 'GP_Color', in gfxprim is enumeration of symbolic color names.
-As all drawing functions works with pixel rather than color the color must be
-converted before using function to draw a shape into a bitmap.
+Color could be converted for a given 'GP_PixelType' which will result into
+'GP_Pixel' value suitable for usage with drawing functions. The color could be
+also converted to color name (C string in English language) and C string may
+be matched against table of color names.
-The color is defined as follows:
+The 'GP_Color' enmum is defined as follows:
[source,c]
--------------------------------------------------------------------------------
typedef enum GP_Color {
GP_COL_INVALID = -1,
GP_COL_BLACK,
- ...
+ GP_COL_RED,
+ GP_COL_GREEN,
+ GP_COL_BLUE,
+ GP_COL_YELLOW,
+ GP_COL_BROWN,
+ GP_COL_ORANGE,
+ GP_COL_GRAY_DARK,
+ GP_COL_GRAY_LIGHT,
+ GP_COL_PURPLE,
+ GP_COL_WHITE,
GP_COL_MAX,
} GP_Color;
--------------------------------------------------------------------------------
@@ -68,6 +55,8 @@ successful match and conversion and false otherwise.
[source,c]
--------------------------------------------------------------------------------
#include <GP_Color.h>
+/* or */
+#include <GP.h>
GP_Pixel GP_ColorToPixel(GP_Color color, GP_PixelType pixel_type);
GP_Pixel GP_ColorToContextPixel(GP_Color color, GP_Context *context);
@@ -87,6 +76,8 @@ returns true if color with such name was found.
[source,c]
--------------------------------------------------------------------------------
#include <GP_Color.h>
+/* or */
+#include <GP.h>
void GP_ColorLoadPixels(GP_Pixel pixels[], GP_PixelType pixel_type);
void GP_ColorLoadContextPixels(GP_Pixel pixels[], GP_Context *context);
@@ -98,8 +89,8 @@ the GP_Color enum as 'pixels[GP_COL_BLACK]'.
Progress Callback
~~~~~~~~~~~~~~~~~
-Progress callback is a structure that stores user-defined callback function,
-pointer to store location of user data and percentage.
+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 could take some time to
complete and adds capability to track the operation progress as well as to
@@ -120,9 +111,7 @@ 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 the filter is aborted, all memory freed etc. and the
-function either returns 'NULL' if pointer is returned or 'GP_EINTR' in case
-filter returns 'GP_RetCode'.
+value is returned the filter is aborted, all memory freed etc.
The callback, if supported, is the last parameter of a function.
http://repo.or.cz/w/gfxprim.git/commit/268542916484c84a4b205bba09a9b700f353…
commit 268542916484c84a4b205bba09a9b700f3530b76
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 13:36:00 2012 +0200
doc: Updated general gfxprim description.
diff --git a/doc/general.txt b/doc/general.txt
index 5e6f356..c8b6262 100644
--- a/doc/general.txt
+++ b/doc/general.txt
@@ -1,43 +1,81 @@
General information
-------------------
-Gfxprim is simple 2D bitmap graphics library with emphasis on speed and
-correctness.
+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".
+
+The library also includes, fairly optimized, fixed-point image filters, namely
+various resampling algorithms used to resize images, low pass filters, etc...
Implemented features
~~~~~~~~~~~~~~~~~~~~
-* basic graphics primitives (with and without fill)
-** line, circle, ellipse, triangle, tetragon
-* text drawing
-** supports both proportional and non proportional fonts
-** basic font is compiled in the library
-** font rendering can be altered by style attributes
-** font can be loaded from or stored in file
-** convertor from bdf is on the way
-* various bitmap formats to draw on
-* SDL drawing backend
-* bitmaps and blitting
-** create, destroy bitmap
-** bitmap rotation (in order to speed up rotated blits)
-Work in progress
-~~~~~~~~~~~~~~~~
+Graphics Rendering
+^^^^^^^^^^^^^^^^^^
+* Basic Graphics Primitives (with and without fill)
+** PutPixel/GetPixel
+** Lines
+** Circles
+** Elipses
+** Polygon
+
+* 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 suppport 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)
+
+Bitmap Filters
+^^^^^^^^^^^^^^
+* Point filters
+** Brightness
+** Contrast
+** General Point filter
-* bitmaps and blitting
-** blit bitmaps (should respect rotation and pixel formats)
-** loading bitmaps from image files (jpg, png, bmp, pnm ...)
+* Linear filters
+** Specialized Gaussian blur
+** Separable Convolution
+** General Convolution
-* backends
-** finish frame-buffer backend (SDL does not work on most of my frame-buffers)
-** other than SDL X backend (SDL does support only one window)
-** some overall initialization routines
+* Arihtmetics 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
+
+Work in progress
+~~~~~~~~~~~~~~~~
-Advanced (and unimplemented) features
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Python bindings
+** basic support works now
+** could be combined with PyGTK for GUI drawing (experimental)
-* bitmaps
-** alpha channel
+* Anti Aliased drawing
+** Line and PutPixel are finished
-* gfx primitives
-** drawing with alpha channel
-** anti aliasing
+* Gamma correction and color profiles
http://repo.or.cz/w/gfxprim.git/commit/075f6abdea6c012df7201450896669431336…
commit 075f6abdea6c012df7201450896669431336b6eb
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 5 11:59:44 2012 +0200
doc: Update loaders docs.
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 7a752e8..4b9422c 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -1,92 +1,101 @@
Context loaders
---------------
This part of gfxprim library aims to create API to load/save images from/to
-common image fileformats.
+common image file formats.
+
+All loading functions returns a pointer to allocated and loaded image or upon
+a failure NULL is returned and errno is set.
+
+The possible errno values are:
+
+* anything returned by fopen(), fclose(), fseek(), ...
+* ENOSYS if library wasn't compiled with particual library support
+* ENOMEM as returned by malloc()
+* EIO/EILSEQ invalid image data
+* ECANCELED loading canceled from callback
Common Loader
~~~~~~~~~~~~~
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_LoadImage(const char *src_path, GP_Context **res,
- GP_ProgressCallback *callback);
+GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads image from a file. The image format is now recognized by the file
-filename extension. Format detection using file signature is planned.
-
-The loading process could be aborted by process callback.
+Loads image from a file. The format is now matched by an image file extension.
+File sinature loading method is on the TODO.
PNG
~~~
+The 'PNG' loading support is optionaly implemented by libpng.
-Just now, the 'PNG' support is not fully finished, the Alpha channel as well
-as palletes doesn't work well or at all, we are working on that.
+Just now, the 'PNG' support is not fully finished. Images with alpha channel
+are not supported yet.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_OpenPNG(const char *src, FILE **f);
+int GP_OpenPNG(const char *src_path, FILE **f);
-------------------------------------------------------------------------------
-Opens file and checks for 'PNG' signature upon successful return (file could
-be opened, signature matches), the opened file is returned and the file
+Opens file and checks for 'PNG' signature. Returns zero on success (file
+could be opened, signature matches), the opened file is returned and the file
possition points right after the end of the 'PNG' signature.
+Upon failure errno is filled.
+
This function is semi-internal, you should rather use functions listed below.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_ReadPNG(FILE *f, GP_Context **res,
- GP_ProgressCallback *callback);
+GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Loads 'PNG' file into context the file pointer must point to the start of the
'PNG' data stream (eg. should point right after the signature). The context,
to store the image to, is allocated. The loading process could by aborted by a
-callback, in such case all memory is freed and the call returns 'GP_EINTR'.
+callback, in such case all memory is freed.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_LoadPNG(const char *src_path, GP_Context **res,
- GP_ProgressCallback *callback);
+GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Same as abowe but takes path to the file as a parameter and check for the
-signature. Basically this combines both of the calls abowe.
+signature. Basically this combines both of the calls above.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_SavePNG(const char *dst_path, GP_Context *src,
- GP_ProgressCallback *callback);
+int GP_SavePNG(const char *dst_path, const GP_Context *src,
+ GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Writes a Context into a 'PNG' image. If aborted by a callback, the opened file
-is closed and removed before the call returns 'GP_EINTR'.
+is closed and removed before the call returns non-zero and errno is set to
+ECANCELED.
Currently only 'RGB888' format is supported, you should convert the GP_Context
-to 'RGB888' before calling this function otherwise 'GP_ENOIMPL' will be
-returned.
+to 'RGB888' before calling this function otherwise non-zero is returned and
+errno is set to ENOSYS.
JPG
~~~
-
-The 'JPG' format is supported for both 'G8' as well as 'RGB888' pixel formats.
+The 'PNG' loading support is optionaly implemented by jpeg library.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_OpenJPG(const char *src, FILE **f);
+int GP_OpenJPG(const char *src_path, FILE **f);
-------------------------------------------------------------------------------
Opens file and checks for 'JPG' signature upon successful return (file could
@@ -100,23 +109,22 @@ file and the 'GP_ReadJPG()' reads the signature instead.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_ReadJPG(FILE *f, GP_Context **res,
- GP_ProgressCallback *callback);
+GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Loads 'JPG' file into context the file pointer must point to the start of the
-'JPG' data stream (eg. should point right after the signature). The context, to
-store the image to, is allocated. The loading process could by aborted by a
-callback, in such case all memory is freed and the call returns 'GP_EINTR'.
+'JPG' data stream (eg. should point right after the signature). The context,
+to store the image to, is allocated. The loading process could by aborted by a
+callback, in such case all memory is freed and the call returns NULL and errno
+is set to ECANCELED.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_LoadJPG(const char *src_path, GP_Context **res,
- GP_ProgressCallback *callback);
+GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Same as abowe but takes path to the file as a parameter and check for the
@@ -124,96 +132,108 @@ signature. Basically this combines both of the calls above.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_SaveJPG(const char *dst_path, GP_Context *src,
- GP_ProgressCallback *callback);
+int GP_SaveJPG(const char *dst_path, const GP_Context *src,
+ GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
Writes a Context into a 'JPG' image. If aborted by a callback, the opened file
-is closed and removed before the call returns 'GP_EINTR'.
+is closed and removed before the call returns non-zero and errno is set to
+ECANCELED.
The 'JPG' format could store either 'G8' or 'RGB888' pixeltypes and you must
convert the context into one of them before this fucntions is called.
-'TODO:' add parameters to change the encoding settings.
-
-PBM
+GIF
~~~
-PBM -- portable bitmap file format.
+The 'GIF' format is supported optionaly by giflib library.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_LoadPBM(const char *src, GP_Context **res);
+int GP_OpenGIF(const char *src_path, void **f);
-------------------------------------------------------------------------------
-This function allocates and loads a 'GP_Context' with 'GP_PIXEL_G1' pixels. If
-the return code is not zero ('GP_ESUCCESS') an error during loading the bitmap
-happend.
+Opens file and checks for 'GIF' signature upon successful return (file could
+be opened, signature matches) zero is returned and gif handle f is set
+otherwise non-zero is returned and errno is set.
-The returned 'GP_Context' should be later freed with 'GP_ContextFree()'.
+This function is semi-internal, you should rather use functions listed below.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_SavePBM(const char *res, GP_Context *src);
+GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Save 'GP_Context' into PBM file. The 'GP_Context' pixel type must be
-'GP_PIXEL_G1', otherwise 'GP_ENOIMPL' error is returned.
+Loads 'GIF' file into context. The pointer must point to the 'GIF' handle as
+returned by 'GP_OpenGIF()' function. The context, to store the image to, is
+allocated. The loading process could by aborted by a callback, in such case
+all memory is freed and the call returns NULL and errno is set to ECANCELED.
-PGM
-~~~
-PBM -- portable graymap file format.
+Currently this function loads only first image from the gif container.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_LoadPGM(const char *src, GP_Context **res);
+GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-While the format allows to have any integer bit depth, only following color
-depths are supported:
-
-* GP_PIXEL_1G
-* GP_PIXEL_2G
-* GP_PIXEL_4G
-* GP_PIXEL_8G
+Same as abowe but takes path to the file as a parameter and check for the
+signature. Basically this combines both of the calls above.
-This function allocates and loads a 'GP_Context'. If the return code is not
-zero ('GP_ESUCCESS') an error during loading the bitmap happend.
+BMP
+~~~
-The returned 'GP_Context' should be later freed with 'GP_ContextFree()'.
+The 'BMP' loading support is nearly complete the only missing features should
+be fancy RGB compressions and RLE support.
[source,c]
-------------------------------------------------------------------------------
-#include <GP_Loaders.h>
+#include <GP.h>
-GP_RetCode GP_SavePGM(const char *res, GP_Context *src);
+int GP_OpenBMP(const char *src_path, FILE **f,
+ GP_Size *w, GP_Size *h, GP_PixelType *pixel_type);
-------------------------------------------------------------------------------
-Save 'GP_Context' into PGM file. The pixel type must be one of:
+Opens file and checks for 'BMP' signature upon successful return (file could
+be opened, signature matches) zero is returned and the parameters, if not
+NULL, are initalized. Upon failure non-zero is returned and errno is set.
-* GP_PIXEL_1G
-* GP_PIXEL_2G
-* GP_PIXEL_4G
-* GP_PIXEL_8G
+This function is semi-internal, you should rather use functions listed below.
-Otherwise 'GP_ENOIMPL' is returned.
+[source,c]
+-------------------------------------------------------------------------------
+#include <GP.h>
-PNM
-~~~
+GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
-To be implemented.
+Loads 'BMP' file into context. The FILE pointer must point to opened 'BMP'
+file. The context, to store the image to, is allocated. The loading process
+could by aborted by a callback, in such case all memory is freed and the call
+returns NULL and errno is set to ECANCELED.
-PPM
-~~~
+Currently this function loads only first image from the 'GIF' container.
-To be implemented.
+[source,c]
+-------------------------------------------------------------------------------
+#include <GP.h>
+
+GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Same as abowe but takes path to the file as a parameter and check for the
+signature. Basically this combines both of the calls above.
+
+PBM, PGM, PPM
+~~~~~~~~~~~~~
+There is a code do load and write PBM, PGM and PPM images too. However it's
+not finished and it's API is outdated. Use at your own risk.
-----------------------------------------------------------------------
Summary of changes:
doc/basic_types.txt | 91 +++++++++-----------
doc/context.txt | 86 +++++++++++++++-----
doc/general.txt | 100 +++++++++++++++-------
doc/loaders.txt | 230 +++++++++++++++++++++++++++++++--------------------
4 files changed, 315 insertions(+), 192 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: e77e1ccb700947ccd7286bf64c06d2d21d73c175
by metan 04 May '12
by metan 04 May '12
04 May '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 e77e1ccb700947ccd7286bf64c06d2d21d73c175 (commit)
from b02d3680c656b2274293750005a57cd3ff602631 (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/e77e1ccb700947ccd7286bf64c06d2d21d73…
commit e77e1ccb700947ccd7286bf64c06d2d21d73c175
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 4 18:09:52 2012 +0200
doc: Initial docs for backends.
diff --git a/doc/api.txt b/doc/api.txt
index 19142f6..c2fca5c 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -8,3 +8,4 @@ include::context.txt[]
include::drawing_api.txt[]
include::filters.txt[]
include::loaders.txt[]
+include::backends.txt[]
diff --git a/doc/backends.txt b/doc/backends.txt
new file mode 100644
index 0000000..f476b10
--- /dev/null
+++ b/doc/backends.txt
@@ -0,0 +1,130 @@
+Drawing Backends
+----------------
+
+Drawing backends provide means to draw into computer screen or into an window
+inside of running operating system. Instead of having one unified
+initalization interface each backend has it's specific function and sematics
+but once backend is initalized the backend structure provides unified API for
+controling the drawing.
+
+So far there are three backends implemented, linux mmaped framebuffer, libSDL
+and X11 backend.
+
+Initalization functions
+~~~~~~~~~~~~~~~~~~~~~~~
+
+[source,c]
+-------------------------------------------------------------------------------
+GP_Backend *GP_BackendLinuxFBInit(const char *path);
+-------------------------------------------------------------------------------
+
+Initalizes mmaped framebuffer backend. The path is path to the framebuffer
+device ie. '/dev/fbX'. This backend is not buffered, everything you draw
+appears on the screen right away (an swich may be added for that purpose).
+
+Also note that this backend doesn't initalize any input driver. You need to
+initalize input driver in order to get keystrokes and/or pointer events.
+
+
+[source,c]
+-------------------------------------------------------------------------------
+enum GP_BackendSDLFlags {
+ GP_SDL_FULLSCREEN = 0x01,
+ GP_SDL_RESIZABLE = 0x02,
+};
+
+GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h,
+ uint8_t bpp, uint8_t flags,
+ const char *caption);
+-------------------------------------------------------------------------------
+
+Initalize SDL as an backend driver. The backend is thread safe as all the
+operations are guarded by locks. You can't initalize more than one backend at a
+time, that is inherited SDL limiation. If you call the initalizaiton for a
+second time, you will get a pointer to allready running backend. This driver
+feeds input events into global input event queue (see input docs for details).
+If w, h and/or bpp are zero SDL tries to do a guess, most of the time wrong for
+w and h though. The caption is window caption and may be ignored for some of
+the backends. And finally flags may change the SDL to go to fullscreen mode or
+make the window resizeable.
+
+[source,c]
+-------------------------------------------------------------------------------
+GP_Backend *GP_BackendX11Init(const char *display, int x, int y,
+ unsigned int w, unsigned int h,
+ const char *caption);
+-------------------------------------------------------------------------------
+
+Returns pointer to backend. When display is NULL default display is used
+(which is what you want most of the time). This backend feeds key events into
+global input queue (pointer events not implemented yet). Note this is
+experimental version of X11 backend and will be changed to support more
+windows at a time.
+
+
+Overall init function
+~~~~~~~~~~~~~~~~~~~~~
+
+Althoug there is no unified backend initalization, there is something close to
+it.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <GP.h>
+
+GP_Backend *GP_BackendInit(const char *params, const char *caption, FILE *help);
+-------------------------------------------------------------------------------
+
+This function takes a params string as an parameter which is used for
+determining backend-dependend parametrs. The format is
+'backend_name:backend_parameters' where backend parameters may be size (either
+'WxH' or 'FS' in case of SDL backend). The caption is window caption (which is
+ignored in most of the cases) and the FILE is file, where an error is printed
+in case of failure, you should mostly use 'stderr' for that purpose. If params
+is set to NULL the the call only prints help into the passed help FILE. If
+intitalizaton was succesfull pointer to allocated and initalized backend is
+returned otherwise NULL is returned and some helpful infomation should be
+printed into the passed help FILE.
+
+
+Drawing Backend API
+~~~~~~~~~~~~~~~~~~~
+
+The drawing backend API consist of structure with callbacks. Every backend
+initalization yields pointer to this structure. Although is possible to call
+these pointers directly it's not recomended and everbody should rather use
+backend inline functions instead.
+
+The backend API consist of several functions:
+
+[source,c]
+-------------------------------------------------------------------------------
+void GP_BackendExit(GP_Backend *backend);
+-------------------------------------------------------------------------------
+
+Calls an backend exit callback.
+
+[source,c]
+-------------------------------------------------------------------------------
+GP_BackendFlip(GP_Backend *backend);
+-------------------------------------------------------------------------------
+
+Flips a screen. Updates rect for a buffered backends.
+
+[source,c]
+-------------------------------------------------------------------------------
+void GP_BackendUpdateRect(GP_Backend *backend,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1);
+-------------------------------------------------------------------------------
+
+Updates particular rectangle for a buffered backends.
+
+[source,c]
+-------------------------------------------------------------------------------
+void GP_BackendPoll(GP_Backend *backend);
+-------------------------------------------------------------------------------
+
+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 filedescriptor.
-----------------------------------------------------------------------
Summary of changes:
doc/api.txt | 1 +
doc/backends.txt | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 131 insertions(+), 0 deletions(-)
create mode 100644 doc/backends.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