diff options
author | Hylke Bons <hbons@pidgin.im> | 2008-08-21 20:52:51 +0000 |
---|---|---|
committer | Hylke Bons <hbons@pidgin.im> | 2008-08-21 20:52:51 +0000 |
commit | 05296182d2296c55ff82967a16df5422858dac9d (patch) | |
tree | 602ecf4331a7da401e2b62b9aa3dc032bb085529 /pidgin/pixmaps/art-tools | |
parent | 2e2449b7c94835f8408620b97f95cf4e47758c9a (diff) | |
download | pidgin-05296182d2296c55ff82967a16df5422858dac9d.tar.gz |
First steps to one-canvas workflow.
Diffstat (limited to 'pidgin/pixmaps/art-tools')
-rw-r--r-- | pidgin/pixmaps/art-tools/clean-svg-definitions.sh | 7 | ||||
-rwxr-xr-x | pidgin/pixmaps/art-tools/render-pidgin-emotes.rb | 48 |
2 files changed, 55 insertions, 0 deletions
diff --git a/pidgin/pixmaps/art-tools/clean-svg-definitions.sh b/pidgin/pixmaps/art-tools/clean-svg-definitions.sh new file mode 100644 index 0000000000..9c5c7968f4 --- /dev/null +++ b/pidgin/pixmaps/art-tools/clean-svg-definitions.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for f in `ls *.svg` +do + echo "Processing $f file..." + inkscape --vacuum-defs $f +done diff --git a/pidgin/pixmaps/art-tools/render-pidgin-emotes.rb b/pidgin/pixmaps/art-tools/render-pidgin-emotes.rb new file mode 100755 index 0000000000..77f9e539a8 --- /dev/null +++ b/pidgin/pixmaps/art-tools/render-pidgin-emotes.rb @@ -0,0 +1,48 @@ +#!/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| + filename = icon.attributes["label"] + filename = `echo -n #{filename} | sed -e 's/plate\-//g'` + puts "#{file} #{filename}.png" + icon.each_element("rect") do |box| + if box.attributes['inkscape:label'] == '22x22' + dir = "#{box.attributes['width']}x#{box.attributes['height']}/" + cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{filename}.png #{SRC}/#{file} > /dev/null 2>&1" + File.makedirs(dir) unless File.exists?(dir) + system(cmd) + print "." + elsif box.attributes['inkscape:label'] == '24x24' + dir = "#{box.attributes['width']}x#{box.attributes['height']}/" + cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{filename}.png #{SRC}/#{file} > /dev/null 2>&1" + File.makedirs(dir) unless File.exists?(dir) + system(cmd) + print "." + end + 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 |