#include "line-interface.hh"
#include "warn.hh"
+#include "international.hh"
#include "dimensions.hh"
#include "bezier.hh"
#include "file-path.hh"
Stencil
Lookup::round_filled_box (Box b, Real blotdiameter)
{
- if (b.x ().length () < blotdiameter)
- blotdiameter = b.x ().length ();
- if (b.y ().length () < blotdiameter)
- blotdiameter = b.y ().length ();
+ Real width = b.x ().delta ();
+ blotdiameter = min (blotdiameter, width);
+ Real height = b.y ().delta ();
+ blotdiameter = min (blotdiameter, height);
+
+ if (blotdiameter < 0.0)
+ {
+ if (!isinf (blotdiameter))
+ warning (_f ("Not drawing a box with negative dimension, %.2f by %.2f.",
+ width, height));
+ return Stencil (b, SCM_EOL);
+ }
SCM at = (scm_list_n (ly_symbol2scm ("round-filled-box"),
scm_from_double (-b[X_AXIS][LEFT]),
Lookup::frame (Box b, Real thick, Real blot)
{
Stencil m;
- Direction d = LEFT;
for (Axis a = X_AXIS; a < NO_AXES; a = Axis (a + 1))
{
Axis o = Axis ((a + 1) % NO_AXES);
- do
+ for (LEFT_and_RIGHT (d))
{
Box edges;
edges[a] = b[a][d] + 0.5 * thick * Interval (-1, 1);
m.add_stencil (round_filled_box (edges, blot));
}
- while (flip (&d) != LEFT);
}
return m;
}
Stencil
Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve, Real thickness)
{
- SCM commands = scm_list_n (ly_symbol2scm ("moveto"),
- scm_from_double (top_curve.control_[0][X_AXIS]),
- scm_from_double (top_curve.control_[0][Y_AXIS]),
- ly_symbol2scm ("curveto"),
- scm_from_double (top_curve.control_[1][X_AXIS]),
- scm_from_double (top_curve.control_[1][Y_AXIS]),
- scm_from_double (top_curve.control_[2][X_AXIS]),
- scm_from_double (top_curve.control_[2][Y_AXIS]),
- scm_from_double (top_curve.control_[3][X_AXIS]),
- scm_from_double (top_curve.control_[3][Y_AXIS]),
- ly_symbol2scm ("curveto"),
- scm_from_double (bottom_curve.control_[2][X_AXIS]),
- scm_from_double (bottom_curve.control_[2][Y_AXIS]),
- scm_from_double (bottom_curve.control_[1][X_AXIS]),
- scm_from_double (bottom_curve.control_[1][Y_AXIS]),
- scm_from_double (bottom_curve.control_[0][X_AXIS]),
- scm_from_double (bottom_curve.control_[0][Y_AXIS]),
- ly_symbol2scm ("closepath"),
- SCM_UNDEFINED);
+ SCM commands = scm_list_n (ly_symbol2scm ("moveto"),
+ scm_from_double (top_curve.control_[0][X_AXIS]),
+ scm_from_double (top_curve.control_[0][Y_AXIS]),
+ ly_symbol2scm ("curveto"),
+ scm_from_double (top_curve.control_[1][X_AXIS]),
+ scm_from_double (top_curve.control_[1][Y_AXIS]),
+ scm_from_double (top_curve.control_[2][X_AXIS]),
+ scm_from_double (top_curve.control_[2][Y_AXIS]),
+ scm_from_double (top_curve.control_[3][X_AXIS]),
+ scm_from_double (top_curve.control_[3][Y_AXIS]),
+ ly_symbol2scm ("curveto"),
+ scm_from_double (bottom_curve.control_[2][X_AXIS]),
+ scm_from_double (bottom_curve.control_[2][Y_AXIS]),
+ scm_from_double (bottom_curve.control_[1][X_AXIS]),
+ scm_from_double (bottom_curve.control_[1][Y_AXIS]),
+ scm_from_double (bottom_curve.control_[0][X_AXIS]),
+ scm_from_double (bottom_curve.control_[0][Y_AXIS]),
+ ly_symbol2scm ("closepath"),
+ SCM_UNDEFINED);
SCM horizontal_bend = scm_list_n (ly_symbol2scm ("path"),
scm_from_double (thickness),