From: Han-Wen Nienhuys Date: Fri, 26 Jan 2007 02:39:25 +0000 (+0100) Subject: use and document Stencil::rotate() interface. X-Git-Tag: release/2.11.14-1~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7580884e0fbb988ef3374f0006a5318f4c757522;p=lilypond.git use and document Stencil::rotate() interface. --- diff --git a/lily/line-interface.cc b/lily/line-interface.cc index ebaceec65c..c2e189c8d3 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -48,7 +48,7 @@ Line_interface::make_trill_line (Grob *me, alist_chain)); Stencil elt = fm->find_by_name ("scripts.trill_element"); - + elt.align_to (Y_AXIS, CENTER); Real elt_len = elt.extent (X_AXIS).length (); if (elt_len <= 0.0) { @@ -65,7 +65,7 @@ Line_interface::make_trill_line (Grob *me, } while (len + elt_len < dz.length ()); - line.rotate (dz.arg (), Offset (0,0)); + line.rotate (dz.arg (), Offset (LEFT, CENTER)); line.translate (from); return line; diff --git a/lily/stencil.cc b/lily/stencil.cc index 12bbf4ea12..59e88398f2 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -76,14 +76,17 @@ Stencil::extent_box () const void Stencil::rotate (Real a, Offset off) { - rotate_degrees (a *180/M_PI, off); + rotate_degrees (a * 180/M_PI, off); } /* - Rotate this stencil around the point [x, y] + Rotate this stencil around the point RELATIVE_OFF. + + RELATIVE_OFF is measured in terms of the extent of the stencil, so + -1 = LEFT/DOWN edge, 1 = RIGHT/UP edge. */ void -Stencil::rotate_degrees (Real a, Offset off) +Stencil::rotate_degrees (Real a, Offset relative_off) { const Real x_cen = extent (X_AXIS).center (); const Real y_cen = extent (Y_AXIS).center (); @@ -91,8 +94,8 @@ Stencil::rotate_degrees (Real a, Offset off) /* * Calculate the center of rotation */ - const Real x = x_cen + off[X_AXIS] * x_cen; - const Real y = y_cen + off[Y_AXIS] * y_cen; + const Real x = x_cen + relative_off[X_AXIS] * x_cen; + const Real y = y_cen + relative_off[Y_AXIS] * y_cen; /* * Build scheme expression (processed in stencil-interpret.cc)