You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Nick Labadie <ni...@gmail.com> on 2006/07/04 01:46:27 UTC

output SVG Tiny documents

Hello,

I want to output SVG Tiny documents with using Batik.
Can Batik output SVG Tiny documents?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: output SVG Tiny documents

Posted by Nick Labadie <ni...@gmail.com>.
Thank you, Thomas.

2006/7/7, thomas.deweese@kodak.com <th...@kodak.com>:
>    So you are asking if the Batik SVGGraphics2D supports
> SVG 1.1 and/or SVG Tiny (there is a lot more to Batik).
> The short answer is yes the SVGGraphics2D supports SVG 1.1
> (really no different than SVG 1.0 for full profile) and
> no the SVGGraphics2D implementation doesn't support
> restricting it's output to SVG Tiny.

I interested it.
I understood it.
Batik doesn't support SVG Tiny in the strict sense.

>    It is easy to modify the output of the SVGGraphics2D
> so that it 'claims' to be SVG Tiny (you can get the root
> of the generated SVG and add/modify it's attributes).
> Assuming what you are drawing maps directly to SVG Tiny,
> I believe that this is essentially all that is needed
> (you might want to turn off the use of css).

I'm happy if Batik translates SVG into SVG Tiny by whatever means possible.
But Batik doesn't traslate.
I have to translate it by myself.

I will delete or translate what SVG-T doesn't support SVG 1.1 modules
into alternatives in my SVG documents.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: output SVG Tiny documents

Posted by th...@kodak.com.
Hi Nick,

"Nick Labadie" <ni...@gmail.com> wrote on 07/07/2006 01:11:32 AM:

> I want output SVG Tiny document with using Batik.
> Does Batik support SVG 1.1 and SVG Tiny?

>       SVGGraphics2D g = new SVGGraphics2D(document);

   So you are asking if the Batik SVGGraphics2D supports
SVG 1.1 and/or SVG Tiny (there is a lot more to Batik).
The short answer is yes the SVGGraphics2D supports SVG 1.1 
(really no different than SVG 1.0 for full profile) and 
no the SVGGraphics2D implementation doesn't support 
restricting it's output to SVG Tiny.

>       g.setSVGCanvasSize(new Dimension(500, 500));

> output SVG document

> <svg fill-opacity="1" [...]

> I want that baseProfile="tiny" .
> A baseProfile attribute of svg element has value, "tiny".

   It is easy to modify the output of the SVGGraphics2D
so that it 'claims' to be SVG Tiny (you can get the root
of the generated SVG and add/modify it's attributes).
Assuming what you are drawing maps directly to SVG Tiny,
I believe that this is essentially all that is needed
(you might want to turn off the use of css).

   However, if you start using opacity, filters and the 
like then Batik won't automatically turn that into a 
raster and include it as an inline image for example. 

   So it might still be very useful, but then again
it might not...


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: output SVG Tiny documents

Posted by Nick Labadie <ni...@gmail.com>.
Hi, Thomas,

2006/7/6, thomas.deweese@kodak.com <th...@kodak.com>:
> "Nick Labadie" <ni...@gmail.com> wrote on 07/03/2006 07:46:27 PM:
>
> > I want to output SVG Tiny documents with using Batik.
> > Can Batik output SVG Tiny documents?
>
>    In what context?  Any Java application can output
> SVG Tiny using 'println' but I'm guessing this is
> not what you have in mind ;)

I want output SVG Tiny document with using Batik.
Does Batik support SVG 1.1 and SVG Tiny?
Does Batik support modules of SVG 1.1?


sample code that I want
------------------------------------------------------------------------
import java.awt.*;
import java.awt.geom.*;
import java.io.*;

import org.w3c.dom.*;
import org.apache.batik.dom.*;
import org.apache.batik.svggen.*;

public class SVGTest {

  public static void main(String[] args) throws Exception {

    try {
      // creating Graphics2D object
      DOMImplementation domImpl
        = GenericDOMImplementation.getDOMImplementation();
      Document document = domImpl.createDocument(null, "svg", null);
      SVGGraphics2D g = new SVGGraphics2D(document);
      g.setSVGCanvasSize(new Dimension(500, 500));

      // drawing graphics
      // (Actually, I want draw more complex graphics...)
      Line2D line = new Line2D.Double(0.0, 0.0, 10, 10);
      g.draw(line);

      // creating svg content string
      StringWriter writer = new StringWriter();
      g.stream(writer);
      String svgContent = writer.toString();

      g.dispose();

      // output svg content
      FileOutputStream fos = new FileOutputStream("svgtest.svg");
      OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
      BufferedWriter bw = new BufferedWriter(osw);
      bw.write(svgContent);
      bw.flush();
      bw.close();

    } catch (Exception e) {
      throw e;
    }
  }

}
------------------------------------------------------------------------


output SVG document
------------------------------------------------------------------------
<?xml version="1.0"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
            'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg fill-opacity="1" xmlns:xlink="http://www.w3.org/1999/xlink"
 color-rendering="auto" color-interpolation="auto"
 text-rendering="auto" stroke="black" stroke-linecap="square"
 width="500" stroke-miterlimit="10" shape-rendering="auto"
 stroke-opacity="1" fill="black" stroke-dasharray="none"
 font-weight="normal" stroke-width="1" height="500"
 xmlns="http://www.w3.org/2000/svg" font-family="&apos;sansserif&apos;"
 font-style="normal" stroke-linejoin="miter" font-size="12"
 stroke-dashoffset="0" image-rendering="auto">

  <!--Generated by the Batik Graphics2D SVG Generator-->
  <defs id="genericDefs" />
  <g>
    <g>
      <line y2="10" fill="none" x1="0" x2="10" y1="0" />
    </g>
  </g>
</svg>
------------------------------------------------------------------------

I want that baseProfile="tiny" .
A baseProfile attribute of svg element has value, "tiny".

I seached Batik API for setup baseProfile. But I didn't find out it.

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: output SVG Tiny documents

Posted by th...@kodak.com.
Hi Nick,

"Nick Labadie" <ni...@gmail.com> wrote on 07/03/2006 07:46:27 PM:

> I want to output SVG Tiny documents with using Batik.
> Can Batik output SVG Tiny documents?

   In what context?  Any Java application can output
SVG Tiny using 'println' but I'm guessing this is
not what you have in mind ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org