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 85eda14c378b6a2acce26d19fa7073ac509ee386 (commit)
from 14374d9981a9e1c76d6f83287ca3d71612c8d659 (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/85eda14c378b6a2acce26d19fa7073ac509e…
commit 85eda14c378b6a2acce26d19fa7073ac509ee386
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Mar 29 11:59:58 2013 +0100
backeds: Make use of GP_FATAL().
Use GP_FATAL() when backend in not compiled in.
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c
index c54bc19..2312564 100644
--- a/libs/backends/GP_SDL.c
+++ b/libs/backends/GP_SDL.c
@@ -251,7 +251,7 @@ GP_Backend *GP_BackendSDLInit(GP_Size w __attribute__((unused)),
uint8_t flags __attribute__((unused)),
const char *caption __attribute__((unused)))
{
- GP_WARN("SDL support not compiled in.");
+ GP_FATAL("SDL support not compiled in.");
return NULL;
}
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c
index 59b28ae..c81f0dd 100644
--- a/libs/backends/GP_X11.c
+++ b/libs/backends/GP_X11.c
@@ -609,7 +609,7 @@ GP_Backend *GP_BackendX11Init(const char *GP_UNUSED(display),
unsigned int GP_UNUSED(h),
const char *GP_UNUSED(caption))
{
- GP_WARN("FATAL: X11 support not compiled in");
+ GP_FATAL("X11 support not compiled in");
return NULL;
}
-----------------------------------------------------------------------
Summary of changes:
libs/backends/GP_SDL.c | 2 +-
libs/backends/GP_X11.c | 2 +-
2 files changed, 2 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 14374d9981a9e1c76d6f83287ca3d71612c8d659 (commit)
via 58de8652bc7329e9307ddca14ea8e28775d328ec (commit)
from 1c86bf51648b295323c49f14f63c14fee0f33dcf (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/14374d9981a9e1c76d6f83287ca3d71612c8…
commit 14374d9981a9e1c76d6f83287ca3d71612c8d659
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Mar 23 20:21:56 2013 +0100
doc: Update X11 backend docs.
diff --git a/doc/backends.txt b/doc/backends.txt
index 8cfb010..2d1398a 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -118,7 +118,12 @@ time).
This backend feeds key events into global input queue.
-TODO: X11 backend will be changed to support more windows at a time.
+This backends supports multiple windows. Each time you call the initialization
+rutine new backend structure is returned. All backend instances share the xlib
+connection so you need to wait or poll only on one of them. Each backend, on
+the other hand, has its own input queue.
+
+TIP: See mutliple windows link:example_x11_windows.html[example].
[source,c]
-------------------------------------------------------------------------------
diff --git a/doc/example_x11_windows.txt b/doc/example_x11_windows.txt
new file mode 100644
index 0000000..4e4bb31
--- /dev/null
+++ b/doc/example_x11_windows.txt
@@ -0,0 +1,8 @@
+Graphics Backend Example
+------------------------
+.An example how to create and manage two windows using the X11 backend
+
+[source,c]
+------------------------------------------------------------------
+include::../demos/c_simple/x11_windows.c[]
+------------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/58de8652bc7329e9307ddca14ea8e28775d3…
commit 58de8652bc7329e9307ddca14ea8e28775d328ec
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Mar 23 20:06:37 2013 +0100
doc: pywrap: Starts python loaders docs.
diff --git a/doc/Makefile b/doc/Makefile
index 4537bf9..840ea66 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -5,7 +5,7 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt get_put_pixel.txt blits.txt progress_callback.txt text_api.txt event_queue.txt
-SOURCES+=core_python.txt gfx_python.txt
+SOURCES+=core_python.txt gfx_python.txt loaders_python.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index 8ce8d85..af20f91 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -60,6 +60,7 @@ endif::disable-javascript[]
<ul>
<li><a href="core_python.html">Core</a></li>
<li><a href="gfx_python.html">Gfx</a></li>
+ <li><a href="loaders_python.html">Loaders</a></li>
</ul>
</div>
diff --git a/doc/loaders_python.txt b/doc/loaders_python.txt
new file mode 100644
index 0000000..4ac158b
--- /dev/null
+++ b/doc/loaders_python.txt
@@ -0,0 +1,28 @@
+Python Loaders module
+---------------------
+
+The python binding maps mostly to the C API with the 'GP_' prefix stripped.
+
+Loaders adds support for loading and storing contexts into/from various image
+fomats.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.loaders as loaders
+
+ img = loaders.Load(path, callback=None)
+
+-------------------------------------------------------------------------------
+
+Loads an image from a file.
+
+May raise 'OSError' with errno set to 'EPERM', 'EISDIR', 'ENOENT' or any other
+'errno' set by 'open(2)', 'read(2)', 'seek(2)'.
+
+May raise 'OSError' with errno set to 'ENOSYS' on unsupported or not recognized
+format.
+
+May raise 'OSError' with errno set to 'EIO' when file is damaged.
+
+May raise 'OSError' with errno set to 'ECANCELED' when action was interrupted
+by callback.
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +-
doc/asciidoc.conf | 1 +
doc/backends.txt | 7 ++++-
...ogress_callback.txt => example_x11_windows.txt} | 3 +-
doc/loaders_python.txt | 28 ++++++++++++++++++++
5 files changed, 38 insertions(+), 3 deletions(-)
copy doc/{example_loaders_progress_callback.txt => example_x11_windows.txt} (63%)
create mode 100644 doc/loaders_python.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.")
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 1c86bf51648b295323c49f14f63c14fee0f33dcf (commit)
from eef84fa42d26341f4dd66b35672957fa35e23b8e (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/1c86bf51648b295323c49f14f63c14fee0f3…
commit 1c86bf51648b295323c49f14f63c14fee0f33dcf
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Mar 23 19:49:13 2013 +0100
doc: pywrap: Finish gfx docs.
diff --git a/doc/gfx_python.txt b/doc/gfx_python.txt
index 3644358..941b1f8 100644
--- a/doc/gfx_python.txt
+++ b/doc/gfx_python.txt
@@ -21,15 +21,8 @@ WARNING: Drawing functions takes strictly integer coordinates, make sure that
all divisions are integer divisions (i.e. use // instead of /) to
ensure portability with Python 3.X.
-[source,python]
--------------------------------------------------------------------------------
-import gfxprim.gfx as gfx
-
- context.gfx.Fill(pixel)
-
--------------------------------------------------------------------------------
-
-Fills context with particualr 'pixel' value.
+Line Based Primitives
+^^^^^^^^^^^^^^^^^^^^^
[source,python]
-------------------------------------------------------------------------------
@@ -105,5 +98,120 @@ import gfxprim.gfx as gfx
Draws a polygon defined by points, points can be either flat list of 2N
integers or list of N tuples.
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.Circle(x, y, r, pixel)
+
+-------------------------------------------------------------------------------
+
+Draws a circle.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.Ellipse(x, y, a, b, pixel)
+
+-------------------------------------------------------------------------------
+
+Draws an ellipse.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.Ring(x, y, r1, r2, pixel)
+
+-------------------------------------------------------------------------------
+
+Draws a ring.
+
+Filled Primitives
+^^^^^^^^^^^^^^^^^
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.Fill(pixel)
+
+-------------------------------------------------------------------------------
+
+Fills context with particular 'pixel' value.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillRect(x0, y0, x1, y1, pixel)
+
+-------------------------------------------------------------------------------
+
+Fills a rectangle defined by two points.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillTriangle(x0, y0, x1, y1, x1, y2, pixel)
+
+-------------------------------------------------------------------------------
+
+Draws a filled triangle defined by three points.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillTetragon(x0, y0, x1, y1, x1, y2, x3, y3, pixel)
+
+-------------------------------------------------------------------------------
+
+Draws a filled tetragon defined by four points.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillPolygon([x0, y0, x1, y1, ...], pixel)
+
+ context.gfx.FillPolygon([(x0, y0), (x1, y1), ...], pixel)
+
+-------------------------------------------------------------------------------
+
+Fills a polygon defined by points, points can be either flat list of 2N
+integers or list of N tuples.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillCircle(x, y, r, pixel)
+
+-------------------------------------------------------------------------------
+
+Fills a circle.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillEllipse(x, y, a, b, pixel)
+
+-------------------------------------------------------------------------------
+
+Fills an ellipse.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.FillRing(x, y, r1, r2, pixel)
+
+-------------------------------------------------------------------------------
+
+Fills a ring, i.e. area enclosed between two circles.
TIP: See gfx module link:example_py_gfx.html[example].
-----------------------------------------------------------------------
Summary of changes:
doc/gfx_python.txt | 126 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 117 insertions(+), 9 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 93aea6a4e0d920f60743fdb89fa102595d6b0d76 (commit)
via c5d16d66f47d38078fefc539ed8d2b478ecb5039 (commit)
from 0489beeb9e8eb9c66e5700a6d998003440219087 (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/93aea6a4e0d920f60743fdb89fa102595d6b…
commit 93aea6a4e0d920f60743fdb89fa102595d6b0d76
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Mar 23 13:47:28 2013 +0100
doc: pywrap: Start gfx documentation.
diff --git a/doc/Makefile b/doc/Makefile
index cb892bf..4537bf9 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -5,7 +5,7 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt get_put_pixel.txt blits.txt progress_callback.txt text_api.txt event_queue.txt
-SOURCES+=core_python.txt
+SOURCES+=core_python.txt gfx_python.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index 72418b7..8ce8d85 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -59,6 +59,7 @@ endif::disable-javascript[]
<h4>Python bindings</h4>
<ul>
<li><a href="core_python.html">Core</a></li>
+ <li><a href="gfx_python.html">Gfx</a></li>
</ul>
</div>
diff --git a/doc/core_python.txt b/doc/core_python.txt
index fe295cb..3e7256f 100644
--- a/doc/core_python.txt
+++ b/doc/core_python.txt
@@ -95,6 +95,7 @@ Blit is clipped.
TIP: See link:example_py_showimage.html[example] Blit usage.
+[[Colors_and_Pixels]]
Colors and Pixels
~~~~~~~~~~~~~~~~~
diff --git a/doc/gfx_python.txt b/doc/gfx_python.txt
new file mode 100644
index 0000000..28f8899
--- /dev/null
+++ b/doc/gfx_python.txt
@@ -0,0 +1,48 @@
+Python GFX module
+-----------------
+
+The python binding maps mostly to the C API with the 'GP_' prefix stripped.
+
+The gfx module adds methods to the gfx context submodule.
+
+NOTE: You may want to see the link:coordinate_system.html[coordinate system]
+ first.
+
+Drawing functions
+~~~~~~~~~~~~~~~~~
+
+All drawing functions takes a 'pixel' value (to describe color) which
+link:core_python.html#Colors_and_Pixels[can be obtained], for a particular
+pixel type (context), from a RGB triplet.
+
+All drawing functions are clipped. Drawing outside of a context is no-op.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.Fill(pixel)
+
+-------------------------------------------------------------------------------
+
+Fills context with particualr 'pixel' value.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.HLine(x0, x1, y, pixel)
+-------------------------------------------------------------------------------
+
+Draws a horizontal line from 'x0' to 'x1' at 'y'.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.gfx as gfx
+
+ context.gfx.VLine(x, y0, y1, pixel)
+-------------------------------------------------------------------------------
+
+Draws a vertical line from 'y0' to 'y1' at 'x'.
+
+
http://repo.or.cz/w/gfxprim.git/commit/c5d16d66f47d38078fefc539ed8d2b478ecb…
commit c5d16d66f47d38078fefc539ed8d2b478ecb5039
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Mar 23 12:30:37 2013 +0100
doc: pywrap: More python docs.
diff --git a/doc/core_python.txt b/doc/core_python.txt
index 57a51e6..fe295cb 100644
--- a/doc/core_python.txt
+++ b/doc/core_python.txt
@@ -53,9 +53,6 @@ import gfxprim.core as core
Puts a pixel at specified coordinates. If coordinates are outside of the
image nothing is done.
-These are basic 'Context' methods from core module. Importing other modules
-will add some other (for example gfx module adds all drawing functions).
-
NOTE: You may want to see link:coordinate_system.html[coordinate system]
description.
@@ -77,14 +74,26 @@ The conversion is naive i.e. the values are just divided/multiplied.
-------------------------------------------------------------------------------
import gfxprim.core as core
-Blit(self, sx, sy, target, tx, ty, w=None, h=None, sx2=None, sy2=None,
- tx2=None, ty2=None)
+ # Blits context to target starting at
+ # sx and sy in the source context
+ # tx and ty in in the target
+ context.Blit(sx, sy, target, tx, ty, w, h)
+
+ # Alternatively the size can be described by
+ # coordinates in the source or target
+ context.Blit(sx, sy, target, tx, ty, sx2=, sy2=)
+ context.Blit(sx, sy, target, tx, ty, tx2=, ty2=)
-------------------------------------------------------------------------------
-Copy a rectangle from self to target. (sx,sy) and (tx,ty) define upper-left
-corners, rectangle size is given by (width, height), lower-right corner in
-source or lower-right corner in the target. Blit is clipped.
+Copy a rectangle from self to target.
+
+The blits can do simple conversions same as the 'Convert' functions however
+such blits are slower.
+
+Blit is clipped.
+
+TIP: See link:example_py_showimage.html[example] Blit usage.
Colors and Pixels
~~~~~~~~~~~~~~~~~
@@ -94,7 +103,7 @@ passed as a parameter to all drawing functions.
Color is a more abstract representation for example RGB triplet.
-There are several functions to create a pixel value for a particualr pixel
+There are several functions to create a pixel value for a particular pixel
type from color.
[source,python]
@@ -141,3 +150,7 @@ Sets and gets the GFXprim debug level. See link:debug.html[debug messages]
description for more details.
+
+
+These are basic 'Context' methods from core module. Importing other modules
+will add some other (for example gfx module adds all drawing functions).
diff --git a/doc/example_py_showimage.txt b/doc/example_py_showimage.txt
new file mode 100644
index 0000000..10e6e51
--- /dev/null
+++ b/doc/example_py_showimage.txt
@@ -0,0 +1,8 @@
+Showimage
+---------
+.A simple program to load and show image
+
+[source,python]
+------------------------------------------------------------------
+include::../demos/py_simple/showimage.py[]
+------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +-
doc/asciidoc.conf | 1 +
doc/core_python.txt | 32 +++++++++----
...{example_input.txt => example_py_showimage.txt} | 9 ++--
doc/gfx_python.txt | 48 ++++++++++++++++++++
5 files changed, 78 insertions(+), 14 deletions(-)
copy doc/{example_input.txt => example_py_showimage.txt} (52%)
create mode 100644 doc/gfx_python.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.")
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 0489beeb9e8eb9c66e5700a6d998003440219087 (commit)
via cb9fe9ad6b062ca96ea2c4a78204290094bfa0dd (commit)
from 7c3141632bc5d4d508aa12073383ac071add934f (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/0489beeb9e8eb9c66e5700a6d99800344021…
commit 0489beeb9e8eb9c66e5700a6d998003440219087
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Mar 22 15:50:26 2013 +0100
doc: pywrap: Add brief core wrap description.
diff --git a/doc/Makefile b/doc/Makefile
index 907bebd..cb892bf 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -5,6 +5,8 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt get_put_pixel.txt blits.txt progress_callback.txt text_api.txt event_queue.txt
+SOURCES+=core_python.txt
+
EXAMPLE_SOURCES=$(wildcard example_*.txt)
ASCIIDOC_PARAMS=--conf-file asciidoc.conf
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index 4294c56..72418b7 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -55,6 +55,11 @@ endif::disable-javascript[]
<li><a href="backends.html">Backends</a></li>
<li><a href="input.html">Input</a></li>
</ul>
+
+ <h4>Python bindings</h4>
+ <ul>
+ <li><a href="core_python.html">Core</a></li>
+ </ul>
</div>
# Rest of the content
diff --git a/doc/core_python.txt b/doc/core_python.txt
new file mode 100644
index 0000000..57a51e6
--- /dev/null
+++ b/doc/core_python.txt
@@ -0,0 +1,143 @@
+Python Core module
+------------------
+
+The python binding maps mostly to the C API with the 'GP_' prefix stripped.
+
+Structures like 'GP_Context' are not created by the 'GP_ContextAlloc()'
+function but have proper constructor and destructor to keep the Python
+reference counting happy.
+
+There there are more complicated problems like 'GP_ProgressCallback' which
+needs a proxy function to call the python callback from the C code.
+
+Context
+~~~~~~~
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ # Create 100x100 RGB888 context
+ c = core.Context(100, 100, core.C.PIXEL_RGB888)
+
+ print("w={} h={} bpp={}".format(c.w, c.h, c.bpp))
+
+-------------------------------------------------------------------------------
+
+Creates a context of a particular size and pixel type.
+
+First two parameters are 'width' and 'height' third is pixel type which is an
+enumeration
+
+May raise 'OSError' with 'ENOMEM' errno if allocation has failed.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ pixel = context.GetPixel(x, y)
+
+-------------------------------------------------------------------------------
+
+Returns a pixel value at x and y. If coordinates are outside the image zero is
+returned.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ context.PutPixel(x, y, pixel)
+
+-------------------------------------------------------------------------------
+
+Puts a pixel at specified coordinates. If coordinates are outside of the
+image nothing is done.
+
+These are basic 'Context' methods from core module. Importing other modules
+will add some other (for example gfx module adds all drawing functions).
+
+NOTE: You may want to see link:coordinate_system.html[coordinate system]
+ description.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ grayscale = context.Convert(core.C.PIXEL_G8)
+
+-------------------------------------------------------------------------------
+
+Returns context converted into the desired pixel format.
+
+The conversion is naive i.e. the values are just divided/multiplied.
+
+//TODO: link to dithering filters etc.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+Blit(self, sx, sy, target, tx, ty, w=None, h=None, sx2=None, sy2=None,
+ tx2=None, ty2=None)
+
+-------------------------------------------------------------------------------
+
+Copy a rectangle from self to target. (sx,sy) and (tx,ty) define upper-left
+corners, rectangle size is given by (width, height), lower-right corner in
+source or lower-right corner in the target. Blit is clipped.
+
+Colors and Pixels
+~~~~~~~~~~~~~~~~~
+
+Pixel in gfxprim is a number large enough to store a pixel value. Pixel is
+passed as a parameter to all drawing functions.
+
+Color is a more abstract representation for example RGB triplet.
+
+There are several functions to create a pixel value for a particualr pixel
+type from color.
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ # You can create a pixel from RGB and pixel type
+ black = core.RGBToPixel(0, 0, 0, core.C.PIXEL_G1)
+
+ # Or using shortcut from context
+ black = context.RGBToPixel(0, 0, 0)
+
+-------------------------------------------------------------------------------
+
+These functions creates a pixel suitable for drawing into a bitmap with
+particular pixel type.
+
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ # Print all supported pixel types
+ for i in core.PixelTypes:
+ print("Pixel type '{}' size {}".format(i.name, i.size))
+
+-------------------------------------------------------------------------------
+
+The PixelTypes array stores all supported pixel types
+
+Debug Functions
+~~~~~~~~~~~~~~~
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+
+ core.GP_SetDebugLevel(10)
+
+ level = core.GP_GetDebugLevel()
+-------------------------------------------------------------------------------
+
+Sets and gets the GFXprim debug level. See link:debug.html[debug messages]
+description for more details.
+
+
http://repo.or.cz/w/gfxprim.git/commit/cb9fe9ad6b062ca96ea2c4a78204290094bf…
commit cb9fe9ad6b062ca96ea2c4a78204290094bfa0dd
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Mar 22 15:49:30 2013 +0100
pywrap: common.i: Change the exception to OSError.
Which is more suitable for errno related errors.
diff --git a/pylib/gfxprim/common.i b/pylib/gfxprim/common.i
index 09dee68..e9242d7 100644
--- a/pylib/gfxprim/common.i
+++ b/pylib/gfxprim/common.i
@@ -24,7 +24,7 @@
%exception funcname {
$action
if (result == NULL)
- return PyErr_SetFromErrno(PyExc_RuntimeError);
+ return PyErr_SetFromErrno(PyExc_OSError);
}
%enddef
@@ -37,6 +37,6 @@
%exception funcname {
$action
if (result != 0)
- return PyErr_SetFromErrno(PyExc_RuntimeError);
+ return PyErr_SetFromErrno(PyExc_OSError);
}
%enddef
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +
doc/asciidoc.conf | 5 ++
doc/core_python.txt | 143 ++++++++++++++++++++++++++++++++++++++++++++++++
pylib/gfxprim/common.i | 4 +-
4 files changed, 152 insertions(+), 2 deletions(-)
create mode 100644 doc/core_python.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.")
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 d5c09d5b8cd72e73f0e0df4110a3981f943d44f9 (commit)
from 81cfb3c3c3d08268a25747d38e05274c8b335300 (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/d5c09d5b8cd72e73f0e0df4110a3981f943d…
commit d5c09d5b8cd72e73f0e0df4110a3981f943d44f9
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Mar 19 23:36:12 2013 +0100
pywrap: backends: The Wait and Poll returns events directly.
diff --git a/demos/py_simple/showimage.py b/demos/py_simple/showimage.py
index b952078..c61f5ff 100755
--- a/demos/py_simple/showimage.py
+++ b/demos/py_simple/showimage.py
@@ -14,15 +14,16 @@ def main():
# Load Image
img = loaders.Load(sys.argv[1])
-
+
+ # Create X11 window
bk = backends.BackendX11Init(None, 0, 0, img.w, img.h, sys.argv[1], 0)
assert(bk)
img.Blit(0, 0, bk.context, 0, 0, img.w, img.h)
bk.Flip()
+ # Event loop
while True:
- bk.Wait()
- ev = bk.GetEvent()
+ ev = bk.Wait()
input.EventDump(ev)
diff --git a/pylib/gfxprim/backends/_extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py
index 97975a7..53e1700 100644
--- a/pylib/gfxprim/backends/_extend_backend.py
+++ b/pylib/gfxprim/backends/_extend_backend.py
@@ -27,12 +27,32 @@ def extend_backend(_backend):
@extend(_backend)
def Poll(self):
"Poll the backend for events."
- return c_backends.GP_BackendPoll(self)
+ ev = c_input.GP_Event();
+
+ if c_backends.GP_BackendGetEvent(self, ev) != 0:
+ return ev
+
+ c_backends.GP_BackendPoll(self)
+
+ if c_backends.GP_BackendGetEvent(self, ev) != 0:
+ return ev
+
+ return None
@extend(_backend)
def Wait(self):
"Waits for backend event"
- return c_backends.GP_BackendWait(self)
+ ev = c_input.GP_Event();
+
+ if c_backends.GP_BackendGetEvent(self, ev) != 0:
+ return ev
+
+ while c_backends.GP_BackendGetEvent(self, ev) == 0:
+ c_backends.GP_BackendWait(self)
+
+ c_backends.GP_BackendGetEvent(self, ev)
+
+ return ev
@extend(_backend)
def SetCaption(self, caption):
@@ -43,13 +63,3 @@ def extend_backend(_backend):
def Resize(self, w, h):
"Resize backend window (if possible)"
return c_backends.GP_BackendResize(self, w, h)
-
- @extend(_backend)
- def GetEvent(self):
- "Removes and returns event from the top of the event queue"
- if c_backends.GP_BackendEventsQueued(self) == 0:
- return None
- ev = c_input.GP_Event();
- if c_backends.GP_BackendGetEvent(self, ev) != 0:
- return ev
- return None
-----------------------------------------------------------------------
Summary of changes:
demos/py_simple/showimage.py | 7 +++--
pylib/gfxprim/backends/_extend_backend.py | 34 ++++++++++++++++++----------
2 files changed, 26 insertions(+), 15 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.")