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 c0d173dc45cf696113927b923decf2d1e140cace (commit) from ce9e4793af70584532932e14d4adec6c38eefc4d (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/c0d173dc45cf696113927b923decf2d1e140c...
commit c0d173dc45cf696113927b923decf2d1e140cace Author: Cyril Hrubis metan@ucw.cz Date: Mon Jun 18 14:27:37 2012 +0200
examples: Add simple showimage example.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index 44926f8..6e3b7d7 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -6,7 +6,7 @@ INCLUDE= LDLIBS+=-lGP -lGP_backends -lSDL -L$(TOPDIR)/build/
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch- virtual_backend_example meta_data meta_data_dump tmp_file + virtual_backend_example meta_data meta_data_dump tmp_file showimage
include $(TOPDIR)/pre.mk include $(TOPDIR)/app.mk diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c new file mode 100644 index 0000000..9abbb6d --- /dev/null +++ b/demos/c_simple/showimage.c @@ -0,0 +1,83 @@ +/***************************************************************************** + * 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 example that shows X11 window with image. + + */ + +#include <stdio.h> +#include <errno.h> +#include <string.h> + +#include "GP.h" +#include "backends/GP_X11.h" + +int main(int argc, char *argv[]) +{ + GP_Backend *backend; + GP_Context *image; + + GP_SetDebugLevel(10); + + if (argc != 2) { + fprintf(stderr, "Takes image as an argumentn"); + return 1; + } + + /* Load image */ + image = GP_LoadImage(argv[1], NULL); + + if (image == NULL) { + fprintf(stderr, "Failed to load bitmap: %sn", strerror(errno)); + return 1; + } + + /* Initalize backend */ + backend = GP_BackendX11Init(NULL, 0, 0, image->w, image->h, argv[1], 0); + + if (backend == NULL) { + fprintf(stderr, "Failed to initalize backendn"); + return 1; + } + + /* Blit image into the window and show it */ + GP_Blit(image, 0, 0, image->w, image->h, backend->context, 0, 0); + GP_BackendFlip(backend); + + /* Wait for events */ + for (;;) { + GP_BackendWait(backend); + + GP_Event ev; + + while (GP_EventGet(&ev)) { + if (ev.type == GP_EV_KEY && ev.val.val == GP_KEY_Q) { + GP_BackendExit(backend); + return 0; + } + } + } + + return 0; +} diff --git a/doc/examples.txt b/doc/examples.txt index ec356e2..cbd4cf5 100644 --- a/doc/examples.txt +++ b/doc/examples.txt @@ -94,6 +94,11 @@ Example in C include::../demos/c_simple/backend_example.c[] ------------------------------------------------------------------
+[source,c] +------------------------------------------------------------------ +include::../demos/c_simple/showimage.c[] +------------------------------------------------------------------ + GFXprim + PyGTK ---------------
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/Makefile | 2 +- demos/c_simple/{loaders_example.c => showimage.c} | 56 ++++++++++++++------ doc/examples.txt | 5 ++ 3 files changed, 45 insertions(+), 18 deletions(-) copy demos/c_simple/{loaders_example.c => showimage.c} (67%)
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.