… | |
… | |
285 | =cut |
285 | =cut |
286 | |
286 | |
287 | sub solid($;$$) { |
287 | sub solid($;$$) { |
288 | my $colour = pop; |
288 | my $colour = pop; |
289 | |
289 | |
290 | my $img = $self->new_img (urxvt::PictStandardARGB32, $_[0] || 1, $_[1] || 1); |
290 | my $img = $self->new_img (urxvt::PictStandardARGB32, 0, 0, $_[0] || 1, $_[1] || 1); |
291 | $img->fill ($colour); |
291 | $img->fill ($colour); |
292 | $img |
292 | $img |
293 | } |
293 | } |
294 | |
294 | |
295 | =item clone $img |
295 | =item clone $img |
… | |
… | |
311 | =cut |
311 | =cut |
312 | |
312 | |
313 | sub merge(@) { |
313 | sub merge(@) { |
314 | # rather annoyingly clumsy, but optimisation is for another time |
314 | # rather annoyingly clumsy, but optimisation is for another time |
315 | |
315 | |
316 | my $x0 = 1e9; |
316 | my $x0 = +1e9; |
317 | my $y0 = 1e9; |
317 | my $y0 = +1e9; |
318 | my $x1 = -1e9; |
318 | my $x1 = -1e9; |
319 | my $y1 = -1e9; |
319 | my $y1 = -1e9; |
320 | |
320 | |
321 | for (@_) { |
321 | for (@_) { |
322 | my ($x, $y, $w, $h) = $_->geometry; |
322 | my ($x, $y, $w, $h) = $_->geometry; |
… | |
… | |
325 | $y0 = $y if $y0 > $y; |
325 | $y0 = $y if $y0 > $y; |
326 | |
326 | |
327 | $x += $w; |
327 | $x += $w; |
328 | $y += $h; |
328 | $y += $h; |
329 | |
329 | |
330 | $x1 = $x if $x1 > $x; |
330 | $x1 = $x if $x1 < $x; |
331 | $y1 = $y if $y1 > $y; |
331 | $y1 = $y if $y1 < $y; |
332 | } |
332 | } |
333 | |
333 | |
334 | my $base = $self->new_img ($x0, $y0, $x1 - $x0, $y1 - $y0); |
334 | my $base = $self->new_img (urxvt::PictStandardARGB32, $x0, $y0, $x1 - $x0, $y1 - $y0); |
335 | $base->fill ([0, 0, 0, 0]); |
335 | $base->fill ([0, 0, 0, 0]); |
336 | |
336 | |
337 | $base->blend (1., $_) |
337 | $base->draw ($_) |
338 | for @_; |
338 | for @_; |
339 | |
339 | |
340 | $base |
340 | $base |
341 | } |
341 | } |
342 | |
342 | |
… | |
… | |
697 | =cut |
697 | =cut |
698 | |
698 | |
699 | sub rotate($$$$) { |
699 | sub rotate($$$$) { |
700 | my $img = pop; |
700 | my $img = pop; |
701 | $img->rotate ( |
701 | $img->rotate ( |
702 | $_[0] * $img->w, |
702 | $_[0] * ($img->w + $img->x), |
703 | $_[1] * $img->h, |
703 | $_[1] * ($img->h + $img->y), |
704 | $_[2] * (3.14159265 / 180), |
704 | $_[2] * (3.14159265 / 180), |
705 | ) |
705 | ) |
706 | } |
706 | } |
707 | |
707 | |
708 | =back |
708 | =back |