The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Quiq::Svg::Tag - Erzeuge SVG Markup-Code

BASE CLASS

Quiq::Tag

SYNOPSIS

Modul laden und Objekt instantiieren

  use Quiq::Svg::Tag;
  
  my $p = Quiq::Svg::Tag->new;

Ein einfaches SVG-Dokument

  $svg = $p->cat(
      $p->preamble,
      $p->tag('svg',
          width => 80,
          height => 80,
          $p->tag('circle',
              cx => 40,
              cy => 40,
              r => 39,
              style => 'stroke: black; fill: none',
          ),
      ),
  );

erzeugt

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  
  <svg width="80" height="80" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <circle cx="40" cy="40" r="39" style="stroke: black; fill: yellow" />
  </svg>

was darstellt wird als

Anstelle eines Kreises kann jeder andere SVG-Code erzeugt werden.

DESCRIPTION

Ein Objekt der Klasse erzeugt SVG Markup-Code beliebiger Komplexität. Dies geschieht durch systematische Anwendung der Methode $p->tag(), die in der Basisklasse Quiq::Tag definiert ist und hier in Quiq::Svg::Tag zur Erzeugung von SVG Markup überschrieben wurde.

SEE ALSO

METHODS

Instantiierung

new() - Konstruktor

Synopsis

  $p = $class->new;

Returns

Objekt

Description

Instantiiere ein Objekt der Klasse und liefere eine Referenz auf dieses Objekt zurück.

Generierung

preamble() - SVG-Vorspann

Synopsis

  $svg = $p->preamble;

Returns

SVG-Vorspann (String)

Description

Liefere die SVG-Präambel bestehend aus der "XML Processing Instruction" und der "DOCTYPE Declaration":

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

tag() - SVG-Tag

Synopsis

  $svg = $p->tag($elem,@opts,@attrs);
  $svg = $p->tag($elem,@opts,@attrs,$content);
  $svg = $p->tag($elem,@opts,@attrs,'-',@content);

Arguments

Siehe Quiq::Tag->tag()

Options

Siehe Quiq::Tag->tag()

Returns

SVG-Code (String)

Description

Erzeuge einen SVG-Tag und liefere diesen zurück. Die Methode ruft die gleichnamige Basisklassenmethode auf und übergibt die SVG-spezifischen Element-Definitionen per Option -elements. Diese definieren die Default-Formatierung und die Default-Attribute einzelner SVG-Elemente. Details zur Methode siehe Quiq::Tag->tag().

VERSION

1.178

AUTHOR

Frank Seitz, http://fseitz.de/

COPYRIGHT

Copyright (C) 2020 Frank Seitz

LICENSE

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.