1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!-- $Id: images.xml,v 1.4 2007/07/16 15:07:14 scott Exp $ -->
3 <!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
4 "../docbook-xml/docbookx.dtd"
6 <!ENTITY % myents SYSTEM "../fvwm.ent" >
10 <section id="icons_and_images">
11 <title>Icons and Images</title>
12 <para>Fvwm can load <markup>.xbm,</markup> <markup>.xpm,</markup>
13 <markup>.png</markup> and
14 <markup>.svg</markup> images. <emphasis remap='B'>XBM</emphasis>
15 images are monochrome. Fvwm can always display
16 <emphasis remap='B'>XBM</emphasis> files. <emphasis remap='B'>XPM</emphasis>
17 and <emphasis remap='B'>PNG</emphasis> formats are color images.
18 SVG is a vector graphics image format.
19 Compile-time options determine whether fvwm can display
20 <emphasis remap='B'>XPM</emphasis>, <emphasis remap='B'>PNG</emphasis> or
21 <emphasis remap='B'>SVG</emphasis>
22 icons and images. See the <emphasis remap='I'>INSTALL.fvwm</emphasis>
23 file for more information.</para>
25 <!-- TODO: Create a link to INSTALL.fvwm file? -->
27 <para>The related <emphasis remap='B'>SHAPE</emphasis>
28 compile-time option can make fvwm display spiffy shaped icons.</para>
31 <section id='svg_rendering_options'>
32 <title>SVG rendering options</title>
35 SVG images are generated from (XML) text files. A really simple SVG file
36 might look something like this:</para>
39 <svg width="120" height="80">
40 <rect fill="red" width="40" height="40" x="0" y="0" />
41 <rect fill="lime" width="40" height="40" x="40" y="0" />
42 <rect fill="blue" width="40" height="40" x="80" y="0" />
43 <rect fill="cyan" width="40" height="40" x="0" y="40" />
44 <rect fill="magenta" width="40" height="40" x="40" y="40" />
45 <rect fill="yellow" width="40" height="40" x="80" y="40" />
49 <mediaobject output='html'>
50 <imageobject><imagedata
51 fileref="../images/svg_rendering/plain.png" />
54 <code>image.svg</code>
60 By default, SVG images are rendered as the image creator intended
61 them to. But since SVG is a vector graphics format, the images can
62 be rendered at any choosen size and rotation, e.g. making it possible
63 to use the same icon file rendered at diffrent sizes for the
64 <fvwmref cmd="Style" opt="Icon"/> and <fvwmref cmd="Style" opt="MiniIcon"/>
67 <para>The rendering options are specified as a string appended to the SVG
68 filename as follows:</para>
72 ><replaceable>image.svg</replaceable
76 ><arg choice='opt'>!</arg
79 ><synopfragmentref linkend="svg_rendering_size"
80 >size</synopfragmentref
82 ><arg choice='plain' rep='repeat'
84 ><synopfragmentref linkend="svg_rendering_position"
85 >position</synopfragmentref
88 ><synopfragmentref linkend="svg_rendering_rotation"
89 >rotation</synopfragmentref
92 ><synopfragmentref linkend="svg_rendering_scale"
93 >scale</synopfragmentref
96 ><synopfragment id="svg_rendering_size"
98 ><arg choice='opt'>-</arg
100 ><replaceable>width</replaceable
102 ><arg choice='req'>x</arg
105 ><arg choice='opt'>-</arg
107 ><replaceable>height</replaceable
109 ><synopfragment id="svg_rendering_position"
112 ><arg choice='plain'>-</arg
113 ><arg choice='plain'>+</arg
116 ><replaceable>xpos</replaceable
119 ><arg choice='plain'>-</arg
120 ><arg choice='plain'>+</arg
123 ><replaceable>ypos</replaceable
125 ><synopfragment id="svg_rendering_rotation"
128 ><arg choice='opt'>-</arg
130 ><replaceable>angle</replaceable
132 ><synopfragment id="svg_rendering_scale"
135 ><arg choice='plain'>*</arg
136 ><arg choice='plain'>/</arg
140 ><arg choice='opt'>-</arg
142 ><replaceable>factor</replaceable
145 ><arg choice='plain'>x</arg
146 ><arg choice='plain'>y</arg
153 The option string always starts with a colon ('<literal>:</literal>')
154 to separate it from the filename. An empty option string can skip this
155 colon, but it might still be a good idea to include it to prevent
156 ambiguity if the filename contains any colon.</para>
159 filename_without_colon.svg
160 filename:with:colon.svg:
164 An exclamation point ('<literal>!</literal>') transposes the entire final
165 image (including the rendering area), i.e. all the horizontal and all the
166 vertical coordinates are swapped with each other.</para>
172 <mediaobject output='html'>
173 <imageobject><imagedata
174 fileref="../images/svg_rendering/transpose.png" />
177 <code>image.svg:!</code>
183 <replaceable>width</replaceable> and <replaceable>height</replaceable>
184 specifies the dimensions of the rendering area in pixels, i.e. the
185 dimensions of the resulting image. The actual image is fitted to fill
186 the entire rendering area.</para>
192 <mediaobject output='html'>
193 <imageobject><imagedata
194 fileref="../images/svg_rendering/size.png" />
197 <code>image.svg:60x60</code>
203 Use a <replaceable>width</replaceable> or <replaceable>height</replaceable>
204 value of 0 to keep the aspect ratio.</para>
211 <mediaobject output='html'>
212 <imageobject><imagedata
213 fileref="../images/svg_rendering/size_keep_ratio_x.png" />
216 <code>image.svg:0x60</code>
220 <mediaobject output='html'>
221 <imageobject><imagedata
222 fileref="../images/svg_rendering/size_keep_ratio_y.png" />
225 <code>image.svg:60x0</code>
230 <para>A '<literal>-</literal>' before <replaceable>width</replaceable>
231 mirrors the rendering area horizontally.</para>
237 <para>A '<literal>-</literal>' before <replaceable>height</replaceable>
238 mirrors the rendering area vertically.</para>
244 <mediaobject output='html'>
245 <imageobject><imagedata
246 fileref="../images/svg_rendering/size_mirroring_y.png" />
249 <code>image.svg:0x-0</code>
255 <replaceable>xpos</replaceable> and <replaceable>ypos</replaceable>
256 specifies a translation of the image in pixels. A positive
257 <replaceable>xpos</replaceable> value moves the image to the right. A
258 positive <replaceable>ypos</replaceable> value moves it down. Moving
259 it partially outside of the rendering area results in a cropped
268 <mediaobject output='html'>
269 <imageobject><imagedata
270 fileref="../images/svg_rendering/position.png" />
273 <code>image.svg:-30+10</code>
279 <replaceable>angle</replaceable> specifies a rotation around the actual
280 image center in degrees. This might result in a cropped image. A
281 positive value rotates the image clockwise. Floating point values are
291 <mediaobject output='html'>
292 <imageobject><imagedata
293 fileref="../images/svg_rendering/rotation.png" />
296 <code>image.svg:@30</code>
302 <replaceable>factor</replaceable> specifes a scaling of the actual
303 image (not the rendering area). Scaling it up results in a cropped
304 image. Floting point values are recognized. Division by zero is
305 ignored. If <replaceable>factor</replaceable> is directly followed
306 by a '<literal>x</literal>' or a '<literal>y</literal>', the scaling
307 is horizontal or vertical respectively. Otherwise the scaling is
317 <mediaobject output='html'>
318 <imageobject><imagedata
319 fileref="../images/svg_rendering/scale_up_uniform.png" />
322 <code>image.svg:*2</code>
326 <mediaobject output='html'>
327 <imageobject><imagedata
328 fileref="../images/svg_rendering/scale_down_uniform.png" />
331 <code>image.svg:/2</code>
335 <mediaobject output='html'>
336 <imageobject><imagedata
337 fileref="../images/svg_rendering/scale_down_y.png" />
340 <code>image.svg:/2y</code>
346 Scaling down a translated or rotated image can prevent cropping.</para>
352 <mediaobject output='html'>
353 <imageobject><imagedata
354 fileref="../images/svg_rendering/prevent_cropping.png" />
357 <code>image.svg:@30*0.6</code>
363 Repeated usage of translation, rotation, and scaling is allowed.
364 Translation and rotation are additive. Scaling is multiplicative.</para>
371 <mediaobject output='html'>
372 <imageobject><imagedata
373 fileref="../images/svg_rendering/scale_down.png" />
376 <code>image.svg:/3x/2y</code>
382 When combining affine transformations, the scaling is always done first,
383 then the rotation, and finally the translation.</para>
386 image.svg:-30+10@30/3x/2y
389 <mediaobject output='html'>
390 <imageobject><imagedata
391 fileref="../images/svg_rendering/affine_combined.png" />
394 <code>image.svg:-30+10@30/3x/2y</code>
400 Use a negative scale <replaceable>factor</replaceable> to mirror the
404 image.svg:-30+10@30/-3x/2y
407 <mediaobject output='html'>
408 <imageobject><imagedata
409 fileref="../images/svg_rendering/scale_mirroring.png" />
412 <code>image.svg:-30+10@30/-3x/2y</code>
418 Mirroring of the rendering area is done after any scaling, rotation or
419 translation of the image.</para>
422 image.svg:-0x0-30+10@30/3x/2y
425 <mediaobject output='html'>
426 <imageobject><imagedata
427 fileref="../images/svg_rendering/size_mirroring.png" />
430 <code>image.svg:-0x0-30+10@30/3x/2y</code>
436 Transposing is done last of all, after everything else.</para>
439 image.svg:!-0x0-30+10@30/3x/2y
442 <mediaobject output='html'>
443 <imageobject><imagedata
444 fileref="../images/svg_rendering/all_combined.png" />
447 <code>image.svg:!-0x0-30+10@30/3x/2y</code>