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