1#!/usr/bin/php4
2<?php
3/**************************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 *************************************************************/
23#$renderer = "rsvg";
24$renderer = "inkscape";
25
26/*
27
28If you're a hacker, please look away
29
30*/
31
32$render_sizes = array("16"=>"sc_","24"=>"lc_");
33$render_dpis = array("16"=>"60", "24"=>"90");
34
35$svgs = `find . -name "*.svg"`;
36$svgs = explode("\n",$svgs);
37
38echo "* rendering PNGs\n\n";
39foreach ($svgs as $line) {
40	if ($line) {
41		$file = eregi_replace("^./lc_(.*)\.svg","\\1",$line);
42		//echo "\n" .  $file . "\n\n";
43		foreach ($render_sizes as $size => $prefix) {
44			$SVG = "lc_$file.svg";
45			$PNG = "$prefix$file.png";
46			//delete older version
47			if (file_exists($PNG)) unlink($PNG);
48			echo "$SVG => $PNG\n";
49			if ($renderer == "inkscape") {
50				$exec = "inkscape -z -e $PNG -f $SVG ";
51				$exec .="-w $size -h $size";
52				exec($exec);
53			} else {
54				exec("rsvg -w $size -h $size $SVG $PNG\n");
55			}
56		}
57	}
58}
59
60exit;
61?>
62