unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* guile-clutter, clutter-devel: add custom bindings for ClutterMatrix
@ 2014-05-09 15:27 David Pirotte
  2014-05-09 18:53 ` David Pirotte
  0 siblings, 1 reply; 2+ messages in thread
From: David Pirotte @ 2014-05-09 15:27 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

Hello,

	guile-clutter
	  clutter-devel: add custom bindings for ClutterMatrix

Patch review solicited.

Thanks,
David

[-- Attachment #2: 0006-add-custom-bindings-for-ClutterMatrix.patch --]
[-- Type: text/x-patch, Size: 3743 bytes --]

From 8f15c981e0d8c6fd089c28c6ca953ec02313c413 Mon Sep 17 00:00:00 2001
From: David PIROTTE <david@altosw.be>
Date: Fri, 9 May 2014 12:16:07 -0300
Subject: [PATCH 6/6] add custom bindings for ClutterMatrix

* clutter/gnome/gw/clutter-spec.scm:
* clutter/gnome/gw/clutter-support.h:
* clutter/gnome/gw/clutter-support.c: add custom bindings and support
  code for ClutterMatrix
---
 clutter/gnome/gw/clutter-spec.scm  |  7 ++++++
 clutter/gnome/gw/clutter-support.c | 49 +++++++++++++++++++++++++++++++++++++-
 clutter/gnome/gw/clutter-support.h |  3 +++
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/clutter/gnome/gw/clutter-spec.scm b/clutter/gnome/gw/clutter-spec.scm
index cd8d3d3..c6089e6 100644
--- a/clutter/gnome/gw/clutter-spec.scm
+++ b/clutter/gnome/gw/clutter-spec.scm
@@ -177,6 +177,13 @@
    ;; unwrap
    (list c-var " = scm_scm_to_clutter_rect (" scm-var ");\n"))
 
+  (wrap-custom-boxed!
+   "ClutterMatrix" "CLUTTER_TYPE_MATRIX"
+   ;; wrap
+   (list scm-var " = " c-var " ? scm_clutter_matrix_to_scm (" c-var ") : SCM_BOOL_F;\n")
+   ;; unwrap
+   (list c-var " = scm_scm_to_clutter_matrix (" scm-var ");\n"))
+
   (wrap-opaque-pointer! ws "ClutterInputDevice*")
 
   (wrap-opaque-pointer! ws "ClutterEventSequence*")
diff --git a/clutter/gnome/gw/clutter-support.c b/clutter/gnome/gw/clutter-support.c
index e166dfb..1cd52d2 100644
--- a/clutter/gnome/gw/clutter-support.c
+++ b/clutter/gnome/gw/clutter-support.c
@@ -358,4 +358,51 @@ scm_scm_to_clutter_rect (SCM scm)
   ret.size.height = scm_to_double (scm_cadddr (scm));
 
   return clutter_rect_copy (&ret);
-};
+}
+
+SCM
+scm_clutter_matrix_to_scm (ClutterMatrix *m)
+{
+  return scm_list_n (scm_from_double (m->xx), /* column 0 */
+		     scm_from_double (m->yx),
+		     scm_from_double (m->zx),
+		     scm_from_double (m->wx),
+		     scm_from_double (m->xy), /* column 1 */
+		     scm_from_double (m->yy),
+		     scm_from_double (m->zy),
+		     scm_from_double (m->wy),
+		     scm_from_double (m->xz), /* column 2 */
+		     scm_from_double (m->yz),
+		     scm_from_double (m->zz),
+		     scm_from_double (m->wz),
+		     scm_from_double (m->xw), /* column 3 */
+		     scm_from_double (m->yw),
+		     scm_from_double (m->zw),
+		     scm_from_double (m->ww),
+		     SCM_UNDEFINED);
+}
+
+ClutterMatrix*
+scm_scm_to_clutter_matrix (SCM scm)
+{
+  ClutterMatrix ret;
+
+  ret.xx = scm_to_double (scm_list_ref (scm, 0));
+  ret.yx = scm_to_double (scm_list_ref (scm, 1));
+  ret.zx = scm_to_double (scm_list_ref (scm, 2));
+  ret.wx = scm_to_double (scm_list_ref (scm, 3));
+  ret.xy = scm_to_double (scm_list_ref (scm, 4));
+  ret.yy = scm_to_double (scm_list_ref (scm, 5));
+  ret.zy = scm_to_double (scm_list_ref (scm, 6));
+  ret.wy = scm_to_double (scm_list_ref (scm, 7));
+  ret.xz = scm_to_double (scm_list_ref (scm, 8));
+  ret.yz = scm_to_double (scm_list_ref (scm, 9));
+  ret.zz = scm_to_double (scm_list_ref (scm, 10));
+  ret.wz = scm_to_double (scm_list_ref (scm, 11));
+  ret.xw = scm_to_double (scm_list_ref (scm, 12));
+  ret.yw = scm_to_double (scm_list_ref (scm, 13));
+  ret.zw = scm_to_double (scm_list_ref (scm, 14));
+  ret.ww = scm_to_double (scm_list_ref (scm, 15));
+
+  return g_boxed_copy (clutter_matrix_get_type (), &ret);
+}
diff --git a/clutter/gnome/gw/clutter-support.h b/clutter/gnome/gw/clutter-support.h
index 388858d..d5ead14 100644
--- a/clutter/gnome/gw/clutter-support.h
+++ b/clutter/gnome/gw/clutter-support.h
@@ -70,3 +70,6 @@ ClutterSize* scm_scm_to_clutter_size (SCM scm);
 
 SCM scm_clutter_rect_to_scm (ClutterRect *rect);
 ClutterRect* scm_scm_to_clutter_rect (SCM scm);
+
+SCM scm_clutter_matrix_to_scm (ClutterMatrix *m);
+ClutterMatrix* scm_scm_to_clutter_matrix (SCM scm);
-- 
2.0.0.rc0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: guile-clutter, clutter-devel: add custom bindings for ClutterMatrix
  2014-05-09 15:27 guile-clutter, clutter-devel: add custom bindings for ClutterMatrix David Pirotte
@ 2014-05-09 18:53 ` David Pirotte
  0 siblings, 0 replies; 2+ messages in thread
From: David Pirotte @ 2014-05-09 18:53 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Hello,

This is a new patch for the ClutterMatrix bindings, please ignore the
previous one.  Indeed scm_list_ref expects 2 SCM args, this new patch now
correctly calls scm_from_int over scm_list_ref second argument, all calls.

Cheers,
David

;; --

Le Fri, 9 May 2014 12:27:17 -0300,
David Pirotte <david@altosw.be> a écrit :

> Hello,
> 
> 	guile-clutter
> 	  clutter-devel: add custom bindings for ClutterMatrix
> 
> Patch review solicited.
> 
> Thanks,
> David

[-- Attachment #2: 0006-add-custom-bindings-for-ClutterMatrix.patch --]
[-- Type: text/x-patch, Size: 3999 bytes --]

From 92388ae5c64b36e8323e453a4ce9cdefa26043d5 Mon Sep 17 00:00:00 2001
From: David PIROTTE <david@altosw.be>
Date: Fri, 9 May 2014 15:34:53 -0300
Subject: [PATCH 6/6] add custom bindings for ClutterMatrix

    * clutter/gnome/gw/clutter-spec.scm:
    * clutter/gnome/gw/clutter-support.h:
    * clutter/gnome/gw/clutter-support.c: add custom bindings and support
      code for ClutterMatrix
---
 clutter/gnome/gw/clutter-spec.scm  |  7 ++++++
 clutter/gnome/gw/clutter-support.c | 49 +++++++++++++++++++++++++++++++++++++-
 clutter/gnome/gw/clutter-support.h |  3 +++
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/clutter/gnome/gw/clutter-spec.scm b/clutter/gnome/gw/clutter-spec.scm
index cd8d3d3..c6089e6 100644
--- a/clutter/gnome/gw/clutter-spec.scm
+++ b/clutter/gnome/gw/clutter-spec.scm
@@ -177,6 +177,13 @@
    ;; unwrap
    (list c-var " = scm_scm_to_clutter_rect (" scm-var ");\n"))
 
+  (wrap-custom-boxed!
+   "ClutterMatrix" "CLUTTER_TYPE_MATRIX"
+   ;; wrap
+   (list scm-var " = " c-var " ? scm_clutter_matrix_to_scm (" c-var ") : SCM_BOOL_F;\n")
+   ;; unwrap
+   (list c-var " = scm_scm_to_clutter_matrix (" scm-var ");\n"))
+
   (wrap-opaque-pointer! ws "ClutterInputDevice*")
 
   (wrap-opaque-pointer! ws "ClutterEventSequence*")
diff --git a/clutter/gnome/gw/clutter-support.c b/clutter/gnome/gw/clutter-support.c
index e166dfb..f3bad6a 100644
--- a/clutter/gnome/gw/clutter-support.c
+++ b/clutter/gnome/gw/clutter-support.c
@@ -358,4 +358,51 @@ scm_scm_to_clutter_rect (SCM scm)
   ret.size.height = scm_to_double (scm_cadddr (scm));
 
   return clutter_rect_copy (&ret);
-};
+}
+
+SCM
+scm_clutter_matrix_to_scm (ClutterMatrix *m)
+{
+  return scm_list_n (scm_from_double (m->xx), /* column 0 */
+		     scm_from_double (m->yx),
+		     scm_from_double (m->zx),
+		     scm_from_double (m->wx),
+		     scm_from_double (m->xy), /* column 1 */
+		     scm_from_double (m->yy),
+		     scm_from_double (m->zy),
+		     scm_from_double (m->wy),
+		     scm_from_double (m->xz), /* column 2 */
+		     scm_from_double (m->yz),
+		     scm_from_double (m->zz),
+		     scm_from_double (m->wz),
+		     scm_from_double (m->xw), /* column 3 */
+		     scm_from_double (m->yw),
+		     scm_from_double (m->zw),
+		     scm_from_double (m->ww),
+		     SCM_UNDEFINED);
+}
+
+ClutterMatrix*
+scm_scm_to_clutter_matrix (SCM scm)
+{
+  ClutterMatrix ret;
+
+  ret.xx = scm_to_double (scm_list_ref (scm, scm_from_int (0)));
+  ret.yx = scm_to_double (scm_list_ref (scm, scm_from_int (1)));
+  ret.zx = scm_to_double (scm_list_ref (scm, scm_from_int (2)));
+  ret.wx = scm_to_double (scm_list_ref (scm, scm_from_int (3)));
+  ret.xy = scm_to_double (scm_list_ref (scm, scm_from_int (4)));
+  ret.yy = scm_to_double (scm_list_ref (scm, scm_from_int (5)));
+  ret.zy = scm_to_double (scm_list_ref (scm, scm_from_int (6)));
+  ret.wy = scm_to_double (scm_list_ref (scm, scm_from_int (7)));
+  ret.xz = scm_to_double (scm_list_ref (scm, scm_from_int (8)));
+  ret.yz = scm_to_double (scm_list_ref (scm, scm_from_int (9)));
+  ret.zz = scm_to_double (scm_list_ref (scm, scm_from_int (10)));
+  ret.wz = scm_to_double (scm_list_ref (scm, scm_from_int (11)));
+  ret.xw = scm_to_double (scm_list_ref (scm, scm_from_int (12)));
+  ret.yw = scm_to_double (scm_list_ref (scm, scm_from_int (13)));
+  ret.zw = scm_to_double (scm_list_ref (scm, scm_from_int (14)));
+  ret.ww = scm_to_double (scm_list_ref (scm, scm_from_int (15)));
+
+  return g_boxed_copy (clutter_matrix_get_type (), &ret);
+}
diff --git a/clutter/gnome/gw/clutter-support.h b/clutter/gnome/gw/clutter-support.h
index 388858d..d5ead14 100644
--- a/clutter/gnome/gw/clutter-support.h
+++ b/clutter/gnome/gw/clutter-support.h
@@ -70,3 +70,6 @@ ClutterSize* scm_scm_to_clutter_size (SCM scm);
 
 SCM scm_clutter_rect_to_scm (ClutterRect *rect);
 ClutterRect* scm_scm_to_clutter_rect (SCM scm);
+
+SCM scm_clutter_matrix_to_scm (ClutterMatrix *m);
+ClutterMatrix* scm_scm_to_clutter_matrix (SCM scm);
-- 
2.0.0.rc0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-09 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-09 15:27 guile-clutter, clutter-devel: add custom bindings for ClutterMatrix David Pirotte
2014-05-09 18:53 ` David Pirotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).