From bbb693c6f8a02dfd2b09b0bcc8b149e02b9d18b3 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Fri, 22 Aug 2008 01:17:37 +0200 Subject: [PATCH] Add ly:round-filled-polygon scheme function to create a filled rounded polygon Simply call the C++ method Lookup::round_filled_polygon, so I simply add a Scheme interface wrapper here. Signed-off-by: Reinhold Kainhofer --- lily/stencil-scheme.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index 79e76e3dcc..ed362c0628 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -319,6 +319,28 @@ LY_DEFINE (ly_round_filled_box, "ly:round-filled-box", scm_to_double (blot)).smobbed_copy (); } +LY_DEFINE (ly_round_filled_polygon, "ly:round-filled-polygon", + 2, 0, 0, + (SCM points, SCM blot), + "Make a @code{Stencil} object that prints a black polygon with " + "corners at the points defined by @var{points} (list of coordinate " + "pairs) and roundness @var{blot}.") +{ + SCM_ASSERT_TYPE (scm_ilength (points) > 0, points, SCM_ARG1, __FUNCTION__, "list of coordinate pairs"); + LY_ASSERT_TYPE (scm_is_number, blot, 2); + vector pts; + for (SCM p = points; scm_is_pair (p); p = scm_cdr (p)) + { + SCM scm_pt = scm_car (p); + if (scm_is_pair (scm_pt)) { + pts.push_back (ly_scm2offset (scm_pt)); + } else { + // TODO: Print out warning + } + } + return Lookup::round_filled_polygon (pts, scm_to_double (blot)).smobbed_copy (); +} + LY_DEFINE (ly_register_stencil_expression, "ly:register-stencil-expression", 1, 0, 0, (SCM symbol), -- 2.39.5