]> git.donarmstrong.com Git - lilypond.git/commitdiff
use and document Stencil::rotate() interface.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 02:39:25 +0000 (03:39 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 02:39:25 +0000 (03:39 +0100)
lily/line-interface.cc
lily/stencil.cc

index ebaceec65c4ba2486bd147a6c18f0602d0efd34f..c2e189c8d3fb353481028ef5cba31757724a7f50 100644 (file)
@@ -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; 
index 12bbf4ea128f0f573a41ae1e9b7d1f6cabd5fbe4..59e88398f29b11f7449353aa5f1d317203b95610 100644 (file)
@@ -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)