From: David Pirotte <david@altosw.be>
To: David Pirotte <david@altosw.be>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: guile-clutter, clutter-devel: add custom bindings for ClutterMatrix
Date: Fri, 9 May 2014 15:53:19 -0300 [thread overview]
Message-ID: <20140509155319.7ec72fd8@capac> (raw)
In-Reply-To: <20140509122717.2f11a550@capac>
[-- 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
prev parent reply other threads:[~2014-05-09 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 15:27 guile-clutter, clutter-devel: add custom bindings for ClutterMatrix David Pirotte
2014-05-09 18:53 ` David Pirotte [this message]
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=20140509155319.7ec72fd8@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).