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.19 by root, Wed Jun 6 20:55:37 2012 UTC vs.
Revision 1.21 by root, Thu Jun 7 09:25:23 2012 UTC

2 2
3#:META:X_RESOURCE:%.expr:string:background expression 3#:META:X_RESOURCE:%.expr:string:background expression
4#:META:X_RESOURCE:%.enable:boolean:some boolean 4#:META:X_RESOURCE:%.enable:boolean:some boolean
5#:META:X_RESOURCE:%.extra.:value:extra config 5#:META:X_RESOURCE:%.extra.:value:extra config
6 6
7our $EXPR = 'move X, Y, load "MagnoliaAlpha.png"'; 7our $EXPR = 'clip -50, -50, 150, 100, move X, Y, load "MagnoliaAlpha.png"';
8#$EXPR = ' 8#$EXPR = '
9# rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, 9# rotate W, H, 50, 50, counter 1/59.95, repeat_mirror,
10# clip X, Y, W, H, repeat_mirror, 10# clip X, Y, W, H, repeat_mirror,
11# load "/root/pix/das_fette_schwein.jpg" 11# load "/root/pix/das_fette_schwein.jpg"
12#'; 12#';
24our $MIN_INTERVAL = 1/100; 24our $MIN_INTERVAL = 1/100;
25 25
26{ 26{
27 package urxvt::bgdsl; # background language 27 package urxvt::bgdsl; # background language
28 28
29 *repeat_empty = \&urxvt::RepeatNone; 29# *repeat_empty = \&urxvt::RepeatNone;
30 *repeat_tile = \&urxvt::RepeatNormal; 30# *repeat_tile = \&urxvt::RepeatNormal;
31 *repeat_pad = \&urxvt::RepeatPad; 31# *repeat_pad = \&urxvt::RepeatPad;
32 *repeat_mirror = \&urxvt::RepeatReflect; 32# *repeat_mirror = \&urxvt::RepeatReflect;
33 33
34=head2 PROVIDERS/GENERATORS 34=head2 PROVIDERS/GENERATORS
35 35
36=over 4 36=over 4
37 37
56 $img 56 $img
57 } 57 }
58 58
59=back 59=back
60 60
61=head2 VARIABLES
62
63=over 4
64
65=cut
66
67 sub X() { $new->{position_sensitive} = 1; $l }
68 sub Y() { $new->{position_sensitive} = 1; $t }
69 sub W() { $new->{size_sensitive} = 1; $w }
70 sub H() { $new->{size_sensitive} = 1; $h }
71
72 sub now() { urxvt::NOW }
73
74 sub again($) {
75 $new->{again} = $_[0];
76 }
77
78 sub counter($) {
79 $new->{again} = $_[0];
80 $bgdsl_self->{counter} + 0
81 }
82
83=back
84
61=head2 OPERATORS 85=head2 OPERATORS
62 86
63=over 4 87=over 4
64 88
65=cut 89=cut
66 90
67# sub clone($) { 91# sub clone($) {
68# $_[0]->clone 92# $_[0]->clone
69# } 93# }
70 94
71 sub clip($$$$$;$) { 95 sub clip($;$$;$$) {
96 my $img = pop;
72 my $img = pop; 97 my $h = pop || H;
98 my $w = pop || W;
73 $img->sub_rect ($_[0], $_[1], $_[2], $_[3], $_[4]) 99 $img->sub_rect ($_[0], $_[1], $w, $h)
74 } 100 }
75 101
76 sub resize($$$) { 102 sub resize($$$) {
77 my $img = pop; 103 my $img = pop;
78 $img->scale ($_[0], $_[1]) 104 $img->scale ($_[0], $_[1])
79 } 105 }
80 106
81 # TODO: ugly 107 # TODO: ugly
82 sub move($$;$) { 108 sub move($$;$) {
109 my $img = pop->clone;
110 $img->move ($_[0], $_[1]);
111 $img
83 my $img = pop; 112# my $img = pop;
84 $img->sub_rect ( 113# $img->sub_rect (
85 $_[0], $_[1], 114# $_[0], $_[1],
86 $img->w, $img->h, 115# $img->w, $img->h,
87 $_[2], 116# $_[2],
88 ) 117# )
89 } 118 }
90 119
91 sub rotate($$$$$$;$) { 120 sub rotate($$$$$$) {
92 my $img = pop; 121 my $img = pop;
93 $img->rotate ( 122 $img->rotate (
94 $_[0], 123 $_[0],
95 $_[1], 124 $_[1],
96 $_[2] * $img->w * .01, 125 $_[2] * $img->w * .01,
97 $_[3] * $img->h * .01, 126 $_[3] * $img->h * .01,
98 $_[4] * (3.14159265 / 180), 127 $_[4] * (3.14159265 / 180),
99 $_[5],
100 ) 128 )
101 } 129 }
102 130
103 sub blur($$$) { 131 sub blur($$$) {
104 my ($rh, $rv, $img) = @_; 132 my ($rh, $rv, $img) = @_;
126 $a = 1 if @_ < 5; 154 $a = 1 if @_ < 5;
127 155
128 $img = $img->clone; 156 $img = $img->clone;
129 $img->brightness ($r, $g, $b, $a); 157 $img->brightness ($r, $g, $b, $a);
130 $img 158 $img
131 }
132
133 sub X() { $new->{position_sensitive} = 1; $l }
134 sub Y() { $new->{position_sensitive} = 1; $t }
135 sub W() { $new->{size_sensitive} = 1; $w }
136 sub H() { $new->{size_sensitive} = 1; $h }
137
138 sub now() { urxvt::NOW }
139
140 sub again($) {
141 $new->{again} = $_[0];
142 }
143
144 sub counter($) {
145 $new->{again} = $_[0];
146 $bgdsl_self->{counter} + 0
147 } 159 }
148 160
149=back 161=back
150 162
151=cut 163=cut

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines