App-Music-ChordPro

 view release on metacpan or  search on metacpan

lib/ChordPro/lib/SVGPDF/Contrib/Bogen.pm  view on Meta::CPAN

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
drew a segment (arc) of a circle, which was adapted here by Phil Perry to draw
an elliptical arc.
 
(German for I<bow>, as in a segment (arc) of an ellipse), this is a
segment of an ellipse defined by the intersection of two ellipses of given x
and y radii, with the two intersection points as inputs. There are four
possible resulting arcs, which can be selected with opts C<large> and C<dir>.
 
This extends the path along an arc of an ellipse of the specified x and y radii
between C<[$x1,$y1]> to C<[$x2,$y2]>. The current position is then set
to the endpoint of the arc (C<[$x2,$y2]>).
 
Options (C<@opts>)
 
=over
 
=item 'move' => move_flag
 
Set C<move> to a I<true> value if this arc is the beginning of a new
path instead of the continuation of an existing path. Note that the default
(C<move> => I<false>) is

lib/ChordPro/lib/SVGPDF/Contrib/Bogen.pm  view on Meta::CPAN

338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
        shift @points;
    }
 
    return $self;
}
  
# input: x and y axis radii
#        sweep start and end angles (degrees)
#        sweep direction (0=CCW (default), or 1=CW)
#        axis rotation (radians, + = CCW, default = 0)
# output: two endpoints and two control points for
#           the Bezier curve describing the arc
# maximum 30 degrees of sweep: is broken up into smaller
#   arc segments if necessary
# if crosses 0 degree angle in either sweep direction, split there at 0
# if alpha=beta (0 degree sweep) or either radius <= 0, fatal error
sub _arctocurve {
    my ($rx,$ry, $alpha,$beta, $dir,$rot) = @_;
 
    if (!defined $rot) { $rot = 0; }  # default is no rotation
    if (!defined $dir) { $dir = 0; }  # default is CCW sweep

lib/ChordPro/lib/SVGPDF/Contrib/Bogen.pm  view on Meta::CPAN

449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
=item $content->bogen($x1,$y1, $x2,$y2, $radius)
 
(I<bogen> is German for I<bow>, as in a segment (arc) of a circle. This is a
segment of a circle defined by the intersection of two circles of a given
radius, with the two intersection points as inputs. There are B<four> possible
resulting arcs, which can be selected with C<$larger> and C<$reverse>.)
 
This extends the path along an arc of a circle of the specified radius
between C<[$x1,$y1]> to C<[$x2,$y2]>. The current position is then set
to the endpoint of the arc (C<[$x2,$y2]>).
 
Set C<$move> to a I<true> value if this arc is the beginning of a new
path instead of the continuation of an existing path. Note that the default
(C<$move> = I<false>) is
I<not> a straight line to I<P1> and then the arc, but a blending into the curve
from the current point. It will often I<not> pass through I<P1>!
 
Set C<$larger> to a I<true> value to draw the larger ("outer") arc between the
two points, instead of the smaller one. Both arcs are drawn I<clockwise> from
I<P1> to I<P2>. The default value of I<false> draws the smaller arc.

lib/ChordPro/res/abc/abc2svg/abc2svg-1.js  view on Meta::CPAN

4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
                ty += dir > 0 ? '+' : '-'    // type = .+ or .-
 
    var savout = output
        output = ""
        draw_slur(path, sl, 1 /*true*/)
        gene.a_sl.push([k1, s_st2, ty, output])
        output = savout
        return
}
 
/* fix endpoints */
x1 = k1.x
if (k1.notes && k1.notes[0].shhd)
        x1 += k1.notes[0].shhd;
x2 = k2.x
if (k2.notes)
        x2 += k2.notes[0].shhd
 
if (not1) {                                     // start on a note
        y1 = 3 * (not1.pit - 18) + 2 * dir
        x1 += 3

lib/ChordPro/res/abc/abc2svg/abc2svg-1.js  view on Meta::CPAN

4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
a = (y2 - y1) / (x2 - x1)               /* slur steepness */
if (a > SLUR_SLOPE || a < -SLUR_SLOPE) {
        a = a > SLUR_SLOPE ? SLUR_SLOPE : -SLUR_SLOPE
        if (a * dir > 0)
                y1 = y2 - a * (x2 - x1)
        else
                y2 = y1 + a * (x2 - x1)
}
 
/* for big vertical jump, shift endpoints */
y = y2 - y1
if (y > 8)
        y = 8
else if (y < -8)
        y = -8
z = y
if (z < 0)
        z = -z;
dx = .5 * z;
dy = .3 * y



( run in 0.814 second using v1.01-cache-2.11-cpan-49f99fa48dc )