Gfxprim
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- 929 discussions
[repo.or.cz] gfxprim.git branch pywrap updated: 1815d235fb569edde9ce1a16bc0df773cbd6e51b
by gavento 24 Feb '12
by gavento 24 Feb '12
24 Feb '12
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 1815d235fb569edde9ce1a16bc0df773cbd6e51b (commit)
via 045bf5ca3eb9490641721f1fe995da9b2f7995ff (commit)
via ae9991521c625c6e992a7f41e776a4df5f26e27c (commit)
via 688f686e2af5d8b93644a133b5d78306f75ba33b (commit)
via 6e374f36d66099a2b22f2159f8e01f29a5b6e93b (commit)
via 292cb728884ef43f466027f5a5b7425db253c844 (commit)
via 3b82597d1e2542af499e250d84f34d98721833e7 (commit)
via 258d6567abfed2915878ef6464514ab612139120 (commit)
via d495753c9dc9129b0511b3dc59e0fff2884c3e2b (commit)
via 4ec758f1d45d859fbf84bff6e8a314c1192f3b68 (commit)
via ba3602872b1b7c717a0c82d4937380feee6240d0 (commit)
via 83704e9f8be3359c9be0b4c2a9569b5aa4aa0812 (commit)
via bee9bc07dfddc0a717246842c29b79cbaa26ab24 (commit)
via 31d264d14f9777dd0e934fedb2b0af0665a0b3f7 (commit)
from 0aed5090e5722d19b06bf91f6652923b1127a2c9 (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/1815d235fb569edde9ce1a16bc0df773cbd6…
commit 1815d235fb569edde9ce1a16bc0df773cbd6e51b
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:50:17 2012 +0100
pywrap: make all modules by default
diff --git a/pylib/gfxprim/Makefile b/pylib/gfxprim/Makefile
index f5bf693..e668b60 100644
--- a/pylib/gfxprim/Makefile
+++ b/pylib/gfxprim/Makefile
@@ -1,3 +1,3 @@
TOPDIR=../..
-SUBDIRS=core loaders
+SUBDIRS=core loaders backends gfx filters text
include $(TOPDIR)/include.mk
http://repo.or.cz/w/gfxprim.git/commit/045bf5ca3eb9490641721f1fe995da9b2f79…
commit 045bf5ca3eb9490641721f1fe995da9b2f7995ff
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:49:30 2012 +0100
pywrap: forgotten file
I forgot to commit pywrap.mk with .swig to .i change
diff --git a/pywrap.mk b/pywrap.mk
index ab8dcf7..b03ab6d 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -2,7 +2,7 @@ ifndef LIBNAME
$(error LIBNAME not defined, fix your library Makefile)
endif
-SWIG_SRC=$(LIBNAME).swig
+SWIG_SRC=$(LIBNAME).i
SWIG_PY=$(LIBNAME)_c.py
SWIG_C=$(LIBNAME)_wrap.c
SWIG_LIB=_$(LIBNAME)_c.so
http://repo.or.cz/w/gfxprim.git/commit/ae9991521c625c6e992a7f41e776a4df5f26…
commit ae9991521c625c6e992a7f41e776a4df5f26e27c
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:48:28 2012 +0100
pywrap: and finally ... added text module!
diff --git a/pylib/gfxprim/text/C.py b/pylib/gfxprim/text/C.py
new file mode 100644
index 0000000..c8f987f
--- /dev/null
+++ b/pylib/gfxprim/text/C.py
@@ -0,0 +1,3 @@
+"""
+Submodule for constants
+"""
diff --git a/pylib/gfxprim/text/Makefile b/pylib/gfxprim/text/Makefile
new file mode 100644
index 0000000..9549bc3
--- /dev/null
+++ b/pylib/gfxprim/text/Makefile
@@ -0,0 +1,5 @@
+TOPDIR=../../..
+LIBNAME=text
+INCLUDE=core
+include $(TOPDIR)/pywrap.mk
+include $(TOPDIR)/include.mk
diff --git a/pylib/gfxprim/text/__init__.py b/pylib/gfxprim/text/__init__.py
new file mode 100644
index 0000000..a24cb69
--- /dev/null
+++ b/pylib/gfxprim/text/__init__.py
@@ -0,0 +1,27 @@
+from . import text_c
+
+from . import C
+
+def _init(module):
+
+ # Imports from the SWIG module
+ import re
+ def strip_GP(s):
+ return re.sub('^GP_', '', s)
+
+ # Import constants from the SWIG module
+ from ..utils import import_members
+ const_regexes = ['^GP_[A-Z0-9_]*$']
+ import_members(text_c, C, include=const_regexes, sub=strip_GP)
+
+ # Import functions from the SWIG module
+ import_members(text_c, module, sub=strip_GP,
+ exclude=const_regexes + [
+ '.*_Raw',
+ '^w+_swigregister$',
+ '^gfxprim$',
+ '^cvar$',
+ '^_w+$'])
+
+_init(locals())
+del _init
diff --git a/pylib/gfxprim/text/text.i b/pylib/gfxprim/text/text.i
new file mode 100644
index 0000000..94f8baf
--- /dev/null
+++ b/pylib/gfxprim/text/text.i
@@ -0,0 +1,23 @@
+%module(package="gfxprim.text") text_c
+
+%{
+#include "text/GP_Text.h"
+#include "text/GP_Font.h"
+%}
+
+#define __attribute__(X)
+
+%import ../core/core.i
+
+%include <stdint.i>
+
+%nodefaultctor;
+
+%ignore GP_GlyphBitmap::bitmap;
+%ignore GP_FontFace::glyph_offsets;
+%include "GP_Text.h"
+%include "GP_Font.h"
+%include "GP_DefaultFont.h"
+%include "GP_TextMetric.h"
+%include "GP_TextStyle.h"
+
http://repo.or.cz/w/gfxprim.git/commit/688f686e2af5d8b93644a133b5d78306f75b…
commit 688f686e2af5d8b93644a133b5d78306f75ba33b
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:37:24 2012 +0100
pywrap: wrappers for filters, not well-filtered
* More work may be necessary (parameters? any allocations?)
diff --git a/pylib/gfxprim/filters/C.py b/pylib/gfxprim/filters/C.py
new file mode 100644
index 0000000..c8f987f
--- /dev/null
+++ b/pylib/gfxprim/filters/C.py
@@ -0,0 +1,3 @@
+"""
+Submodule for constants
+"""
diff --git a/pylib/gfxprim/filters/Makefile b/pylib/gfxprim/filters/Makefile
new file mode 100644
index 0000000..6e03032
--- /dev/null
+++ b/pylib/gfxprim/filters/Makefile
@@ -0,0 +1,5 @@
+TOPDIR=../../..
+LIBNAME=filters
+INCLUDE=core
+include $(TOPDIR)/pywrap.mk
+include $(TOPDIR)/include.mk
diff --git a/pylib/gfxprim/filters/__init__.py b/pylib/gfxprim/filters/__init__.py
new file mode 100644
index 0000000..96ed8c9
--- /dev/null
+++ b/pylib/gfxprim/filters/__init__.py
@@ -0,0 +1,26 @@
+from . import filters_c
+
+from . import C
+
+def _init(module):
+
+ # Imports from the SWIG module
+ import re
+ def strip_GP(s):
+ return re.sub('^GP_', '', s)
+
+ # Import constants from the SWIG module
+ from ..utils import import_members
+ const_regexes = ['^GP_[A-Z0-9_]*$']
+ import_members(filters_c, C, include=const_regexes, sub=strip_GP)
+
+ # Import functions from the SWIG module
+ import_members(filters_c, module, sub=strip_GP,
+ exclude=const_regexes + [
+ '.*_Raw',
+ '^w+_swigregister$',
+ '^gfxprim$',
+ '^_w+$'])
+
+_init(locals())
+del _init
diff --git a/pylib/gfxprim/filters/filters.i b/pylib/gfxprim/filters/filters.i
new file mode 100644
index 0000000..34baeb9
--- /dev/null
+++ b/pylib/gfxprim/filters/filters.i
@@ -0,0 +1,26 @@
+%module(package="gfxprim.filters") filters_c
+
+%{
+#include "filters/GP_Filters.h"
+%}
+
+#define __attribute__(X)
+
+%import ../core/core.i
+
+%include <stdint.i>
+
+%nodefaultctor;
+
+%include "GP_Filters.h"
+
+/* Listed in GP_Filters.h: */
+%include "GP_FilterParam.h"
+%include "GP_Point.h"
+%include "GP_Arithmetic.h"
+%ignore GP_Histogram::hist;
+%include "GP_Stats.h"
+%include "GP_Rotate.h"
+%include "GP_Linear.h"
+%include "GP_Resize.h"
+/* %include "GP_Dither.h" -- missing symbols */
http://repo.or.cz/w/gfxprim.git/commit/6e374f36d66099a2b22f2159f8e01f29a5b6…
commit 6e374f36d66099a2b22f2159f8e01f29a5b6e93b
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:34:45 2012 +0100
pywrap: fix excluded elements
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py
index 9aac820..224e0e5 100644
--- a/pylib/gfxprim/backends/__init__.py
+++ b/pylib/gfxprim/backends/__init__.py
@@ -39,6 +39,7 @@ def _init(module):
import_members(backends_c, module, sub=strip_GP,
exclude=const_regexes + [
'^GP_Backend$',
+ '^gfxprim$',
'^w+_swigregister$',
'^_w+$'])
diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py
index 6d03923..c80ae6a 100644
--- a/pylib/gfxprim/gfx/__init__.py
+++ b/pylib/gfxprim/gfx/__init__.py
@@ -12,9 +12,7 @@ def _init(module):
# Import constants from the SWIG module
from ..utils import import_members
- const_regexes = [
- '^GP_[A-Z0-9_]*$',
- '^GP_PIXEL_x[A-Z0-9_]*$']
+ const_regexes = ['^GP_[A-Z0-9_]*$']
import_members(gfx_c, C, include=const_regexes, sub=strip_GP)
# Import functions from the SWIG module
@@ -22,7 +20,7 @@ def _init(module):
exclude=const_regexes + [
'.*_Raw',
'^w+_swigregister$',
- '^core_c$',
+ '^gfxprim$',
'^_w+$'])
_init(locals())
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
index ed235bc..c3fe31b 100644
--- a/pylib/gfxprim/loaders/__init__.py
+++ b/pylib/gfxprim/loaders/__init__.py
@@ -17,7 +17,7 @@ def _init(module):
import_members(loaders_c, module, sub=strip_GP,
exclude=[
'^w+_swigregister$',
- '^core_c$',
+ '^gfxprim$',
'^_w+$'])
_init(locals())
http://repo.or.cz/w/gfxprim.git/commit/292cb728884ef43f466027f5a5b7425db253…
commit 292cb728884ef43f466027f5a5b7425db253c844
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:28:14 2012 +0100
Update .gitignore (include libraries)
diff --git a/.gitignore b/.gitignore
index 52f0d89..7d18a2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,8 @@
*.gen.c
*.gen.h
*.swp
-libGP.so*
-libGP.a
+*.so.*
+*.so
+*.a
config.h
config.gen.mk
http://repo.or.cz/w/gfxprim.git/commit/3b82597d1e2542af499e250d84f34d987218…
commit 3b82597d1e2542af499e250d84f34d98721833e7
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:23:33 2012 +0100
pywrap: separate constants for gfx
diff --git a/pylib/gfxprim/gfx/C.py b/pylib/gfxprim/gfx/C.py
new file mode 100644
index 0000000..c8f987f
--- /dev/null
+++ b/pylib/gfxprim/gfx/C.py
@@ -0,0 +1,3 @@
+"""
+Submodule for constants
+"""
diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py
index 4bbaa40..6d03923 100644
--- a/pylib/gfxprim/gfx/__init__.py
+++ b/pylib/gfxprim/gfx/__init__.py
@@ -1,16 +1,25 @@
from . import gfx_c
+from . import C
+
def _init(module):
+
# Imports from the SWIG module
import re
def strip_GP(s):
return re.sub('^GP_', '', s)
- # Import functions from the SWIG module
+ # Import constants from the SWIG module
from ..utils import import_members
+ const_regexes = [
+ '^GP_[A-Z0-9_]*$',
+ '^GP_PIXEL_x[A-Z0-9_]*$']
+ import_members(gfx_c, C, include=const_regexes, sub=strip_GP)
+
+ # Import functions from the SWIG module
import_members(gfx_c, module, sub=strip_GP,
- exclude=[
+ exclude=const_regexes + [
'.*_Raw',
'^w+_swigregister$',
'^core_c$',
http://repo.or.cz/w/gfxprim.git/commit/258d6567abfed2915878ef6464514ab61213…
commit 258d6567abfed2915878ef6464514ab612139120
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:11:09 2012 +0100
pywrap: wrappers for gfx module
diff --git a/pylib/gfxprim/gfx/Makefile b/pylib/gfxprim/gfx/Makefile
new file mode 100644
index 0000000..db31c60
--- /dev/null
+++ b/pylib/gfxprim/gfx/Makefile
@@ -0,0 +1,5 @@
+TOPDIR=../../..
+LIBNAME=gfx
+INCLUDE=core
+include $(TOPDIR)/pywrap.mk
+include $(TOPDIR)/include.mk
diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py
new file mode 100644
index 0000000..4bbaa40
--- /dev/null
+++ b/pylib/gfxprim/gfx/__init__.py
@@ -0,0 +1,20 @@
+from . import gfx_c
+
+def _init(module):
+
+ # Imports from the SWIG module
+ import re
+ def strip_GP(s):
+ return re.sub('^GP_', '', s)
+
+ # Import functions from the SWIG module
+ from ..utils import import_members
+ import_members(gfx_c, module, sub=strip_GP,
+ exclude=[
+ '.*_Raw',
+ '^w+_swigregister$',
+ '^core_c$',
+ '^_w+$'])
+
+_init(locals())
+del _init
diff --git a/pylib/gfxprim/gfx/gfx.i b/pylib/gfxprim/gfx/gfx.i
new file mode 100644
index 0000000..1f59443
--- /dev/null
+++ b/pylib/gfxprim/gfx/gfx.i
@@ -0,0 +1,37 @@
+%module(package="gfxprim.gfx") gfx_c
+
+%{
+#include "gfx/GP_Gfx.h"
+%}
+
+#define __attribute__(X)
+
+%import ../core/core.i
+
+%include <stdint.i>
+
+%nodefaultctor;
+
+%include "GP_Gfx.h"
+
+/* Listed in GP_Gfx.h: */
+%include "GP_Fill.h"
+%include "GP_HLine.h"
+%include "GP_VLine.h"
+%include "GP_Line.h"
+%include "GP_Rect.h"
+%include "GP_Triangle.h"
+%include "GP_Tetragon.h"
+%include "GP_Circle.h"
+/* %include "GP_CircleSeg.h" -- missing symbols */
+%include "GP_Ellipse.h"
+%include "GP_Arc.h"
+%include "GP_Polygon.h"
+%include "GP_Symbol.h"
+
+%include "GP_PutPixelAA.h"
+%include "GP_VLineAA.h"
+%include "GP_HLineAA.h"
+%include "GP_LineAA.h"
+%include "GP_RectAA.h"
+
http://repo.or.cz/w/gfxprim.git/commit/d495753c9dc9129b0511b3dc59e0fff2884c…
commit d495753c9dc9129b0511b3dc59e0fff2884c3e2b
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 20:10:34 2012 +0100
pywrap: clean old links
diff --git a/pylib/_gfxprim_core_c.so b/pylib/_gfxprim_core_c.so
deleted file mode 120000
index b0aff10..0000000
--- a/pylib/_gfxprim_core_c.so
+++ /dev/null
@@ -1 +0,0 @@
-../build/_gfxprim_core_c.so
No newline at end of file
diff --git a/pylib/_gfxprim_loaders_c.so b/pylib/_gfxprim_loaders_c.so
deleted file mode 120000
index 41a41f9..0000000
--- a/pylib/_gfxprim_loaders_c.so
+++ /dev/null
@@ -1 +0,0 @@
-../build/_gfxprim_loaders_c.so
No newline at end of file
http://repo.or.cz/w/gfxprim.git/commit/4ec758f1d45d859fbf84bff6e8a314c1192f…
commit 4ec758f1d45d859fbf84bff6e8a314c1192f3b68
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 19:56:34 2012 +0100
pywrap: use .i instead of .pywrap
diff --git a/pylib/gfxprim/backends/backends.swig b/pylib/gfxprim/backends/backends.i
similarity index 96%
rename from pylib/gfxprim/backends/backends.swig
rename to pylib/gfxprim/backends/backends.i
index 9c2eea1..5a03736 100644
--- a/pylib/gfxprim/backends/backends.swig
+++ b/pylib/gfxprim/backends/backends.i
@@ -10,7 +10,7 @@
%feature("autodoc");
-%import ../core/core.swig
+%import ../core/core.i
/*
diff --git a/pylib/gfxprim/core/core.swig b/pylib/gfxprim/core/core.i
similarity index 100%
rename from pylib/gfxprim/core/core.swig
rename to pylib/gfxprim/core/core.i
diff --git a/pylib/gfxprim/loaders/loaders.swig b/pylib/gfxprim/loaders/loaders.i
similarity index 95%
rename from pylib/gfxprim/loaders/loaders.swig
rename to pylib/gfxprim/loaders/loaders.i
index aeb5ad2..990b07d 100644
--- a/pylib/gfxprim/loaders/loaders.swig
+++ b/pylib/gfxprim/loaders/loaders.i
@@ -7,7 +7,7 @@
#define __attribute__(X)
-%import ../core/core.swig
+%import ../core/core.i
%include <stdint.i>
http://repo.or.cz/w/gfxprim.git/commit/ba3602872b1b7c717a0c82d4937380feee62…
commit ba3602872b1b7c717a0c82d4937380feee6240d0
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 19:52:24 2012 +0100
pywrap: Clean and simplify backend wrappers
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py
index f33aa9b..9aac820 100644
--- a/pylib/gfxprim/backends/__init__.py
+++ b/pylib/gfxprim/backends/__init__.py
@@ -7,40 +7,25 @@ Accessing a context after its backend has ben freed will probably
end your (program's) world
"""
-# HACK to allow backends_c to find core_c
-def import_backends_c_helper():
- from os.path import dirname
- import sys
- oldpath = sys.path[:]
- sys.path.append(dirname(__file__) + '/../core')
- from . import backends_c
- sys.path = oldpath
- return backends_c
-backends_c = import_backends_c_helper()
-del import_backends_c_helper
-
-# Extend Context with convenience methods
-def extend():
- from . import extend_context
- from ..core import Context
- extend_context.extend_context_class(Context)
-extend()
-del extend
-
+from . import backends_c
# Pull GP_Backend
Backend = backends_c.GP_Backend
-# Extend GP_Backend with convenience methods
-from . import extend_backend
-extend_backend.extend_backend_class(Backend)
-del extend_backend
-
# Constants module
from . import C
-# Import some members from the SWIG module
-def import_helper(module):
+def _init(module):
+ # Extend Context with convenience methods
+ from ._extend_context import extend_context
+ from ..core import Context
+ extend_context(Context)
+
+ # Extend GP_Backend with convenience methods
+ from _extend_backend import extend_backend
+ extend_backend(Backend)
+
+ # Import some members from the SWIG module
from ..utils import import_members
import re
def strip_GP(s):
@@ -56,5 +41,6 @@ def import_helper(module):
'^GP_Backend$',
'^w+_swigregister$',
'^_w+$'])
-import_helper(locals())
-del import_helper
+
+_init(locals())
+del _init
diff --git a/pylib/gfxprim/backends/extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py
similarity index 71%
rename from pylib/gfxprim/backends/extend_backend.py
rename to pylib/gfxprim/backends/_extend_backend.py
index bbd52cd..2f739fc 100644
--- a/pylib/gfxprim/backends/extend_backend.py
+++ b/pylib/gfxprim/backends/_extend_backend.py
@@ -1,29 +1,29 @@
from ..utils import extend, add_swig_getmethod, add_swig_setmethod
from . import backends_c
-def extend_backend_class(_backend_class):
+def extend_backend(_backend):
"""
- Extends _backend_class class with convenience methods.
+ Extends _backend class with convenience methods.
Called once on module inicialization.
"""
- @extend(_backend_class, name='__str__')
- @extend(_backend_class, name='__repr__')
+ @extend(_backend, name='__str__')
+ @extend(_backend, name='__repr__')
def backend_str(self):
return "<Backend "%s", GP_Backend %sowned>" % (
self.name, "" if self.thisown else "not ")
- @extend(_backend_class)
+ @extend(_backend)
def Flip(self):
"If display is buffered, this copies content of context onto display."
return backends_c.GP_BackendFlip(self)
- @extend(_backend_class)
+ @extend(_backend)
def UpdateRect(self, rect):
"Update a rectangle on a buffered backend."
return backends_c.GP_BackendUpdateRect(self, rect[0], rect[1], rect[2], rect[3])
- @extend(_backend_class)
+ @extend(_backend)
def Poll(self):
"Poll the backend for events."
return backends_c.GP_BackendPoll(self)
diff --git a/pylib/gfxprim/backends/_extend_context.py b/pylib/gfxprim/backends/_extend_context.py
new file mode 100644
index 0000000..f1754a5
--- /dev/null
+++ b/pylib/gfxprim/backends/_extend_context.py
@@ -0,0 +1,8 @@
+from ..utils import extend, add_swig_getmethod, add_swig_setmethod
+from . import backends_c
+
+def extend_context(_context):
+ """
+ Extends _context class with backend support.
+ """
+ extend(_context, name='backend')(None)
diff --git a/pylib/gfxprim/backends/backends.swig b/pylib/gfxprim/backends/backends.swig
index 792e789..9c2eea1 100644
--- a/pylib/gfxprim/backends/backends.swig
+++ b/pylib/gfxprim/backends/backends.swig
@@ -1,4 +1,4 @@
-%module backends_c
+%module(package="gfxprim.backends") backends_c
%{
#include "GP_Backend.h"
diff --git a/pylib/gfxprim/backends/extend_context.py b/pylib/gfxprim/backends/extend_context.py
deleted file mode 100644
index f959547..0000000
--- a/pylib/gfxprim/backends/extend_context.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from ..utils import extend, add_swig_getmethod, add_swig_setmethod
-from . import backends_c
-
-def extend_context_class(_context_class):
- """
- Extends _context_class class with backend support.
- """
- extend(_context_class, name='backend')(None)
http://repo.or.cz/w/gfxprim.git/commit/83704e9f8be3359c9be0b4c2a9569b5aa4aa…
commit 83704e9f8be3359c9be0b4c2a9569b5aa4aa0812
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 19:46:48 2012 +0100
pywrap: Simplify and clean core SWIG imports
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index 21699f7..7589d14 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -1,16 +1,17 @@
from . import core_c
-Context = core_c.Context
-
-# Extend Context with convenience methods
-from . import extend_context
-extend_context.extend_context_class(Context)
-del extend_context
+Context = core_c.GP_Context
+# Constants
from . import C
-# Import some members from the SWIG module
-def import_helper(module):
+def _init(module):
+
+ # Extend Context with convenience methods
+ from ._extend_context import extend_context
+ extend_context(Context)
+
+ # Import some members from the SWIG module
import re
from ..utils import import_members
@@ -33,5 +34,6 @@ def import_helper(module):
'^w+_swigregister$',
'^cvar$',
'^_w+$'])
-import_helper(locals())
-del import_helper
+
+_init(locals())
+del _init
diff --git a/pylib/gfxprim/core/extend_context.py b/pylib/gfxprim/core/_extend_context.py
similarity index 77%
rename from pylib/gfxprim/core/extend_context.py
rename to pylib/gfxprim/core/_extend_context.py
index f8f197d..340e142 100644
--- a/pylib/gfxprim/core/extend_context.py
+++ b/pylib/gfxprim/core/_extend_context.py
@@ -1,57 +1,57 @@
from ..utils import extend, add_swig_getmethod, add_swig_setmethod
from . import core_c
-def extend_context_class(_context_class):
+def extend_context(_context):
"""
- Extends _context_class class with core module methods and properties
+ Extends _context class with core module methods and properties
for object-oriented usage.
Called once on module inicialization.
"""
# Add "parent" attribute
- extend(_context_class, name='parent')(None)
+ extend(_context, name='parent')(None)
- @extend(_context_class, name='__str__')
- @extend(_context_class, name='__repr__')
+ @extend(_context, name='__str__')
+ @extend(_context, name='__repr__')
def context_str(self):
return "<Context %dx%d, %dbpp, GP_Context %sowned, %s parent>" % (
self.w, self.h, self._bpp,
"" if self.thisown else "not ",
"with" if self.parent else "no")
- @add_swig_getmethod(_context_class)
+ @add_swig_getmethod(_context)
def w(self):
return core_c.GP_ContextW(self)
- @add_swig_getmethod(_context_class)
+ @add_swig_getmethod(_context)
def h(self):
return core_c.GP_ContextH(self)
- @add_swig_getmethod(_context_class)
+ @add_swig_getmethod(_context)
def pixel_type(self):
return self._pixel_type
- @extend(_context_class)
+ @extend(_context)
def Subcontext(self, x, y, w, h):
"Create a subcontext (rectangular view)."
c = core_c.GP_ContextSubContext(self, None, x, y, w, h)
c.parent = self
return c
- @extend(_context_class)
+ @extend(_context)
def Copy(self, withdata):
"Copy the context to a new context. Pixel data are copie optionally."
flags = core_c.GP_COPY_WITH_PIXELS if withdata else 0
return core_c.GP_ContextCopy(self, flags)
- @extend(_context_class)
+ @extend(_context)
def Convert(self, target_type):
"""Converts context to a different pixel type, allocates new context.
See GP_ContextConvert() for details."""
pixeltype_no = target_type ## TODO also accept PixelType
return core_c.GP_ContextConvert(self, pixeltype_no)
- @extend(_context_class, name='create')
+ @extend(_context, name='create')
@staticmethod
def Create(w, h, pixeltype):
"Allocate a new w*h bitmap of given type."
@@ -61,12 +61,12 @@ def extend_context_class(_context_class):
c = core_c.GP_ContextAlloc(w, h, pixeltype_no)
return c
- @extend(_context_class)
+ @extend(_context)
def RGBToPixel(self, r, g, b):
"Convert RGB888 (values 0-255) to context pixel type."
return GP_RGBToPixel(r, g, b, self.pixel_type)
- @extend(_context_class)
+ @extend(_context)
def RGBAToPixel(self, r, g, b):
"Convert RGBA8888 (values 0-255) to context pixel type."
return GP_RGBToPixel(r, g, b, self.pixel_type)
diff --git a/pylib/gfxprim/core/core.swig b/pylib/gfxprim/core/core.swig
index 481ab1b..2fb33ca 100644
--- a/pylib/gfxprim/core/core.swig
+++ b/pylib/gfxprim/core/core.swig
@@ -1,4 +1,4 @@
-%module core_c
+%module(package="gfxprim.core") core_c
%{
#include "core/GP_Core.h"
@@ -63,7 +63,6 @@
/* This nice batch would work in swig 2.0, sigh:
* %rename("_%s", regexmatch$name="^GP_Context::") ""; */
-%rename("Context") "GP_Context";
%feature("autodoc", "Proxy of C GP_Context struct
@@ -72,7 +71,8 @@ All attributes of GP_Context are accessible directly as _attribute
(self._w etc.), but it is reccomended to use redefined properties:
self.w: Context width (transformed)
-self.h: Context width (transformed)
+self.h: Context height (transformed)
+self.pixel_type: Context pixel type (number)
Some context-related methods are provided as class members for convenience.
http://repo.or.cz/w/gfxprim.git/commit/bee9bc07dfddc0a717246842c29b79cbaa26…
commit bee9bc07dfddc0a717246842c29b79cbaa26ab24
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 19:38:32 2012 +0100
pywrap: set SWIG in config.mk
diff --git a/config.mk b/config.mk
index 53bcc7c..889944f 100644
--- a/config.mk
+++ b/config.mk
@@ -13,3 +13,5 @@ PYTHON_INCLUDE=/usr/include/python2.6
PYTHON=PYTHONPATH=$$PYTHONPATH:${PYLIBSDIR} ${PYTHON_BIN} -Werror
SWIGOPTS=-Wextra -w322,314 -I/usr/include/
+
+SWIG=swig
http://repo.or.cz/w/gfxprim.git/commit/31d264d14f9777dd0e934fedb2b0af0665a0…
commit 31d264d14f9777dd0e934fedb2b0af0665a0b3f7
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 19:36:15 2012 +0100
pywrap: simplify, clean loading, proper module names
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
index 5c62e9d..ed235bc 100644
--- a/pylib/gfxprim/loaders/__init__.py
+++ b/pylib/gfxprim/loaders/__init__.py
@@ -1,37 +1,24 @@
+from . import loaders_c
-# HACK to allow loaders_c to find core_c
-def import_loaders_c_helper():
- from os.path import dirname
- import sys
- oldpath = sys.path[:]
- sys.path.append(dirname(__file__) + '/../core')
- from . import loaders_c
- sys.path = oldpath
- return loaders_c
-loaders_c = import_loaders_c_helper()
-del import_loaders_c_helper
+def _init(module):
-# Extend Context with convenience methods
-def extend():
- from . import extend_context
+ # Extend Context with convenience methods
+ from _extend_context import extend_context
from ..core import Context
- extend_context.extend_context_class(Context)
-extend()
-del extend
+ extend_context(Context)
-# Import some members from the SWIG module
-def import_helper(module):
- from ..utils import import_members
+ # Imports from the SWIG module
import re
def strip_GP(s):
return re.sub('^GP_', '', s)
- # Functions
+ # Import functions from the SWIG module
+ from ..utils import import_members
import_members(loaders_c, module, sub=strip_GP,
exclude=[
'^w+_swigregister$',
'^core_c$',
'^_w+$'])
-import_helper(locals())
-del import_helper
+_init(locals())
+del _init
diff --git a/pylib/gfxprim/loaders/extend_context.py b/pylib/gfxprim/loaders/_extend_context.py
similarity index 85%
rename from pylib/gfxprim/loaders/extend_context.py
rename to pylib/gfxprim/loaders/_extend_context.py
index c8334ae..5e0b8c4 100644
--- a/pylib/gfxprim/loaders/extend_context.py
+++ b/pylib/gfxprim/loaders/_extend_context.py
@@ -1,20 +1,20 @@
from ..utils import extend, add_swig_getmethod, add_swig_setmethod
from . import loaders_c
-def extend_context_class(_context_class):
+def extend_context(_context):
"""
- Extends _context_class class with loader module methods for calling convenience.
+ Extends _context class with loader module methods for calling convenience.
Called once on loaders module inicialization.
"""
- @extend(_context_class, name='load')
+ @extend(_context, name='load')
@staticmethod
def Load(filename):
"Load image from given file, guess type."
c = loaders_c.GP_LoadImage_Wrap(filename)
return c
- @extend(_context_class)
+ @extend(_context)
def Save(self, filename, format=None):
"""Save the image in given format (or guess it from the extension)
diff --git a/pylib/gfxprim/loaders/loaders.swig b/pylib/gfxprim/loaders/loaders.swig
index 1f171a3..aeb5ad2 100644
--- a/pylib/gfxprim/loaders/loaders.swig
+++ b/pylib/gfxprim/loaders/loaders.swig
@@ -1,4 +1,4 @@
-%module loaders_c
+%module(package="gfxprim.loaders") loaders_c
%{
#include "core/GP_Core.h"
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 5 +-
config.mk | 2 +
pylib/_gfxprim_core_c.so | 1 -
pylib/_gfxprim_loaders_c.so | 1 -
pylib/gfxprim/Makefile | 2 +-
pylib/gfxprim/backends/__init__.py | 45 +++++++-------------
.../{extend_backend.py => _extend_backend.py} | 14 +++---
pylib/gfxprim/backends/_extend_context.py | 8 ++++
.../gfxprim/backends/{backends.swig => backends.i} | 4 +-
pylib/gfxprim/backends/extend_context.py | 8 ----
pylib/gfxprim/core/__init__.py | 22 +++++----
.../core/{extend_context.py => _extend_context.py} | 28 ++++++------
pylib/gfxprim/core/{core.swig => core.i} | 6 +-
pylib/gfxprim/{backends => filters}/C.py | 0
pylib/gfxprim/{loaders => filters}/Makefile | 2 +-
pylib/gfxprim/filters/__init__.py | 26 +++++++++++
pylib/gfxprim/filters/filters.i | 26 +++++++++++
pylib/gfxprim/{backends => gfx}/C.py | 0
pylib/gfxprim/{loaders => gfx}/Makefile | 2 +-
pylib/gfxprim/gfx/__init__.py | 27 ++++++++++++
pylib/gfxprim/gfx/gfx.i | 37 ++++++++++++++++
pylib/gfxprim/loaders/__init__.py | 35 +++++----------
.../{extend_context.py => _extend_context.py} | 8 ++--
pylib/gfxprim/loaders/{loaders.swig => loaders.i} | 4 +-
pylib/gfxprim/{backends => text}/C.py | 0
pylib/gfxprim/{loaders => text}/Makefile | 2 +-
pylib/gfxprim/text/__init__.py | 27 ++++++++++++
pylib/gfxprim/text/text.i | 23 ++++++++++
pywrap.mk | 2 +-
29 files changed, 255 insertions(+), 112 deletions(-)
delete mode 120000 pylib/_gfxprim_core_c.so
delete mode 120000 pylib/_gfxprim_loaders_c.so
rename pylib/gfxprim/backends/{extend_backend.py => _extend_backend.py} (71%)
create mode 100644 pylib/gfxprim/backends/_extend_context.py
rename pylib/gfxprim/backends/{backends.swig => backends.i} (90%)
delete mode 100644 pylib/gfxprim/backends/extend_context.py
rename pylib/gfxprim/core/{extend_context.py => _extend_context.py} (77%)
rename pylib/gfxprim/core/{core.swig => core.i} (95%)
copy pylib/gfxprim/{backends => filters}/C.py (100%)
copy pylib/gfxprim/{loaders => filters}/Makefile (84%)
create mode 100644 pylib/gfxprim/filters/__init__.py
create mode 100644 pylib/gfxprim/filters/filters.i
copy pylib/gfxprim/{backends => gfx}/C.py (100%)
copy pylib/gfxprim/{loaders => gfx}/Makefile (84%)
create mode 100644 pylib/gfxprim/gfx/__init__.py
create mode 100644 pylib/gfxprim/gfx/gfx.i
rename pylib/gfxprim/loaders/{extend_context.py => _extend_context.py} (85%)
rename pylib/gfxprim/loaders/{loaders.swig => loaders.i} (87%)
copy pylib/gfxprim/{backends => text}/C.py (100%)
copy pylib/gfxprim/{loaders => text}/Makefile (84%)
create mode 100644 pylib/gfxprim/text/__init__.py
create mode 100644 pylib/gfxprim/text/text.i
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.")
1
0
[repo.or.cz] gfxprim.git branch pywrap updated: 0aed5090e5722d19b06bf91f6652923b1127a2c9
by gavento 24 Feb '12
by gavento 24 Feb '12
24 Feb '12
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 0aed5090e5722d19b06bf91f6652923b1127a2c9 (commit)
via 96cff89699672066b2a8f18043d8455a46add474 (commit)
via 41a2719db7086efe7c888a3acc2807295bcef640 (commit)
via d6538118cb90b513bbe82c90f7aa5c23b051050b (commit)
via 85343b9e91ec90b29ea7cd3b568376154bd2b3df (commit)
via 39401ddcc823b061542a35fd3020a5de5cf182be (commit)
from ed8672e72135a52839ca300b6e1253ae9cecad1a (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/0aed5090e5722d19b06bf91f6652923b1127…
commit 0aed5090e5722d19b06bf91f6652923b1127a2c9
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 18:51:24 2012 +0100
pywrap: CamelCase the method names, strip GP_ prefix
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py
index e050008..f33aa9b 100644
--- a/pylib/gfxprim/backends/__init__.py
+++ b/pylib/gfxprim/backends/__init__.py
@@ -1,7 +1,7 @@
"""
Module wrapping GfxPrim backends.
-BIG FAT WARNING
+BIG FAT WARNING
---------------
Accessing a context after its backend has ben freed will probably
end your (program's) world
@@ -20,19 +20,20 @@ backends_c = import_backends_c_helper()
del import_backends_c_helper
# Extend Context with convenience methods
-from . import extend_context
-from ..core import Context
-extend_context.extend_context_class(Context)
-del Context
-del extend_context
+def extend():
+ from . import extend_context
+ from ..core import Context
+ extend_context.extend_context_class(Context)
+extend()
+del extend
# Pull GP_Backend
-GP_Backend = backends_c.GP_Backend
+Backend = backends_c.GP_Backend
# Extend GP_Backend with convenience methods
from . import extend_backend
-extend_backend.extend_backend_class(GP_Backend)
+extend_backend.extend_backend_class(Backend)
del extend_backend
# Constants module
@@ -41,14 +42,18 @@ from . import C
# Import some members from the SWIG module
def import_helper(module):
from ..utils import import_members
+ import re
+ def strip_GP(s):
+ return re.sub('^GP_', '', s)
# Constants
const_regexes = ['^GP_[A-Z0-9_]*$']
- import_members(backends_c, C, include=const_regexes)
+ import_members(backends_c, C, include=const_regexes, sub=strip_GP)
# Functions
- import_members(backends_c, module,
+ import_members(backends_c, module, sub=strip_GP,
exclude=const_regexes + [
+ '^GP_Backend$',
'^w+_swigregister$',
'^_w+$'])
import_helper(locals())
diff --git a/pylib/gfxprim/backends/extend_backend.py b/pylib/gfxprim/backends/extend_backend.py
index 526302f..bbd52cd 100644
--- a/pylib/gfxprim/backends/extend_backend.py
+++ b/pylib/gfxprim/backends/extend_backend.py
@@ -14,17 +14,17 @@ def extend_backend_class(_backend_class):
self.name, "" if self.thisown else "not ")
@extend(_backend_class)
- def flip(self):
+ def Flip(self):
"If display is buffered, this copies content of context onto display."
return backends_c.GP_BackendFlip(self)
@extend(_backend_class)
- def update_rect(self, rect):
+ def UpdateRect(self, rect):
"Update a rectangle on a buffered backend."
return backends_c.GP_BackendUpdateRect(self, rect[0], rect[1], rect[2], rect[3])
@extend(_backend_class)
- def poll(self):
+ def Poll(self):
"Poll the backend for events."
return backends_c.GP_BackendPoll(self)
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index d1aba53..21699f7 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -11,21 +11,25 @@ from . import C
# Import some members from the SWIG module
def import_helper(module):
+ import re
from ..utils import import_members
# Constants
const_regexes = [
'^GP_[A-Z0-9_]*$',
'^GP_PIXEL_x[A-Z0-9_]*$']
- import_members(core_c, C, include=const_regexes)
+ def strip_GP(s):
+ return re.sub('^GP_', '', s)
+ import_members(core_c, C, include=const_regexes, sub=strip_GP)
# Functions
- import_members(core_c, module,
+ import_members(core_c, module, sub=strip_GP,
exclude=const_regexes + [
'^GP_Blitw+$',
'^GP_Contextw+$',
'^GP_PixelSNPrintw+$',
'^GP_WritePixelsw+$',
+ '.*_Raw.*',
'^w+_swigregister$',
'^cvar$',
'^_w+$'])
diff --git a/pylib/gfxprim/core/extend_context.py b/pylib/gfxprim/core/extend_context.py
index b72b5d2..f8f197d 100644
--- a/pylib/gfxprim/core/extend_context.py
+++ b/pylib/gfxprim/core/extend_context.py
@@ -27,21 +27,25 @@ def extend_context_class(_context_class):
def h(self):
return core_c.GP_ContextH(self)
+ @add_swig_getmethod(_context_class)
+ def pixel_type(self):
+ return self._pixel_type
+
@extend(_context_class)
- def subcontext(self, x, y, w, h):
+ def Subcontext(self, x, y, w, h):
"Create a subcontext (rectangular view)."
c = core_c.GP_ContextSubContext(self, None, x, y, w, h)
c.parent = self
return c
@extend(_context_class)
- def copy(self, withdata):
+ def Copy(self, withdata):
"Copy the context to a new context. Pixel data are copie optionally."
flags = core_c.GP_COPY_WITH_PIXELS if withdata else 0
return core_c.GP_ContextCopy(self, flags)
@extend(_context_class)
- def convert(self, target_type):
+ def Convert(self, target_type):
"""Converts context to a different pixel type, allocates new context.
See GP_ContextConvert() for details."""
pixeltype_no = target_type ## TODO also accept PixelType
@@ -49,7 +53,7 @@ def extend_context_class(_context_class):
@extend(_context_class, name='create')
@staticmethod
- def create(w, h, pixeltype):
+ def Create(w, h, pixeltype):
"Allocate a new w*h bitmap of given type."
pixeltype_no = pixeltype if isinstance(pixeltype, int) else 0 # !!!
@@ -57,3 +61,12 @@ def extend_context_class(_context_class):
c = core_c.GP_ContextAlloc(w, h, pixeltype_no)
return c
+ @extend(_context_class)
+ def RGBToPixel(self, r, g, b):
+ "Convert RGB888 (values 0-255) to context pixel type."
+ return GP_RGBToPixel(r, g, b, self.pixel_type)
+
+ @extend(_context_class)
+ def RGBAToPixel(self, r, g, b):
+ "Convert RGBA8888 (values 0-255) to context pixel type."
+ return GP_RGBToPixel(r, g, b, self.pixel_type)
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
index 5f9de96..5c62e9d 100644
--- a/pylib/gfxprim/loaders/__init__.py
+++ b/pylib/gfxprim/loaders/__init__.py
@@ -12,18 +12,22 @@ loaders_c = import_loaders_c_helper()
del import_loaders_c_helper
# Extend Context with convenience methods
-from . import extend_context
-from ..core import Context
-extend_context.extend_context_class(Context)
-del Context
-del extend_context
+def extend():
+ from . import extend_context
+ from ..core import Context
+ extend_context.extend_context_class(Context)
+extend()
+del extend
# Import some members from the SWIG module
def import_helper(module):
from ..utils import import_members
+ import re
+ def strip_GP(s):
+ return re.sub('^GP_', '', s)
# Functions
- import_members(loaders_c, module,
+ import_members(loaders_c, module, sub=strip_GP,
exclude=[
'^w+_swigregister$',
'^core_c$',
diff --git a/pylib/gfxprim/loaders/extend_context.py b/pylib/gfxprim/loaders/extend_context.py
index a7df590..c8334ae 100644
--- a/pylib/gfxprim/loaders/extend_context.py
+++ b/pylib/gfxprim/loaders/extend_context.py
@@ -9,13 +9,13 @@ def extend_context_class(_context_class):
@extend(_context_class, name='load')
@staticmethod
- def load(filename):
+ def Load(filename):
"Load image from given file, guess type."
c = loaders_c.GP_LoadImage_Wrap(filename)
return c
@extend(_context_class)
- def save(self, filename, format=None):
+ def Save(self, filename, format=None):
"""Save the image in given format (or guess it from the extension)
Currently, JPG, PNG and P[BGP]M are supported, but not for all
diff --git a/pylib/gfxprim/utils.py b/pylib/gfxprim/utils.py
index 467eed0..4060811 100644
--- a/pylib/gfxprim/utils.py
+++ b/pylib/gfxprim/utils.py
@@ -30,7 +30,7 @@ def add_swig_setmethod(cls, name=None):
cls.__swig_setmethods__[propname] = method
return decf
-def import_members(from_, to, include=[], exclude=[]):
+def import_members(from_, to, include=[], exclude=[], sub=None):
"""Import members of `from_` to `to`. By default take all. If `exclude` is provided,
use as a filter. If `include` is provided, ONLY include those.
`include` and `exclude` are lists of regexes to match (include ^ and $)."""
@@ -56,8 +56,9 @@ def import_members(from_, to, include=[], exclude=[]):
ok = False
if ok:
+ newname = name if sub == None else sub(name)
try:
- to[name] = o
+ to[newname] = o
except TypeError:
- to.__setattr__(name, o)
+ to.__setattr__(newname, o)
http://repo.or.cz/w/gfxprim.git/commit/96cff89699672066b2a8f18043d8455a46ad…
commit 96cff89699672066b2a8f18043d8455a46add474
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 14:48:52 2012 +0100
Potentially orphaned contexts, no fix
After deleting GP_Backend, the context pointer
may still be held inside the application. This leads to EVIL.
No fix for now. Referencing the backend from the context would create
an evil uncollectable loop.
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py
index dce87e2..e050008 100644
--- a/pylib/gfxprim/backends/__init__.py
+++ b/pylib/gfxprim/backends/__init__.py
@@ -1,3 +1,12 @@
+"""
+Module wrapping GfxPrim backends.
+
+BIG FAT WARNING
+---------------
+Accessing a context after its backend has ben freed will probably
+end your (program's) world
+"""
+
# HACK to allow backends_c to find core_c
def import_backends_c_helper():
from os.path import dirname
@@ -10,6 +19,15 @@ def import_backends_c_helper():
backends_c = import_backends_c_helper()
del import_backends_c_helper
+# Extend Context with convenience methods
+from . import extend_context
+from ..core import Context
+extend_context.extend_context_class(Context)
+del Context
+del extend_context
+
+
+# Pull GP_Backend
GP_Backend = backends_c.GP_Backend
# Extend GP_Backend with convenience methods
@@ -17,6 +35,7 @@ from . import extend_backend
extend_backend.extend_backend_class(GP_Backend)
del extend_backend
+# Constants module
from . import C
# Import some members from the SWIG module
diff --git a/pylib/gfxprim/backends/extend_context.py b/pylib/gfxprim/backends/extend_context.py
new file mode 100644
index 0000000..f959547
--- /dev/null
+++ b/pylib/gfxprim/backends/extend_context.py
@@ -0,0 +1,8 @@
+from ..utils import extend, add_swig_getmethod, add_swig_setmethod
+from . import backends_c
+
+def extend_context_class(_context_class):
+ """
+ Extends _context_class class with backend support.
+ """
+ extend(_context_class, name='backend')(None)
http://repo.or.cz/w/gfxprim.git/commit/41a2719db7086efe7c888a3acc2807295bce…
commit 41a2719db7086efe7c888a3acc2807295bcef640
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 14:33:34 2012 +0100
Batch of support for backends in pywrap.
diff --git a/pylib/gfxprim/backends/C.py b/pylib/gfxprim/backends/C.py
new file mode 100644
index 0000000..c8f987f
--- /dev/null
+++ b/pylib/gfxprim/backends/C.py
@@ -0,0 +1,3 @@
+"""
+Submodule for constants
+"""
diff --git a/pylib/gfxprim/backends/Makefile b/pylib/gfxprim/backends/Makefile
new file mode 100644
index 0000000..11180f9
--- /dev/null
+++ b/pylib/gfxprim/backends/Makefile
@@ -0,0 +1,6 @@
+TOPDIR=../../..
+LIBNAME=backends
+INCLUDE=core
+LDLIBS+=-lGP_backends -lSDL
+include $(TOPDIR)/pywrap.mk
+include $(TOPDIR)/include.mk
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py
new file mode 100644
index 0000000..dce87e2
--- /dev/null
+++ b/pylib/gfxprim/backends/__init__.py
@@ -0,0 +1,36 @@
+# HACK to allow backends_c to find core_c
+def import_backends_c_helper():
+ from os.path import dirname
+ import sys
+ oldpath = sys.path[:]
+ sys.path.append(dirname(__file__) + '/../core')
+ from . import backends_c
+ sys.path = oldpath
+ return backends_c
+backends_c = import_backends_c_helper()
+del import_backends_c_helper
+
+GP_Backend = backends_c.GP_Backend
+
+# Extend GP_Backend with convenience methods
+from . import extend_backend
+extend_backend.extend_backend_class(GP_Backend)
+del extend_backend
+
+from . import C
+
+# Import some members from the SWIG module
+def import_helper(module):
+ from ..utils import import_members
+
+ # Constants
+ const_regexes = ['^GP_[A-Z0-9_]*$']
+ import_members(backends_c, C, include=const_regexes)
+
+ # Functions
+ import_members(backends_c, module,
+ exclude=const_regexes + [
+ '^w+_swigregister$',
+ '^_w+$'])
+import_helper(locals())
+del import_helper
diff --git a/pylib/gfxprim/backends/backends.swig b/pylib/gfxprim/backends/backends.swig
new file mode 100644
index 0000000..792e789
--- /dev/null
+++ b/pylib/gfxprim/backends/backends.swig
@@ -0,0 +1,46 @@
+%module backends_c
+
+%{
+#include "GP_Backend.h"
+#include "GP_Backends.h"
+%}
+
+#define __attribute__(X)
+%include <stdint.i>
+
+%feature("autodoc");
+
+%import ../core/core.swig
+
+
+/*
+ * General backend structure handling
+ */
+
+%extend GP_Backend {
+ ~GP_Backend() {
+ GP_DEBUG(2, "[wrapper] GP_BackendExit (%s)",
+ $self->name);
+ GP_BackendExit($self);
+ }
+};
+
+%ignore GP_Backend::priv;
+%ignore GP_Backend::fd_list;
+%ignore GP_BackendFD;
+
+%include "GP_Backend.h"
+
+
+/*
+ * Particular backends. We need to list every header separately.
+ */
+
+%include "GP_Backends.h"
+
+%newobject GP_BackendLinuxFBInit;
+%include "GP_LinuxFB.h"
+
+%newobject GP_BackendSDLInit;
+%include "GP_SDL.h"
+
diff --git a/pylib/gfxprim/backends/extend_backend.py b/pylib/gfxprim/backends/extend_backend.py
new file mode 100644
index 0000000..526302f
--- /dev/null
+++ b/pylib/gfxprim/backends/extend_backend.py
@@ -0,0 +1,30 @@
+from ..utils import extend, add_swig_getmethod, add_swig_setmethod
+from . import backends_c
+
+def extend_backend_class(_backend_class):
+ """
+ Extends _backend_class class with convenience methods.
+ Called once on module inicialization.
+ """
+
+ @extend(_backend_class, name='__str__')
+ @extend(_backend_class, name='__repr__')
+ def backend_str(self):
+ return "<Backend "%s", GP_Backend %sowned>" % (
+ self.name, "" if self.thisown else "not ")
+
+ @extend(_backend_class)
+ def flip(self):
+ "If display is buffered, this copies content of context onto display."
+ return backends_c.GP_BackendFlip(self)
+
+ @extend(_backend_class)
+ def update_rect(self, rect):
+ "Update a rectangle on a buffered backend."
+ return backends_c.GP_BackendUpdateRect(self, rect[0], rect[1], rect[2], rect[3])
+
+ @extend(_backend_class)
+ def poll(self):
+ "Poll the backend for events."
+ return backends_c.GP_BackendPoll(self)
+
http://repo.or.cz/w/gfxprim.git/commit/d6538118cb90b513bbe82c90f7aa5c23b051…
commit d6538118cb90b513bbe82c90f7aa5c23b051050b
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 14:30:46 2012 +0100
Add separate sub-module for constants
(replace dict)
diff --git a/pylib/gfxprim/core/C.py b/pylib/gfxprim/core/C.py
new file mode 100644
index 0000000..c8f987f
--- /dev/null
+++ b/pylib/gfxprim/core/C.py
@@ -0,0 +1,3 @@
+"""
+Submodule for constants
+"""
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index cce62d2..d1aba53 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -7,16 +7,16 @@ from . import extend_context
extend_context.extend_context_class(Context)
del extend_context
+from . import C
+
# Import some members from the SWIG module
def import_helper(module):
from ..utils import import_members
- # Constants (TODO consider a separate module)
+ # Constants
const_regexes = [
'^GP_[A-Z0-9_]*$',
'^GP_PIXEL_x[A-Z0-9_]*$']
- C = {}
- module['C'] = C
import_members(core_c, C, include=const_regexes)
# Functions
http://repo.or.cz/w/gfxprim.git/commit/85343b9e91ec90b29ea7cd3b568376154bd2…
commit 85343b9e91ec90b29ea7cd3b568376154bd2b3df
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 14:28:28 2012 +0100
Enable additional library linking for pywrap.mk
diff --git a/pywrap.mk b/pywrap.mk
index 3376c78..ab8dcf7 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -25,10 +25,10 @@ endif # VERBOSE
$(SWIG_LIB): $(SWIG_C)
ifdef VERBOSE
- $(CC) $< $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o $@
+ $(CC) $< $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
else # VERBOSE
@echo "LD $@"
- @$(CC) $< $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o $@
+ @$(CC) $< $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
endif # VERBOSE
endif # ifneq ($(SWIG),)
http://repo.or.cz/w/gfxprim.git/commit/39401ddcc823b061542a35fd3020a5de5cf1…
commit 39401ddcc823b061542a35fd3020a5de5cf182be
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 14:28:01 2012 +0100
Fix attribute setting
diff --git a/pylib/gfxprim/utils.py b/pylib/gfxprim/utils.py
index d48aa0e..467eed0 100644
--- a/pylib/gfxprim/utils.py
+++ b/pylib/gfxprim/utils.py
@@ -59,5 +59,5 @@ def import_members(from_, to, include=[], exclude=[]):
try:
to[name] = o
except TypeError:
- to.__setattribute__(name, o)
+ to.__setattr__(name, o)
-----------------------------------------------------------------------
Summary of changes:
pylib/gfxprim/backends/C.py | 3 +
pylib/gfxprim/{loaders => backends}/Makefile | 3 +-
pylib/gfxprim/backends/__init__.py | 60 ++++++++++++++++++++++++++
pylib/gfxprim/backends/backends.swig | 46 ++++++++++++++++++++
pylib/gfxprim/backends/extend_backend.py | 30 +++++++++++++
pylib/gfxprim/backends/extend_context.py | 8 +++
pylib/gfxprim/core/C.py | 3 +
pylib/gfxprim/core/__init__.py | 14 ++++--
pylib/gfxprim/core/extend_context.py | 21 +++++++--
pylib/gfxprim/loaders/__init__.py | 16 ++++---
pylib/gfxprim/loaders/extend_context.py | 4 +-
pylib/gfxprim/utils.py | 7 ++-
pywrap.mk | 4 +-
13 files changed, 196 insertions(+), 23 deletions(-)
create mode 100644 pylib/gfxprim/backends/C.py
copy pylib/gfxprim/{loaders => backends}/Makefile (65%)
create mode 100644 pylib/gfxprim/backends/__init__.py
create mode 100644 pylib/gfxprim/backends/backends.swig
create mode 100644 pylib/gfxprim/backends/extend_backend.py
create mode 100644 pylib/gfxprim/backends/extend_context.py
create mode 100644 pylib/gfxprim/core/C.py
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.")
1
0
[repo.or.cz] gfxprim.git branch pywrap updated: ed8672e72135a52839ca300b6e1253ae9cecad1a
by gavento 24 Feb '12
by gavento 24 Feb '12
24 Feb '12
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 ed8672e72135a52839ca300b6e1253ae9cecad1a (commit)
via 3fb898da008ec9e178806abe426fe79a28caa294 (commit)
via 2255767fb838329bd6c40f7b813763f652ac400f (commit)
from 3088a1c77b7ad67a580c40f65d8e9d84d218ba3d (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/ed8672e72135a52839ca300b6e1253ae9cec…
commit ed8672e72135a52839ca300b6e1253ae9cecad1a
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 01:00:50 2012 +0100
Finish importing from *_c, rename gfxprim_core_c to core_c
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index 7764673..cce62d2 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -1,4 +1,4 @@
-from . import gfxprim_core_c as core_c
+from . import core_c
Context = core_c.Context
@@ -7,14 +7,14 @@ from . import extend_context
extend_context.extend_context_class(Context)
del extend_context
+# Import some members from the SWIG module
def import_helper(module):
from ..utils import import_members
+ # Constants (TODO consider a separate module)
const_regexes = [
'^GP_[A-Z0-9_]*$',
'^GP_PIXEL_x[A-Z0-9_]*$']
-
- # Constants, consider a separate module
C = {}
module['C'] = C
import_members(core_c, C, include=const_regexes)
@@ -29,6 +29,5 @@ def import_helper(module):
'^w+_swigregister$',
'^cvar$',
'^_w+$'])
-
import_helper(locals())
del import_helper
diff --git a/pylib/gfxprim/core/gfxprim_core.swig b/pylib/gfxprim/core/core.swig
similarity index 99%
rename from pylib/gfxprim/core/gfxprim_core.swig
rename to pylib/gfxprim/core/core.swig
index 0208cec..481ab1b 100644
--- a/pylib/gfxprim/core/gfxprim_core.swig
+++ b/pylib/gfxprim/core/core.swig
@@ -1,4 +1,4 @@
-%module gfxprim_core_c
+%module core_c
%{
#include "core/GP_Core.h"
diff --git a/pylib/gfxprim/core/extend_context.py b/pylib/gfxprim/core/extend_context.py
index ecae2af..b72b5d2 100644
--- a/pylib/gfxprim/core/extend_context.py
+++ b/pylib/gfxprim/core/extend_context.py
@@ -1,5 +1,5 @@
from ..utils import extend, add_swig_getmethod, add_swig_setmethod
-from . import gfxprim_core_c as core_c
+from . import core_c
def extend_context_class(_context_class):
"""
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
index b1fd630..5f9de96 100644
--- a/pylib/gfxprim/loaders/__init__.py
+++ b/pylib/gfxprim/loaders/__init__.py
@@ -1,17 +1,33 @@
-from .. import core
-# HACK to allow gfxprim_loaders_c find gfxprim_core_c
-def import_gfxprim_loaders_c_helper():
+# HACK to allow loaders_c to find core_c
+def import_loaders_c_helper():
from os.path import dirname
import sys
oldpath = sys.path[:]
sys.path.append(dirname(__file__) + '/../core')
- from . import gfxprim_loaders_c as loaders_c
+ from . import loaders_c
sys.path = oldpath
return loaders_c
-loaders_c = import_gfxprim_loaders_c_helper()
+loaders_c = import_loaders_c_helper()
+del import_loaders_c_helper
# Extend Context with convenience methods
from . import extend_context
-extend_context.extend_context_class(core.Context)
+from ..core import Context
+extend_context.extend_context_class(Context)
+del Context
del extend_context
+
+# Import some members from the SWIG module
+def import_helper(module):
+ from ..utils import import_members
+
+ # Functions
+ import_members(loaders_c, module,
+ exclude=[
+ '^w+_swigregister$',
+ '^core_c$',
+ '^_w+$'])
+import_helper(locals())
+del import_helper
+
diff --git a/pylib/gfxprim/loaders/gfxprim_loaders.swig b/pylib/gfxprim/loaders/gfxprim_loaders.swig
deleted file mode 100644
index 5eb10e1..0000000
--- a/pylib/gfxprim/loaders/gfxprim_loaders.swig
+++ /dev/null
@@ -1,35 +0,0 @@
-%module gfxprim_loaders_c
-
-%{
-#include "core/GP_Core.h"
-#include "loaders/GP_Loaders.h"
-%}
-
-#define __attribute__(X)
-
-%import ../core/gfxprim_core.swig
-
-%include <stdint.i>
-
-%nodefaultctor;
-
-%include "GP_Loaders.h"
-
-%{
-GP_Context *GP_LoadImage_SWIG(const char *src_path)
-{
- GP_Context *c = NULL;
- if (GP_LoadImage(src_path, &c, NULL) != 0)
- return NULL;
- return c;
-}
-%}
-
-GP_Context *GP_LoadImage_SWIG(const char *src_path);
-
-%include "GP_JPG.h"
-%include "GP_PBM.h"
-%include "GP_PGM.h"
-%include "GP_PPM.h"
-%include "GP_PNG.h"
-
diff --git a/pywrap.mk b/pywrap.mk
index c99293d..3376c78 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -2,15 +2,20 @@ ifndef LIBNAME
$(error LIBNAME not defined, fix your library Makefile)
endif
+SWIG_SRC=$(LIBNAME).swig
+SWIG_PY=$(LIBNAME)_c.py
+SWIG_C=$(LIBNAME)_wrap.c
+SWIG_LIB=_$(LIBNAME)_c.so
+
include $(TOPDIR)/config.gen.mk
ifneq ($(SWIG),)
INCLUDES+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE))
-all: _gfxprim_$(LIBNAME)_c.so gfxprim_$(LIBNAME)_c.py
+all: $(SWIG_LIB) $(SWIG_PY)
-gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py: gfxprim_$(LIBNAME).swig
+$(SWIG_C) $(SWIG_PY): $(SWIG_SRC)
ifdef VERBOSE
$(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
else # VERBOSE
@@ -18,14 +23,14 @@ else # VERBOSE
@$(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
endif # VERBOSE
-_gfxprim_$(LIBNAME)_c.so: gfxprim_$(LIBNAME)_wrap.c
+$(SWIG_LIB): $(SWIG_C)
ifdef VERBOSE
- $(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
+ $(CC) $< $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o $@
else # VERBOSE
@echo "LD $@"
- @$(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
+ @$(CC) $< $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o $@
endif # VERBOSE
endif # ifneq ($(SWIG),)
-CLEAN+=gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py _gfxprim_$(LIBNAME)_c.so
+CLEAN+=$(SWIG_C) $(SWIG_PY) $(SWIG_LIB)
http://repo.or.cz/w/gfxprim.git/commit/3fb898da008ec9e178806abe426fe79a28ca…
commit 3fb898da008ec9e178806abe426fe79a28caa294
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 00:58:19 2012 +0100
Rename GP_LoadImage_SWIG to GP_LoadImage_Wrap
diff --git a/pylib/gfxprim/loaders/extend_context.py b/pylib/gfxprim/loaders/extend_context.py
index 1ea7aeb..a7df590 100644
--- a/pylib/gfxprim/loaders/extend_context.py
+++ b/pylib/gfxprim/loaders/extend_context.py
@@ -1,5 +1,5 @@
from ..utils import extend, add_swig_getmethod, add_swig_setmethod
-from . import gfxprim_loaders_c as loaders_c
+from . import loaders_c
def extend_context_class(_context_class):
"""
@@ -11,7 +11,7 @@ def extend_context_class(_context_class):
@staticmethod
def load(filename):
"Load image from given file, guess type."
- c = loaders_c.GP_LoadImage_SWIG(filename)
+ c = loaders_c.GP_LoadImage_Wrap(filename)
return c
@extend(_context_class)
diff --git a/pylib/gfxprim/loaders/loaders.swig b/pylib/gfxprim/loaders/loaders.swig
new file mode 100644
index 0000000..1f171a3
--- /dev/null
+++ b/pylib/gfxprim/loaders/loaders.swig
@@ -0,0 +1,35 @@
+%module loaders_c
+
+%{
+#include "core/GP_Core.h"
+#include "loaders/GP_Loaders.h"
+%}
+
+#define __attribute__(X)
+
+%import ../core/core.swig
+
+%include <stdint.i>
+
+%nodefaultctor;
+
+%include "GP_Loaders.h"
+
+%{
+GP_Context *GP_LoadImage_Wrap(const char *src_path)
+{
+ GP_Context *c = NULL;
+ if (GP_LoadImage(src_path, &c, NULL) != 0)
+ return NULL;
+ return c;
+}
+%}
+
+GP_Context *GP_LoadImage_Wrap(const char *src_path);
+
+%include "GP_JPG.h"
+%include "GP_PBM.h"
+%include "GP_PGM.h"
+%include "GP_PPM.h"
+%include "GP_PNG.h"
+
http://repo.or.cz/w/gfxprim.git/commit/2255767fb838329bd6c40f7b813763f652ac…
commit 2255767fb838329bd6c40f7b813763f652ac400f
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Feb 24 00:30:41 2012 +0100
Basic context extending and improting SWIG functions
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index e69de29..7764673 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -0,0 +1,34 @@
+from . import gfxprim_core_c as core_c
+
+Context = core_c.Context
+
+# Extend Context with convenience methods
+from . import extend_context
+extend_context.extend_context_class(Context)
+del extend_context
+
+def import_helper(module):
+ from ..utils import import_members
+
+ const_regexes = [
+ '^GP_[A-Z0-9_]*$',
+ '^GP_PIXEL_x[A-Z0-9_]*$']
+
+ # Constants, consider a separate module
+ C = {}
+ module['C'] = C
+ import_members(core_c, C, include=const_regexes)
+
+ # Functions
+ import_members(core_c, module,
+ exclude=const_regexes + [
+ '^GP_Blitw+$',
+ '^GP_Contextw+$',
+ '^GP_PixelSNPrintw+$',
+ '^GP_WritePixelsw+$',
+ '^w+_swigregister$',
+ '^cvar$',
+ '^_w+$'])
+
+import_helper(locals())
+del import_helper
diff --git a/pylib/gfxprim/core/context.py b/pylib/gfxprim/core/context.py
deleted file mode 100644
index d65008a..0000000
--- a/pylib/gfxprim/core/context.py
+++ /dev/null
@@ -1,121 +0,0 @@
-import gfxprim_core_c as core
-import gfxprim_loaders_c as loaders
-
-def extend(cls, name=None):
- def decf(method):
- funname = name
- if not funname:
- funname = method.__name__
- type.__setattr__(cls, funname, method)
- return method
- return decf
-
-def add_swig_getmethod(cls, name=None):
- def decf(method):
- propname = name
- if not propname:
- propname = method.__name__
- cls.__swig_getmethods__[propname] = method
- return decf
-
-def add_swig_setmethod(cls, name=None):
- def decf(method):
- propname = name
- if not propname:
- propname = method.__name__
- cls.__swig_setmethods__[propname] = method
- return decf
-
-
-def extend_context_class(_context_class = core.Context):
- """
- Extends _context_class class with convenience methods.
- Called on module inicialization.
- """
-
- # Add "parent" attribute
- extend(_context_class, name='parent')(None)
-
- @extend(_context_class, name='__str__')
- @extend(_context_class, name='__repr__')
- def context_str(self):
- return "<Context %dx%d, %dbpp, GP_Context %sowned, %s parent>" % (
- self.w, self.h, self._bpp,
- "" if self.thisown else "not ",
- "with" if self.parent else "no")
-
- @add_swig_getmethod(_context_class)
- def w(self):
- return core.GP_ContextW(self)
-
- @add_swig_getmethod(_context_class)
- def h(self):
- return core.GP_ContextH(self)
-
- @extend(_context_class)
- def subcontext(self, x, y, w, h):
- "Create a subcontext (rectangular view)."
- c = core.GP_ContextSubContext(self, None, x, y, w, h)
- c.parent = self
- return c
-
- @extend(_context_class)
- def copy(self, withdata):
- "Copy the context to a new context. Pixel data are copie optionally."
- flags = core.GP_COPY_WITH_PIXELS if withdata else 0
- return core.GP_ContextCopy(self, flags)
-
- @extend(_context_class)
- def convert(self, target_type):
- """Converts context to a different pixel type, allocates new context.
- See GP_ContextConvert() for details."""
- pixeltype_no = target_type ## TODO also accept PixelType
- return core.GP_ContextConvert(self, pixeltype_no)
-
-
- @extend(_context_class)
- def save(self, filename, format=None):
- """Save the image in given format (or guess it from the extension)
-
- Currently, JPG, PNG and P[BGP]M are supported, but not for all
- context pixel types.
- """
- if not format:
- format = filename.rsplit('.', 1)[-1]
- format = format.lower()
- if format == 'jpg':
- res = loaders.GP_SaveJPG(filename, self, None)
- elif format == 'png':
- res = loaders.GP_SavePNG(filename, self, None)
- elif format == 'pbm':
- res = loaders.GP_SavePBM(filename, self, None)
- elif format == 'pgm':
- res = loaders.GP_SavePGM(filename, self, None)
- elif format == 'ppm':
- res = loaders.GP_SavePPM(filename, self, None)
- else:
- raise Exception("Format %r not supported.", format)
- if res != 0:
- raise Exception("Error saving %r (code %d)", filename, res)
-
- @extend(_context_class, name='create')
- @staticmethod
- def create(w, h, pixeltype):
- "Allocate a new w*h bitmap of given type."
-
- pixeltype_no = pixeltype if isinstance(pixeltype, int) else 0 # !!!
- # TODO: actually accept a PixelType
- c = core.GP_ContextAlloc(w, h, pixeltype_no)
- return c
-
- @extend(_context_class, name='load')
- @staticmethod
- def load(filename):
- "Load image from given file, guess type."
- c = loaders.GP_LoadImage_SWIG(filename)
- return c
-
-
-
-extend_context_class()
-
diff --git a/pylib/gfxprim/core/extend_context.py b/pylib/gfxprim/core/extend_context.py
new file mode 100644
index 0000000..ecae2af
--- /dev/null
+++ b/pylib/gfxprim/core/extend_context.py
@@ -0,0 +1,59 @@
+from ..utils import extend, add_swig_getmethod, add_swig_setmethod
+from . import gfxprim_core_c as core_c
+
+def extend_context_class(_context_class):
+ """
+ Extends _context_class class with core module methods and properties
+ for object-oriented usage.
+ Called once on module inicialization.
+ """
+
+ # Add "parent" attribute
+ extend(_context_class, name='parent')(None)
+
+ @extend(_context_class, name='__str__')
+ @extend(_context_class, name='__repr__')
+ def context_str(self):
+ return "<Context %dx%d, %dbpp, GP_Context %sowned, %s parent>" % (
+ self.w, self.h, self._bpp,
+ "" if self.thisown else "not ",
+ "with" if self.parent else "no")
+
+ @add_swig_getmethod(_context_class)
+ def w(self):
+ return core_c.GP_ContextW(self)
+
+ @add_swig_getmethod(_context_class)
+ def h(self):
+ return core_c.GP_ContextH(self)
+
+ @extend(_context_class)
+ def subcontext(self, x, y, w, h):
+ "Create a subcontext (rectangular view)."
+ c = core_c.GP_ContextSubContext(self, None, x, y, w, h)
+ c.parent = self
+ return c
+
+ @extend(_context_class)
+ def copy(self, withdata):
+ "Copy the context to a new context. Pixel data are copie optionally."
+ flags = core_c.GP_COPY_WITH_PIXELS if withdata else 0
+ return core_c.GP_ContextCopy(self, flags)
+
+ @extend(_context_class)
+ def convert(self, target_type):
+ """Converts context to a different pixel type, allocates new context.
+ See GP_ContextConvert() for details."""
+ pixeltype_no = target_type ## TODO also accept PixelType
+ return core_c.GP_ContextConvert(self, pixeltype_no)
+
+ @extend(_context_class, name='create')
+ @staticmethod
+ def create(w, h, pixeltype):
+ "Allocate a new w*h bitmap of given type."
+
+ pixeltype_no = pixeltype if isinstance(pixeltype, int) else 0 # !!!
+ # TODO: actually accept a PixelType
+ c = core_c.GP_ContextAlloc(w, h, pixeltype_no)
+ return c
+
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
index e69de29..b1fd630 100644
--- a/pylib/gfxprim/loaders/__init__.py
+++ b/pylib/gfxprim/loaders/__init__.py
@@ -0,0 +1,17 @@
+from .. import core
+
+# HACK to allow gfxprim_loaders_c find gfxprim_core_c
+def import_gfxprim_loaders_c_helper():
+ from os.path import dirname
+ import sys
+ oldpath = sys.path[:]
+ sys.path.append(dirname(__file__) + '/../core')
+ from . import gfxprim_loaders_c as loaders_c
+ sys.path = oldpath
+ return loaders_c
+loaders_c = import_gfxprim_loaders_c_helper()
+
+# Extend Context with convenience methods
+from . import extend_context
+extend_context.extend_context_class(core.Context)
+del extend_context
diff --git a/pylib/gfxprim/loaders/extend_context.py b/pylib/gfxprim/loaders/extend_context.py
new file mode 100644
index 0000000..1ea7aeb
--- /dev/null
+++ b/pylib/gfxprim/loaders/extend_context.py
@@ -0,0 +1,41 @@
+from ..utils import extend, add_swig_getmethod, add_swig_setmethod
+from . import gfxprim_loaders_c as loaders_c
+
+def extend_context_class(_context_class):
+ """
+ Extends _context_class class with loader module methods for calling convenience.
+ Called once on loaders module inicialization.
+ """
+
+ @extend(_context_class, name='load')
+ @staticmethod
+ def load(filename):
+ "Load image from given file, guess type."
+ c = loaders_c.GP_LoadImage_SWIG(filename)
+ return c
+
+ @extend(_context_class)
+ def save(self, filename, format=None):
+ """Save the image in given format (or guess it from the extension)
+
+ Currently, JPG, PNG and P[BGP]M are supported, but not for all
+ context pixel types.
+ """
+ if not format:
+ format = filename.rsplit('.', 1)[-1]
+ format = format.lower()
+ if format == 'jpg':
+ res = loaders_c.GP_SaveJPG(filename, self, None)
+ elif format == 'png':
+ res = loaders_c.GP_SavePNG(filename, self, None)
+ elif format == 'pbm':
+ res = loaders_c.GP_SavePBM(filename, self, None)
+ elif format == 'pgm':
+ res = loaders_c.GP_SavePGM(filename, self, None)
+ elif format == 'ppm':
+ res = loaders_c.GP_SavePPM(filename, self, None)
+ else:
+ raise Exception("Format %r not supported.", format)
+ if res != 0:
+ raise Exception("Error saving %r (code %d)", filename, res)
+
diff --git a/pylib/gfxprim/utils.py b/pylib/gfxprim/utils.py
new file mode 100644
index 0000000..d48aa0e
--- /dev/null
+++ b/pylib/gfxprim/utils.py
@@ -0,0 +1,63 @@
+"""
+Utility methods for polishing SWIGified gfxprim.
+"""
+
+def extend(cls, name=None):
+ "Decorator extending a class with a function"
+ def decf(method):
+ funname = name
+ if not funname:
+ funname = method.__name__
+ type.__setattr__(cls, funname, method)
+ return method
+ return decf
+
+def add_swig_getmethod(cls, name=None):
+ "Decorator to add a property get method to a SWIG-defined class"
+ def decf(method):
+ propname = name
+ if not propname:
+ propname = method.__name__
+ cls.__swig_getmethods__[propname] = method
+ return decf
+
+def add_swig_setmethod(cls, name=None):
+ "Decorator to add a property set method to a SWIG-defined class"
+ def decf(method):
+ propname = name
+ if not propname:
+ propname = method.__name__
+ cls.__swig_setmethods__[propname] = method
+ return decf
+
+def import_members(from_, to, include=[], exclude=[]):
+ """Import members of `from_` to `to`. By default take all. If `exclude` is provided,
+ use as a filter. If `include` is provided, ONLY include those.
+ `include` and `exclude` are lists of regexes to match (include ^ and $)."""
+ assert not (include and exclude)
+ import re
+ il = map(re.compile, include)
+ el = map(re.compile, exclude)
+ for name in dir(from_):
+ try:
+ o = from_[name]
+ except TypeError:
+ o = from_.__getattribute__(name)
+
+ ok = True
+ if il:
+ ok = False
+ for x in il:
+ if x.match(name):
+ ok = True
+ if el:
+ for x in el:
+ if x.match(name):
+ ok = False
+
+ if ok:
+ try:
+ to[name] = o
+ except TypeError:
+ to.__setattribute__(name, o)
+
-----------------------------------------------------------------------
Summary of changes:
pylib/gfxprim/core/__init__.py | 33 ++++++
pylib/gfxprim/core/context.py | 121 --------------------
.../gfxprim/core/{gfxprim_core.swig => core.swig} | 2 +-
pylib/gfxprim/core/extend_context.py | 59 ++++++++++
pylib/gfxprim/loaders/__init__.py | 33 ++++++
pylib/gfxprim/loaders/extend_context.py | 41 +++++++
.../loaders/{gfxprim_loaders.swig => loaders.swig} | 8 +-
pylib/gfxprim/utils.py | 63 ++++++++++
pywrap.mk | 17 ++-
9 files changed, 245 insertions(+), 132 deletions(-)
delete mode 100644 pylib/gfxprim/core/context.py
rename pylib/gfxprim/core/{gfxprim_core.swig => core.swig} (99%)
create mode 100644 pylib/gfxprim/core/extend_context.py
create mode 100644 pylib/gfxprim/loaders/extend_context.py
rename pylib/gfxprim/loaders/{gfxprim_loaders.swig => loaders.swig} (68%)
create mode 100644 pylib/gfxprim/utils.py
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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: bac5c04edb39e16dd0632b1d900daa77d350bdb1
by gavento 23 Feb '12
by gavento 23 Feb '12
23 Feb '12
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 bac5c04edb39e16dd0632b1d900daa77d350bdb1 (commit)
via 7cb9b250da3dd979a43169cd7fdb47c0dbcb1437 (commit)
from 5fe09088bb3606b059aab62e0decdb05e122e34f (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/bac5c04edb39e16dd0632b1d900daa77d350…
commit bac5c04edb39e16dd0632b1d900daa77d350bdb1
Merge: 7cb9b25 5fe0908
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Feb 23 12:49:34 2012 +0100
Merge branch 'master' of ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/7cb9b250da3dd979a43169cd7fdb47c0dbcb…
commit 7cb9b250da3dd979a43169cd7fdb47c0dbcb1437
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Feb 23 12:43:50 2012 +0100
Minor readout improvement
diff --git a/Makefile b/Makefile
index 142c98c..6337e40 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ clean:
ifdef VERBOSE
$(MAKE) -C build clean
else
- @echo "/build"
+ @echo "DIR /build"
@$(MAKE) --no-print-directory -C build clean
endif
@@ -32,7 +32,7 @@ ifdef VERBOSE
$(MAKE) clean
else
@$(MAKE) clean
- @rm config.h config.gen.mk
+ @rm config.h config.gen.mk
endif
HEADER_LOC=/usr/include/
-----------------------------------------------------------------------
Summary of changes:
Makefile | 4 ++--
1 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.")
1
0
[repo.or.cz] gfxprim.git branch pywrap updated: 3088a1c77b7ad67a580c40f65d8e9d84d218ba3d
by gavento 23 Feb '12
by gavento 23 Feb '12
23 Feb '12
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 3088a1c77b7ad67a580c40f65d8e9d84d218ba3d (commit)
via 4e3bac15c5bd717e954cb7c431a12b6583691347 (commit)
via 33609c5ab7aabd7b13a1d013cb849e2ef21ddb32 (commit)
via ca726c8da26dfd21e5abd6f197ab3473b5133695 (commit)
from 88080e9a2b9c406de4214a878cc42bc478785132 (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/3088a1c77b7ad67a580c40f65d8e9d84d218…
commit 3088a1c77b7ad67a580c40f65d8e9d84d218ba3d
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Feb 23 12:26:35 2012 +0100
Add SWIGOPTS, supress selected SWIG warnings
diff --git a/config.mk b/config.mk
index b29461d..53bcc7c 100644
--- a/config.mk
+++ b/config.mk
@@ -11,3 +11,5 @@ PYTHON_INCLUDE=/usr/include/python2.6
# Command to run Python with pylib/ modules
PYTHON=PYTHONPATH=$$PYTHONPATH:${PYLIBSDIR} ${PYTHON_BIN} -Werror
+
+SWIGOPTS=-Wextra -w322,314 -I/usr/include/
diff --git a/pywrap.mk b/pywrap.mk
index b73a1d4..c99293d 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -12,18 +12,18 @@ all: _gfxprim_$(LIBNAME)_c.so gfxprim_$(LIBNAME)_c.py
gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py: gfxprim_$(LIBNAME).swig
ifdef VERBOSE
- $(SWIG) -python -Wall -I/usr/include/ $(INCLUDES) $<
+ $(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
else # VERBOSE
@echo "SWIG $(LIBNAME)"
- @$(SWIG) -python -Wall -I/usr/include/ $(INCLUDES) $<
+ @$(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
endif # VERBOSE
_gfxprim_$(LIBNAME)_c.so: gfxprim_$(LIBNAME)_wrap.c
ifdef VERBOSE
- $(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) -dPIC --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
+ $(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
else # VERBOSE
@echo "LD $@"
- @$(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) -dPIC --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
+ @$(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
endif # VERBOSE
endif # ifneq ($(SWIG),)
http://repo.or.cz/w/gfxprim.git/commit/4e3bac15c5bd717e954cb7c431a12b658369…
commit 4e3bac15c5bd717e954cb7c431a12b6583691347
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Feb 23 10:46:58 2012 +0100
Always use CLEAN+= in pywrap.mk
diff --git a/pywrap.mk b/pywrap.mk
index aac3901..b73a1d4 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -13,18 +13,19 @@ all: _gfxprim_$(LIBNAME)_c.so gfxprim_$(LIBNAME)_c.py
gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py: gfxprim_$(LIBNAME).swig
ifdef VERBOSE
$(SWIG) -python -Wall -I/usr/include/ $(INCLUDES) $<
-else
+else # VERBOSE
@echo "SWIG $(LIBNAME)"
@$(SWIG) -python -Wall -I/usr/include/ $(INCLUDES) $<
-endif
+endif # VERBOSE
_gfxprim_$(LIBNAME)_c.so: gfxprim_$(LIBNAME)_wrap.c
ifdef VERBOSE
$(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) -dPIC --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
-else
+else # VERBOSE
@echo "LD $@"
@$(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) -dPIC --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
-endif
+endif # VERBOSE
+
+endif # ifneq ($(SWIG),)
CLEAN+=gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py _gfxprim_$(LIBNAME)_c.so
-endif
http://repo.or.cz/w/gfxprim.git/commit/33609c5ab7aabd7b13a1d013cb849e2ef21d…
commit 33609c5ab7aabd7b13a1d013cb849e2ef21ddb32
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Feb 23 10:38:27 2012 +0100
Make pywrap compile properly, include into Makefiles
* Fix pywrap.mk
diff --git a/config.mk b/config.mk
index 9718669..b29461d 100644
--- a/config.mk
+++ b/config.mk
@@ -4,6 +4,8 @@ CFLAGS+=-I$(TOPDIR)/include/
# path to local module directory
PYLIBSDIR=$(TOPDIR)/pylib
+PYTHON_INCLUDE=/usr/include/python2.6
+
# To test with other python versions (example):
#PYTHON_BIN=${TOPDIR}/virtualpy2.4/bin/python
diff --git a/include/core/Makefile b/include/core/Makefile
index bf82884..7eb72be 100644
--- a/include/core/Makefile
+++ b/include/core/Makefile
@@ -1,7 +1,7 @@
TOPDIR=../..
GENHEADERS=GP_Convert_Scale.gen.h GP_Pixel.gen.h GP_GetPutPixel.gen.h GP_Convert.gen.h GP_FnPerBpp.gen.h - GP_MixPixels.gen.h GP_GammaCorrection.gen.h
+ GP_MixPixels.gen.h GP_GammaCorrection.gen.h
LIBNAME=core
include $(TOPDIR)/gen.mk
include $(TOPDIR)/include.mk
diff --git a/pylib/Makefile b/pylib/Makefile
index 2d01e96..6186075 100644
--- a/pylib/Makefile
+++ b/pylib/Makefile
@@ -1,4 +1,5 @@
TOPDIR=..
+SUBDIRS=gfxprim
#
# Add .pyc files to CLEAN list
@@ -9,3 +10,4 @@ include $(TOPDIR)/include.mk
all:
@true
+
diff --git a/pylib/gfxprim/Makefile b/pylib/gfxprim/Makefile
index 1004920..f5bf693 100644
--- a/pylib/gfxprim/Makefile
+++ b/pylib/gfxprim/Makefile
@@ -1,3 +1,3 @@
-TOPDIR=..
+TOPDIR=../..
SUBDIRS=core loaders
include $(TOPDIR)/include.mk
diff --git a/pylib/gfxprim/core/Makefile b/pylib/gfxprim/core/Makefile
index eb25047..312df53 100644
--- a/pylib/gfxprim/core/Makefile
+++ b/pylib/gfxprim/core/Makefile
@@ -1,4 +1,4 @@
-TOPDIR=../..
+TOPDIR=../../..
LIBNAME=core
include $(TOPDIR)/pywrap.mk
include $(TOPDIR)/include.mk
diff --git a/pylib/gfxprim/loaders/Makefile b/pylib/gfxprim/loaders/Makefile
index b599253..196c9c1 100644
--- a/pylib/gfxprim/loaders/Makefile
+++ b/pylib/gfxprim/loaders/Makefile
@@ -1,4 +1,4 @@
-TOPDIR=../..
+TOPDIR=../../..
LIBNAME=loaders
INCLUDE=core
include $(TOPDIR)/pywrap.mk
diff --git a/pywrap.mk b/pywrap.mk
index fd60b0f..aac3901 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -8,27 +8,23 @@ ifneq ($(SWIG),)
INCLUDES+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE))
-all: _gfxprim_$(LIBNAME)_c.so
+all: _gfxprim_$(LIBNAME)_c.so gfxprim_$(LIBNAME)_c.py
-gfxprim_$(LIBNAME).c: gfxprim_$(LIBNAME).swig
-
-gfxprim_$(LIBNAME).c: %.c: %.swig
+gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py: gfxprim_$(LIBNAME).swig
ifdef VERBOSE
$(SWIG) -python -Wall -I/usr/include/ $(INCLUDES) $<
- cp gfxprim_$(LIBNAME)_c.py ../../pylib/
else
@echo "SWIG $(LIBNAME)"
@$(SWIG) -python -Wall -I/usr/include/ $(INCLUDES) $<
- @cp gfxprim_$(LIBNAME)_c.py ../../pylib/
endif
-_gfxprim_$(LIBNAME)_c.so: gfxprim_$(LIBNAME).c
+_gfxprim_$(LIBNAME)_c.so: gfxprim_$(LIBNAME)_wrap.c
ifdef VERBOSE
- $(CC) -fPIC -dPIC --shared -Wall -lGP -lpng -ljpeg -lm -ldl -o _gfxprim_$(LIBNAME)_c.so
+ $(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) -dPIC --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
else
@echo "LD $@"
- @$(CC) -fPIC -dPIC --shared -Wall -lGP -lpng -ljpeg -lm -ldl -o _gfxprim_$(LIBNAME)_c.so
+ @$(CC) gfxprim_$(LIBNAME)_wrap.c $(CFLAGS) $(LDFLAGS) -I$(PYTHON_INCLUDE) -dPIC --shared -lGP -L$(TOPDIR)/build/ -o _gfxprim_$(LIBNAME)_c.so
endif
-CLEAN+=gfxprim_$(LIBNAME).c gfxprim_$(LIBNAME)_c.py gfxprim_$(LIBNAME)_wrap.c _gfxprim_$(LIBNAME)_c.so
+CLEAN+=gfxprim_$(LIBNAME)_wrap.c gfxprim_$(LIBNAME)_c.py _gfxprim_$(LIBNAME)_c.so
endif
http://repo.or.cz/w/gfxprim.git/commit/ca726c8da26dfd21e5abd6f197ab3473b513…
commit ca726c8da26dfd21e5abd6f197ab3473b5133695
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Feb 23 10:36:56 2012 +0100
Move pywrap into pylib/gfxprim
diff --git a/Makefile b/Makefile
index 2fcd174..142c98c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
TOPDIR=.
-SUBDIRS=include libs tests pylib demos pywrap
+SUBDIRS=include libs tests pylib demos
include include.mk
#
diff --git a/pylib/gfxprim/Makefile b/pylib/gfxprim/Makefile
index 03e42fa..1004920 100644
--- a/pylib/gfxprim/Makefile
+++ b/pylib/gfxprim/Makefile
@@ -1,16 +1,3 @@
-TOPDIR=../..
-
+TOPDIR=..
+SUBDIRS=core loaders
include $(TOPDIR)/include.mk
-
-# Core
-core/gfxprim_core_c.py core/gfxprim_core_wrap.c: $(TOPDIR)/include/core/gfxprim_core.swig
- swig -python -Wall -I/usr/include/ - $(TOPDIR)/include/core/gfxprim_core.swig
-
-$(TOPDIR)/build/_gfxprim_core_c.so: core/gfxprim_core_wrap.c
- gcc -shared core/gfxprim_core_wrap.c -L $(TOPDIR)/build/ -I /usr/include/python2.6/ -I$(TOPDIR)/include/ - -fPIC -Wall -lGP -lpng -ljpeg -lm -ldl -o $(TOPDIR)/build/_gfxprim_core_c.so
-
-
-all: $(TOPDIR)/build/_gfxprim_core_c.so
-
diff --git a/pywrap/core/Makefile b/pylib/gfxprim/core/Makefile
similarity index 100%
rename from pywrap/core/Makefile
rename to pylib/gfxprim/core/Makefile
diff --git a/pywrap/core/gfxprim_core.swig b/pylib/gfxprim/core/gfxprim_core.swig
similarity index 100%
rename from pywrap/core/gfxprim_core.swig
rename to pylib/gfxprim/core/gfxprim_core.swig
diff --git a/pywrap/loaders/Makefile b/pylib/gfxprim/loaders/Makefile
similarity index 100%
rename from pywrap/loaders/Makefile
rename to pylib/gfxprim/loaders/Makefile
diff --git a/pywrap/loaders/gfxprim_loaders.swig b/pylib/gfxprim/loaders/gfxprim_loaders.swig
similarity index 100%
rename from pywrap/loaders/gfxprim_loaders.swig
rename to pylib/gfxprim/loaders/gfxprim_loaders.swig
diff --git a/pywrap/Makefile b/pywrap/Makefile
deleted file mode 100644
index 1004920..0000000
--- a/pywrap/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-TOPDIR=..
-SUBDIRS=core loaders
-include $(TOPDIR)/include.mk
diff --git a/pywrap/loaders/gfxprim_loaders_c.so b/pywrap/loaders/gfxprim_loaders_c.so
deleted file mode 100755
index b809122..0000000
Binary files a/pywrap/loaders/gfxprim_loaders_c.so and /dev/null differ
-----------------------------------------------------------------------
Summary of changes:
Makefile | 2 +-
config.mk | 4 ++
include/core/Makefile | 2 +-
pylib/Makefile | 2 +
pylib/gfxprim/Makefile | 15 +---------
{pywrap => pylib/gfxprim}/core/Makefile | 2 +-
{pywrap => pylib/gfxprim}/core/gfxprim_core.swig | 0
{pywrap => pylib/gfxprim}/loaders/Makefile | 2 +-
.../gfxprim}/loaders/gfxprim_loaders.swig | 0
pywrap.mk | 31 +++++++++-----------
pywrap/Makefile | 3 --
pywrap/loaders/gfxprim_loaders_c.so | Bin 6141 -> 0 bytes
12 files changed, 25 insertions(+), 38 deletions(-)
rename {pywrap => pylib/gfxprim}/core/Makefile (81%)
rename {pywrap => pylib/gfxprim}/core/gfxprim_core.swig (100%)
rename {pywrap => pylib/gfxprim}/loaders/Makefile (84%)
rename {pywrap => pylib/gfxprim}/loaders/gfxprim_loaders.swig (100%)
delete mode 100644 pywrap/Makefile
delete mode 100755 pywrap/loaders/gfxprim_loaders_c.so
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.")
1
0
[repo.or.cz] gfxprim.git branch pywrap updated: 88080e9a2b9c406de4214a878cc42bc478785132
by gavento 22 Feb '12
by gavento 22 Feb '12
22 Feb '12
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 88080e9a2b9c406de4214a878cc42bc478785132 (commit)
via 1832d27ef46a9075db864ed0c5dee236ce1ac940 (commit)
via ca4d1e00c41ace34e8db1f806204fe0aa36dc0d9 (commit)
via 967e802a258863e45da3f143f66d298cb5201824 (commit)
via 61a39f1c06288ddae8c94a7c1c2e363d14619839 (commit)
via 07d8a923162114629fa898af720d16e41160285d (commit)
via 567aafbadcf454ab32ea74f81d6dba8cd872e1d2 (commit)
via e0d46203381e3dd146a17fe0078af68a1d2e8b40 (commit)
via 923ee620ce7cc8acf847c29b9da82ba5899ae520 (commit)
via 6b71d7fd13d9e9f9bd596d75e07d196c8042205c (commit)
via 188e3a319e7a0f9eb12cfd5d06a0ac7aa996d771 (commit)
via b3b9438ff87b573ce38bde2602edb0b07086560d (commit)
via 1434e01b44e30a1e00c7f10d92d87304ce7f8f3a (commit)
via 7d9c51d82767ee65ed41023f8851ba8e89d1e1e5 (commit)
via ef3231da764cd212ba973958aafd57ce1c286ce6 (commit)
via 584ef7b40c75f90ad55347dac6e4fd95a4ff54af (commit)
via 565271d45d92a19f90b6f8ec637e8626fe8c1f0f (commit)
via 6e4677159b0d9febdd48f359e335277b53991093 (commit)
via 8c91f2055c2d8a0f47593811e9ddb7261234d7b2 (commit)
via 8dafb4ba1c30fc36d48f86e166212af3b7cf329c (commit)
via 763bca3b9ac509c837ca940dcede58e58b86d21b (commit)
via 02901b7585b1265cedf68d019e7eb8ec5263c5a7 (commit)
via d170475005b04f6e2a1d69283760c0bc03bc4d64 (commit)
via 173957cead4c3099479976cfd3a5b62f3d2b0f56 (commit)
via e659d64782d1f5d6c93fc1547c81d941b5ea45bc (commit)
via c9a9d19055f9add550845b8e3c9050e7e32467c2 (commit)
via b98ab667d547b2de4ad9d8fdb2c5d1dee4e65419 (commit)
via 4c14716c974906c490a2f96bdbd0cef840fe1812 (commit)
via c5bfa31f9116879d4bf934536c238427fb5c0f19 (commit)
via 52bed540fa7128ba565a2a6ab8bb3f91674c04d1 (commit)
via 7949b70ee58a7ce28bf21767e1b29efe56ef68e0 (commit)
via 076239276ea6205aaf69d5338bfd529d40592c4b (commit)
via 2954919a806b005e125f1bc08542dc38f94138c8 (commit)
via 504c3a5c6858d9af39bc640b2a16638b984226a7 (commit)
via 150058b75f541d901eda178e485d65112ab77e5b (commit)
via cb293ded8c994e9df465ad5af0b0777def55f680 (commit)
via 89d86e0b6926dd8f6a5f650a89920e104ea52b00 (commit)
via 995986f457f6cc5d2ea615622cb6d3a310f51e9d (commit)
via 9b6212e7e083c6a78dca9cf322553c27baea66b2 (commit)
via d17743a7cfa2617c5f50d47f801f8722480553fc (commit)
via 66cbe1a3b25ba7d4c3361d420fa9de364c02557e (commit)
via 446922190513e6535202e8f45ab897bc622390ee (commit)
via 09241d96413a6376d399b4e81219fdf2d9fb1462 (commit)
via 1d97b3f64cb80fea14245d253f6c7db64b8495b2 (commit)
via f6d646faac5ebf7a3f0831af73a79709fae9d36a (commit)
via 47b078113632ec8cf3e760af0dce2e0bf0c01c92 (commit)
via 7850ea0241dc2bef8cd4d45d3c22697206788cc9 (commit)
via d093866437ca8adc100d6bc2a40011a26c26e813 (commit)
via c5d3e2a62fabfd142f86d47f51e313680d363ea3 (commit)
via bccb0491d955bfbd1c0cb8d9ca7add8c886c50fe (commit)
via 6f7a48cf329d250dea4f2c4a34cf9f0e84c78c39 (commit)
via 76102f7788b5e16a479e7b3543dbac60b60eae0b (commit)
via b369dc80bc0313dd846091ab433f265af1b2b081 (commit)
via 2f32bbb6ab45e8648e9f1023b1ed7ca167f1a4a1 (commit)
via ea35af9019e34da61945dd72615c57d3e303a743 (commit)
via 0f58139e80e4a6da1385034144d9f67e146ff6b8 (commit)
via 36f12d07e7626a423264eca355c4000fc392dbf6 (commit)
via b549f66c9fc9e0ccb125692a7a2570bbe2016cdc (commit)
via 4d4ca995c2d6ae58d85863cae26c4369d5bd0967 (commit)
via 357771c22372e5584d8c0e9126e7877783784073 (commit)
via 4c798878c771c9306afdffb5416ca817f625d8cd (commit)
via 89f781e8da4907c3e34db57714777601227a3719 (commit)
via 713e4f3f13172cb63b59ac501b54992a2309b314 (commit)
via 03dc78a368cf8724cfaf79b6e149bdbe2d709205 (commit)
via 97369ab9d2fc879e4d491f7f0813db4fa191b5e8 (commit)
via b02edef9bfce2083f3692ffccd6a3acd750b79da (commit)
via 4134b186f31ff445db42c9ef938b05abe240d689 (commit)
via 85ff34bf491fb4653020c474b9bc79d54d69a167 (commit)
via 59bcc6a412d016392c5ea5aaf5f0fac674e06150 (commit)
via 2452f86d8fc399fb31bc2688a1c1f0cdea4c4156 (commit)
via 1bd709f7b02e6cf8c47318125d75d21092a8bcd9 (commit)
via bf70bc758e8d915a99250ce0422f05f414785e5d (commit)
via e5db2b1f3508e1630b9af36a397a68ef069a56a2 (commit)
via 566ed587e8f01232c84c2aba46d1861a20cd0c27 (commit)
via 870edf9002091a710e94dd929c2e9583af590f34 (commit)
via 30d9e3ba8aa2412e028bb51b34d3be44ddf7a92b (commit)
via 183e450a847b698b96f2f7ecbd08ed785e58879f (commit)
via b0791316458c7edc23a03dc8eb1d9bc346dc3b3a (commit)
via a52536952b40f8337b4415fe265217c5976f2f77 (commit)
via 9f1c5605ccc309bc66b098c26590a3a1e35025b2 (commit)
via 0850c45f543489686dc6a2984cf104ed2e89b4aa (commit)
via 39de4836f42404f669d76cf0ebd759a0a32f41b9 (commit)
via 261533840975611674984ee1e3a8ea2b83085dae (commit)
via 1bac6fdd5618b074d38c9f7d4da6e867b302ba16 (commit)
via af6a9007db86d114595f630d6a6be24519a2b0df (commit)
via 0c39d1adbaeb40591a13cbf965d773374fb8194b (commit)
via 4d91a70e678339b10b0ed4b35ba9a18ccc84fa67 (commit)
via 584415285129a73670aa799560d765a94707850e (commit)
via 9743963133809d6610a4986dbe1514e333e87589 (commit)
via d9e3b063bae380e838bf4ae99ddc5ca387b73877 (commit)
via 25e3933b27e047c26e4eefd3024d51bd44fca741 (commit)
via 69614535beec61f64ac9b3d5c5016896d0a27beb (commit)
via d05b5939892335e58f0f578928a89a05df78f2a0 (commit)
via 5f476be6ba4492daf8d71abb03656c7dcefec959 (commit)
via 91989ac6cef96d62797a104a2f99cca17f6151de (commit)
via d10318c0369619faa73b93abe840ea8e67cb5a52 (commit)
via db1bbab2baeb3c556862cacaa9ac9e0fa15ce859 (commit)
via 2f824b15387739be5c32dd417b6fabbf54234bc8 (commit)
via 0c88946ef930d04eb2c3ea3afe202ab8248150b4 (commit)
via 36a72a1ec467da8e2b49ed57e98be58f911d01f7 (commit)
via 3c4a561ca197f91aa1b3040a18ced825667e63dc (commit)
via 42ad59f700932298c5d6441054ca7d6d7590a9e1 (commit)
via 5777210fdacd7e722325dbad7a3df78bfa587462 (commit)
via e8994a4be0338cc1d5edc52ea60612157eed9c2b (commit)
via a19d7e22a4d18fc9ada59ce5968b3ea382ff6498 (commit)
via b4d70c436ceb9fa60ed951a3a5259db2dc4159d5 (commit)
from 0f2c026b6360e700cf3f1a87d0031a5760523886 (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/88080e9a2b9c406de4214a878cc42bc47878…
commit 88080e9a2b9c406de4214a878cc42bc478785132
Merge: 1832d27 0f2c026
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Wed Feb 22 18:35:40 2012 +0100
Merge branch 'pywrap' of ssh://repo.or.cz/srv/git/gfxprim into pywrap
diff --cc configure
index 7d0ffd6,3157690..24fc5f2
--- a/configure
+++ b/configure
@@@ -147,8 -138,9 +147,9 @@@ if __name__ == '__main__'
# Dictionary for default configuration parameters
#
cfg = {'CC' : ['gcc', 'Path/name of the C compiler'],
- 'CFLAGS' : ['-W -Wall -Wextra -fPIC -O2', 'C compiler flags'],
+ 'CFLAGS' : ['-W -Wall -Wextra -fPIC -O2 -ggdb', 'C compiler flags'],
'PYTHON_BIN' : ['python', 'Path/name of python interpreter'],
+ 'SWIG' : ['swig', 'Simplified Wrapper and Interface Generator'],
'include_path': ['/usr/include', 'Path to the system headers']}
#
http://repo.or.cz/w/gfxprim.git/commit/1832d27ef46a9075db864ed0c5dee236ce1a…
commit 1832d27ef46a9075db864ed0c5dee236ce1ac940
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Wed Feb 22 16:57:35 2012 +0100
Creating gfxprim module structure
diff --git a/pylib/gfxprim/Makefile b/pylib/gfxprim/Makefile
new file mode 100644
index 0000000..03e42fa
--- /dev/null
+++ b/pylib/gfxprim/Makefile
@@ -0,0 +1,16 @@
+TOPDIR=../..
+
+include $(TOPDIR)/include.mk
+
+# Core
+core/gfxprim_core_c.py core/gfxprim_core_wrap.c: $(TOPDIR)/include/core/gfxprim_core.swig
+ swig -python -Wall -I/usr/include/ + $(TOPDIR)/include/core/gfxprim_core.swig
+
+$(TOPDIR)/build/_gfxprim_core_c.so: core/gfxprim_core_wrap.c
+ gcc -shared core/gfxprim_core_wrap.c -L $(TOPDIR)/build/ -I /usr/include/python2.6/ -I$(TOPDIR)/include/ + -fPIC -Wall -lGP -lpng -ljpeg -lm -ldl -o $(TOPDIR)/build/_gfxprim_core_c.so
+
+
+all: $(TOPDIR)/build/_gfxprim_core_c.so
+
diff --git a/pylib/gfxprim/__init__.py b/pylib/gfxprim/__init__.py
new file mode 100644
index 0000000..4710136
--- /dev/null
+++ b/pylib/gfxprim/__init__.py
@@ -0,0 +1,17 @@
+"""
+GFXPrim Python bindings. Mostly generated using SWIG.
+
+Structure:
+gfxprim:
+ core:
+ context: module defining Context
+ Context - wrapper class, with many proxy methods
+ [Context from context]
+ gfxprim_core_c: - SWIG module
+ [almost * from gfxprim_core_c]
+ loaders:
+ gfxprim_loaders_c - SWIG submodule
+ [almost * from gfxprim_loaders_c]
+
+"""
+
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pylib/context.py b/pylib/gfxprim/core/context.py
similarity index 100%
rename from pylib/context.py
rename to pylib/gfxprim/core/context.py
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
new file mode 100644
index 0000000..e69de29
http://repo.or.cz/w/gfxprim.git/commit/ca4d1e00c41ace34e8db1f806204fe0aa36d…
commit ca4d1e00c41ace34e8db1f806204fe0aa36dc0d9
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Wed Feb 22 16:09:34 2012 +0100
Fixed include headers in SWIG file
diff --git a/include/core/gfxprim_core.swig b/include/core/gfxprim_core.swig
index d497c8f..0208cec 100644
--- a/include/core/gfxprim_core.swig
+++ b/include/core/gfxprim_core.swig
@@ -104,6 +104,4 @@ and self.thisown.") GP_Context;
%include "GP_GetPutPixel.h"
%import "GP_GetPutPixel.gen.h"
%include "GP_WritePixel.h"
-
%include "GP_Blit.h"
-%import "GP_Blit.gen.h"
http://repo.or.cz/w/gfxprim.git/commit/967e802a258863e45da3f143f66d298cb520…
commit 967e802a258863e45da3f143f66d298cb5201824
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Wed Feb 22 16:03:49 2012 +0100
Move gfxprim/ to gp_codegen, refactorize to be (more) movable
* Using "import .something" might break older pythons
diff --git a/pylib/bin/generate_collected_tests.py b/pylib/bin/generate_collected_tests.py
index 4038bd8..72f6efb 100644
--- a/pylib/bin/generate_collected_tests.py
+++ b/pylib/bin/generate_collected_tests.py
@@ -5,7 +5,7 @@
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
#
-from gfxprim import render_utils, test_collection
+from gp_codegen import render_utils, test_collection
import jinja2
import logging as log
from optparse import OptionParser
diff --git a/pylib/bin/generate_file.py b/pylib/bin/generate_file.py
index b8b6b12..e642f77 100644
--- a/pylib/bin/generate_file.py
+++ b/pylib/bin/generate_file.py
@@ -6,7 +6,7 @@
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
#
-from gfxprim import render_utils
+from gp_codegen import render_utils
import jinja2
import logging as log
from optparse import OptionParser
diff --git a/pylib/gfxprim/README b/pylib/gp_codegen/README
similarity index 100%
rename from pylib/gfxprim/README
rename to pylib/gp_codegen/README
diff --git a/pylib/gfxprim/__init__.py b/pylib/gp_codegen/__init__.py
similarity index 100%
rename from pylib/gfxprim/__init__.py
rename to pylib/gp_codegen/__init__.py
diff --git a/pylib/gfxprim/gfxprimconfig.py b/pylib/gp_codegen/gfxprimconfig.py
similarity index 93%
rename from pylib/gfxprim/gfxprimconfig.py
rename to pylib/gp_codegen/gfxprimconfig.py
index 9d90ae4..81d3f32 100644
--- a/pylib/gfxprim/gfxprimconfig.py
+++ b/pylib/gp_codegen/gfxprimconfig.py
@@ -1,13 +1,13 @@
#
-# gfxprim.generators.gfxprimconfig - Class for (global) GfxPrim configuration
+# gfxprimconfig - Class for (global) GfxPrim configuration
#
# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
# 2011 - Cyril Hrubis <metan(a)ucw.cz>
import os
import logging as log
-from gfxprim.pixeltype import PixelType
-from gfxprim.pixelsize import PixelSize
+from .pixeltype import PixelType
+from .pixelsize import PixelSize
class GfxPrimConfig(object):
def __init__(self, pixel_type = None, pixel_size=None, pixelsizes=None,
diff --git a/pylib/gfxprim/pixelsize.py b/pylib/gp_codegen/pixelsize.py
similarity index 100%
rename from pylib/gfxprim/pixelsize.py
rename to pylib/gp_codegen/pixelsize.py
diff --git a/pylib/gfxprim/pixeltype.py b/pylib/gp_codegen/pixeltype.py
similarity index 97%
rename from pylib/gfxprim/pixeltype.py
rename to pylib/gp_codegen/pixeltype.py
index fb2744f..08e08fe 100644
--- a/pylib/gfxprim/pixeltype.py
+++ b/pylib/gp_codegen/pixeltype.py
@@ -5,7 +5,7 @@
#
import re
-from gfxprim.pixelsize import PixelSize
+from .pixelsize import PixelSize
class PixelType(object):
"""Representation of one GP_PixelType"""
diff --git a/pylib/gfxprim/render_utils.py b/pylib/gp_codegen/render_utils.py
similarity index 91%
rename from pylib/gfxprim/render_utils.py
rename to pylib/gp_codegen/render_utils.py
index b115b91..9c9c1a8 100644
--- a/pylib/gfxprim/render_utils.py
+++ b/pylib/gp_codegen/render_utils.py
@@ -2,12 +2,16 @@
# gfxprim.render_utils
#
-import jinja2
import logging as log
import os
import time
import re
+try:
+ import jinja2
+except:
+ log.fatal("Jinja 2 is required to compile gfxprim.")
+
def template_error(s, *args):
raise Exception(s, *args)
@@ -22,7 +26,7 @@ def create_environment(config, template_dir):
env.globals['pixeltypes'] = config.pixeltypes
env.globals['pixeltypes_dict'] = config.pixeltypes_dict
env.globals['config'] = config
- from gfxprim.pixelsize import LE, BE
+ from .pixelsize import LE, BE
env.globals['LE'] = LE
env.globals['BE'] = BE
env.globals['len'] = len
@@ -79,9 +83,9 @@ def load_gfxprimconfig(config_file = None):
config_file)
return None
- from gfxprim.pixeltype import PixelType
- from gfxprim.pixelsize import PixelSize, LE, BE
- from gfxprim.gfxprimconfig import GfxPrimConfig
+ from .pixeltype import PixelType
+ from .pixelsize import PixelSize, LE, BE
+ from .gfxprimconfig import GfxPrimConfig
l = {"PixelType": PixelType,
"PixelSize": PixelSize,
"LE": LE,
diff --git a/pylib/gfxprim/test_collection.py b/pylib/gp_codegen/test_collection.py
similarity index 97%
rename from pylib/gfxprim/test_collection.py
rename to pylib/gp_codegen/test_collection.py
index 0d947ef..254cd21 100644
--- a/pylib/gfxprim/test_collection.py
+++ b/pylib/gp_codegen/test_collection.py
@@ -10,7 +10,7 @@ import os
import re
import glob
import logging as log
-from gfxprim.render_utils import create_environment, render_file
+from .render_utils import create_environment, render_file
testfile_patterns = ['*.test.c', '*.test.gen.c']
diff --git a/pylib/gfxprim/pylint.conf b/pylib/pylint.conf
similarity index 100%
rename from pylib/gfxprim/pylint.conf
rename to pylib/pylint.conf
http://repo.or.cz/w/gfxprim.git/commit/61a39f1c06288ddae8c94a7c1c2e363d1461…
commit 61a39f1c06288ddae8c94a7c1c2e363d14619839
Merge: ce520ce 07d8a92
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Wed Feb 22 13:50:34 2012 +0100
Merge branch 'master' into pywrap
Conflicts:
include/core/GP_Core.h
include/core/GP_Counter.h
diff --cc include/core/GP_Core.h
index 93ce52b,043e6ce..3987d07
--- a/include/core/GP_Core.h
+++ b/include/core/GP_Core.h
@@@ -62,10 -59,7 +62,13 @@@
/* Color */
#include "core/GP_Color.h"
+/* Progress callback */
+#include "core/GP_ProgressCallback.h"
+
+/* Debug counters */
+#include "core/GP_Counter.h"
+
+ /* Mix Pixel */
+ #include "core/GP_MixPixels.h"
+
#endif /* GP_CORE_H */
diff --cc include/core/GP_Counter.h
index e501309,21eaccf..0429df9
--- a/include/core/GP_Counter.h
+++ b/include/core/GP_Counter.h
@@@ -54,12 -52,12 +52,12 @@@ typedef GP_Counter_t *GP_Counter
/*
* Increase a counter by 1.
*/
-
-static inline void GP_IncCounter(GP_Counter counter)
+static inline void GP_IncCounter(GP_Counter counter)
{
#ifdef GP_IMPLEMENT_COUNTERS
- if (!counter) return;
- (*counter) ++;
+ if (!counter)
+ return;
+ (*counter)++;
#endif /* GP_IMPLEMENT_COUNTERS */
}
@@@ -67,11 -65,11 +65,11 @@@
* Increase a counter by delta (may be negative).
* No checks for underflow.
*/
-
-static inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta)
+static inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta)
{
#ifdef GP_IMPLEMENT_COUNTERS
- if (!counter) return;
+ if (!counter)
+ return;
(*counter) += delta;
#endif /* GP_IMPLEMENT_COUNTERS */
}
diff --cc include/core/GP_Pixel.h
index 294c022,a36c9bd..c8d82e4
--- a/include/core/GP_Pixel.h
+++ b/include/core/GP_Pixel.h
@@@ -114,29 -115,23 +115,26 @@@ typedef struct
/*
* Array of size GP_PIXEL_MAX describing known pixel types
*/
-
extern const GP_PixelTypeDescription const GP_PixelTypes[];
+#define GP_CHECK_VALID_PIXELTYPE(type) + GP_CHECK(((type) > 0) && ((type) < GP_PIXEL_MAX), "Invalid PixelType %d", (type))
+
/*
* Convert pixel type to name.
*/
-
static inline const char *GP_PixelTypeName(GP_PixelType type)
{
- GP_CHECK(type < GP_PIXEL_MAX);
+ GP_CHECK_VALID_PIXELTYPE(type);
return GP_PixelTypes[type].name;
}
/*
* Returns number of bits per pixel.
*/
-
static inline uint32_t GP_PixelSize(GP_PixelType type)
{
- GP_CHECK(type < GP_PIXEL_MAX);
+ GP_CHECK_VALID_PIXELTYPE(type);
return GP_PixelTypes[type].size;
}
-----------------------------------------------------------------------
Summary of changes:
TODO | 2 -
app.mk | 2 +-
build/get_objs.sh | 2 +-
configure | 50 +-
demos/Makefile | 2 +-
demos/fbshow/Makefile | 6 +-
.../GP_GetPutPixel.c => demos/fbshow/cpu_timer.c | 36 +-
.../GP_Framebuffer.h => demos/fbshow/cpu_timer.h | 38 +-
demos/fbshow/fbshow.c | 193 ++++---
demos/grinder/Makefile | 4 +-
demos/grinder/grinder.c | 119 ++++-
.../linux_input.c => demos/grinder/histogram.c | 73 ++-
libs/core/GP_Debug.c => demos/grinder/histogram.h | 15 +-
demos/{fbshow => particle}/Makefile | 8 +-
demos/particle/particle_demo.c | 160 +++++
demos/{fbshow => particle}/runtest.sh | 0
demos/particle/space.c | 188 ++++++
.../linux_input.c => demos/particle/space.h | 66 ++-
gen.mk | 23 +-
include/backends/GP_Backend.h | 152 ++++--
.../GP_InputDriverSDL.h => backends/GP_Backends.h} | 20 +-
.../backends/{GP_Framebuffer.h => GP_LinuxFB.h} | 35 +-
.../GP_InputDriverLinux.h => backends/GP_SDL.h} | 77 +--
.../GP_Debug.c => include/core/GP_AngleUtils.h | 17 +-
include/core/GP_Blit.gen.h.t | 16 -
include/core/GP_Blit.h | 78 ++-
include/core/GP_Common.h | 10 +-
include/core/GP_Context.h | 16 +-
include/core/GP_Core.h | 3 +
include/core/GP_Counter.h | 36 +-
include/core/GP_FixedPoint.h | 133 +++++
include/core/GP_FnPerBpp.gen.h.t | 5 -
include/core/GP_FnPerBpp.h | 9 -
include/core/GP_GammaCorrection.gen.h.t | 27 +
include/core/GP_GammaCorrection.h | 66 ++
include/core/GP_GetPutPixel.h | 35 +-
include/core/GP_MixPixels.gen.h.t | 140 +++++
.../GP_Blit.test.c => include/core/GP_MixPixels.h | 11 +-
include/core/GP_Pixel.h | 4 +-
include/core/GP_Transform.h | 61 ++-
include/core/Makefile | 5 +-
include/filters/{GP_Dither.h => GP_Arithmetic.h} | 60 ++-
include/filters/GP_FilterParam.h | 4 +
include/filters/GP_Filters.h | 12 +-
include/filters/GP_Resize.h | 18 +-
include/{loaders/GP_JPG.h => filters/GP_Stats.h} | 52 +-
include/gfx/{GP_Line.h => GP_Arc.h} | 20 +-
include/gfx/{GP_Triangle.h => GP_CircleSeg.h} | 52 ++-
include/gfx/GP_Gfx.h | 8 +
.../GP_Framebuffer.h => gfx/GP_HLineAA.h} | 40 +-
.../{backends/GP_Framebuffer.h => gfx/GP_LineAA.h} | 40 +-
include/{loaders/GP_JPG.h => gfx/GP_PutPixelAA.h} | 45 +-
include/gfx/{GP_VLine.h => GP_RectAA.h} | 44 +-
.../GP_Framebuffer.h => gfx/GP_VLineAA.h} | 40 +-
include/input/GP_Event.h | 2 +-
include/loaders/{GP_JPG.h => GP_BMP.h} | 40 +-
include/loaders/GP_Loaders.h | 4 +-
.../GP_Debug.c => include/text/GP_DefaultFont.h | 17 +-
include/text/GP_Font.h | 249 +++++----
include/text/GP_Text.h | 9 +-
include/text/GP_TextStyle.h | 36 +-
libs/backends/GP_Backend.c | 87 ---
libs/backends/{GP_Framebuffer.c => GP_LinuxFB.c} | 93 +++-
libs/backends/{GP_Backend_SDL.c => GP_SDL.c} | 196 ++++---
libs/backends/Makefile | 1 +
libs/core/{GP_GetPutPixel.c => GP_AngleUtils.c} | 39 +-
libs/core/GP_Blit.c | 129 +++--
libs/core/GP_Blit.gen.c.t | 280 ++++++++--
libs/core/GP_Context.c | 25 +
libs/core/GP_Counter.c | 30 +-
libs/core/GP_GammaCorrection.gen.c.t | 39 ++
libs/core/GP_GetPutPixel.c | 5 +-
libs/core/Makefile | 3 +-
libs/filters/GP_Addition.gen.c.t | 24 +
libs/filters/GP_Brightness.gen.c.t | 2 +-
libs/filters/GP_Contrast.gen.c.t | 2 +-
libs/filters/GP_Difference.gen.c.t | 23 +
libs/filters/GP_FilterParam.c | 8 +
libs/filters/GP_Histogram.gen.c.t | 25 +
libs/filters/GP_Invert.gen.c.t | 2 +-
libs/filters/GP_Linear.c | 394 +++----------
libs/filters/GP_Max.gen.c.t | 23 +
libs/filters/GP_Min.gen.c.t | 23 +
libs/filters/GP_Multiply.gen.c.t | 24 +
libs/filters/GP_Point.gen.c.t | 2 +-
libs/filters/GP_Resize.c | 551 ++++++++++++++----
.../linux_input.c => libs/filters/GP_Stats.c | 75 ++-
libs/filters/Makefile | 20 +-
libs/gfx/{GP_Line.c => GP_Arc.c} | 37 +-
libs/gfx/GP_Circle.c | 7 +-
libs/gfx/{GP_Circle.c => GP_CircleSeg.c} | 98 ++--
libs/gfx/GP_Ellipse.c | 7 +-
libs/gfx/GP_HLine.c | 11 +-
libs/gfx/{GP_Line.c => GP_HLineAA.c} | 42 +-
libs/gfx/GP_HLineAA.gen.c.t | 62 ++
libs/gfx/GP_Line.c | 6 +-
libs/gfx/{GP_Line.c => GP_LineAA.c} | 21 +-
libs/gfx/GP_LineAA.gen.c.t | 139 +++++
libs/gfx/{GP_Line.c => GP_PartialEllipse.c} | 35 +-
libs/gfx/GP_Polygon.c | 5 +-
libs/gfx/GP_PutPixelAA.gen.c.t | 55 ++
libs/gfx/GP_Rect.c | 8 +-
libs/gfx/GP_RectAA.c | 183 ++++++
libs/gfx/GP_Tetragon.c | 8 +-
libs/gfx/GP_Triangle.c | 8 +-
libs/gfx/GP_VLine.c | 7 +-
include/gfx/GP_Gfx.h => libs/gfx/GP_VLineAA.c | 58 +-
libs/gfx/GP_VLineAA.gen.c.t | 62 ++
libs/gfx/Makefile | 6 +-
libs/gfx/algo/{Ellipse.algo.h => Arc.algo.h} | 99 ++--
libs/gfx/algo/{Circle.algo.h => CircleSeg.algo.h} | 30 +-
.../algo/{Line.algo.h => PartialEllipse.algo.h} | 71 +--
libs/input/GP_Event.c | 43 ++-
libs/loaders/GP_BMP.c | 607 +++++++++++++++++++
libs/loaders/GP_JPG.c | 39 ++-
libs/loaders/GP_Loaders.c | 17 +
libs/loaders/GP_PNG.c | 49 ++-
libs/text/GP_DefaultFont.c | 619 +++++++++++++-------
libs/text/GP_Font.c | 195 +------
libs/text/GP_FreeType.c | 201 +++++++
libs/text/GP_Text.c | 41 +--
libs/text/GP_Text.gen.c.t | 176 ++++++
libs/text/GP_TextMetric.c | 188 ++++--
libs/text/GP_TextStyle.c | 4 +-
libs/text/Makefile | 8 +-
libs/text/algo/Text.algo.h | 83 ---
pylib/bin/generate_collected_tests.py | 2 +-
pylib/bin/generate_file.py | 2 +-
pylib/gfxprim/Makefile | 16 +
pylib/gfxprim/__init__.py | 21 +-
pylib/{ => gfxprim/core}/context.py | 0
pylib/{gfxprim => gp_codegen}/README | 0
pylib/{gfxprim => gp_codegen}/__init__.py | 0
pylib/{gfxprim => gp_codegen}/gfxprimconfig.py | 6 +-
pylib/{gfxprim => gp_codegen}/pixelsize.py | 0
pylib/{gfxprim => gp_codegen}/pixeltype.py | 2 +-
pylib/{gfxprim => gp_codegen}/render_utils.py | 18 +-
pylib/{gfxprim => gp_codegen}/test_collection.py | 2 +-
pylib/{gfxprim => }/pylint.conf | 0
pylib/templates/common.c.t | 16 +
pylib/templates/filter.arithmetic.c.t | 154 +++++
pylib/templates/filter.c.t | 58 ++
pylib/templates/filter.point.c.t | 77 +---
pylib/templates/filter.stats.c.t | 102 ++++
pywrap/core/gfxprim_core.swig | 2 -
tests/SDL/Makefile | 3 +-
tests/SDL/{pixeltest.c => aatest.c} | 131 ++--
tests/SDL/blittest.c | 60 ++-
tests/SDL/fileview.c | 28 +-
tests/SDL/fonttest.c | 153 +++--
tests/SDL/linetest.c | 53 ++-
tests/SDL/{pixeltest.c => mixpixeltest.c} | 123 +++-
tests/SDL/randomshapetest.c | 40 +-
tests/SDL/shapetest.c | 15 +-
tests/SDL/sierpinsky.c | 20 +-
tests/SDL/textaligntest.c | 56 +-
tests/core/GP_MixPixels.test.gen.c.t | 51 ++
tests/core/Makefile | 5 +-
tests/drivers/Makefile | 2 +-
tests/drivers/framebuffer_test.c | 39 +-
tests/drivers/sierpinsky.c | 143 -----
161 files changed, 6658 insertions(+), 2937 deletions(-)
copy libs/core/GP_GetPutPixel.c => demos/fbshow/cpu_timer.c (68%)
copy include/backends/GP_Framebuffer.h => demos/fbshow/cpu_timer.h (76%)
copy tests/drivers/linux_input.c => demos/grinder/histogram.c (53%)
copy libs/core/GP_Debug.c => demos/grinder/histogram.h (88%)
copy demos/{fbshow => particle}/Makefile (54%)
create mode 100644 demos/particle/particle_demo.c
copy demos/{fbshow => particle}/runtest.sh (100%)
create mode 100644 demos/particle/space.c
copy tests/drivers/linux_input.c => demos/particle/space.h (65%)
copy include/{input/GP_InputDriverSDL.h => backends/GP_Backends.h} (83%)
copy include/backends/{GP_Framebuffer.h => GP_LinuxFB.h} (75%)
copy include/{input/GP_InputDriverLinux.h => backends/GP_SDL.h} (57%)
copy libs/core/GP_Debug.c => include/core/GP_AngleUtils.h (87%)
delete mode 100644 include/core/GP_Blit.gen.h.t
create mode 100644 include/core/GP_FixedPoint.h
create mode 100644 include/core/GP_GammaCorrection.gen.h.t
create mode 100644 include/core/GP_GammaCorrection.h
create mode 100644 include/core/GP_MixPixels.gen.h.t
copy tests/core/GP_Blit.test.c => include/core/GP_MixPixels.h (88%)
copy include/filters/{GP_Dither.h => GP_Arithmetic.h} (55%)
copy include/{loaders/GP_JPG.h => filters/GP_Stats.h} (66%)
copy include/gfx/{GP_Line.h => GP_Arc.h} (82%)
copy include/gfx/{GP_Triangle.h => GP_CircleSeg.h} (55%)
copy include/{backends/GP_Framebuffer.h => gfx/GP_HLineAA.h} (68%)
copy include/{backends/GP_Framebuffer.h => gfx/GP_LineAA.h} (68%)
copy include/{loaders/GP_JPG.h => gfx/GP_PutPixelAA.h} (66%)
copy include/gfx/{GP_VLine.h => GP_RectAA.h} (57%)
rename include/{backends/GP_Framebuffer.h => gfx/GP_VLineAA.h} (68%)
copy include/loaders/{GP_JPG.h => GP_BMP.h} (71%)
copy libs/core/GP_Debug.c => include/text/GP_DefaultFont.h (88%)
delete mode 100644 libs/backends/GP_Backend.c
rename libs/backends/{GP_Framebuffer.c => GP_LinuxFB.c} (80%)
rename libs/backends/{GP_Backend_SDL.c => GP_SDL.c} (50%)
copy libs/core/{GP_GetPutPixel.c => GP_AngleUtils.c} (73%)
create mode 100644 libs/core/GP_GammaCorrection.gen.c.t
create mode 100644 libs/filters/GP_Addition.gen.c.t
create mode 100644 libs/filters/GP_Difference.gen.c.t
create mode 100644 libs/filters/GP_Histogram.gen.c.t
create mode 100644 libs/filters/GP_Max.gen.c.t
create mode 100644 libs/filters/GP_Min.gen.c.t
create mode 100644 libs/filters/GP_Multiply.gen.c.t
copy tests/drivers/linux_input.c => libs/filters/GP_Stats.c (54%)
copy libs/gfx/{GP_Line.c => GP_Arc.c} (65%)
copy libs/gfx/{GP_Circle.c => GP_CircleSeg.c} (59%)
copy libs/gfx/{GP_Line.c => GP_HLineAA.c} (66%)
create mode 100644 libs/gfx/GP_HLineAA.gen.c.t
copy libs/gfx/{GP_Line.c => GP_LineAA.c} (82%)
create mode 100644 libs/gfx/GP_LineAA.gen.c.t
copy libs/gfx/{GP_Line.c => GP_PartialEllipse.c} (66%)
create mode 100644 libs/gfx/GP_PutPixelAA.gen.c.t
create mode 100644 libs/gfx/GP_RectAA.c
copy include/gfx/GP_Gfx.h => libs/gfx/GP_VLineAA.c (65%)
create mode 100644 libs/gfx/GP_VLineAA.gen.c.t
copy libs/gfx/algo/{Ellipse.algo.h => Arc.algo.h} (58%)
copy libs/gfx/algo/{Circle.algo.h => CircleSeg.algo.h} (85%)
copy libs/gfx/algo/{Line.algo.h => PartialEllipse.algo.h} (66%)
create mode 100644 libs/loaders/GP_BMP.c
create mode 100644 libs/text/GP_FreeType.c
create mode 100644 libs/text/GP_Text.gen.c.t
delete mode 100644 libs/text/algo/Text.algo.h
create mode 100644 pylib/gfxprim/Makefile
create mode 100644 pylib/gfxprim/core/__init__.py
rename pylib/{ => gfxprim/core}/context.py (100%)
create mode 100644 pylib/gfxprim/loaders/__init__.py
rename pylib/{gfxprim => gp_codegen}/README (100%)
copy pylib/{gfxprim => gp_codegen}/__init__.py (100%)
rename pylib/{gfxprim => gp_codegen}/gfxprimconfig.py (93%)
rename pylib/{gfxprim => gp_codegen}/pixelsize.py (100%)
rename pylib/{gfxprim => gp_codegen}/pixeltype.py (97%)
rename pylib/{gfxprim => gp_codegen}/render_utils.py (86%)
rename pylib/{gfxprim => gp_codegen}/test_collection.py (97%)
rename pylib/{gfxprim => }/pylint.conf (100%)
create mode 100644 pylib/templates/common.c.t
create mode 100644 pylib/templates/filter.arithmetic.c.t
create mode 100644 pylib/templates/filter.c.t
create mode 100644 pylib/templates/filter.stats.c.t
copy tests/SDL/{pixeltest.c => aatest.c} (65%)
copy tests/SDL/{pixeltest.c => mixpixeltest.c} (58%)
create mode 100644 tests/core/GP_MixPixels.test.gen.c.t
delete mode 100644 tests/drivers/sierpinsky.c
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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 5fe09088bb3606b059aab62e0decdb05e122e34f
by metan 19 Feb '12
by metan 19 Feb '12
19 Feb '12
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 5fe09088bb3606b059aab62e0decdb05e122e34f (commit)
from 548b430abfdc45d7fdae3c88fc998c9431179f54 (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/5fe09088bb3606b059aab62e0decdb05e122…
commit 5fe09088bb3606b059aab62e0decdb05e122e34f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Feb 19 22:45:20 2012 +0100
input: Fix includes.
diff --git a/include/GP.h b/include/GP.h
index 7310ddc..b01e512 100644
--- a/include/GP.h
+++ b/include/GP.h
@@ -19,7 +19,7 @@
* Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -39,7 +39,7 @@
#include "backends/GP_Backend.h"
/* input and events */
-#include "input/GP_Event.h"
+#include "input/GP_Input.h"
/* bitmap loaders */
#include "loaders/GP_Loaders.h"
diff --git a/include/GP.h b/include/input/GP_Input.h
similarity index 70%
copy from include/GP.h
copy to include/input/GP_Input.h
index 7310ddc..07724ae 100644
--- a/include/GP.h
+++ b/include/input/GP_Input.h
@@ -16,35 +16,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
-#ifndef GP_H
-#define GP_H
-
-/* library core */
-#include "core/GP_Core.h"
-
-/* public drawing API */
-#include "gfx/GP_Gfx.h"
+#ifndef INPUT_GP_INPUT_H
+#define INPUT_GP_INPUT_H
-/* fonts and text drawing */
-#include "text/GP_Text.h"
-
-/* backends */
-#include "backends/GP_Backend.h"
-
-/* input and events */
+/*
+ * Base GP_Event definitions.
+ */
#include "input/GP_Event.h"
-/* bitmap loaders */
-#include "loaders/GP_Loaders.h"
-
-/* bitmap filters */
-#include "filters/GP_Filters.h"
+/*
+ * Input drivers (semi internal).
+ */
+#include "input/GP_InputDriverSDL.h"
+#include "input/GP_InputDriverLinux.h"
-#endif /* GP_H */
+#endif /* INPUT_GP_INPUT_H */
-----------------------------------------------------------------------
Summary of changes:
include/GP.h | 4 +-
include/input/{GP_InputDriverSDL.h => GP_Input.h} | 22 +++++++++-----------
2 files changed, 12 insertions(+), 14 deletions(-)
copy include/input/{GP_InputDriverSDL.h => GP_Input.h} (83%)
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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 548b430abfdc45d7fdae3c88fc998c9431179f54
by metan 19 Feb '12
by metan 19 Feb '12
19 Feb '12
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 548b430abfdc45d7fdae3c88fc998c9431179f54 (commit)
from 017a24fe557af8dfd0f3b98796ef439db5246a84 (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/548b430abfdc45d7fdae3c88fc998c943117…
commit 548b430abfdc45d7fdae3c88fc998c9431179f54
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Feb 19 21:36:52 2012 +0100
backends: Fix the backend Flip().
After the transformation, make sure
that x0 <= x1 and y0 <= y1.
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h
index 25d6b7e..c83a411 100644
--- a/include/backends/GP_Backend.h
+++ b/include/backends/GP_Backend.h
@@ -42,7 +42,6 @@
#ifndef BACKENDS_GP_BACKEND_H
#define BACKENDS_GP_BACKEND_H
-#include "core/GP_Transform.h"
#include "core/GP_Context.h"
struct GP_Backend;
@@ -127,15 +126,9 @@ static inline void GP_BackendFlip(GP_Backend *backend)
/*
* Calls backend->UpdateRect().
*/
-static inline void GP_BackendUpdateRect(GP_Backend *backend,
- GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1)
-{
- GP_TRANSFORM_POINT(backend->context, x0, y0);
- GP_TRANSFORM_POINT(backend->context, x1, y1);
-
- backend->UpdateRect(backend, x0, y0, x1, y1);
-}
+void GP_BackendUpdateRect(GP_Backend *backend,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1);
/*
* Calls backend->Exit().
diff --git a/libs/backends/GP_Backend.c b/libs/backends/GP_Backend.c
new file mode 100644
index 0000000..d878760
--- /dev/null
+++ b/libs/backends/GP_Backend.c
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * 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> *
+ * *
+ *****************************************************************************/
+
+#include "core/GP_Common.h"
+#include "core/GP_Transform.h"
+
+#include "backends/GP_Backend.h"
+
+void GP_BackendUpdateRect(GP_Backend *backend,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1)
+{
+ GP_TRANSFORM_POINT(backend->context, x0, y0);
+ GP_TRANSFORM_POINT(backend->context, x1, y1);
+
+ if (x1 < x0)
+ GP_SWAP(x0, x1);
+
+ if (y1 < y0)
+ GP_SWAP(y0, y1);
+
+ backend->UpdateRect(backend, x0, y0, x1, y1);
+}
-----------------------------------------------------------------------
Summary of changes:
include/backends/GP_Backend.h | 13 +-----
.../GP_Backends.h => libs/backends/GP_Backend.c | 40 ++++++++-----------
2 files changed, 20 insertions(+), 33 deletions(-)
copy include/backends/GP_Backends.h => libs/backends/GP_Backend.c (80%)
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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 017a24fe557af8dfd0f3b98796ef439db5246a84
by metan 19 Feb '12
by metan 19 Feb '12
19 Feb '12
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
discards 6d6139b6ed2cf86b481229d1e5234aecb186b81a (commit)
via 017a24fe557af8dfd0f3b98796ef439db5246a84 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (6d6139b6ed2cf86b481229d1e5234aecb186b81a)
N -- N -- N (017a24fe557af8dfd0f3b98796ef439db5246a84)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
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/017a24fe557af8dfd0f3b98796ef439db524…
commit 017a24fe557af8dfd0f3b98796ef439db5246a84
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Feb 19 20:45:11 2012 +0100
backends: SDL Fix Flip operation.
The SDL Flip takes x, y, w, h and not x, y, x, y.
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h
index 4ddda59..25d6b7e 100644
--- a/include/backends/GP_Backend.h
+++ b/include/backends/GP_Backend.h
@@ -86,8 +86,8 @@ typedef struct GP_Backend {
* If display is not buffered, this is no-op.
*/
void (*UpdateRect)(struct GP_Backend *self,
- GP_Coord x1, GP_Coord y1,
- GP_Coord x2, GP_Coord y2);
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1);
/*
* Exits the backend.
@@ -133,6 +133,7 @@ static inline void GP_BackendUpdateRect(GP_Backend *backend,
{
GP_TRANSFORM_POINT(backend->context, x0, y0);
GP_TRANSFORM_POINT(backend->context, x1, y1);
+
backend->UpdateRect(backend, x0, y0, x1, y1);
}
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c
index b88b3b5..809d4b6 100644
--- a/libs/backends/GP_SDL.c
+++ b/libs/backends/GP_SDL.c
@@ -52,11 +52,17 @@ static void sdl_flip(struct GP_Backend *self __attribute__((unused)))
}
static void sdl_update_rect(struct GP_Backend *self __attribute__((unused)),
- GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2)
+ GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1)
{
SDL_mutexP(mutex);
-
- SDL_UpdateRect(sdl_surface, x1, y1, x2, y2);
+
+ /*
+ * SDL_UpdateRect() with all x0, y0, x1 and y1 zero updates whole
+ * screen we avoid such behavior as it will break other backends.
+ */
+ if (x1 != 0 && y1 != 0)
+ SDL_UpdateRect(sdl_surface, x0, y0,
+ GP_ABS(x1 - x0) + 1, GP_ABS(y1 - y0) + 1);
SDL_mutexV(mutex);
}
-----------------------------------------------------------------------
Summary of changes:
libs/backends/GP_SDL.c | 2 +-
1 files changed, 1 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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 6d6139b6ed2cf86b481229d1e5234aecb186b81a
by metan 19 Feb '12
by metan 19 Feb '12
19 Feb '12
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 6d6139b6ed2cf86b481229d1e5234aecb186b81a (commit)
from 0a5fbacf4887f8cf496cf45c9fa7121f091f1153 (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/6d6139b6ed2cf86b481229d1e5234aecb186…
commit 6d6139b6ed2cf86b481229d1e5234aecb186b81a
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Feb 19 20:45:11 2012 +0100
backends: SDL Fix Flip operation.
The SDL Flip takes x, y, w, h and not x, y, x, y.
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h
index 4ddda59..25d6b7e 100644
--- a/include/backends/GP_Backend.h
+++ b/include/backends/GP_Backend.h
@@ -86,8 +86,8 @@ typedef struct GP_Backend {
* If display is not buffered, this is no-op.
*/
void (*UpdateRect)(struct GP_Backend *self,
- GP_Coord x1, GP_Coord y1,
- GP_Coord x2, GP_Coord y2);
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1);
/*
* Exits the backend.
@@ -133,6 +133,7 @@ static inline void GP_BackendUpdateRect(GP_Backend *backend,
{
GP_TRANSFORM_POINT(backend->context, x0, y0);
GP_TRANSFORM_POINT(backend->context, x1, y1);
+
backend->UpdateRect(backend, x0, y0, x1, y1);
}
diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c
index b88b3b5..4a327c5 100644
--- a/libs/backends/GP_SDL.c
+++ b/libs/backends/GP_SDL.c
@@ -52,11 +52,17 @@ static void sdl_flip(struct GP_Backend *self __attribute__((unused)))
}
static void sdl_update_rect(struct GP_Backend *self __attribute__((unused)),
- GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2)
+ GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1)
{
SDL_mutexP(mutex);
-
- SDL_UpdateRect(sdl_surface, x1, y1, x2, y2);
+
+ /*
+ * SDL_UpdateRect() with all x0, y0, x1 and y1 zero updates whole
+ * screen we avoid such behavior as it will break other backends.
+ */
+ if (x1 != 0 && y1 != 0)
+ SDL_UpdateRect(sdl_surface, x0, y0,
+ GP_ABS(x1 - x0), GP_ABS(y1 - x0));
SDL_mutexV(mutex);
}
-----------------------------------------------------------------------
Summary of changes:
include/backends/GP_Backend.h | 5 +++--
libs/backends/GP_SDL.c | 12 +++++++++---
2 files changed, 12 insertions(+), 5 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.")
1
0