From: David Pirotte <david@altosw.be>
To: guile-devel <guile-devel@gnu.org>
Subject: guile-clutter, clutter-devel: add custom bindings for ClutterMatrix
Date: Fri, 9 May 2014 12:27:17 -0300 [thread overview]
Message-ID: <20140509122717.2f11a550@capac> (raw)
[-- 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
next reply other threads:[~2014-05-09 15:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 15:27 David Pirotte [this message]
2014-05-09 18:53 ` guile-clutter, clutter-devel: add custom bindings for ClutterMatrix David Pirotte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140509122717.2f11a550@capac \
--to=david@altosw.be \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).