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
24 #include "lily-proto.hh"
28 /** a group of individually translated symbols. You can add stencils
29 to the top, to the right, etc.
31 It is implemented as a "tree" of scheme expressions, as in
33 Expr = combine Expr-list
34 | translate Offset Expr
35 | origin (ORIGIN) Expr
40 SCHEME is a Scheme expression that --when eval'd-- produces the
45 * Because of the way that Stencil is implemented, it is the most
46 efficient to add "fresh" stencils to what you're going to build.
48 * Do not create Stencil objects on the heap. That includes passing
49 around Stencil* which are produced by unsmob<Stencil>(). Either
50 copy Stencil objects, or use SCM references.
52 * Empty stencils have empty dimensions. If add_at_edge is used to
53 init the stencil, we assume that
55 DIMENSIONS = (Interval (0, 0), Interval (0, 0)
57 class Stencil : public Simple_smob<Stencil>
60 SCM mark_smob () const;
61 static const char type_p_name_[];
73 Set dimensions to empty, or to (Interval (0, 0), Interval (0, 0) */
74 void set_empty (bool);
75 void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding);
76 void stack (Axis a, Direction d, const Stencil &m, Real padding, Real mindist);
77 void add_stencil (Stencil const &m);
78 void translate (Offset);
79 Stencil translated (Offset) const;
80 void rotate (Real, Offset);
81 void rotate_degrees (Real, Offset);
82 void rotate_degrees_absolute (Real, Offset);
83 void align_to (Axis a, Real x);
84 void translate_axis (Real, Axis);
85 void scale (Real, Real);
87 Interval extent (Axis) const;
88 Box extent_box () const;
89 bool is_empty () const;
90 bool is_empty (Axis) const;
91 Stencil in_color (Real r, Real g, Real b) const;
92 static SCM skylines_from_stencil (SCM, Real, Axis);
96 void interpret_stencil_expression (SCM expr,
97 SCM (*func) (void *, SCM),
100 SCM find_expression_fonts (SCM expr);
102 void register_stencil_head (SCM symbol);
103 bool is_stencil_head (SCM symbol);
104 SCM all_stencil_heads ();
106 #endif /* STENCIL_HH */