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 bcd8f5bd8906312aee47f6cbf16eba26f69ea1c3 (commit) via a6718e68a480bde3453228f2ac4579fbebd8ff03 (commit) via 7ac428d4c42068bf9e9344c23a4f38bc65f07bbe (commit) via 884dd7a3d80177fb248d869ef738f6aa07c0b03c (commit) via 2bf13c5f6bae8334f7be911f2754d8b3b620b8c5 (commit) via 271cd6a9b3d67f3590e2e70849cb862578a63378 (commit) from 5ec9bafb0205f6f1aebde21eebcb2719bbee9074 (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/bcd8f5bd8906312aee47f6cbf16eba26f69ea...
commit bcd8f5bd8906312aee47f6cbf16eba26f69ea1c3 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jul 20 23:28:46 2013 +0200
container: ZIP: Add support for loading PNG.
We need to add more general loaders here, but that is not possible without small changed in general loaders structure, so add a bit hacky support for PNG for now.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_ZIP.c b/libs/loaders/GP_ZIP.c index 4874c7c..c9064b8 100644 --- a/libs/loaders/GP_ZIP.c +++ b/libs/loaders/GP_ZIP.c @@ -344,14 +344,24 @@ static GP_Context *zip_next_file(FILE *f, GP_ProgressCallback *callback) goto out;
ret = GP_ReadJPG(f, callback); + goto out; break; case COMPRESS_DEFLATE: if (read_deflate(f, &header, &fres)) goto out;
+ ret = GP_ReadJPG(fres, callback); - err = errno; + + if (!ret) { + rewind(fres); + ret = GP_ReadPNG(fres, callback); + } + + if (!ret) + err = errno; + fclose(fres); goto out; break;
http://repo.or.cz/w/gfxprim.git/commit/a6718e68a480bde3453228f2ac4579fbebd8f...
commit a6718e68a480bde3453228f2ac4579fbebd8ff03 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jul 20 23:26:56 2013 +0200
loaders: PNG: Change the ReadPNG() and OpenPNG
The ReadPNG() now expects the PNG header too and the OpenPNG() does rewind the file after the signature is checked.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c index 47a4d6a..9e7ce53 100644 --- a/libs/loaders/GP_PNG.c +++ b/libs/loaders/GP_PNG.c @@ -78,6 +78,8 @@ int GP_OpenPNG(const char *src_path, FILE **f)
GP_DEBUG(1, "Found PNG signature in '%s'", src_path);
+ rewind(*f); + return 0; err2: fclose(*f); @@ -133,7 +135,7 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) }
png_init_io(png, f); - png_set_sig_bytes(png, 8); + png_set_sig_bytes(png, 0); png_read_info(png, png_info);
png_get_IHDR(png, png_info, &w, &h, &depth,
http://repo.or.cz/w/gfxprim.git/commit/7ac428d4c42068bf9e9344c23a4f38bc65f07...
commit 7ac428d4c42068bf9e9344c23a4f38bc65f07bbe Author: Cyril Hrubis metan@ucw.cz Date: Sat Jul 20 17:36:20 2013 +0200
doc: loaders_python: Update.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/loaders_python.txt b/doc/loaders_python.txt index 8fa511a..de37a29 100644 --- a/doc/loaders_python.txt +++ b/doc/loaders_python.txt @@ -12,6 +12,16 @@ import gfxprim.loaders as loaders
img = loaders.Load(path, callback=None)
+ img = loaders.LoadBMP(path, callback=None) + img = loaders.LoadGIF(path, callback=None) + img = loaders.LoadJPG(path, callback=None) + img = loaders.LoadPBM(path, callback=None) + img = loaders.LoadPGM(path, callback=None) + img = loaders.LoadPNG(path, callback=None) + img = loaders.LoadPNM(path, callback=None) + img = loaders.LoadPPM(path, callback=None) + img = loaders.LoadPSP(path, callback=None) + img = loaders.LoadTIFF(path, callback=None) -------------------------------------------------------------------------------
Loads an image from a file. @@ -40,11 +50,14 @@ import gfxprim.loaders as loaders
img.loaders.Save(path, callback=None)
- img.loaders.SavePNG(path, callback=None) - - img.loaders.SaveJPG(path, callback=None) - img.loaders.SaveBMP(path, callback=None) + img.loaders.SaveJPG(path, callback=None) + img.loaders.SavePBM(path, callback=None) + img.loaders.SavePGM(path, callback=None) + img.loaders.SavePNG(path, callback=None) + img.loaders.SavePNM(path, callback=None) + img.loaders.SavePPM(path, callback=None) + img.loaders.SaveTIFF(path, callback=None) -------------------------------------------------------------------------------
Save image to a file. @@ -57,7 +70,7 @@ May raise 'OSError' with errno set to 'EPERM', 'EISDIR', 'ENOENT' or any other May raise 'OSError' with errno set to 'ENOSYS' on unsupported pixel type for a given format.
-May raise 'OSError' with errno set to 'EIO' when file is damaged. +May raise 'OSError' with errno set to 'EIO' when filesystem is full.
May raise 'OSError' with errno set to 'ECANCELED' when action was interrupted by callback.
http://repo.or.cz/w/gfxprim.git/commit/884dd7a3d80177fb248d869ef738f6aa07c0b...
commit 884dd7a3d80177fb248d869ef738f6aa07c0b03c Author: Cyril Hrubis metan@ucw.cz Date: Sat Jul 20 17:28:27 2013 +0200
pywrap: loaders: Add a new methods.
* Add error checking for TIFF Load and Save methods.
* Add new Save methods into the loaders submodule.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py index a9878fa..d1a63a6 100644 --- a/pylib/gfxprim/loaders/__init__.py +++ b/pylib/gfxprim/loaders/__init__.py @@ -24,7 +24,7 @@ def _init(module): Generally, not all pixel types work with all formats. """ c_loaders.GP_SaveImage(self.ctx, filename, callback) - + @extend(LoadersSubmodule) def SavePNG(self, filename, callback=None): """Save the image as PNG. @@ -32,7 +32,7 @@ def _init(module): Generally, not all pixel types work with all formats. """ c_loaders.GP_SavePNG(self.ctx, filename, callback) - + @extend(LoadersSubmodule) def SaveJPG(self, filename, callback=None): """Save the image as JPEG. @@ -40,7 +40,7 @@ def _init(module): Generally, not all pixel types work with all formats. """ c_loaders.GP_SaveJPG(self.ctx, filename, callback) - + @extend(LoadersSubmodule) def SaveBMP(self, filename, callback=None): """Save the image as BMP. @@ -49,6 +49,46 @@ def _init(module): """ c_loaders.GP_SaveBMP(self.ctx, filename, callback)
+ @extend(LoadersSubmodule) + def SavePBM(self, filename, callback=None): + """Save the image as PBM. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SavePBM(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SavePGM(self, filename, callback=None): + """Save the image as PGM. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SavePGM(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SavePPM(self, filename, callback=None): + """Save the image as PPM. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SavePPM(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SavePNM(self, filename, callback=None): + """Save the image as PNM. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SavePNM(self.ctx, filename, callback) + + @extend(LoadersSubmodule) + def SaveTIFF(self, filename, callback=None): + """Save the image as TIFF. + + Generally, not all pixel types work with all formats. + """ + c_loaders.GP_SaveTIFF(self.ctx, filename, callback) + # Imports from the SWIG module import re def strip_GP(s): diff --git a/pylib/gfxprim/loaders/loaders.i b/pylib/gfxprim/loaders/loaders.i index e651a1c..66bd1e8 100644 --- a/pylib/gfxprim/loaders/loaders.i +++ b/pylib/gfxprim/loaders/loaders.i @@ -65,4 +65,22 @@ ERROR_ON_NONZERO(GP_SavePGM); ERROR_ON_NONZERO(GP_SavePPM); ERROR_ON_NONZERO(GP_SavePNM);
+%newobject GP_LoadPBM; +%newobject GP_LoadPGM; +%newobject GP_LoadPPM; +%newobject GP_LoadPNM; + %include "GP_PNM.h" + +ERROR_ON_NULL(GP_LoadTIFF); +ERROR_ON_NONZERO(GP_SaveTIFF); + +%newobject GP_LoadTIFF; + +%include "GP_TIFF.h" + +ERROR_ON_NULL(GP_LoadPSP); + +%newobject GP_LoadPSP; + +%include "GP_PSP.h"
http://repo.or.cz/w/gfxprim.git/commit/2bf13c5f6bae8334f7be911f2754d8b3b620b...
commit 2bf13c5f6bae8334f7be911f2754d8b3b620b8c5 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jul 20 17:14:51 2013 +0200
doc: Update general information.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/general.txt b/doc/general.txt index 23de40d..4179408 100644 --- a/doc/general.txt +++ b/doc/general.txt @@ -5,7 +5,7 @@ Gfxprim is simple modular 2D bitmap graphics library with emphasis on speed and correctness.
One of the key points of the library is meta-programming. Most of the -operations and filters are wriiten in http://jinja.pocoo.org/%5BJinja] +operations and filters are written in http://jinja.pocoo.org/%5BJinja] templating language that is used to generate specialized code in C programmming language. Creating code that works with less usuall pixel types should be as easy as adding pixel definition into the configuration and @@ -22,9 +22,9 @@ that represents in-memory pixmap.
The Core also contains generated code for basic operations such as link:get_put_pixel.html[GetPixel] and link:get_put_pixel.html[PutPixel] and -optimized code for writing continous line of pixels 'GP_WritePixels' that are -base for the more complex drawing primitives in GFX or for graphics operations -in Filters. +optimized functions for writing continous line of pixels 'GP_WritePixels' that +are base for the more complex drawing primitives in GFX or for graphics +operations in Filters.
link:blits.html[Blits] are functions used to copy part of one bitmap into another bitmap. The blits be also used for primitive bitmap pixel type @@ -65,49 +65,48 @@ Loaders -------
link:loaders.html[Loaders] are part that is resposible for loading and saving -images into various standard formats (PNG, JPEG, GIF, BMP, PNM, etc...). +images into various standard formats (PNG, JPEG, GIF, TIFF, BMP, PNM, etc...).
.Currently supported formats [width="100%",options="header"] |============================================================================= -| Extension | Format Name | Signature | Read Support | Write Support +| Extension | Format Name | Read Support | Write Support
-| JPEG | | [green]*Yes* | [green]*Yes* | [green]*Yes* +| JPEG | | [green]*Yes* | [green]*Yes*
| PNG | Portable Network Graphics | - [green]*Yes* | [green]#16 Bit RGB not supported# | [green]#16 Bit RGB not supported#
| GIF | Graphics Interchange Format | [green]*Yes* | - [green]*Yes* | [black]*No*
| BMP | | - [green]*Yes* | [green]#RLE4 and some less common bitfiels not supported# | [green]#RGB888 only#
| TIFF | Tagged Image File Format | - [green]*Yes* | - [gray]#Not finished# | - [black]*No* + [green]#Most of the Palette, RGB and Grayscale works (no tiles yet)# | + [green]#RGB888 and Grayscale#
| PSP | Paint Shop Pro Image | - [green]*Yes* | [green]#Composite image only for newer formats than 3.0# | [black]*No*
| PBM PGM PNM | Netpbm portable bitmap | - [black]*No* | - [gray]#Not finished# | - [gray]#Not finished# + [green]#All but < 8bit binary grayscale# | + [green]#All ASCII formats# + +| CBZ | + Comic book archive | + [green]#Experimental support via ZIP Container# | + [black]*No*
|=============================================================================
@@ -200,14 +199,20 @@ drawing on screen (or into a window) and for getting keystrokes/mouse coordinates. So far we support X11, linux framebuffer and SDL as a graphics backend.
+There is also a virtual backend used for testing that allows you to create a +backend of any pixel type on the top of other backends. + +Python bindings +--------------- + +Python bindings currently covers most of the library, there is (not yet +finished) documentation for link:core_python.html[Core], +link:gfx_python.html[Gfx], link:loaders_python.html[Loaders] and +link:backends_python.html[Backends].
Work in progress ----------------
-* Python bindings - * Anti Aliased drawing
* Gamma correction and color profiles - -* Alfa channel blits diff --git a/doc/input.txt b/doc/input.txt index aa69595..08b0816 100644 --- a/doc/input.txt +++ b/doc/input.txt @@ -165,7 +165,7 @@ image::keyboard.svg["Keyboard Layout",width=800,link="keyboard.svg"] * The system event is used with 'GP_EV_SYS_RESIZE' and informs you of the new window size.
-* The value of timer event is simply pointer to the expired timer. +* The value of timer event is simply pointer to the expired link:#Timers[Timer].
The 'dev_id' is not used at the moment and may be removed.
http://repo.or.cz/w/gfxprim.git/commit/271cd6a9b3d67f3590e2e70849cb862578a63...
commit 271cd6a9b3d67f3590e2e70849cb862578a63378 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jul 20 16:37:28 2013 +0200
examples, doc: Add backend timers example.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index 3ed296b..c32d873 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -19,7 +19,7 @@ APPS=backend_example loaders_example loaders filters_symmetry gfx_koch input_example fileview linetest randomshapetest fonttest loaders_register blittest textaligntest abort sin_AA x11_windows debug_handler gaussian_noise byte_utils version pretty_print timers- zip_container + zip_container backend_timers_example
ifeq ($(HAVE_LIBSDL),yes) APPS+=SDL_glue @@ -29,6 +29,7 @@ endif
showimage: LDLIBS+=$(LDLIBS_BACKENDS) $(LDLIBS_LOADERS) backend_example: LDLIBS+=$(LDLIBS_BACKENDS) +backend_timers_example: LDLIBS+=$(LDLIBS_BACKENDS) virtual_backend_example: LDLIBS+=$(LDLIBS_BACKENDS) loaders_example: LDLIBS+=$(LDLIBS_LOADERS) loaders: LDLIBS+=$(LDLIBS_LOADERS) diff --git a/demos/c_simple/backend_timers_example.c b/demos/c_simple/backend_timers_example.c new file mode 100644 index 0000000..e31075c --- /dev/null +++ b/demos/c_simple/backend_timers_example.c @@ -0,0 +1,117 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + + /* + + Simple backend timers example. + + */ + +#include <GP.h> + +static void redraw(GP_Backend *self) +{ + GP_Context *context = self->context; + GP_Pixel black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context); + + GP_Fill(context, black_pixel); + + /* Update the backend screen */ + GP_BackendFlip(self); +} + +static uint32_t timer_callback(GP_Timer *self) +{ + uint32_t next = random() % 10000; + + printf("Timer %s callback called, rescheduling after %u.n", + self->id, (unsigned) next); + + return next; +} + +int main(void) +{ + GP_Backend *backend; + const char *backend_opts = "X11:100x100"; + + backend = GP_BackendInit(backend_opts, "Backend Timers Example", stderr); + + if (backend == NULL) { + fprintf(stderr, "Failed to initialize backendn"); + return 1; + } + + redraw(backend); + + /* + * Periodic timer with 1000ms interval. As the callback is set to NULL + * Timer Event is pushed to event queue upon expiration. + */ + GP_TIMER_DECLARE(timer1, 0, 1000, "Timer 1", NULL, NULL); + + /* + * Timer with a callback, this timer gets scheduled depending on ouput + * from callback (0 means disable timer). + */ + GP_TIMER_DECLARE(timer2, 5000, 0, "Timer 2", timer_callback, NULL); + + GP_BackendAddTimer(backend, &timer1); + GP_BackendAddTimer(backend, &timer2); + + /* Handle events */ + for (;;) { + GP_Event ev; + + GP_BackendWaitEvent(backend, &ev); + + GP_EventDump(&ev); + + switch (ev.type) { + case GP_EV_KEY: + switch (ev.val.val) { + case GP_KEY_ESC: + case GP_KEY_Q: + GP_BackendExit(backend); + return 0; + break; + } + break; + case GP_EV_SYS: + switch (ev.code) { + case GP_EV_SYS_RESIZE: + GP_BackendResizeAck(backend); + redraw(backend); + break; + case GP_EV_SYS_QUIT: + GP_BackendExit(backend); + return 0; + break; + } + break; + } + } + + GP_BackendExit(backend); + + return 0; +} diff --git a/doc/backends.txt b/doc/backends.txt index 7130b29..a57a7ad 100644 --- a/doc/backends.txt +++ b/doc/backends.txt @@ -47,7 +47,7 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, const char *caption); -------------------------------------------------------------------------------
-Initialize 'SDL' as an backend driver. The backend is thread safe as all the +Initialize 'SDL' as a backend driver. The backend is thread safe as all the operations are guarded by locks.
You can't initialize more than one backend at a time, which is inherited 'SDL' @@ -236,7 +236,7 @@ GP_BackendExit void GP_BackendExit(GP_Backend *backend); -------------------------------------------------------------------------------
-Calls an backend exit callback. Restores the display, keyboard, etc. state +Calls a backend exit callback. Restores the display, keyboard, etc. state back.
WARNING: It's important to call this functions on application exit. If you @@ -424,6 +424,9 @@ backend 'Poll' or 'Wait' functions. If timer callback is set to 'NULL' a timer event is pushed to the backend input queue once timer has expired otherwise timer callback is called.
+TIP: For example usage see backend timers + link:example_backend_timers.html[example]. + GP_BackendTimersInQueue ^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/example_backend_timers.txt b/doc/example_backend_timers.txt new file mode 100644 index 0000000..e9d479f --- /dev/null +++ b/doc/example_backend_timers.txt @@ -0,0 +1,7 @@ +Backend Timers Example +---------------------- + +[source,c] +------------------------------------------------------------------ +include::../demos/c_simple/backend_timers_example.c[] +------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/Makefile | 3 +- ...{backend_example.c => backend_timers_example.c} | 57 ++++++++++---------- doc/backends.txt | 7 ++- ...xample_input.txt => example_backend_timers.txt} | 6 +- doc/general.txt | 47 +++++++++------- doc/input.txt | 2 +- doc/loaders_python.txt | 23 ++++++-- libs/loaders/GP_PNG.c | 4 +- libs/loaders/GP_ZIP.c | 12 ++++- pylib/gfxprim/loaders/__init__.py | 46 +++++++++++++++- pylib/gfxprim/loaders/loaders.i | 18 ++++++ 11 files changed, 159 insertions(+), 66 deletions(-) copy demos/c_simple/{backend_example.c => backend_timers_example.c} (74%) copy doc/{example_input.txt => example_backend_timers.txt} (59%)
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.