2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
22 #include <cstdlib> // size_t
25 #include "lily-proto.hh"
29 /** a group of individually translated symbols. You can add stencils
30 to the top, to the right, etc.
32 It is implemented as a "tree" of scheme expressions, as in
34 Expr = combine Expr-list
35 | translate Offset Expr
36 | origin (ORIGIN) Expr
41 SCHEME is a Scheme expression that --when eval'd-- produces the
46 * Because of the way that Stencil is implemented, it is the most
47 efficient to add "fresh" stencils to what you're going to build.
49 * Do not create Stencil objects on the heap. That includes passing
50 around Stencil* which are produced by Stencil::unsmob(). Either
51 copy Stencil objects, or use SCM references.
53 * Empty stencils have empty dimensions. If add_at_edge is used to
54 init the stencil, we assume that
56 DIMENSIONS = (Interval (0, 0), Interval (0, 0)
58 class Stencil : public Simple_smob<Stencil>
62 static const char type_p_name_[];
74 Set dimensions to empty, or to (Interval (0, 0), Interval (0, 0) */
75 void set_empty (bool);
76 void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding);
77 void stack (Axis a, Direction d, const Stencil &m, Real padding, Real mindist);
78 void add_stencil (Stencil const &m);
79 void translate (Offset);
80 Stencil translated (Offset) const;
81 void rotate (Real, Offset);
82 void rotate_degrees (Real, Offset);
83 void rotate_degrees_absolute (Real, Offset);
84 void align_to (Axis a, Real x);
85 void translate_axis (Real, Axis);
86 void scale (Real, Real);
88 Interval extent (Axis) const;
89 Box extent_box () const;
90 bool is_empty () const;
91 bool is_empty (Axis) const;
92 Stencil in_color (Real r, Real g, Real b) const;
93 static SCM skylines_from_stencil (SCM, Real, Axis);
97 void interpret_stencil_expression (SCM expr,
98 SCM (*func) (void *, SCM),
101 SCM find_expression_fonts (SCM expr);
103 void register_stencil_head (SCM symbol);
104 bool is_stencil_head (SCM symbol);
105 SCM all_stencil_heads ();
107 #endif /* STENCIL_HH */