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 d64232857f0895b73f637f3985442a2cda23da72 (commit)
from 7e9e270e7fb4be007cd4027fa7130ac079bc8fd2 (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/d64232857f0895b73f637f3985442a2cda23…
commit d64232857f0895b73f637f3985442a2cda23da72
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Mon May 7 18:21:52 2012 +0200
Added the "doc" target to the main Makefile.
diff --git a/post.mk b/post.mk
index bafd7fb..84ef703 100644
--- a/post.mk
+++ b/post.mk
@@ -5,7 +5,7 @@ ifndef SUBDIRS
SUBDIRS=
endif
-.PHONY: $(SUBDIRS) all clean rebuild help
+.PHONY: $(SUBDIRS) all clean rebuild help doc
all: $(SUBDIRS)
clean: $(SUBDIRS)
@@ -16,6 +16,8 @@ help:
@echo ""
@echo "help: prints this help"
@echo ""
+ @echo "doc: builds (only) the documentation"
+ @echo ""
@echo "clean: cleans current directory and all subdirectories"
@echo ""
@echo "all: make current directory and all subdirectories"
@@ -26,6 +28,9 @@ help:
@echo "'VERBOSE' shell variable as 'VERBOSE=1 make'"
@echo ""
+doc:
+ cd doc && make
+
#
# Determine mode (eg do not generate anything if not in compile mode
#
-----------------------------------------------------------------------
Summary of changes:
post.mk | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 7e9e270e7fb4be007cd4027fa7130ac079bc8fd2 (commit)
from 4224d32b5a4eddd8751d8fd7fbc02dab74df125f (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/7e9e270e7fb4be007cd4027fa7130ac079bc…
commit 7e9e270e7fb4be007cd4027fa7130ac079bc8fd2
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Mon May 7 17:54:10 2012 +0200
Added new color values to the docs.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index cab5435..f02688a 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -32,17 +32,24 @@ The 'GP_Color' enum is defined as follows:
--------------------------------------------------------------------------------
typedef enum GP_Color {
GP_COL_INVALID = -1,
+
+ /* full-intensity RGB and CMYK */
GP_COL_BLACK,
GP_COL_RED,
GP_COL_GREEN,
GP_COL_BLUE,
GP_COL_YELLOW,
+ GP_COL_CYAN,
+ GP_COL_MAGENTA,
+
+ /* various common mixes */
GP_COL_BROWN,
GP_COL_ORANGE,
- GP_COL_GRAY_DARK,
+ GP_COL_GRAY_DARK, /* exactly half RGB values of white */
GP_COL_GRAY_LIGHT,
GP_COL_PURPLE,
- GP_COL_WHITE,
+
+ GP_COL_WHITE, /* full-intensity white */
GP_COL_MAX,
} GP_Color;
--------------------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
doc/basic_types.txt | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 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.")
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.")
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.")