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.49 by root, Sun Jun 10 15:29:18 2012 UTC vs.
Revision 1.51 by sf-exg, Sun Jun 10 19:01:03 2012 UTC

1#! perl 1#! perl
2 2
3#:META:X_RESOURCE:%.expr:string:background expression 3#:META:X_RESOURCE:%.expr:string:background expression
4#:META:X_RESOURCE:%.border:boolean:respect the terminal border 4#:META:X_RESOURCE:%.border:boolean:respect the terminal border
5#:META:X_RESOURCE:%.interval:seconds:minimum time between updates 5#:META:X_RESOURCE:%.interval:seconds:minimum time between updates
6
7#TODO: once, rootalign
8 6
9=head1 NAME 7=head1 NAME
10 8
11 background - manage terminal background 9 background - manage terminal background
12 10
59 57
60For example, an expression such as C<scale load "$HOME/mybg.png"> scales the 58For example, an expression such as C<scale load "$HOME/mybg.png"> scales the
61image to the window size, so it relies on the window size and will 59image to the window size, so it relies on the window size and will
62be reevaluated each time it is changed, but not when it moves for 60be reevaluated each time it is changed, but not when it moves for
63example. That ensures that the picture always fills the terminal, even 61example. That ensures that the picture always fills the terminal, even
64after it's size changes. 62after its size changes.
65 63
66=head2 EXPRESSIONS 64=head2 EXPRESSIONS
67 65
68Expressions are normal Perl expressions, in fact, they are Perl blocks - 66Expressions are normal Perl expressions, in fact, they are Perl blocks -
69which means you could use multiple lines and statements: 67which means you could use multiple lines and statements:
117horizontal and vertical dimensions. For example, this halves the image 115horizontal and vertical dimensions. For example, this halves the image
118width and doubles the image height: 116width and doubles the image height:
119 117
120 scale 0.5, 2, load "$HOME/mypic.png" 118 scale 0.5, 2, load "$HOME/mypic.png"
121 119
122Other effects than scalign are also readily available, for exmaple, you can 120Other effects than scaling are also readily available, for example, you can
123tile the image to fill the whole window, instead of resizing it: 121tile the image to fill the whole window, instead of resizing it:
124 122
125 tile load "$HOME/mypic.png" 123 tile load "$HOME/mypic.png"
126 124
127In fact, images returned by C<load> are in C<tile> mode by default, so the C<tile> operator 125In fact, images returned by C<load> are in C<tile> mode by default, so the C<tile> operator
153This only works for one cycle though, so as long as you load the same 151This only works for one cycle though, so as long as you load the same
154image every time, it will always be cached, but when you load a different 152image every time, it will always be cached, but when you load a different
155image, it will forget about the first one. 153image, it will forget about the first one.
156 154
157This allows you to either speed things up by keeping multiple images in 155This allows you to either speed things up by keeping multiple images in
158memory, or comserve memory by loading images more often. 156memory, or conserve memory by loading images more often.
159 157
160For example, you can keep two images in memory and use a random one like 158For example, you can keep two images in memory and use a random one like
161this: 159this:
162 160
163 my $img1 = load "img1.png"; 161 my $img1 = load "img1.png";
193Specifying this flag changes the behaviour, so that the image only 191Specifying this flag changes the behaviour, so that the image only
194replaces the background of the character area. 192replaces the background of the character area.
195 193
196=item --background-interval seconds 194=item --background-interval seconds
197 195
198Since some operations in the underlying XRender extension can effetively 196Since some operations in the underlying XRender extension can effectively
199freeze your X-server for prolonged time, this extension enforces a minimum 197freeze your X-server for prolonged time, this extension enforces a minimum
200time between updates, which is normally about 0.1 seconds. 198time between updates, which is normally about 0.1 seconds.
201 199
202If you want to do updates more often, you can decrease this safety 200If you want to do updates more often, you can decrease this safety
203interval with this switch. 201interval with this switch.
326become transparent. This mode is most useful when you want to place an 324become transparent. This mode is most useful when you want to place an
327image over another image or the background colour while leaving all 325image over another image or the background colour while leaving all
328background pixels outside the image unchanged. 326background pixels outside the image unchanged.
329 327
330Example: load an image and display it in the upper left corner. The rest 328Example: load an image and display it in the upper left corner. The rest
331of the space is left "empty" (transparent or wahtever your compisotr does 329of the space is left "empty" (transparent or whatever your compositor does
332in alpha mode, else background colour). 330in alpha mode, else background colour).
333 331
334 pad load "mybg.png" 332 pad load "mybg.png"
335 333
336=item extend $img 334=item extend $img
337 335
338Extends the image over the whole plane, using the closest pixel in the 336Extends the image over the whole plane, using the closest pixel in the
339area outside the image. This mode is mostly useful when you more complex 337area outside the image. This mode is mostly useful when you use more complex
340filtering operations and want the pixels outside the image to have the 338filtering operations and want the pixels outside the image to have the
341same values as the pixels near the edge. 339same values as the pixels near the edge.
342 340
343Example: just for curiosity, how does this pixel extension stuff work? 341Example: just for curiosity, how does this pixel extension stuff work?
344 342
675 673
676Values less than 0 reduce brightness, while values larger than 0 increase 674Values less than 0 reduce brightness, while values larger than 0 increase
677it. Useful range is from -1 to 1 - the former results in a black, the 675it. Useful range is from -1 to 1 - the former results in a black, the
678latter in a white picture. 676latter in a white picture.
679 677
680Due to idiosynchrasies in the underlying XRender extension, biases less 678Due to idiosyncrasies in the underlying XRender extension, biases less
681than zero can be I<very> slow. 679than zero can be I<very> slow.
682 680
683=cut 681=cut
684 682
685 sub contrast($$;$$;$) { 683 sub contrast($$;$$;$) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines