Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 39139d92

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID 39139d92a79b03d0cb04ab9e451696c6d60a74fe
  • Vorgänger 621ed30a
  • Nachfolger 62822c6a

Icons per Sprites renderbar gemacht.

Das neue Script scripts/image_map.pl kann pngs gleicher Größe zu einem master
zusammenfassen und ein css generieren, dass entsprechende Klassen enthält.

In diesem Commit enthalten ist ein Script scripts/make_icons.sh, was das für
die Icons tut. Damit lassen sich die icons urch die zwei Klassen icon<size> und
Name der vorherigen Datei mit Leerzeichen durch - ersetzt.

Beispielhaft für ein Icon:

Vorher:

<img src='image/icons/16x16/AR--Add Invoice.png' height='16px' width='16px' alt='Rechnung erfassen'>

Jetzt:

<style type='text/css' src='css/icons16.css'>
<div class='icon16 AR--Add-Invoice'></div>

Unterschiede anzeigen:

css/icons16.css
1
.icon16 { background: url(../image/maps/icons16.png) 16px 0px no-repeat; padding: 0; width: 16px; height: 16px; }
2
.icon16.AP--Add-Purchase-Order { background-position: -0px 0px; }
3
.icon16.AP--Add-RFQ { background-position: -16px 0px; }
4
.icon16.AP { background-position: -32px 0px; }
5
.icon16.AP--Reports { background-position: -48px 0px; }
6
.icon16.AP--Reports--Purchase-Orders { background-position: -64px 0px; }
7
.icon16.AP--Reports--RFQs { background-position: -80px 0px; }
8
.icon16.AR--Add-Credit-Note { background-position: -96px 0px; }
9
.icon16.AR--Add-Delivery-Order { background-position: -112px 0px; }
10
.icon16.AR--Add-Dunning { background-position: -128px 0px; }
11
.icon16.AR--Add-Quotation { background-position: -144px 0px; }
12
.icon16.AR--Add-Sales-Invoice { background-position: -160px 0px; }
13
.icon16.AR--Add-Sales-Order { background-position: -176px 0px; }
14
.icon16.AR { background-position: -192px 0px; }
15
.icon16.AR--Reports--Delivery-Orders { background-position: -208px 0px; }
16
.icon16.AR--Reports--Dunnings { background-position: -224px 0px; }
17
.icon16.AR--Reports--Invoices { background-position: -240px 0px; }
18
.icon16.AR--Reports { background-position: -256px 0px; }
19
.icon16.AR--Reports--Quotations { background-position: -272px 0px; }
20
.icon16.AR--Reports--Sales-Orders { background-position: -288px 0px; }
21
.icon16.Batch-Printing--Packing-Lists { background-position: -304px 0px; }
22
.icon16.Batch-Printing { background-position: -320px 0px; }
23
.icon16.Batch-Printing--Purchase-Orders { background-position: -336px 0px; }
24
.icon16.Batch-Printing--Quotations { background-position: -352px 0px; }
25
.icon16.Batch-Printing--Receipts { background-position: -368px 0px; }
26
.icon16.Batch-Printing--RFQs { background-position: -384px 0px; }
27
.icon16.Batch-Printing--Sales-Invoices { background-position: -400px 0px; }
28
.icon16.Batch-Printing--Sales-Orders { background-position: -416px 0px; }
29
.icon16.Cash--Payment { background-position: -432px 0px; }
30
.icon16.Cash { background-position: -448px 0px; }
31
.icon16.Cash--Receipt { background-position: -464px 0px; }
32
.icon16.Cash--Reconciliation { background-position: -480px 0px; }
33
.icon16.Cash--Reports--Payments { background-position: -496px 0px; }
34
.icon16.Cash--Reports { background-position: -512px 0px; }
35
.icon16.Cash--Reports--Receipts { background-position: -528px 0px; }
36
.icon16.CRM--Admin--Benutzer { background-position: -544px 0px; }
37
.icon16.CRM--Admin--Dokumentvorlage { background-position: -560px 0px; }
38
.icon16.CRM--Admin--Etiketten { background-position: -576px 0px; }
39
.icon16.CRM--Admin--Gruppen { background-position: -592px 0px; }
40
.icon16.CRM--Admin--Mitteilungen { background-position: -608px 0px; }
41
.icon16.CRM--Admin { background-position: -624px 0px; }
42
.icon16.CRM--Admin--Status { background-position: -640px 0px; }
43
.icon16.CRM--Auftragschance { background-position: -656px 0px; }
44
.icon16.CRM--eMail { background-position: -672px 0px; }
45
.icon16.CRM--Hilfe { background-position: -688px 0px; }
46
.icon16.CRM--Kunden { background-position: -704px 0px; }
47
.icon16.CRM--Lieferant { background-position: -720px 0px; }
48
.icon16.CRM--Notizen { background-position: -736px 0px; }
49
.icon16.CRM--Personen { background-position: -752px 0px; }
50
.icon16.CRM { background-position: -768px 0px; }
51
.icon16.CRM--Schnellsuche { background-position: -784px 0px; }
52
.icon16.CRM--Service { background-position: -800px 0px; }
53
.icon16.CRM--Termine { background-position: -816px 0px; }
54
.icon16.CRM--Wiedervorlage { background-position: -832px 0px; }
55
.icon16.CRM--Wissens-DB { background-position: -848px 0px; }
56
.icon16.General-Ledger--Add-AP-Transaction { background-position: -864px 0px; }
57
.icon16.General-Ledger--Add-AR-Transaction { background-position: -880px 0px; }
58
.icon16.General-Ledger--Add-Transaction { background-position: -896px 0px; }
59
.icon16.General-Ledger--DATEV---Export-Assistent { background-position: -912px 0px; }
60
.icon16.General-Ledger { background-position: -928px 0px; }
61
.icon16.General-Ledger--Reports--AP-Aging { background-position: -944px 0px; }
62
.icon16.General-Ledger--Reports--AR-Aging { background-position: -960px 0px; }
63
.icon16.General-Ledger--Reports--Journal { background-position: -976px 0px; }
64
.icon16.General-Ledger--Reports { background-position: -992px 0px; }
65
.icon16.Master-Data--Add-Assembly { background-position: -1008px 0px; }
66
.icon16.Master-Data--Add-Customer { background-position: -1024px 0px; }
67
.icon16.Master-Data--Add-License { background-position: -1040px 0px; }
68
.icon16.Master-Data--Add-Part { background-position: -1056px 0px; }
69
.icon16.Master-Data--Add-Project { background-position: -1072px 0px; }
70
.icon16.Master-Data--Add-Service { background-position: -1088px 0px; }
71
.icon16.Master-Data--Add-Vendor { background-position: -1104px 0px; }
72
.icon16.Master-Data { background-position: -1120px 0px; }
73
.icon16.Master-Data--Reports--Assemblies { background-position: -1136px 0px; }
74
.icon16.Master-Data--Reports--Customers { background-position: -1152px 0px; }
75
.icon16.Master-Data--Reports--Licenses { background-position: -1168px 0px; }
76
.icon16.Master-Data--Reports--Parts { background-position: -1184px 0px; }
77
.icon16.Master-Data--Reports { background-position: -1200px 0px; }
78
.icon16.Master-Data--Reports--Projects { background-position: -1216px 0px; }
79
.icon16.Master-Data--Reports--Projecttransactions { background-position: -1232px 0px; }
80
.icon16.Master-Data--Reports--Services { background-position: -1248px 0px; }
81
.icon16.Master-Data--Reports--Vendors { background-position: -1264px 0px; }
82
.icon16.Master-Data--Update-Prices { background-position: -1280px 0px; }
83
.icon16.MDI-Text-Editor-16x16 { background-position: -1296px 0px; }
84
.icon16.Neues-Fenster { background-position: -1312px 0px; }
85
.icon16.Program--Logout { background-position: -1328px 0px; }
86
.icon16.Program { background-position: -1344px 0px; }
87
.icon16.Program--Preferences { background-position: -1360px 0px; }
88
.icon16.Program--Version { background-position: -1376px 0px; }
89
.icon16.Reports--Balance-Sheet { background-position: -1392px 0px; }
90
.icon16.Reports--Chart-of-Accounts { background-position: -1408px 0px; }
91
.icon16.Reports--Income-Statement { background-position: -1424px 0px; }
92
.icon16.Reports { background-position: -1440px 0px; }
93
.icon16.Reports--UStVa { background-position: -1456px 0px; }
94
.icon16.System { background-position: -1472px 0px; }
95
.icon16.Warehouse { background-position: -1488px 0px; }
96
.icon16.Warehouse--Produce-Assembly { background-position: -1504px 0px; }
css/icons24.css
1
.icon24 { background: url(../image/maps/icons24.png) 24px 0px no-repeat; padding: 0; width: 24px; height: 24px; }
2
.icon24.AP--Add-Purchase-Order { background-position: -0px 0px; }
3
.icon24.AP--Add-RFQ { background-position: -24px 0px; }
4
.icon24.AP { background-position: -48px 0px; }
5
.icon24.AP--Reports { background-position: -72px 0px; }
6
.icon24.AP--Reports--Purchase-Orders { background-position: -96px 0px; }
7
.icon24.AP--Reports--RFQs { background-position: -120px 0px; }
8
.icon24.AR--Add-Dunning { background-position: -144px 0px; }
9
.icon24.AR--Add-Quotation { background-position: -168px 0px; }
10
.icon24.AR--Add-Sales-Invoice { background-position: -192px 0px; }
11
.icon24.AR--Add-Sales-Order { background-position: -216px 0px; }
12
.icon24.AR { background-position: -240px 0px; }
13
.icon24.AR--Reports--Dunnings { background-position: -264px 0px; }
14
.icon24.AR--Reports--Invoices { background-position: -288px 0px; }
15
.icon24.AR--Reports { background-position: -312px 0px; }
16
.icon24.AR--Reports--Quotations { background-position: -336px 0px; }
17
.icon24.AR--Reports--Sales-Orders { background-position: -360px 0px; }
18
.icon24.Batch-Printing--Packing-Lists { background-position: -384px 0px; }
19
.icon24.Batch-Printing { background-position: -408px 0px; }
20
.icon24.Batch-Printing--Purchase-Orders { background-position: -432px 0px; }
21
.icon24.Batch-Printing--Quotations { background-position: -456px 0px; }
22
.icon24.Batch-Printing--Receipts { background-position: -480px 0px; }
23
.icon24.Batch-Printing--RFQs { background-position: -504px 0px; }
24
.icon24.Batch-Printing--Sales-Invoices { background-position: -528px 0px; }
25
.icon24.Batch-Printing--Sales-Orders { background-position: -552px 0px; }
26
.icon24.Cash--Payment { background-position: -576px 0px; }
27
.icon24.Cash { background-position: -600px 0px; }
28
.icon24.Cash--Receipt { background-position: -624px 0px; }
29
.icon24.Cash--Reconciliation { background-position: -648px 0px; }
30
.icon24.Cash--Reports--Payments { background-position: -672px 0px; }
31
.icon24.Cash--Reports { background-position: -696px 0px; }
32
.icon24.Cash--Reports--Receipts { background-position: -720px 0px; }
33
.icon24.CRM--Admin--Benutzer { background-position: -744px 0px; }
34
.icon24.CRM--Admin--Dokumentvorlage { background-position: -768px 0px; }
35
.icon24.CRM--Admin--Etiketten { background-position: -792px 0px; }
36
.icon24.CRM--Admin--Gruppen { background-position: -816px 0px; }
37
.icon24.CRM--Admin--Mitteilungen { background-position: -840px 0px; }
38
.icon24.CRM--Admin { background-position: -864px 0px; }
39
.icon24.CRM--Admin--Status { background-position: -888px 0px; }
40
.icon24.CRM--Auftragschance { background-position: -912px 0px; }
41
.icon24.CRM--eMail { background-position: -936px 0px; }
42
.icon24.CRM--Hilfe { background-position: -960px 0px; }
43
.icon24.CRM--Kunden { background-position: -984px 0px; }
44
.icon24.CRM--Lieferant { background-position: -1008px 0px; }
45
.icon24.CRM--Notizen { background-position: -1032px 0px; }
46
.icon24.CRM--Personen { background-position: -1056px 0px; }
47
.icon24.CRM { background-position: -1080px 0px; }
48
.icon24.CRM--Schnellsuche { background-position: -1104px 0px; }
49
.icon24.CRM--Service { background-position: -1128px 0px; }
50
.icon24.CRM--Termine { background-position: -1152px 0px; }
51
.icon24.CRM--Wiedervorlage { background-position: -1176px 0px; }
52
.icon24.CRM--Wissens-DB { background-position: -1200px 0px; }
53
.icon24.General-Ledger--Add-AP-Transaction { background-position: -1224px 0px; }
54
.icon24.General-Ledger--Add-AR-Transaction { background-position: -1248px 0px; }
55
.icon24.General-Ledger--Add-Transaction { background-position: -1272px 0px; }
56
.icon24.General-Ledger--DATEV---Export-Assistent { background-position: -1296px 0px; }
57
.icon24.General-Ledger { background-position: -1320px 0px; }
58
.icon24.General-Ledger--Reports--AP-Aging { background-position: -1344px 0px; }
59
.icon24.General-Ledger--Reports--AR-Aging { background-position: -1368px 0px; }
60
.icon24.General-Ledger--Reports--Journal { background-position: -1392px 0px; }
61
.icon24.General-Ledger--Reports { background-position: -1416px 0px; }
62
.icon24.leftarrow_24 { background-position: -1440px 0px; }
63
.icon24.Master-Data--Add-Assembly { background-position: -1464px 0px; }
64
.icon24.Master-Data--Add-Customer { background-position: -1488px 0px; }
65
.icon24.Master-Data--Add-License { background-position: -1512px 0px; }
66
.icon24.Master-Data--Add-Part { background-position: -1536px 0px; }
67
.icon24.Master-Data--Add-Project { background-position: -1560px 0px; }
68
.icon24.Master-Data--Add-Service { background-position: -1584px 0px; }
69
.icon24.Master-Data--Add-Vendor { background-position: -1608px 0px; }
70
.icon24.Master-Data { background-position: -1632px 0px; }
71
.icon24.Master-Data--Reports--Assemblies { background-position: -1656px 0px; }
72
.icon24.Master-Data--Reports--Customers { background-position: -1680px 0px; }
73
.icon24.Master-Data--Reports--Licenses { background-position: -1704px 0px; }
74
.icon24.Master-Data--Reports--Parts { background-position: -1728px 0px; }
75
.icon24.Master-Data--Reports { background-position: -1752px 0px; }
76
.icon24.Master-Data--Reports--Projects { background-position: -1776px 0px; }
77
.icon24.Master-Data--Reports--Projecttransactions { background-position: -1800px 0px; }
78
.icon24.Master-Data--Reports--Services { background-position: -1824px 0px; }
79
.icon24.Master-Data--Reports--Vendors { background-position: -1848px 0px; }
80
.icon24.Neues-Fenster { background-position: -1872px 0px; }
81
.icon24.Productivity { background-position: -1896px 0px; }
82
.icon24.Program--Logout { background-position: -1920px 0px; }
83
.icon24.Program { background-position: -1944px 0px; }
84
.icon24.Program--Preferences { background-position: -1968px 0px; }
85
.icon24.Program--Version { background-position: -1992px 0px; }
86
.icon24.Reports--Balance-Sheet { background-position: -2016px 0px; }
87
.icon24.Reports--Chart-of-Accounts { background-position: -2040px 0px; }
88
.icon24.Reports--Income-Statement { background-position: -2064px 0px; }
89
.icon24.Reports { background-position: -2088px 0px; }
90
.icon24.Reports--UStVa { background-position: -2112px 0px; }
91
.icon24.rightarrow_24 { background-position: -2136px 0px; }
92
.icon24.System { background-position: -2160px 0px; }
93
.icon24.Warehouse { background-position: -2184px 0px; }
css/icons32.css
1
.icon32 { background: url(../image/maps/icons32.png) 32px 0px no-repeat; padding: 0; width: 32px; height: 32px; }
2
.icon32.AP--Add-Purchase-Order { background-position: -0px 0px; }
3
.icon32.AP--Add-RFQ { background-position: -32px 0px; }
4
.icon32.AP { background-position: -64px 0px; }
5
.icon32.AP--Reports { background-position: -96px 0px; }
6
.icon32.AP--Reports--Purchase-Orders { background-position: -128px 0px; }
7
.icon32.AP--Reports--RFQs { background-position: -160px 0px; }
8
.icon32.AR--Add-Dunning { background-position: -192px 0px; }
9
.icon32.AR--Add-Quotation { background-position: -224px 0px; }
10
.icon32.AR--Add-Sales-Invoice { background-position: -256px 0px; }
11
.icon32.AR--Add-Sales-Order { background-position: -288px 0px; }
12
.icon32.AR { background-position: -320px 0px; }
13
.icon32.AR--Reports--Dunnings { background-position: -352px 0px; }
14
.icon32.AR--Reports--Invoices { background-position: -384px 0px; }
15
.icon32.AR--Reports { background-position: -416px 0px; }
16
.icon32.AR--Reports--Quotations { background-position: -448px 0px; }
17
.icon32.AR--Reports--Sales-Orders { background-position: -480px 0px; }
18
.icon32.Batch-Printing--Packing-Lists { background-position: -512px 0px; }
19
.icon32.Batch-Printing { background-position: -544px 0px; }
20
.icon32.Batch-Printing--Purchase-Orders { background-position: -576px 0px; }
21
.icon32.Batch-Printing--Quotations { background-position: -608px 0px; }
22
.icon32.Batch-Printing--Receipts { background-position: -640px 0px; }
23
.icon32.Batch-Printing--RFQs { background-position: -672px 0px; }
24
.icon32.Batch-Printing--Sales-Invoices { background-position: -704px 0px; }
25
.icon32.Batch-Printing--Sales-Orders { background-position: -736px 0px; }
26
.icon32.Cash--Payment { background-position: -768px 0px; }
27
.icon32.Cash { background-position: -800px 0px; }
28
.icon32.Cash--Receipt { background-position: -832px 0px; }
29
.icon32.Cash--Reconciliation { background-position: -864px 0px; }
30
.icon32.Cash--Reports--Payments { background-position: -896px 0px; }
31
.icon32.Cash--Reports { background-position: -928px 0px; }
32
.icon32.Cash--Reports--Receipts { background-position: -960px 0px; }
33
.icon32.CRM--Admin--Benutzer { background-position: -992px 0px; }
34
.icon32.CRM--Admin--Dokumentvorlage { background-position: -1024px 0px; }
35
.icon32.CRM--Admin--Etiketten { background-position: -1056px 0px; }
36
.icon32.CRM--Admin--Gruppen { background-position: -1088px 0px; }
37
.icon32.CRM--Admin--Mitteilungen { background-position: -1120px 0px; }
38
.icon32.CRM--Admin { background-position: -1152px 0px; }
39
.icon32.CRM--Admin--Status { background-position: -1184px 0px; }
40
.icon32.CRM--Auftragschance { background-position: -1216px 0px; }
41
.icon32.CRM--eMail { background-position: -1248px 0px; }
42
.icon32.CRM--Hilfe { background-position: -1280px 0px; }
43
.icon32.CRM--Kunden { background-position: -1312px 0px; }
44
.icon32.CRM--Lieferant { background-position: -1344px 0px; }
45
.icon32.CRM--Notizen { background-position: -1376px 0px; }
46
.icon32.CRM--Personen { background-position: -1408px 0px; }
47
.icon32.CRM { background-position: -1440px 0px; }
48
.icon32.CRM--Schnellsuche { background-position: -1472px 0px; }
49
.icon32.CRM--Service { background-position: -1504px 0px; }
50
.icon32.CRM--Termine { background-position: -1536px 0px; }
51
.icon32.CRM--Wiedervorlage { background-position: -1568px 0px; }
52
.icon32.CRM--Wissens-DB { background-position: -1600px 0px; }
53
.icon32.General-Ledger--Add-AP-Transaction { background-position: -1632px 0px; }
54
.icon32.General-Ledger--Add-AR-Transaction { background-position: -1664px 0px; }
55
.icon32.General-Ledger--Add-Transaction { background-position: -1696px 0px; }
56
.icon32.General-Ledger--DATEV---Export-Assistent { background-position: -1728px 0px; }
57
.icon32.General-Ledger { background-position: -1760px 0px; }
58
.icon32.General-Ledger--Reports--AP-Aging { background-position: -1792px 0px; }
59
.icon32.General-Ledger--Reports--AR-Aging { background-position: -1824px 0px; }
60
.icon32.General-Ledger--Reports--Journal { background-position: -1856px 0px; }
61
.icon32.General-Ledger--Reports { background-position: -1888px 0px; }
62
.icon32.Master-Data--Add-Assembly { background-position: -1920px 0px; }
63
.icon32.Master-Data--Add-Customer { background-position: -1952px 0px; }
64
.icon32.Master-Data--Add-License { background-position: -1984px 0px; }
65
.icon32.Master-Data--Add-Part { background-position: -2016px 0px; }
66
.icon32.Master-Data--Add-Project { background-position: -2048px 0px; }
67
.icon32.Master-Data--Add-Service { background-position: -2080px 0px; }
68
.icon32.Master-Data--Add-Vendor { background-position: -2112px 0px; }
69
.icon32.Master-Data { background-position: -2144px 0px; }
70
.icon32.Master-Data--Reports--Assemblies { background-position: -2176px 0px; }
71
.icon32.Master-Data--Reports--Customers { background-position: -2208px 0px; }
72
.icon32.Master-Data--Reports--Licenses { background-position: -2240px 0px; }
73
.icon32.Master-Data--Reports--Parts { background-position: -2272px 0px; }
74
.icon32.Master-Data--Reports { background-position: -2304px 0px; }
75
.icon32.Master-Data--Reports--Projects { background-position: -2336px 0px; }
76
.icon32.Master-Data--Reports--Projecttransactions { background-position: -2368px 0px; }
77
.icon32.Master-Data--Reports--Services { background-position: -2400px 0px; }
78
.icon32.Master-Data--Reports--Vendors { background-position: -2432px 0px; }
79
.icon32.Neues-Fenster { background-position: -2464px 0px; }
80
.icon32.Program--Logout { background-position: -2496px 0px; }
81
.icon32.Program { background-position: -2528px 0px; }
82
.icon32.Program--Preferences { background-position: -2560px 0px; }
83
.icon32.Program--Version { background-position: -2592px 0px; }
84
.icon32.Reports--Balance-Sheet { background-position: -2624px 0px; }
85
.icon32.Reports--Chart-of-Accounts { background-position: -2656px 0px; }
86
.icon32.Reports--Income-Statement { background-position: -2688px 0px; }
87
.icon32.Reports { background-position: -2720px 0px; }
88
.icon32.Reports--UStVa { background-position: -2752px 0px; }
89
.icon32.System { background-position: -2784px 0px; }
90
.icon32.Warehouse--Produce-Assembly { background-position: -2816px 0px; }
scripts/image_maps.pl
1
#!/usr/bin/perl
2

  
3
use strict;
4
use GD;
5
use Getopt::Long;
6
use File::Basename;
7

  
8

  
9
my $css_file   = 'generated.css';
10
my $image_file = 'generated.png';
11
my $class_for_map = 'icon';
12

  
13
GetOptions(
14
  'css-out=s'    => \$css_file,
15
  'image-out=s'  => \$image_file,
16
  'icon-class=s' => \$class_for_map,
17
);
18

  
19
my @files = @ARGV;
20
my @gd_images;
21

  
22
GD::Image->trueColor(1);
23

  
24
# read files
25

  
26
for my $filename (@files) {
27
  my $image = GD::Image->newFromPng($filename);
28
   if (!defined $image) {
29
     warn "warning: could not load image '$filename'. skpping...";
30
     next;
31
   }
32
  push @gd_images, {
33
    gd       => $image,
34
    filename => $filename,
35
  };
36
}
37

  
38
# make target layout
39
# for simplification thi will check if all the  images have the same dimensions
40
# and croak if not
41
my $first_height = $gd_images[0]->{gd}->height;
42
my $first_width  = $gd_images[0]->{gd}->width;
43

  
44
use Data::Dumper;
45

  
46
for my $img (@gd_images) {
47
  die 'heights are not equal' if $first_height != $img->{gd}->height;
48
  die 'widths are not equal'  if $first_width  != $img->{gd}->width;
49
}
50

  
51
# all equal? nice.
52
# we'll be lazy and just put them all together left-to-right
53
my $new_height = $first_height;
54
my $new_width  = $first_width * @gd_images;
55

  
56
my $new_image = GD::Image->new($new_width, $new_height, 1);
57
# now copy them all together, and keep a referende to;
58

  
59
$new_image->saveAlpha(1);
60
$new_image->alphaBlending(0);
61

  
62
my $h_offset = 0;
63
for (@gd_images) {
64
  $_->{h_offset} = $h_offset;
65
  $_->{v_offset} = 0;
66
  $new_image->copy($_->{gd}, $_->{h_offset}, $_->{v_offset}, 0, 0, $_->{gd}->width, $_->{gd}->height);
67
} continue {
68
  $h_offset += $_->{gd}->width;
69
}
70

  
71
# now write that png...
72
{
73
  open my $file, '>:raw', $image_file or die "can't write to $image_file";
74
  print $file $new_image->png;
75
}
76

  
77
# make css file
78
{
79
  open my $file, ">", $css_file or die "can't write too $css_file";
80
  print $file ".$class_for_map { background: url(../$image_file) ${first_width}px 0px no-repeat; padding: 0; width: ${first_width}px; height: ${first_height}px; }\n";
81

  
82
  for (@gd_images) {
83
    my $name = fileparse($_->{filename}, ".png");
84
    $name =~ s/ /-/g;
85
    print $file ".$class_for_map.$name { background-position: -$_->{h_offset}px 0px; }\n";
86
  }
87
}
88

  
89
1;
90

  
91
__END__
92

  
93
=encoding utf-8
94

  
95
=head1 NAME
96

  
97
image_maps - generates image maps for css sprites from images in a directory
98

  
99
=head1 SYNOPSIS
100

  
101
  scripts/image_maps.pl \
102
    --out-css=css/icons_16.css \
103
    --out-image= image/maps/icons_16.png \
104
    image/icons/16x16/*
105

  
106
=head1 DESCRIPTION
107

  
108
=head1 OPTIONS
109

  
110
=head1 BUGS
111

  
112
None yet. :)
113

  
114
=head1 AUTHOR
115

  
116
Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>
117

  
118
=cut
119

  
120

  
scripts/make_icons.sh
1
scripts/image_maps.pl --icon-class=icon16 --css-out=css/icons16.css --image-out=image/maps/icons16.png image/icons/16x16/*.png
2
scripts/image_maps.pl --icon-class=icon24 --css-out=css/icons24.css --image-out=image/maps/icons24.png image/icons/24x24/*.png
3
scripts/image_maps.pl --icon-class=icon32 --css-out=css/icons32.css --image-out=image/maps/icons32.png image/icons/32x32/*.png

Auch abrufbar als: Unified diff