ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/background
(Generate patch)

Comparing rxvt-unicode/src/perl/background (file contents):
Revision 1.59 by root, Thu Jun 14 19:31:17 2012 UTC vs.
Revision 1.61 by root, Fri Jun 15 19:50:56 2012 UTC

306=item merge $img ... 306=item merge $img ...
307 307
308Takes any number of images and merges them together, creating a single 308Takes any number of images and merges them together, creating a single
309image containing them all. 309image containing them all.
310 310
311This function is called automatically when an expression returns multiple
312images.
313
311=cut 314=cut
312 315
313 sub merge(@) { 316 sub merge(@) {
317 return $_[0] unless $#_;
318
314 # rather annoyingly clumsy, but optimisation is for another time 319 # rather annoyingly clumsy, but optimisation is for another time
315 320
316 my $x0 = +1e9; 321 my $x0 = +1e9;
317 my $y0 = +1e9; 322 my $y0 = +1e9;
318 my $x1 = -1e9; 323 my $x1 = -1e9;
697=cut 702=cut
698 703
699 sub rotate($$$$) { 704 sub rotate($$$$) {
700 my $img = pop; 705 my $img = pop;
701 $img->rotate ( 706 $img->rotate (
702 $_[0] * $img->w, 707 $_[0] * ($img->w + $img->x),
703 $_[1] * $img->h, 708 $_[1] * ($img->h + $img->y),
704 $_[2] * (3.14159265 / 180), 709 $_[2] * (3.14159265 / 180),
705 ) 710 )
706 } 711 }
707 712
708=back 713=back
905 ($x, $y, $w, $h) = 910 ($x, $y, $w, $h) =
906 $self->background_geometry ($self->{border}); 911 $self->background_geometry ($self->{border});
907 912
908 # evaluate user expression 913 # evaluate user expression
909 914
910 my $img = eval { $self->{expr}->() }; 915 my $img = eval { urxvt::bgdsl::merge $self->{expr}->() };
911 warn $@ if $@;#d# 916 die $@ if $@;
912 die "background-expr did not return an image.\n" if !UNIVERSAL::isa $img, "urxvt::img"; 917 die "background-expr did not return an image.\n" if !UNIVERSAL::isa $img, "urxvt::img";
913 918
914 # if the expression is sensitive to external events, prepare reevaluation then 919 # if the expression is sensitive to external events, prepare reevaluation then
915 920
916 my $again = delete $state->{again}; 921 my $again = delete $state->{again};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines