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.64 by root, Tue Jun 19 20:49:53 2012 UTC vs.
Revision 1.65 by sf-exg, Wed Jun 20 18:18:14 2012 UTC

119 119
120 scale 0.5, 2, load "$HOME/mypic.png" 120 scale 0.5, 2, load "$HOME/mypic.png"
121 121
122IF you try out these expressions, you might suffer from sluggishness, 122IF you try out these expressions, you might suffer from sluggishness,
123because each time the terminal is resized, it again loads the PNG image 123because each time the terminal is resized, it again loads the PNG image
124and scales it. Scaling is usually fats, but loading the image can be quite 124and scales it. Scaling is usually fast, but loading the image can be quite
125time consuming. This is where C<keep> comes in handy: 125time consuming. This is where C<keep> comes in handy:
126 126
127 scale 0.5, 2, keep { load "$HOME/mypic.png" } 127 scale 0.5, 2, keep { load "$HOME/mypic.png" }
128 128
129The C<keep> operator executes all the statements inside the braces only 129The C<keep> operator executes all the statements inside the braces only
130once, or when it thinks the outcome might change. In other cases it 130once, or when it thinks the outcome might change. In other cases it
131returns the last value computed by the brace block. 131returns the last value computed by the brace block.
132 132
133This means that the C<load> is only executed once, which makes it much 133This means that the C<load> is only executed once, which makes it much
134faster, but alos means that more memory is being used, because the loaded 134faster, but also means that more memory is being used, because the loaded
135image must be kept in memory at all times. In this expression, the 135image must be kept in memory at all times. In this expression, the
136trade-off is likely worth it. 136trade-off is likely worth it.
137 137
138But back to effects: Other effects than scaling are also readily 138But back to effects: Other effects than scaling are also readily
139available, for example, you can tile the image to fill the whole window, 139available, for example, you can tile the image to fill the whole window,
152Another common background expression is: 152Another common background expression is:
153 153
154 rootalign root 154 rootalign root
155 155
156This one first takes a snapshot of the screen background image, and then 156This one first takes a snapshot of the screen background image, and then
157moves it to the upper left corner of the screen (as opposed to the upepr 157moves it to the upper left corner of the screen (as opposed to the upper
158left corner of the terminal window)- the result is pseudo-transparency: 158left corner of the terminal window)- the result is pseudo-transparency:
159the image seems to be static while the window is moved around. 159the image seems to be static while the window is moved around.
160 160
161=head2 CACHING AND SENSITIVITY 161=head2 CACHING AND SENSITIVITY
162 162
171The most important way to cache expensive operations is to use C<keep { 171The most important way to cache expensive operations is to use C<keep {
172... }>. The C<keep> operator takes a block of multiple statements enclosed 172... }>. The C<keep> operator takes a block of multiple statements enclosed
173by C<{}> and keeps the return value in memory. 173by C<{}> and keeps the return value in memory.
174 174
175An expression can be "sensitive" to various external events, such as 175An expression can be "sensitive" to various external events, such as
176scaling or moving the window, root backgorund changes and timers. Simply 176scaling or moving the window, root background changes and timers. Simply
177using an expression (such as C<scale> without parameters) that depend on 177using an expression (such as C<scale> without parameters) that depend on
178certain changing values (called "variables"), or using those variables 178certain changing values (called "variables"), or using those variables
179directly, will make an expression sensitive to these events - for example, 179directly, will make an expression sensitive to these events - for example,
180using C<scale> or C<TW> will make the expression sensitive to the terminal 180using C<scale> or C<TW> will make the expression sensitive to the terminal
181size, and thus to resizing events. 181size, and thus to resizing events.
266=item load $path 266=item load $path
267 267
268Loads the image at the given C<$path>. The image is set to plane tiling 268Loads the image at the given C<$path>. The image is set to plane tiling
269mode. 269mode.
270 270
271If the image is already in memory (e.g. because another temrinal instance 271If the image is already in memory (e.g. because another terminal instance
272uses it), then the in-memory copy us returned instead. 272uses it), then the in-memory copy us returned instead.
273 273
274=item load_uc $path 274=item load_uc $path
275 275
276Load uncached - same as load, but does not cache the image, which means it 276Load uncached - same as load, but does not cache the image, which means it
340 340
341=item merge $img ... 341=item merge $img ...
342 342
343Takes any number of images and merges them together, creating a single 343Takes any number of images and merges them together, creating a single
344image containing them all. The tiling mode of the first image is used as 344image containing them all. The tiling mode of the first image is used as
345the tiling mdoe of the resulting image. 345the tiling mode of the resulting image.
346 346
347This function is called automatically when an expression returns multiple 347This function is called automatically when an expression returns multiple
348images. 348images.
349 349
350=cut 350=cut

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines