… | |
… | |
552 | |
552 | |
553 | Example: move the image right by 20 pixels and down by 30. |
553 | Example: move the image right by 20 pixels and down by 30. |
554 | |
554 | |
555 | move 20, 30, ... |
555 | move 20, 30, ... |
556 | |
556 | |
|
|
557 | =item center $img |
|
|
558 | |
|
|
559 | =item center $width, $height, $img |
|
|
560 | |
|
|
561 | Centers the image, i.e. the center of the image is moved to the center of |
|
|
562 | the terminal window (or the box specified by C<$width> and C<$height> if |
|
|
563 | given). |
|
|
564 | |
557 | =item rootalign $img |
565 | =item rootalign $img |
558 | |
566 | |
559 | Moves the image so that it appears glued to the screen as opposed to the |
567 | Moves the image so that it appears glued to the screen as opposed to the |
560 | window. This gives the illusion of a larger area behind the window. It is |
568 | window. This gives the illusion of a larger area behind the window. It is |
561 | exactly equivalent to C<move -TX, -TY>, that is, it moves the image to the |
569 | exactly equivalent to C<move -TX, -TY>, that is, it moves the image to the |
… | |
… | |
574 | |
582 | |
575 | sub move($$;$) { |
583 | sub move($$;$) { |
576 | my $img = pop->clone; |
584 | my $img = pop->clone; |
577 | $img->move ($_[0], $_[1]); |
585 | $img->move ($_[0], $_[1]); |
578 | $img |
586 | $img |
|
|
587 | } |
|
|
588 | |
|
|
589 | sub center($;$$) { |
|
|
590 | my $img = pop; |
|
|
591 | my $w = $_[0] || TW; |
|
|
592 | my $h = $_[0] || TH; |
|
|
593 | |
|
|
594 | move 0.5 * ($w - $img->w), 0.5 * ($h - $img->h), $img |
579 | } |
595 | } |
580 | |
596 | |
581 | sub rootalign($) { |
597 | sub rootalign($) { |
582 | move -TX, -TY, $_[0] |
598 | move -TX, -TY, $_[0] |
583 | } |
599 | } |