]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stencil-scheme.cc
(LY_DEFINE): add ly:stencil-origin
[lilypond.git] / lily / stencil-scheme.cc
index 1577f52758538726f8f3e232bac71e9d1bc2ec42..ccf7e37ebd54122ecf687a2af9ef53209a0c2c27 100644 (file)
@@ -86,6 +86,20 @@ LY_DEFINE (ly_stencil_get_extent, "ly:stencil-extent",
   return ly_interval2scm (s->extent (Axis (scm_to_int (axis))));
 }
 
+
+LY_DEFINE (ly_stencil_origin, "ly:stencil-origin",
+          2, 0, 0, (SCM stil, SCM axis),
+          "Return a pair of numbers signifying the origin @var{stil} in "
+          "@var{axis} direction (0 or 1 for x and y axis respectively).")
+{
+  Stencil *s = unsmob_stencil (stil);
+  SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
+  SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+
+  return scm_from_double (s->origin()[Axis (scm_to_int (axis))]);
+}
+
+
 LY_DEFINE (ly_stencil_moved_to_edge, "ly:stencil-moved-to-edge",
           4, 2, 0, (SCM first, SCM axis, SCM direction, SCM second,
                     SCM padding, SCM minimum),
@@ -186,12 +200,12 @@ LY_DEFINE (ly_stencil_add , "ly:stencil-add",
 
   while (!SCM_NULLP (args))
     {
-      Stencil *s = unsmob_stencil (ly_car (args));
+      Stencil *s = unsmob_stencil (scm_car (args));
       if (!s)
-       SCM_ASSERT_TYPE (s, ly_car (args), SCM_ARGn, __FUNCTION__, "Stencil");
+       SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil");
 
       result.add_stencil (*s);
-      args = ly_cdr (args);
+      args = scm_cdr (args);
     }
 
   return result.smobbed_copy ();