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.30 by root, Thu Jun 7 13:22:06 2012 UTC vs.
Revision 1.31 by root, Thu Jun 7 13:48:15 2012 UTC

28{ 28{
29 package urxvt::bgdsl; # background language 29 package urxvt::bgdsl; # background language
30 30
31=head2 PROVIDERS/GENERATORS 31=head2 PROVIDERS/GENERATORS
32 32
33These functions provide an image, by loading it from disk, grabbing it
34from the root screen or by simply generating it. They are used as strating
35points to get an image you can play with.
36
33=over 4 37=over 4
34 38
35=item load $path 39=item load $path
36 40
37Loads the image at the given C<$path>. The image is set to plane tiling 41Loads the image at the given C<$path>. The image is set to plane tiling
38mode. 42mode.
39 43
40 44Loaded images will be cached for one cycle.
41 45
42=cut 46=cut
43 47
44 sub load($) { 48 sub load($) {
45 my ($path) = @_; 49 my ($path) = @_;
46 50
47 $new->{load}{$path} = $old->{load}{$path} || $bgdsl_self->new_img_from_file ($path); 51 $new->{load}{$path} = $old->{load}{$path} || $bgdsl_self->new_img_from_file ($path);
48 } 52 }
53
54=item root
55
56Returns the root window pixmap, that is, hopefully, the background image
57of your screen. The image is set to extend mode.
58
59This function makes your expression root sensitive, that means it will be
60reevaluated when the bg image changes.
61
62=cut
49 63
50 sub root() { 64 sub root() {
51 $new->{rootpmap_sensitive} = 1; 65 $new->{rootpmap_sensitive} = 1;
52 die "root op not supported, exg, we need you"; 66 die "root op not supported, exg, we need you";
53 } 67 }
54 68
69=item solid $colour
70
71=item solid $width, $height, $colour
72
73Creates a new image and completely fills it with the given colour. The
74image is set to tiling mode.
75
76If <$width> and C<$height> are omitted, it creates a 1x1 image, which is
77useful for solid backgrounds or for use in filtering effects.
78
79=cut
80
55 sub solid($;$$) { 81 sub solid($$;$) {
82 my $colour = pop;
83
56 my $img = $bgdsl_self->new_img (urxvt::PictStandardARGB32, $_[1] || 1, $_[2] || 1); 84 my $img = $bgdsl_self->new_img (urxvt::PictStandardARGB32, $_[0] || 1, $_[1] || 1);
57 $img->fill ($_[0]); 85 $img->fill ($colour);
58 $img 86 $img
59 } 87 }
60 88
61=back 89=back
62 90
63=head2 VARIABLES 91=head2 VARIABLES
64 92
93The following functions provide variable data such as the terminal
94widnow dimensions. Most of them make your expression sensitive to some
95events, for example using C<TW> (terminal width) means your expression is
96evaluated again when the terminal is resized.
97
65=over 4 98=over 4
99
100=item TX
101
102=item TY
103
104Return the X and Y coordinates of the terminal window (the terminal
105window is the full window by default, and the character area only when in
106border-respect mode).
107
108Using these functions make your expression sensitive to window moves.
109
110These functions are mainly useful to align images to the root window.
111
112Example: load an image and align it so it looks as if anchored to the
113background.
114
115 move -TX, -TY, load "mybg.png"
116
117=item TW
118
119Return the width (C<TW>) and height (C<TH>) of the terminal window (the
120terminal window is the full window by default, and the character area only
121when in border-respect mode).
122
123Using these functions make your expression sensitive to window resizes.
124
125These functions are mainly useful to scale images, or to clip images to
126the window size to conserve memory.
127
128Example: take the screen background, clip it to the window size, blur it a
129bit, align it to the window position and use it as background.
130
131 clip move -TX, -TY, blur 5, root
66 132
67=cut 133=cut
68 134
69 sub TX() { $new->{position_sensitive} = 1; $x } 135 sub TX() { $new->{position_sensitive} = 1; $x }
70 sub TY() { $new->{position_sensitive} = 1; $y } 136 sub TY() { $new->{position_sensitive} = 1; $y }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines