--- rxvt-unicode/src/perl/background 2012/06/10 11:23:20 1.43 +++ rxvt-unicode/src/perl/background 2012/06/10 11:31:22 1.44 @@ -554,6 +554,14 @@ move 20, 30, ... +=item center $img + +=item center $width, $height, $img + +Centers the image, i.e. the center of the image is moved to the center of +the terminal window (or the box specified by C<$width> and C<$height> if +given). + =item rootalign $img Moves the image so that it appears glued to the screen as opposed to the @@ -578,6 +586,14 @@ $img } + sub center($;$$) { + my $img = pop; + my $w = $_[0] || TW; + my $h = $_[0] || TH; + + move 0.5 * ($w - $img->w), 0.5 * ($h - $img->h), $img + } + sub rootalign($) { move -TX, -TY, $_[0] }