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, pywrap has been updated via e345fda1e7684c1869952e03d5cf6b88b8116499 (commit) via 42ef30f3b79bde06f2081ce92ff3b141771a5051 (commit) via 6e75cff5b5c5a6cd6986304f3a75aecf6fd05010 (commit) via cd95c746b36256361430395355e7f6f308f36b44 (commit) from 14fc5c33518764dfb5a938c5aa5a38ce4810badf (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/e345fda1e7684c1869952e03d5cf6b88b8116...
commit e345fda1e7684c1869952e03d5cf6b88b8116499 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 23:28:55 2012 +0100
pywrap: fix Context.create to CamelCase
diff --git a/pylib/gfxprim/core/_extend_context.py b/pylib/gfxprim/core/_extend_context.py index 351c2a5..4b73ec9 100644 --- a/pylib/gfxprim/core/_extend_context.py +++ b/pylib/gfxprim/core/_extend_context.py @@ -39,7 +39,7 @@ def extend_context(_context): pixeltype_no = target_type ## TODO also accept PixelType return core_c.GP_ContextConvert(self, pixeltype_no)
- @extend(_context, name='create') + @extend(_context, name='Create') @staticmethod def Create(w, h, pixeltype): "Allocate a new w*h bitmap of given type."
http://repo.or.cz/w/gfxprim.git/commit/42ef30f3b79bde06f2081ce92ff3b141771a5...
commit 42ef30f3b79bde06f2081ce92ff3b141771a5051 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 23:28:07 2012 +0100
pywrap: simplified access to members of Context
diff --git a/pylib/gfxprim/core/_extend_context.py b/pylib/gfxprim/core/_extend_context.py index e012b3f..351c2a5 100644 --- a/pylib/gfxprim/core/_extend_context.py +++ b/pylib/gfxprim/core/_extend_context.py @@ -15,22 +15,10 @@ def extend_context(_context): @extend(_context, name='__repr__') def context_str(self): return "<Context %dx%d, %dbpp, GP_Context %sowned, %s parent>" % ( - self.w, self.h, self._bpp, + self.w, self.h, self.bpp, "" if self.thisown else "not ", "with" if self.parent else "no")
- @add_swig_getmethod(_context) - def w(self): - return core_c.GP_ContextW(self) - - @add_swig_getmethod(_context) - def h(self): - return core_c.GP_ContextH(self) - - @add_swig_getmethod(_context) - def pixel_type(self): - return self._pixel_type - @extend(_context) def Subcontext(self, x, y, w, h): "Create a subcontext (rectangular view)." diff --git a/pylib/gfxprim/core/core.i b/pylib/gfxprim/core/core.i index 2fb33ca..046481a 100644 --- a/pylib/gfxprim/core/core.i +++ b/pylib/gfxprim/core/core.i @@ -4,7 +4,7 @@ #include "core/GP_Core.h" %}
-#define __attribute__(X) +#define __attribute__(X)
%include <stdint.i>
@@ -47,21 +47,20 @@ * GP_Context wrapping */
-/* Rename accesors to GP_Context attributes to "_attribute" */ +/* Make some members RO */ +%immutable GP_Context::w; +%immutable GP_Context::h; +%immutable GP_Context::pixel_type; +%immutable GP_Context::bpp; +%immutable GP_Context::bytes_per_row; +/* Rename "internal" GP_Context */ %rename("_%s") "GP_Context::pixels"; -%rename("_%s") "GP_Context::bpp"; -%rename("_%s") "GP_Context::bytes_per_row"; -%rename("_%s") "GP_Context::w"; -%rename("_%s") "GP_Context::h"; %rename("_%s") "GP_Context::offset"; -%rename("_%s") "GP_Context::pixel_type"; %rename("_%s") "GP_Context::axes_swap"; %rename("_%s") "GP_Context::x_swap"; %rename("_%s") "GP_Context::y_swap"; %rename("_%s") "GP_Context::bit_endian"; %rename("_%s") "GP_Context::free_pixels"; -/* This nice batch would work in swig 2.0, sigh: - * %rename("_%s", regexmatch$name="^GP_Context::") ""; */
%feature("autodoc", "Proxy of C GP_Context struct
http://repo.or.cz/w/gfxprim.git/commit/6e75cff5b5c5a6cd6986304f3a75aecf6fd05...
commit 6e75cff5b5c5a6cd6986304f3a75aecf6fd05010 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 23:20:09 2012 +0100
pywrap: fix a warning (make member RO)
diff --git a/pylib/gfxprim/backends/backends.i b/pylib/gfxprim/backends/backends.i index 5a03736..1592509 100644 --- a/pylib/gfxprim/backends/backends.i +++ b/pylib/gfxprim/backends/backends.i @@ -5,7 +5,7 @@ #include "GP_Backends.h" %}
-#define __attribute__(X) +#define __attribute__(X) %include <stdint.i>
%feature("autodoc"); @@ -27,6 +27,7 @@
%ignore GP_Backend::priv; %ignore GP_Backend::fd_list; +%immutable GP_Backend::name; %ignore GP_BackendFD;
%include "GP_Backend.h"
http://repo.or.cz/w/gfxprim.git/commit/cd95c746b36256361430395355e7f6f308f36...
commit cd95c746b36256361430395355e7f6f308f36b44 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 22:29:06 2012 +0100
demos: pywrap demo (SDL, AA and non-AA, no event-handling)
diff --git a/demos/py_simple/runpytest.sh b/demos/py_simple/runpytest.sh new file mode 100755 index 0000000..264af15 --- /dev/null +++ b/demos/py_simple/runpytest.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Run python test with dynamically linked libGP. +# + +PROG="$1" +shift + +LD_LIBRARY_PATH=../../build/ PYTHONPATH=$PYTHONPATH:../../pylib/ ./$PROG "$@" diff --git a/demos/py_simple/sinplots_AA.py b/demos/py_simple/sinplots_AA.py new file mode 100755 index 0000000..1e2db04 --- /dev/null +++ b/demos/py_simple/sinplots_AA.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +import gfxprim.core as core +import gfxprim.backends as backends +import gfxprim.gfx as gfx +import random +from math import sin + +AA = True +W = 320 +H = 240 +N = 10 + +class plotter(object): + def __init__(self): + self.x0 = random.uniform(0, W) + self.y0 = random.uniform(H*0.2, H*0.8) + self.a = H * (0.06 + random.uniform(0, 0.1) + random.uniform(0, 0.2)) + self.period = 4.0 + random.expovariate(4.0/W) + self.speed = random.uniform(0.04, min(max(0.05, 0.5 * self.period / self.a), 1.0)) + def pos(self, t): + x = self.x0 + self.speed * t + y = self.y0 + sin(x / self.period) * self.a + return (x % W, y) + def color(self, t): + return ( + 128 + 120 * sin(t / (self.a + 10.0)), + 128 + 120 * sin(t / (self.y0 + 3.0)), + 128 + 120 * sin(t / (self.x0 + 5.0))) + + +def main(): + bk = backends.BackendSDLInit(W, H, 16, 0) + assert bk + print bk + print "Modify source for parameters," + print "Kill to terminate ;-)" + black = bk.context.RGBToPixel(0, 0, 0) + + ps = [plotter() for i in range(N)] + t = random.uniform(0.0, 10.0 * W) + while True: + t += 1.0 + for p in ps: + (x, y) = p.pos(t) + (r, g, b) = p.color(t) + if AA: + x = int(x * 0x100) + y = int(y * 0x100) + gfx.VLineAA(bk.context, x + 0x100, y - 0x200, y + 0x200, black) + gfx.PutPixelAA(bk.context, x, y, bk.context.RGBToPixel(int(r), int(g), int(b))) + else: + x = int(x) + y = int(y) + gfx.VLine(bk.context, x + 1, y - 2, y + 2, black) + core.PutPixel(bk.context, x, y, bk.context.RGBToPixel(int(r), int(g), int(b))) + bk.Flip() + +if __name__ == '__main__': + main()
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/runpytest.sh | 9 +++++ demos/py_simple/sinplots_AA.py | 59 +++++++++++++++++++++++++++++++++ pylib/gfxprim/backends/backends.i | 3 +- pylib/gfxprim/core/_extend_context.py | 16 +-------- pylib/gfxprim/core/core.i | 17 ++++----- 5 files changed, 80 insertions(+), 24 deletions(-) create mode 100755 demos/py_simple/runpytest.sh create mode 100755 demos/py_simple/sinplots_AA.py
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.