summaryrefslogtreecommitdiffhomepage
path: root/icons/gen-load-icons.sh
blob: 2ff765ef0b101ab2cfd52f6d02a90c5a194eccb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/env perl

use warnings;
use strict;

use local::lib;
use Image::Xpm;
use POSIX;

my $iwidth = 8;
my $iheight = 16;
my $pixels_per = $iheight / 8;
my $color_bg = "white";
my $color_fg = "darkseagreen";

for ( my $file_num = 0; $file_num <= 8; $file_num++ ) {
    my $i = Image::Xpm->new(-file => "load_$file_num.xpm",
                            -width => $iwidth,
                            -height => $iheight,
                            -background => $color_bg);

    my $h = $file_num * $pixels_per;

    for ( my $x = 0; $x < $iwidth; $x++ ) {
        for ( my $y = 0; $y < $iheight; $y++ ) {
            $i->xy($x, $y, $color_bg);
        }
    }
    for ( my $x = 0; $x < $iwidth; $x++ ) {
        for ( my $y = $iheight; $y >= ($iheight - $h); $y-- ) {
            $i->xy($x, $y, $color_fg);
        }
    }

    $i->save;
}