Begin packaging new upstream version.
[debian_comixcursors.git] / debian / patches / 03-convert-using-rsvg.patch
blobe6218a857250d0b8d5171110b812c2005d04a4a1
1 Description: Use ‘rsvg’ for conversion from SVG to PNG.
2 Origin: Created to improve package build speed.
3 Author: Ben Finney <ben+debian@benfinney.id.au>
4 Last-Update: 2010-05-07
6 === modified file 'INSTALL'
7 --- old/INSTALL 2010-04-23 05:50:33 +0000
8 +++ new/INSTALL 2010-05-07 07:28:51 +0000
9 @@ -5,8 +5,8 @@
10 ==================
12 Requirements:
13 -- ImageMagick (www.imagemagick.org)
14 -- inkscape (www.inkscape.org)
15 +- ImageMagick <http://www.imagemagick.org/>
16 +- librsvg <http://librsvg.sourceforge.net/>
18 Download the ComixCursors sources from:
20 @@ -17,15 +17,15 @@
21 # tar -xjvf ComixCursours-0.5.0.tar.bz2
22 # cd ComixCursors-0.5.0
24 -With ImageMagick and inkscape installed
25 +With the programs from ImageMagick and librsvg installed,
26 build and install the custom ComixCursors:
28 # ./install.bash
30 This will parse the CONFIG and HOTSPOTS files, export the
31 cursor source files in the svn directory to PNGs in the
32 -build directory (using inkscape), assemble and apply some
33 -effects using ImageMagick tools convert and mogrify, create
34 +build directory (using ‘rsvg’), assemble and apply some
35 +effects using ImageMagick tools ‘convert’ and ‘mogrify’, create
36 the xcursors in the cursors directory, and install the files
37 in your ~/.icons directory.
38 Not that the shadow images will be cached to reduce building
40 === modified file 'README'
41 --- old/README 2010-04-23 05:50:33 +0000
42 +++ new/README 2010-05-07 07:30:06 +0000
43 @@ -4,11 +4,10 @@
45 INSTALLATION
47 -You need to have the ImageMagick (www.imagemagick.org)
48 -tools and Inkscape (www.inkscape.org) installed, to run
49 -the installation script!
50 +Refer to the ‘INSTALL’ file for requirements and detailed instructions
51 +to build and install.
53 -If you have, issue
54 +If you have the required programs, issue
56 # ./install.bash
59 === modified file 'svg2png.bash'
60 --- old/svg2png.bash 2010-04-23 05:50:33 +0000
61 +++ new/svg2png.bash 2010-05-07 11:52:49 +0000
62 @@ -1,18 +1,19 @@
63 #!/bin/bash
64 ##########################################################
65 -# svg2png.bash #
66 -# 2006 Jens Luetkens <j.luetkens@limitland.de> #
67 -# version: ComixCursors 0.5.0 #
68 -# flatbedcursors 0.1 (compatible) #
69 -# #
70 -# take a simple svg file, export it to an image, #
71 -# do some image magig, generate a shadow, scale #
72 -# and merge it to a single image #
73 -# #
74 -# Required tools: #
75 -# ImageMagick : http://www.imagemagick.org #
76 -# Inkscape : http://www.inkscape.org #
77 -# #
78 +# svg2png.bash
79 +# Copyright © 2010 Ben Finney <ben+debian@benfinney.id.au>
80 +# Copyright © 2006 Jens Luetkens <j.luetkens@limitland.de>
81 +# version: ComixCursors 0.5.0
82 +# flatbedcursors 0.1 (compatible)
84 +# Take a simple svg file, export it to an image,
85 +# do some image magig, generate a shadow, scale
86 +# and merge it to a single image.
88 +# Required tools:
89 +# ImageMagick: http://www.imagemagick.org
90 +# librsvg: http://librsvg.sourceforge.net/
92 ##########################################################
94 if [ $# -lt 1 ]; then
95 @@ -69,11 +70,11 @@
97 SCALEBLUR=`echo "$BLUR * $TMPSCALE" | bc`
98 SCALESIZE=`echo "$SIZE * $TMPSCALE" | bc`
99 -CROP=`echo "($SCALESIZE - $TMPSIZE) / 2" | bc`
101 -# scaling the shadow from a 500x500 px image
102 -RIGHT=`echo "500 / $SHADOWSCALE" | bc`
103 -LEFT=`echo "500 - $RIGHT" | bc`
104 +# Scaling the shadow from the cursor image.
105 +SHADOWSIZE=$(echo "$TMPSIZE * $SHADOWSCALE" | bc)
106 +RIGHT=$(echo "$TMPSIZE / $SHADOWSCALE" | bc)
107 +LEFT=$(echo "$TMPSIZE - $RIGHT" | bc)
109 if [ ! -d tmp ]; then mkdir tmp ; fi
110 if [ ! -d shadows ]; then mkdir shadows ; fi
111 @@ -113,27 +114,28 @@
112 CURSORIMAGE=tmp/cursor.png
113 SCALEDIMAGE=tmp/scaledcursor.png
115 +function svg2png {
116 + # Convert a single SVG image to PNG.
117 + local infile=$1
118 + local outfile=$2
119 + local size=$3
121 + rsvg --format png \
122 + --dpi-x 72 --dpi-y 72 \
123 + --width $size --height $size \
124 + $infile $outfile
127 # compose the image
128 -inkscape -e $CURSORIMAGE \
129 - -w $TMPSIZE \
130 - -h $TMPSIZE \
131 - -b $OUTLINECOLOR \
132 - -y 0 \
133 - -d 72 \
134 - $INFILE >> /dev/null
135 +svg2png $INFILE $CURSORIMAGE $TMPSIZE
137 if [ ! -f $SHADOWIMAGE ]; then
138 - # echo "creating shadow image $SHADOWIMAGE..."
139 - # scaling the shadow must be done with exporting a different area from inkscape...
140 - inkscape -e $SCALEDIMAGE \
141 - -a $LEFT:$LEFT:$RIGHT:$RIGHT \
142 - -w $TMPSIZE \
143 - -h $TMPSIZE \
144 - -b $OUTLINECOLOR \
145 - -y 0 \
146 - -d 72 \
147 - $INFILE >> /dev/null
149 + # Make the shadow image from an extract of the cursor.
150 + convert \
151 + -extract ${SHADOWSIZE}x${SHADOWSIZE}+${LEFT}+${LEFT} \
152 + -resize ${TMPSIZE}x${TMPSIZE} \
153 + $CURSORIMAGE $SCALEDIMAGE
155 convert -modulate 0 \
156 -fill "$SHADOWCOLOR" \
157 -colorize 100 \