LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2012 Mike Solomon <mike@apollinemike.com> | 4 Copyright (C) 2012 Mike Solomon <mike@apollinemike.com> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "stencil.hh" | 52 #include "stencil.hh" |
53 #include "string-convert.hh" | 53 #include "string-convert.hh" |
54 #include "skyline.hh" | 54 #include "skyline.hh" |
55 #include "skyline-pair.hh" | 55 #include "skyline-pair.hh" |
56 using namespace std; | 56 using namespace std; |
57 | 57 |
58 Real QUANTIZATION_UNIT = 0.2; | 58 Real QUANTIZATION_UNIT = 0.2; |
59 | 59 |
60 void create_path_cap (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings
, PangoMatrix trans, Offset pt, Real rad, Real slope, Direction d); | 60 void create_path_cap (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings
, PangoMatrix trans, Offset pt, Real rad, Real slope, Direction d); |
61 | 61 |
62 struct Transform_matrix_and_expression { | 62 struct Transform_matrix_and_expression |
| 63 { |
63 PangoMatrix tm_; | 64 PangoMatrix tm_; |
64 SCM expr_; | 65 SCM expr_; |
65 | 66 |
66 Transform_matrix_and_expression (PangoMatrix tm, SCM expr); | 67 Transform_matrix_and_expression (PangoMatrix tm, SCM expr); |
67 }; | 68 }; |
68 | |
69 | 69 |
70 Transform_matrix_and_expression::Transform_matrix_and_expression (PangoMatrix tm
, SCM expr) | 70 Transform_matrix_and_expression::Transform_matrix_and_expression (PangoMatrix tm
, SCM expr) |
71 { | 71 { |
72 tm_ = tm; | 72 tm_ = tm; |
73 expr_ = expr; | 73 expr_ = expr; |
74 } | 74 } |
75 | 75 |
76 PangoMatrix | 76 PangoMatrix |
77 make_transform_matrix (Real p0, Real p1, Real p2, Real p3, Real p4, Real p5) | 77 make_transform_matrix (Real p0, Real p1, Real p2, Real p3, Real p4, Real p5) |
78 { | 78 { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 { | 307 { |
308 b.add_point (points[d][i]); | 308 b.add_point (points[d][i]); |
309 b.add_point (points[d][i + 1]); | 309 b.add_point (points[d][i + 1]); |
310 } | 310 } |
311 while (flip (&d) != DOWN); | 311 while (flip (&d) != DOWN); |
312 boxes.push_back (b); | 312 boxes.push_back (b); |
313 } | 313 } |
314 | 314 |
315 if (connect || fill) | 315 if (connect || fill) |
316 { | 316 { |
317 make_draw_line_boxes (boxes, buildings, trans, scm_list_5(scm_from_double
(th), | 317 make_draw_line_boxes (boxes, buildings, trans, scm_list_5 (scm_from_double
(th), |
318 scm_from_double (sp[X_AXIS]
), | 318 scm_from_double
(sp[X_AXIS]), |
319 scm_from_double (sp[Y_AXIS]
), | 319 scm_from_double
(sp[Y_AXIS]), |
320 scm_from_double (ep[X_AXIS]
), | 320 scm_from_double
(ep[X_AXIS]), |
321 scm_from_double (ep[Y_AXIS]
)), | 321 scm_from_double
(ep[Y_AXIS])), |
322 false); | 322 false); |
323 } | 323 } |
324 | 324 |
325 if (th > 0.0) | 325 if (th > 0.0) |
326 { | 326 { |
327 // beg line cap | 327 // beg line cap |
328 complex<Real> coord = polar (1.0, start); | 328 complex<Real> coord = polar (1.0, start); |
329 Offset pt (real (coord) * x_rad, | 329 Offset pt (real (coord) * x_rad, |
330 imag (coord) * y_rad); | 330 imag (coord) * y_rad); |
331 Real slope = pt[Y_AXIS] / pt[X_AXIS]; | 331 Real slope = pt[Y_AXIS] / pt[X_AXIS]; |
332 create_path_cap (boxes, | 332 create_path_cap (boxes, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 Real holder = other; | 386 Real holder = other; |
387 other = angle; | 387 other = angle; |
388 angle = holder; | 388 angle = holder; |
389 } | 389 } |
390 other = (slope >= 0 && d == DOWN) || (slope < 0 && d == UP) | 390 other = (slope >= 0 && d == DOWN) || (slope < 0 && d == UP) |
391 ? other + 360.0 | 391 ? other + 360.0 |
392 : other; | 392 : other; |
393 PangoMatrix new_trans (trans); | 393 PangoMatrix new_trans (trans); |
394 pango_matrix_translate (&new_trans, pt[X_AXIS], pt[Y_AXIS]); | 394 pango_matrix_translate (&new_trans, pt[X_AXIS], pt[Y_AXIS]); |
395 make_partial_ellipse_boxes (boxes, buildings, new_trans, | 395 make_partial_ellipse_boxes (boxes, buildings, new_trans, |
396 scm_list_n (scm_from_double (rad), | 396 scm_list_n (scm_from_double (rad), |
397 scm_from_double (rad), | 397 scm_from_double (rad), |
398 scm_from_double (angle), | 398 scm_from_double (angle), |
399 scm_from_double (other), | 399 scm_from_double (other), |
400 scm_from_double (0.0), | 400 scm_from_double (0.0), |
401 SCM_BOOL_F, | 401 SCM_BOOL_F, |
402 SCM_BOOL_F, | 402 SCM_BOOL_F, |
403 SCM_UNDEFINED)); | 403 SCM_UNDEFINED)); |
404 } | 404 } |
405 | 405 |
406 void | 406 void |
407 make_draw_bezier_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildin
gs, PangoMatrix trans, SCM expr) | 407 make_draw_bezier_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildin
gs, PangoMatrix trans, SCM expr) |
408 { | 408 { |
409 Real th = robust_scm2double (scm_car (expr), 0.0); | 409 Real th = robust_scm2double (scm_car (expr), 0.0); |
410 expr = scm_cdr (expr); | 410 expr = scm_cdr (expr); |
411 Real x0 = robust_scm2double (scm_car (expr), 0.0); | 411 Real x0 = robust_scm2double (scm_car (expr), 0.0); |
412 expr = scm_cdr (expr); | 412 expr = scm_cdr (expr); |
413 Real y0 = robust_scm2double (scm_car (expr), 0.0); | 413 Real y0 = robust_scm2double (scm_car (expr), 0.0); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 expr = scm_cdr (expr); | 584 expr = scm_cdr (expr); |
585 out = scm_cons (scm_list_n (scm_from_double (current[X_AXIS]), | 585 out = scm_cons (scm_list_n (scm_from_double (current[X_AXIS]), |
586 scm_from_double (current[Y_AXIS]), | 586 scm_from_double (current[Y_AXIS]), |
587 scm_from_double (x1), | 587 scm_from_double (x1), |
588 scm_from_double (y1), | 588 scm_from_double (y1), |
589 scm_from_double (x2), | 589 scm_from_double (x2), |
590 scm_from_double (y2), | 590 scm_from_double (y2), |
591 scm_from_double (x3), | 591 scm_from_double (x3), |
592 scm_from_double (y3), | 592 scm_from_double (y3), |
593 SCM_UNDEFINED), | 593 SCM_UNDEFINED), |
594 out); | 594 out); |
595 current = Offset (x3, y3); | 595 current = Offset (x3, y3); |
596 } | 596 } |
597 else if (scm_car (expr) == ly_symbol2scm ("rcurveto")) | 597 else if (scm_car (expr) == ly_symbol2scm ("rcurveto")) |
598 { | 598 { |
599 Real x1 = robust_scm2double (scm_cadr (expr), 0.0); | 599 Real x1 = robust_scm2double (scm_cadr (expr), 0.0); |
600 expr = scm_cddr (expr); | 600 expr = scm_cddr (expr); |
601 Real y1 = robust_scm2double (scm_car (expr), 0.0); | 601 Real y1 = robust_scm2double (scm_car (expr), 0.0); |
602 expr = scm_cdr (expr); | 602 expr = scm_cdr (expr); |
603 Real x2 = robust_scm2double (scm_car (expr), 0.0); | 603 Real x2 = robust_scm2double (scm_car (expr), 0.0); |
604 expr = scm_cdr (expr); | 604 expr = scm_cdr (expr); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 internal_make_path_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &build
ings, PangoMatrix trans, SCM expr, bool use_building) | 647 internal_make_path_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &build
ings, PangoMatrix trans, SCM expr, bool use_building) |
648 { | 648 { |
649 SCM blot = scm_car (expr); | 649 SCM blot = scm_car (expr); |
650 expr = scm_cdr (expr); | 650 expr = scm_cdr (expr); |
651 SCM path = all_commands_to_absolute_and_group (expr); | 651 SCM path = all_commands_to_absolute_and_group (expr); |
652 // note that expr has more stuff that we don't need after this - simply ignore
it | 652 // note that expr has more stuff that we don't need after this - simply ignore
it |
653 ////////////////////// | 653 ////////////////////// |
654 for (SCM s = path; scm_is_pair (s); s = scm_cdr (s)) | 654 for (SCM s = path; scm_is_pair (s); s = scm_cdr (s)) |
655 { | 655 { |
656 scm_to_int (scm_length (scm_car (s))) == 4 | 656 scm_to_int (scm_length (scm_car (s))) == 4 |
657 ? make_draw_line_boxes (boxes, buildings, trans, scm_cons (blo
t, scm_car (s)), use_building) | 657 ? make_draw_line_boxes (boxes, buildings, trans, scm_cons (blot, scm_car (
s)), use_building) |
658 : make_draw_bezier_boxes (boxes, buildings, trans, scm_cons (b
lot, scm_car (s))); | 658 : make_draw_bezier_boxes (boxes, buildings, trans, scm_cons (blot, scm_car
(s))); |
659 } | 659 } |
660 } | 660 } |
661 | 661 |
662 void | 662 void |
663 make_path_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, Pan
goMatrix trans, SCM expr) | 663 make_path_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings, Pan
goMatrix trans, SCM expr) |
664 { | 664 { |
665 return internal_make_path_boxes (boxes, buildings, trans, scm_cons (scm_car (e
xpr), get_path_list (scm_cdr (expr))), false); | 665 return internal_make_path_boxes (boxes, buildings, trans, scm_cons (scm_car (e
xpr), get_path_list (scm_cdr (expr))), false); |
666 } | 666 } |
667 | 667 |
668 void | 668 void |
(...skipping 19 matching lines...) Expand all Loading... |
688 void | 688 void |
689 make_named_glyph_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildin
gs, PangoMatrix trans, SCM expr) | 689 make_named_glyph_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildin
gs, PangoMatrix trans, SCM expr) |
690 { | 690 { |
691 SCM fm_scm = scm_car (expr); | 691 SCM fm_scm = scm_car (expr); |
692 Font_metric *fm = unsmob_metrics (fm_scm); | 692 Font_metric *fm = unsmob_metrics (fm_scm); |
693 expr = scm_cdr (expr); | 693 expr = scm_cdr (expr); |
694 SCM glyph = scm_car (expr); | 694 SCM glyph = scm_car (expr); |
695 string glyph_s = ly_scm2string (glyph); | 695 string glyph_s = ly_scm2string (glyph); |
696 | 696 |
697 ////////////////////// | 697 ////////////////////// |
698 Open_type_font *open_fm = | 698 Open_type_font *open_fm |
699 dynamic_cast<Open_type_font *> | 699 = dynamic_cast<Open_type_font *> |
700 (dynamic_cast<Modified_font_metric *>(fm)->original_font ()); | 700 (dynamic_cast<Modified_font_metric *>(fm)->original_font ()); |
701 SCM_ASSERT_TYPE (open_fm, fm_scm, SCM_ARG1, __FUNCTION__, "OpenType font"); | 701 SCM_ASSERT_TYPE (open_fm, fm_scm, SCM_ARG1, __FUNCTION__, "OpenType font"); |
702 | 702 |
703 size_t gidx = open_fm->name_to_index (glyph_s); | 703 size_t gidx = open_fm->name_to_index (glyph_s); |
704 //Box bbox = open_fm->get_unscaled_indexed_char_dimensions (gidx); | 704 //Box bbox = open_fm->get_unscaled_indexed_char_dimensions (gidx); |
705 Box bbox = open_fm->get_unscaled_indexed_char_dimensions (gidx); | 705 Box bbox = open_fm->get_unscaled_indexed_char_dimensions (gidx); |
706 SCM outline = open_fm->get_glyph_outline (gidx); | 706 SCM outline = open_fm->get_glyph_outline (gidx); |
707 Box real_bbox = fm->get_indexed_char_dimensions (gidx); | 707 Box real_bbox = fm->get_indexed_char_dimensions (gidx); |
708 | 708 |
709 /* | 709 /* |
710 Because extents for named glyphs are cached, the value of | 710 Because extents for named glyphs are cached, the value of |
711 real_bbox may not be the one that freetype calculates. | 711 real_bbox may not be the one that freetype calculates. |
712 | 712 |
713 They should be close, though. | 713 They should be close, though. |
714 A workaround below is to use the max of the two, which may | 714 A workaround below is to use the max of the two, which may |
715 slightly overshoot an extent but generally doesn't. | 715 slightly overshoot an extent but generally doesn't. |
716 */ | 716 */ |
717 Real xlen = real_bbox[X_AXIS].length () / bbox[X_AXIS].length (); | 717 Real xlen = real_bbox[X_AXIS].length () / bbox[X_AXIS].length (); |
718 Real ylen = real_bbox[Y_AXIS].length () / bbox[Y_AXIS].length (); | 718 Real ylen = real_bbox[Y_AXIS].length () / bbox[Y_AXIS].length (); |
719 assert (abs (xlen - ylen) < 10e-3); | 719 assert (abs (xlen - ylen) < 10e-3); |
720 | 720 |
721 pango_matrix_scale (&trans, max (xlen, ylen), max (xlen, ylen)); | 721 pango_matrix_scale (&trans, max (xlen, ylen), max (xlen, ylen)); |
722 | 722 |
723 ////////////////////// | 723 ////////////////////// |
724 for (SCM s = outline; | 724 for (SCM s = outline; |
725 scm_is_pair (s); | 725 scm_is_pair (s); |
726 s = scm_cdr (s)) | 726 s = scm_cdr (s)) |
727 { | 727 { |
728 scm_to_int (scm_length (scm_car (s))) == 4 | 728 scm_to_int (scm_length (scm_car (s))) == 4 |
729 ? make_draw_line_boxes (boxes, buildings, trans, scm_cons (scm
_from_double (0), scm_car (s)), false) | 729 ? make_draw_line_boxes (boxes, buildings, trans, scm_cons (scm_from_double
(0), scm_car (s)), false) |
730 : make_draw_bezier_boxes (boxes, buildings, trans, scm_cons (s
cm_from_double (0), scm_car (s))); | 730 : make_draw_bezier_boxes (boxes, buildings, trans, scm_cons (scm_from_doub
le (0), scm_car (s))); |
731 } | 731 } |
732 } | 732 } |
733 | 733 |
734 void | 734 void |
735 make_glyph_string_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildi
ngs, PangoMatrix trans, SCM expr) | 735 make_glyph_string_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildi
ngs, PangoMatrix trans, SCM expr) |
736 { | 736 { |
737 SCM fm_scm = scm_car (expr); | 737 SCM fm_scm = scm_car (expr); |
738 Font_metric *fm = unsmob_metrics (fm_scm); | 738 Font_metric *fm = unsmob_metrics (fm_scm); |
739 expr = scm_cdr (expr); | 739 expr = scm_cdr (expr); |
740 expr = scm_cdr (expr); // font-name | 740 expr = scm_cdr (expr); // font-name |
741 expr = scm_cdr (expr); // size | 741 expr = scm_cdr (expr); // size |
742 expr = scm_cdr (expr); // cid? | 742 expr = scm_cdr (expr); // cid? |
743 SCM whxy = scm_cadar (expr); | 743 SCM whxy = scm_cadar (expr); |
744 vector<Real> widths; | 744 vector<Real> widths; |
745 vector<Interval> heights; | 745 vector<Interval> heights; |
746 vector<Real> xos; | 746 vector<Real> xos; |
747 vector<Real> yos; | 747 vector<Real> yos; |
748 vector<string> char_ids; | 748 vector<string> char_ids; |
749 ////////////////////// | 749 ////////////////////// |
750 Pango_font *pango_fm = dynamic_cast<Pango_font *> (fm); | 750 Pango_font *pango_fm = dynamic_cast<Pango_font *> (fm); |
751 SCM_ASSERT_TYPE (pango_fm, fm_scm, SCM_ARG1, __FUNCTION__, "Pango font"); | 751 SCM_ASSERT_TYPE (pango_fm, fm_scm, SCM_ARG1, __FUNCTION__, "Pango font"); |
752 | 752 |
753 for (SCM s = whxy; scm_is_pair (s); s = scm_cdr (s)) | 753 for (SCM s = whxy; scm_is_pair (s); s = scm_cdr (s)) |
754 { | 754 { |
755 SCM now = scm_car (s); | 755 SCM now = scm_car (s); |
756 widths.push_back (robust_scm2double (scm_car (now), 0.0)); | 756 widths.push_back (robust_scm2double (scm_car (now), 0.0)); |
757 now = scm_cdr (now); | 757 now = scm_cdr (now); |
758 heights.push_back (robust_scm2interval (scm_car (now), Interval (0,0))); | 758 heights.push_back (robust_scm2interval (scm_car (now), Interval (0, 0))); |
759 now = scm_cdr (now); | 759 now = scm_cdr (now); |
760 xos.push_back (robust_scm2double (scm_car (now), 0.0)); | 760 xos.push_back (robust_scm2double (scm_car (now), 0.0)); |
761 now = scm_cdr (now); | 761 now = scm_cdr (now); |
762 yos.push_back (robust_scm2double (scm_car (now), 0.0)); | 762 yos.push_back (robust_scm2double (scm_car (now), 0.0)); |
763 now = scm_cdr (now); | 763 now = scm_cdr (now); |
764 char_ids.push_back (robust_scm2string (scm_car (now), "")); | 764 char_ids.push_back (robust_scm2string (scm_car (now), "")); |
765 } | 765 } |
766 Real cumulative_x = 0.0; | 766 Real cumulative_x = 0.0; |
767 for (vsize i = 0; i < widths.size (); i++) | 767 for (vsize i = 0; i < widths.size (); i++) |
768 { | 768 { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 pango_matrix_translate (&transcopy, real_bbox[X_AXIS][LEFT], real_bbox
[Y_AXIS][DOWN]); | 806 pango_matrix_translate (&transcopy, real_bbox[X_AXIS][LEFT], real_bbox
[Y_AXIS][DOWN]); |
807 pango_matrix_scale (&transcopy, scale_factor, scale_factor); | 807 pango_matrix_scale (&transcopy, scale_factor, scale_factor); |
808 pango_matrix_translate (&transcopy, -bbox[X_AXIS][LEFT], -bbox[Y_AXIS]
[DOWN]); | 808 pango_matrix_translate (&transcopy, -bbox[X_AXIS][LEFT], -bbox[Y_AXIS]
[DOWN]); |
809 } | 809 } |
810 ////////////////////// | 810 ////////////////////// |
811 for (SCM s = outline; | 811 for (SCM s = outline; |
812 scm_is_pair (s); | 812 scm_is_pair (s); |
813 s = scm_cdr (s)) | 813 s = scm_cdr (s)) |
814 { | 814 { |
815 scm_to_int (scm_length (scm_car (s))) == 4 | 815 scm_to_int (scm_length (scm_car (s))) == 4 |
816 ? make_draw_line_boxes (boxes, buildings, transcopy, scm_c
ons (scm_from_double (0), scm_car (s)), false) | 816 ? make_draw_line_boxes (boxes, buildings, transcopy, scm_cons (scm_fro
m_double (0), scm_car (s)), false) |
817 : make_draw_bezier_boxes (boxes, buildings, transcopy, scm
_cons (scm_from_double (0), scm_car (s))); | 817 : make_draw_bezier_boxes (boxes, buildings, transcopy, scm_cons (scm_f
rom_double (0), scm_car (s))); |
818 } | 818 } |
819 } | 819 } |
820 } | 820 } |
821 | 821 |
822 /* | 822 /* |
823 receives a stencil expression and a transform matrix | 823 receives a stencil expression and a transform matrix |
824 depending on the stencil name, dispatches it to the appropriate function | 824 depending on the stencil name, dispatches it to the appropriate function |
825 */ | 825 */ |
826 | 826 |
827 void | 827 void |
(...skipping 15 matching lines...) Expand all Loading... |
843 SCM x2 = scm_car (expr); | 843 SCM x2 = scm_car (expr); |
844 make_draw_line_boxes (boxes, buildings, trans, scm_list_5 (th, scm_from_do
uble (0.0), scm_from_double (0.0), x1, x2), true); | 844 make_draw_line_boxes (boxes, buildings, trans, scm_list_5 (th, scm_from_do
uble (0.0), scm_from_double (0.0), x1, x2), true); |
845 } | 845 } |
846 else if (scm_car (expr) == ly_symbol2scm ("circle")) | 846 else if (scm_car (expr) == ly_symbol2scm ("circle")) |
847 { | 847 { |
848 expr = scm_cdr (expr); | 848 expr = scm_cdr (expr); |
849 SCM rad = scm_car (expr); | 849 SCM rad = scm_car (expr); |
850 expr = scm_cdr (expr); | 850 expr = scm_cdr (expr); |
851 SCM th = scm_car (expr); | 851 SCM th = scm_car (expr); |
852 make_partial_ellipse_boxes (boxes, buildings, trans, | 852 make_partial_ellipse_boxes (boxes, buildings, trans, |
853 scm_list_n (rad, | 853 scm_list_n (rad, |
854 rad, | 854 rad, |
855 scm_from_double (0.0), | 855 scm_from_double (0.0), |
856 scm_from_double (360.0), | 856 scm_from_double (360.0), |
857 th, | 857 th, |
858 SCM_BOOL_F, | 858 SCM_BOOL_F, |
859 SCM_BOOL_T, | 859 SCM_BOOL_T, |
860 SCM_UNDEFINED)); | 860 SCM_UNDEFINED)); |
861 } | 861 } |
862 else if (scm_car (expr) == ly_symbol2scm ("ellipse")) | 862 else if (scm_car (expr) == ly_symbol2scm ("ellipse")) |
863 { | 863 { |
864 expr = scm_cdr (expr); | 864 expr = scm_cdr (expr); |
865 SCM x_rad = scm_car (expr); | 865 SCM x_rad = scm_car (expr); |
866 expr = scm_cdr (expr); | 866 expr = scm_cdr (expr); |
867 SCM y_rad = scm_car (expr); | 867 SCM y_rad = scm_car (expr); |
868 expr = scm_cdr (expr); | 868 expr = scm_cdr (expr); |
869 SCM th = scm_car (expr); | 869 SCM th = scm_car (expr); |
870 make_partial_ellipse_boxes (boxes, buildings, trans, | 870 make_partial_ellipse_boxes (boxes, buildings, trans, |
871 scm_list_n (x_rad, | 871 scm_list_n (x_rad, |
872 y_rad, | 872 y_rad, |
873 scm_from_double (0.0), | 873 scm_from_double (0.0), |
874 scm_from_double (360.0), | 874 scm_from_double (360.0), |
875 th, | 875 th, |
876 SCM_BOOL_F, | 876 SCM_BOOL_F, |
877 SCM_BOOL_T, | 877 SCM_BOOL_T, |
878 SCM_UNDEFINED)); | 878 SCM_UNDEFINED)); |
879 } | 879 } |
880 else if (scm_car (expr) == ly_symbol2scm ("partial-ellipse")) | 880 else if (scm_car (expr) == ly_symbol2scm ("partial-ellipse")) |
881 make_partial_ellipse_boxes (boxes, buildings, trans, scm_cdr (expr)); | 881 make_partial_ellipse_boxes (boxes, buildings, trans, scm_cdr (expr)); |
882 else if (scm_car (expr) == ly_symbol2scm ("round-filled-box")) | 882 else if (scm_car (expr) == ly_symbol2scm ("round-filled-box")) |
883 make_round_filled_box_boxes (boxes, trans, scm_cdr (expr)); | 883 make_round_filled_box_boxes (boxes, trans, scm_cdr (expr)); |
884 else if (scm_car (expr) == ly_symbol2scm ("named-glyph")) | 884 else if (scm_car (expr) == ly_symbol2scm ("named-glyph")) |
885 make_named_glyph_boxes (boxes, buildings, trans, scm_cdr (expr)); | 885 make_named_glyph_boxes (boxes, buildings, trans, scm_cdr (expr)); |
886 else if (scm_car (expr) == ly_symbol2scm ("polygon")) | 886 else if (scm_car (expr) == ly_symbol2scm ("polygon")) |
887 make_polygon_boxes (boxes, buildings, trans, scm_cdr (expr)); | 887 make_polygon_boxes (boxes, buildings, trans, scm_cdr (expr)); |
888 else if (scm_car (expr) == ly_symbol2scm ("path")) | 888 else if (scm_car (expr) == ly_symbol2scm ("path")) |
889 make_path_boxes (boxes, buildings, trans, scm_cdr (expr)); | 889 make_path_boxes (boxes, buildings, trans, scm_cdr (expr)); |
890 else if (scm_car (expr) == ly_symbol2scm ("glyph-string")) | 890 else if (scm_car (expr) == ly_symbol2scm ("glyph-string")) |
891 make_glyph_string_boxes (boxes, buildings, trans, scm_cdr (expr)); | 891 make_glyph_string_boxes (boxes, buildings, trans, scm_cdr (expr)); |
892 else | 892 else |
893 { | 893 { |
894 #if 0 | 894 #if 0 |
895 warning ("Stencil expression not supported by the veritcal skylines."); | 895 warning ("Stencil expression not supported by the veritcal skylines."); |
896 #endif | 896 #endif |
897 /* | 897 /* |
898 We don't issue a warning here, as we assume that stencil-expression.cc | 898 We don't issue a warning here, as we assume that stencil-expression.cc |
899 is doing stencil-checking correctly. | 899 is doing stencil-checking correctly. |
900 */ | 900 */ |
901 } | 901 } |
902 } | 902 } |
903 | 903 |
904 /* | 904 /* |
905 traverses a stencil expression, returning a vector of Transform_matrix_and_exp
ression | 905 traverses a stencil expression, returning a vector of Transform_matrix_and_exp
ression |
906 the struct Transform_matrix_and_expression contains two members, | 906 the struct Transform_matrix_and_expression contains two members, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 975 |
976 if (to_boolean (me->get_property ("cross-staff"))) | 976 if (to_boolean (me->get_property ("cross-staff"))) |
977 return Skyline_pair ().smobbed_copy (); | 977 return Skyline_pair ().smobbed_copy (); |
978 | 978 |
979 extract_grob_set (me, "elements", elts); | 979 extract_grob_set (me, "elements", elts); |
980 if (elts.size ()) | 980 if (elts.size ()) |
981 return internal_skylines_from_element_stencils (smob, a); | 981 return internal_skylines_from_element_stencils (smob, a); |
982 | 982 |
983 Stencil *s = unsmob_stencil (me->get_property ("stencil")); | 983 Stencil *s = unsmob_stencil (me->get_property ("stencil")); |
984 if (!s) | 984 if (!s) |
985 return Skyline_pair ().smobbed_copy(); | 985 return Skyline_pair ().smobbed_copy (); |
986 | 986 |
987 vector<Box> boxes; | 987 vector<Box> boxes; |
988 boxes.push_back (Box (s->extent (X_AXIS), s->extent (Y_AXIS))); | 988 boxes.push_back (Box (s->extent (X_AXIS), s->extent (Y_AXIS))); |
989 return Skyline_pair (boxes, a).smobbed_copy (); | 989 return Skyline_pair (boxes, a).smobbed_copy (); |
990 } | 990 } |
991 | 991 |
992 MAKE_SCHEME_CALLBACK (Grob, simple_vertical_skylines_from_stencil, 1); | 992 MAKE_SCHEME_CALLBACK (Grob, simple_vertical_skylines_from_stencil, 1); |
993 SCM | 993 SCM |
994 Grob::simple_vertical_skylines_from_stencil (SCM smob) | 994 Grob::simple_vertical_skylines_from_stencil (SCM smob) |
995 { | 995 { |
996 return internal_simple_skylines_from_stencil (smob, X_AXIS); | 996 return internal_simple_skylines_from_stencil (smob, X_AXIS); |
997 } | 997 } |
998 | 998 |
999 MAKE_SCHEME_CALLBACK (Grob, simple_horizontal_skylines_from_stencil, 1); | 999 MAKE_SCHEME_CALLBACK (Grob, simple_horizontal_skylines_from_stencil, 1); |
1000 SCM | 1000 SCM |
1001 Grob::simple_horizontal_skylines_from_stencil (SCM smob) | 1001 Grob::simple_horizontal_skylines_from_stencil (SCM smob) |
1002 { | 1002 { |
1003 return internal_simple_skylines_from_stencil (smob, Y_AXIS); | 1003 return internal_simple_skylines_from_stencil (smob, Y_AXIS); |
1004 } | 1004 } |
1005 | 1005 |
1006 SCM | 1006 SCM |
1007 Stencil::skylines_from_stencil (SCM sten, Real pad, Axis a) | 1007 Stencil::skylines_from_stencil (SCM sten, Real pad, Axis a) |
1008 { | 1008 { |
1009 Stencil *s = unsmob_stencil (sten); | 1009 Stencil *s = unsmob_stencil (sten); |
1010 if (!s) | 1010 if (!s) |
1011 return Skyline_pair ().smobbed_copy (); | 1011 return Skyline_pair ().smobbed_copy (); |
1012 | 1012 |
1013 vector<Transform_matrix_and_expression> data = | 1013 vector<Transform_matrix_and_expression> data |
1014 stencil_traverser (make_transform_matrix (1.0,0.0,0.0,1.0,0.0,0.0), | 1014 = stencil_traverser (make_transform_matrix (1.0, 0.0, 0.0, 1.0, 0.0, 0.0), |
1015 s->expr ()); | 1015 s->expr ()); |
1016 vector<Box> boxes; | 1016 vector<Box> boxes; |
1017 vector<Drul_array<Offset> > buildings; | 1017 vector<Drul_array<Offset> > buildings; |
1018 for (vsize i = 0; i < data.size (); i++) | 1018 for (vsize i = 0; i < data.size (); i++) |
1019 stencil_dispatcher (boxes, buildings, data[i].tm_, data[i].expr_); | 1019 stencil_dispatcher (boxes, buildings, data[i].tm_, data[i].expr_); |
1020 | 1020 |
1021 // we use the bounding box if there are no boxes | 1021 // we use the bounding box if there are no boxes |
1022 if (!boxes.size () && !buildings.size ()) | 1022 if (!boxes.size () && !buildings.size ()) |
1023 boxes.push_back (Box (s->extent (X_AXIS), s->extent (Y_AXIS))); | 1023 boxes.push_back (Box (s->extent (X_AXIS), s->extent (Y_AXIS))); |
1024 | 1024 |
1025 Skyline_pair out (boxes, a); | 1025 Skyline_pair out (boxes, a); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 { | 1112 { |
1113 return internal_skylines_from_element_stencils (smob, X_AXIS); | 1113 return internal_skylines_from_element_stencils (smob, X_AXIS); |
1114 } | 1114 } |
1115 | 1115 |
1116 MAKE_SCHEME_CALLBACK (Grob, horizontal_skylines_from_element_stencils, 1); | 1116 MAKE_SCHEME_CALLBACK (Grob, horizontal_skylines_from_element_stencils, 1); |
1117 SCM | 1117 SCM |
1118 Grob::horizontal_skylines_from_element_stencils (SCM smob) | 1118 Grob::horizontal_skylines_from_element_stencils (SCM smob) |
1119 { | 1119 { |
1120 return internal_skylines_from_element_stencils (smob, Y_AXIS); | 1120 return internal_skylines_from_element_stencils (smob, Y_AXIS); |
1121 } | 1121 } |
LEFT | RIGHT |