A Slide-Show Presentation via SVG - Part 1 of Chapter 7 from Perl Graphics Programming (1/4) | WebReference

A Slide-Show Presentation via SVG - Part 1 of Chapter 7 from Perl Graphics Programming (1/4)

current pageTo page 2To page 3To page 4
[next]

Perl Graphics Programming, Chapter 7: Creating SVG with Perl

A Slide-Show Presentation

Many programs let you build presentations, the biggest and best-known of which is Microsoft's Powerpoint. In this section we develop a program that transforms an XML file describing a slide-show presentation (slides, bullet items, etc.) into an SVG file that is the presentation.

The input file consists of a collection of any of the following six tags:

<slideshow>
The top-level tag

<slide>
A new slide in the sequence

<block>
A block can be either a line of text or a bullet list

<bulletlist>
A group of <bullet> elements

<bullet>
An indented line of text with a bullet prepended

<image>
An image to place in the upper left corner of the slide

A complete slide show file written in this format looks like Example 7-1.

Example 7-1: Sample slideshow file

<slideshow subdir="./slideshow1/">
  <slide title="Perl for Graphics">
    <image>https://shawn.apocabilly.org/PFG/examples/shawn.png
    </image>
    <block type="textline">Section I: File Formats</block>
    <block type="bulletlist">
      <bullet>1. Raster Graphics Formats</bullet>
      <bullet>2. Efficient Multimedia with SWF</bullet>
      <bullet>3. The SVG format</bullet>
      <bullet>4. Printing with PostScript and PDF</bullet>
    </block>
    <block type="textline">Section II: Tools</block>
                      ...
  </slide>
  <slide title="Chapter 1">
    <image>https://shawn.apocabilly.org/PFG/examples/shawn.png
    </image>
    <block type="textline">Web Graphics Basics</block>
    <block type="bulletlist">
        <bullet>Fields and Streams</bullet>
        <bullet>Color tables</bullet>
        <bullet>Transparency and alpha</bullet>
        <bullet>Compression</bullet>
        <bullet>Interlacing</bullet>
        <bullet>Which to use when?</bullet>
    </block>
                      ...
  </slide>
</slideshow>

When given the file in Example 7-1, the output of our program is the presentation shown in Figure 7-1.

Two linked SVG slides generated from an XML slideshow definition file
Figure 7-1. Two linked SVG slides generated from an XML slideshow definition file


current pageTo page 2To page 3To page 4
[next]

Created: February 12, 2003
Revised: February 12, 2003

URL: https://webreference.com/programming/perl/chap7/1/