2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2014 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>
61 static SCM mark_smob (SCM);
62 static int print_smob (SCM, SCM, scm_print_state *);
63 static const char type_p_name_[];
75 Set dimensions to empty, or to (Interval (0, 0), Interval (0, 0) */
76 void set_empty (bool);
77 void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding);
78 void stack (Axis a, Direction d, const Stencil &m, Real padding, Real mindist);
79 void add_stencil (Stencil const &m);
80 void translate (Offset);
81 Stencil translated (Offset) const;
82 void rotate (Real, Offset);
83 void rotate_degrees (Real, Offset);
84 void rotate_degrees_absolute (Real, Offset);
85 void align_to (Axis a, Real x);
86 void translate_axis (Real, Axis);
87 void scale (Real, Real);
89 Interval extent (Axis) const;
90 Box extent_box () const;
91 bool is_empty () const;
92 bool is_empty (Axis) const;
93 Stencil in_color (Real r, Real g, Real b) const;
94 static SCM skylines_from_stencil (SCM, Real, Axis);
98 void interpret_stencil_expression (SCM expr,
99 SCM (*func) (void *, SCM),
102 SCM find_expression_fonts (SCM expr);
104 void register_stencil_head (SCM symbol);
105 bool is_stencil_head (SCM symbol);
106 SCM all_stencil_heads ();
108 #endif /* STENCIL_HH */