From 62d19b24453e36cb2ad4d4e14ca9a51317a100f6 Mon Sep 17 00:00:00 2001 From: Jakub Steiner Date: Mon, 8 Sep 2008 12:07:47 +0200 Subject: Remove the 'build' scripts. Add a README and replace the placeholder template with an initial asset - paper sheet --- AUTHORS | 1 + README | 11 +- render-bitmaps.pl | 102 --- render-bitmaps.py | 58 -- render-bitmaps.rb | 40 - svg/paper-sheet.svg | 2288 +++++++++++++++++++++++++++++++++++++++++++++++++++ svg/test-sheet.svg | 2083 ---------------------------------------------- 7 files changed, 2299 insertions(+), 2284 deletions(-) delete mode 100755 render-bitmaps.pl delete mode 100755 render-bitmaps.py delete mode 100755 render-bitmaps.rb create mode 100644 svg/paper-sheet.svg delete mode 100644 svg/test-sheet.svg diff --git a/AUTHORS b/AUTHORS index faf3554..7fb1d6d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,2 @@ Jakub Steiner + diff --git a/README b/README index 0f30597..76af416 100644 --- a/README +++ b/README @@ -1 +1,10 @@ -FIXME: Howto create/render icons +Tango Icon Library +================== + +This is the library of basic icon assets freely reusable in your Tango-styled [1] icon project. +The assets are public domain, so you are free to use them in any way imaginable. We do, however, +ask you to be kind and mention the Tango project somewhere on your website or application if +you use these assets. Linking to http://tango.freedesktop.org is greatly appreciated. + + +[1] http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines diff --git a/render-bitmaps.pl b/render-bitmaps.pl deleted file mode 100755 index fb3d2c7..0000000 --- a/render-bitmaps.pl +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/perl -w -# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- -############################################################################# -## Copyright (C) 2008 Rodney Dawes -## -## Authors: Rodney Dawes -## - -use strict; -use XML::Simple; -use Getopt::Long; - -my $inkscape = "inkscape"; -my $sizeonly; -my $outdir = ""; -my $dirall; - -############################################################################ -my @default_getopt_config = ("permute", "pass_through", "bundling", - "no_auto_abbrev", "no_ignore_case"); - -Getopt::Long::Configure (@default_getopt_config); -GetOptions ("size|s=s" => \$sizeonly, - "inkscape|i=s" => \$inkscape, - "output-dir|o=s" => \$outdir, - "directory|d=s" => \$dirall); - -############################################################################ - -use Data::Dumper; - -sub render_icons { - my $filename = shift; - - my $mapping = XML::Simple::XMLin ($filename, - keyattr => [ qw() ], - forcearray => [ qw(g rect text) ]); - - foreach my $icon (@{$mapping->{g}}) { - my $name; - my $context; - - foreach my $plate (@{$icon->{g}}) { - if (defined $plate->{'inkscape:label'} && - $plate->{'inkscape:label'} =~ m/plate(.*)/) { - - foreach my $text (@{$plate->{text}}) { - if (defined $text->{'inkscape:label'} && - $text->{'inkscape:label'} eq "icon-name") { - $name = $text->{tspan}->{content}; - } elsif (defined $text->{'inkscape:label'} && - $text->{'inkscape:label'} eq "context") { - $context = $text->{tspan}->{content}; - } - } - foreach my $box (@{$plate->{rect}}) { - if (defined $box->{'inkscape:label'}) { - my $size = $box->{'inkscape:label'}; - my $dir = "$outdir/$size/$context"; - - next if (defined $sizeonly && $size ne $sizeonly); - - if (! -d $dir) { - system ("mkdir -p $dir"); - } - my $cmd = "$inkscape -i $box->{id} -e $dir/$name.png $filename > /dev/null"; - print "Rendering $dir/$name.png...\n"; - system ($cmd); - } - } - } - } - } -} - -sub usage { - print "Usage: render-bitmaps.pl [OPTIONS] - - -d, --directory= Render all SVGs in - -i, --inkscape= Path to inkscape binary to use - -o, --output= Directory to output PNGs to - -s, --size= Size to render from - -"; - - exit 1; -} - -if (defined $ARGV[0]) { - render_icons ($ARGV[0]); -} elsif (defined $dirall) { - opendir (DIR, $dirall) || die ("ERROR: Failed to open directory: $dirall"); - my @filelist = readdir (DIR); - closedir (DIR); - - foreach my $file (@filelist) { - next if ($file eq "." || $file eq ".."); - render_icons ("$dirall/$file") if ($file =~ m/^(.*).svg[z]?$/); - } -} else { - usage (); -} diff --git a/render-bitmaps.py b/render-bitmaps.py deleted file mode 100755 index a0e9cb6..0000000 --- a/render-bitmaps.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -import glob, os, sys, dircache, xml.dom.minidom -import new - -INKSCAPE = "/usr/bin/inkscape" -SRC = "./svg" - -# getText() by Mark Pilgrim -def getText(self): - def isTextNode(node): - return isinstance(node, xml.dom.minidom.Text) - def getData(node): - return node.data - try: - return "".join(map(getData, filter(isTextNode, self.childNodes))) - except: - return "" - -def render(file): - print "\t%s" % (file) - svg = xml.dom.minidom.parse(SRC + "/" + file) - for icon in svg.getElementsByTagName("g"): - if icon.getAttribute("inkscape:label").find("plate") == -1: - continue - for in_node in icon.getElementsByTagName("text"): - if in_node.getAttribute("inkscape:label") == "icon-name": - icon_name = getText(in_node.getElementsByTagName("tspan")[0]) - if in_node.getAttribute("inkscape:label") == "context": - context = getText(in_node.getElementsByTagName("tspan")[0]) - print "\t\t%s/%s" % (context, icon_name) - for box in icon.getElementsByTagName("rect"): - bid = box.getAttribute("id") - size = "%sx%s" % (box.getAttribute("width"), - box.getAttribute("height")) - destdir = "%s/%s" % (size, context) - src = "%s/%s" % (SRC, file) - dest = "%s/%s.png" % (destdir, icon_name) - cmd = INKSCAPE + " -i " + bid + " -e " + dest + " " + src + " > /dev/null 2>&1" - if not os.path.isdir(destdir): - os.makedirs(destdir) - print "\t\t\t%s/%s" % (destdir, icon_name) - os.system(cmd) - return - -if len(sys.argv) < 2: - print "Rendering from SVGs in %s" % (SRC) - for file in dircache.listdir(SRC): - if file.endswith(".svg"): - render(file) -else: - for svgname in sys.argv[1:]: - file = svgname + ".svg" - if os.path.isfile(SRC + "/" + file): - render(file) - else: - print "Error: No such file: %s" % (file) - diff --git a/render-bitmaps.rb b/render-bitmaps.rb deleted file mode 100755 index eb919e7..0000000 --- a/render-bitmaps.rb +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env ruby - -require "rexml/document" -require "ftools" -include REXML -INKSCAPE = '/usr/bin/inkscape' -SRC = "./svg" - -def renderit(file) - svg = Document.new(File.new("#{SRC}/#{file}", 'r')) - svg.root.each_element("//g[contains(@inkscape:label,'plate')]") do |icon| - context = icon.elements["text[@inkscape:label='context']/tspan"].text - icon_name = icon.elements["text[@inkscape:label='icon-name']/tspan"].text - puts "#{file}:#{icon.attributes['inkscape:label']} #{context}/#{icon_name}" - icon.each_element("rect") do |box| - dir = "#{box.attributes['width']}x#{box.attributes['height']}/#{context}" - cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{icon_name.gsub(/$/,'.png')} #{SRC}/#{file} > /dev/null 2>&1" - File.makedirs(dir) unless File.exists?(dir) - system(cmd) - print "." - end - puts '' - end -end - -if (ARGV[0].nil?) #render all SVGs - puts "Rendering from SVGs in #{SRC}" - Dir.foreach(SRC) do |file| - renderit(file) if file.match(/svg$/) - end - puts "\nrendered all SVGs" -else #only render the SVG passed - file = "#{ARGV[0]}.svg" - if (File.exists?("#{SRC}/#{file}")) - renderit(file) - puts "\nrendered #{file}" - else - puts "[E] No such file (#{file})" - end -end diff --git a/svg/paper-sheet.svg b/svg/paper-sheet.svg new file mode 100644 index 0000000..fad3bd7 --- /dev/null +++ b/svg/paper-sheet.svg @@ -0,0 +1,2288 @@ + + + + Paper Sheet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Paper Sheet + + + + Lapo Calamandrei + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/test-sheet.svg b/svg/test-sheet.svg deleted file mode 100644 index 7c0d2c5..0000000 --- a/svg/test-sheet.svg +++ /dev/null @@ -1,2083 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Jakub Steiner - - - http://jimmac.musichall.cz - - Generic Audio - - - mp3 - audio - media - file - audio - sound - music - wave - - - - - - - - - - - - - - - - - - mimetypes - - - - - - - - - - - - - - - - - - - - - - - - - mimetypes - audio-x-generic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - star - apps - - - - - - - - - How does this work? - The ruby script will walk this SVG and search for layers that include the string 'plate'.in each of this layer it looks for a text object with the label 'context' and 'icon-name'.It then iterates throu all rect objects within that layer. It takes the dimensions of the rectangle and exports a bitmap to #{width}x#{height}/#{context}/#{icon_name}.pngMake sure you label text objects when you create new layers. Make sure your plate layers are hidden when saving. - -- cgit v1.2.3