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/7d47aaf60dd83f10d1478eb99ec10f29b6407...
commit 7d47aaf60dd83f10d1478eb99ec10f29b6407795 Author: Cyril Hrubis metan@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/22f1747c69692d0769e2c4bc6e288c95c517d...
commit 22f1747c69692d0769e2c4bc6e288c95c517d205 Author: Cyril Hrubis metan@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/5cb7ab4228726c1193cfa5378a2751608ee7b...
commit 5cb7ab4228726c1193cfa5378a2751608ee7b2ac Author: Cyril Hrubis metan@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/933fdbbd2f09c3ab6869dbbc6c30c698576eb...
commit 933fdbbd2f09c3ab6869dbbc6c30c698576eb3fd Author: Cyril Hrubis metan@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/4124b65e9f3c2ba8984e0727d13f955fc04ae...
commit 4124b65e9f3c2ba8984e0727d13f955fc04ae7e0 Author: Cyril Hrubis metan@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/db71e716da4792f972540c31b2d3d24aeede6...
commit db71e716da4792f972540c31b2d3d24aeede6825 Author: Cyril Hrubis metan@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@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@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@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.