… | |
… | |
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 | |
7 | our $EXPR; |
7 | our $EXPR; |
8 | #$EXPR = 'move W * 0.1, -H * 0.1, resize W * 0.5, H * 0.5, repeat_none load "opensource.png"'; |
8 | #$EXPR = 'move W * 0.1, -H * 0.1, resize W * 0.5, H * 0.5, repeat_none load "opensource.png"'; |
9 | $EXPR = 'move -X, -Y, load "argb.png"'; |
9 | $EXPR = 'move -TX, -TY, load "argb.png"'; |
10 | #$EXPR = ' |
10 | #$EXPR = ' |
11 | # rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, |
11 | # rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, |
12 | # clip X, Y, W, H, repeat_mirror, |
12 | # clip X, Y, W, H, repeat_mirror, |
13 | # load "/root/pix/das_fette_schwein.jpg" |
13 | # load "/root/pix/das_fette_schwein.jpg" |
14 | #'; |
14 | #'; |
… | |
… | |
64 | |
64 | |
65 | =over 4 |
65 | =over 4 |
66 | |
66 | |
67 | =cut |
67 | =cut |
68 | |
68 | |
69 | sub X() { $new->{position_sensitive} = 1; $x } |
69 | sub TX() { $new->{position_sensitive} = 1; $x } |
70 | sub Y() { $new->{position_sensitive} = 1; $y } |
70 | sub TY() { $new->{position_sensitive} = 1; $y } |
71 | sub W() { $new->{size_sensitive} = 1; $w } |
71 | sub TW() { $new->{size_sensitive} = 1; $w } |
72 | sub H() { $new->{size_sensitive} = 1; $h } |
72 | sub TH() { $new->{size_sensitive} = 1; $h } |
73 | |
73 | |
74 | sub now() { urxvt::NOW } |
74 | sub now() { urxvt::NOW } |
75 | |
75 | |
76 | sub again($) { |
76 | sub again($) { |
77 | $new->{again} = $_[0]; |
77 | $new->{again} = $_[0]; |
… | |
… | |
184 | |
184 | |
185 | =cut |
185 | =cut |
186 | |
186 | |
187 | sub clip($;$$;$$) { |
187 | sub clip($;$$;$$) { |
188 | my $img = pop; |
188 | my $img = pop; |
189 | my $h = pop || H; |
189 | my $h = pop || TH; |
190 | my $w = pop || W; |
190 | my $w = pop || TW; |
191 | $img->sub_rect ($_[0], $_[1], $w, $h) |
191 | $img->sub_rect ($_[0], $_[1], $w, $h) |
192 | } |
192 | } |
193 | |
193 | |
194 | =item scale $img |
194 | =item scale $img |
195 | |
195 | |
… | |
… | |
216 | sub scale($$$) { |
216 | sub scale($$$) { |
217 | my $img = pop; |
217 | my $img = pop; |
218 | |
218 | |
219 | @_ == 2 ? $img->scale ($_[0] * $img->w * 0.01, $_[1] * $img->h * 0.01) |
219 | @_ == 2 ? $img->scale ($_[0] * $img->w * 0.01, $_[1] * $img->h * 0.01) |
220 | : @_ ? $img->scale ($_[0] * $img->w * 0.01, $_[0] * $img->h * 0.01) |
220 | : @_ ? $img->scale ($_[0] * $img->w * 0.01, $_[0] * $img->h * 0.01) |
221 | : $img->scale (W, H) |
221 | : $img->scale (TW, TH) |
222 | } |
222 | } |
223 | |
223 | |
224 | sub resize($$$) { |
224 | sub resize($$$) { |
225 | my $img = pop; |
225 | my $img = pop; |
226 | $img->scale ($_[0], $_[1]) |
226 | $img->scale ($_[0], $_[1]) |
227 | } |
227 | } |
228 | |
228 | |
229 | # TODO: ugly |
|
|
230 | sub move($$;$) { |
229 | sub move($$;$) { |
231 | my $img = pop->clone; |
230 | my $img = pop->clone; |
232 | $img->move ($_[0], $_[1]); |
231 | $img->move ($_[0], $_[1]); |
233 | $img |
232 | $img |
234 | # my $img = pop; |
|
|
235 | # $img->sub_rect ( |
|
|
236 | # $_[0], $_[1], |
|
|
237 | # $img->w, $img->h, |
|
|
238 | # $_[2], |
|
|
239 | # ) |
|
|
240 | } |
233 | } |
241 | |
234 | |
242 | sub rotate($$$$$$) { |
235 | sub rotate($$$$$$) { |
243 | my $img = pop; |
236 | my $img = pop; |
244 | $img->rotate ( |
237 | $img->rotate ( |
… | |
… | |
250 | ) |
243 | ) |
251 | } |
244 | } |
252 | |
245 | |
253 | sub blur($$;$) { |
246 | sub blur($$;$) { |
254 | my $img = pop; |
247 | my $img = pop; |
255 | |
|
|
256 | $img->blur ($_[0], @_ >= 2 ? $_[1] : $_[0]); |
248 | $img->blur ($_[0], @_ >= 2 ? $_[1] : $_[0]) |
257 | } |
249 | } |
258 | |
250 | |
259 | sub contrast($$;$$;$) { |
251 | sub contrast($$;$$;$) { |
260 | my $img = pop; |
252 | my $img = pop; |
261 | my ($r, $g, $b, $a) = @_; |
253 | my ($r, $g, $b, $a) = @_; |