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 wo...@free.fr on 2005/07/05 11:35:20 UTC
clipping don't work thomas
hello thomas,
i do what you says me thomas , this my code:
public static void main(String[] args) throws Exception {
String Entree = "batik3D.svg";
String Sortie = "sortie.svg";
//declaration variable
String rep="c:/pierrestage/JavaApplication1/";
//int width = Integer.parseInt(parama);
//int height = Integer.parseInt(paramb);
// Ouverture du fichier svg
String svgURI = new File(rep+Entree).toURL().toString();
FileInputStream instream = new FileInputStream(rep+Entree);
System.out.println("svgURI = "+svgURI);
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
System.out.println("svgNS = "+svgNS);
Document doc1 = impl.createDocument(svgNS, "svg", null);
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
Document doc2 = f.createDocument(svgURI);
/***** methode de thomas *****/
/*SVGDocument svgDoc;
UserAgent userAgent;
DocumentLoader loader;
BridgeContext ctx;
GVTBuilder builder;
GraphicsNode gn;*/
UserAgent userAgent = new UserAgentAdapter();
GVTBuilder builder = new GVTBuilder();
DocumentLoader docload = new DocumentLoader(userAgent);
Document doc = docload.loadDocument(svgURI,instream);
//doc = docload.checkCache(svgURI);
BridgeContext ctx = new BridgeContext(userAgent,docload);
System.out.println("ctx = "+ctx);
System.out.println("doc = "+doc);
System.out.println("doc1 = "+doc1);
System.out.println("doc2 = "+doc2);
GraphicsNode gn = builder.build(ctx,doc);
SVGGraphics2D sg2D = new SVGGraphics2D(doc);
GraphicsNode gn1 = builder.build(ctx,doc1);
SVGGraphics2D sg2D1 = new SVGGraphics2D(doc1);
GraphicsNode gn2 = builder.build(ctx,doc2);
SVGGraphics2D sg2D2 = new SVGGraphics2D(doc2);
System.out.println("svg2D = "+sg2D);
System.out.println("svg2D1 = "+sg2D1);
System.out.println("svg2D2 = "+sg2D2);
System.out.println("gn = "+gn);
System.out.println("gn1 = "+gn1);
System.out.println("gn2 = "+gn2);
//gn.paint(sg2D2);
//gn1.paint(sg2D);
gn2.paint(sg2D2);
gn2.setVisible(true);
/***** *****/
//fais le clipping un rectangle
//dimension du clipping
sg2D.setClip(0,0,200,300);
//different test d affichage ca marche
sg2D.drawString("test marche ou pas",10,150);
sg2D.drawLine(200,200,110,200);
//dimension de l image finale
//sg2D.setSVGCanvasSize(new Dimension(640,480));
//ecrit normalement sur le fichier de sortie mon clipping
sg2D.stream(rep+Sortie);
System.out.println("fichier " + Sortie + " a été généré");
}
/************************************/
when i compil it i wrote this at the referrences of gn2.paint(sg2D2) :
Exception in thread "main" java.lang.NullPointerException
at org.apache.batik.ext.awt.image.GraphicsUtil.getDestination(Unknown
Source)
at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorModel(Unknown
Source)
at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorSpace(Unknown
Source)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(Unknown Source)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(Unknown Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at org.apache.batik.gvt.ShapeNode.paint(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown
Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown
Source)
at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(Unknown
Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at javaapplication1.Main.main(Main.java:122)
i verify my sg2D and the doc it'snt null : what the problem.
if a comment //gn2.paint(sg2D2) he dont show the clipping of my svg
file(batik3D.svg)
thanks for your help
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: clipping don't work thomas
Posted by Bastien DEBLAIS <bd...@iftechnologies.net>.
Hi thomas,
i will try to do this and i tell you if the code run correctly
----- Original Message -----
From: "Thomas DeWeese" <Th...@Kodak.com>
Newsgroups: gmane.text.xml.batik.user
Sent: Tuesday, July 05, 2005 1:04 PM
Subject: Re: clipping don't work thomas
> Hi Bastien,
>
> This was a bug in Batik. This is now fixed in SVN. You will have
> to pull a new version from SVN and build it locally (see the
> web site page about how to access the SVN repository).
>
> Bastien DEBLAIS wrote:
>
> > when i compil it i wrote this at the referrences of gn2.paint(sg2D2) :
> >
> >
> > Exception in thread "main" java.lang.NullPointerException
> > at
> > org.apache.batik.ext.awt.image.GraphicsUtil.getDestination(Unknown
Source)
> > at
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: clipping don't work thomas
Posted by Bastien DEBLAIS <bd...@iftechnologies.net>.
hi, thomas
i dont work. he show me nothing. Give a example of a clipping a svgFile, by
clipping batik3D.svg and save this clip into an other svgFile
Thanks very much.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: clipping don't work thomas
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Bastien,
This was a bug in Batik. This is now fixed in SVN. You will have
to pull a new version from SVN and build it locally (see the
web site page about how to access the SVN repository).
Bastien DEBLAIS wrote:
> when i compil it i wrote this at the referrences of gn2.paint(sg2D2) :
>
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.apache.batik.ext.awt.image.GraphicsUtil.getDestination(Unknown Source)
> at
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: clipping don't work thomas
Posted by Bastien DEBLAIS <bd...@iftechnologies.net>.
hello thomas,
i do what you says me thomas , this my code:
public static void main(String[] args) throws Exception {
String Entree = "batik3D.svg";
String Sortie = "sortie.svg";
//declaration variable
String rep="c:/pierrestage/JavaApplication1/";
//int width = Integer.parseInt(parama);
//int height = Integer.parseInt(paramb);
// Ouverture du fichier svg
String svgURI = new File(rep+Entree).toURL().toString();
FileInputStream instream = new FileInputStream(rep+Entree);
System.out.println("svgURI = "+svgURI);
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
System.out.println("svgNS = "+svgNS);
Document doc1 = impl.createDocument(svgNS, "svg", null);
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
Document doc2 = f.createDocument(svgURI);
/***** methode de thomas *****/
/*SVGDocument svgDoc;
UserAgent userAgent;
DocumentLoader loader;
BridgeContext ctx;
GVTBuilder builder;
GraphicsNode gn;*/
UserAgent userAgent = new UserAgentAdapter();
GVTBuilder builder = new GVTBuilder();
DocumentLoader docload = new DocumentLoader(userAgent);
Document doc = docload.loadDocument(svgURI,instream);
//doc = docload.checkCache(svgURI);
BridgeContext ctx = new BridgeContext(userAgent,docload);
System.out.println("ctx = "+ctx);
System.out.println("doc = "+doc);
System.out.println("doc1 = "+doc1);
System.out.println("doc2 = "+doc2);
GraphicsNode gn = builder.build(ctx,doc);
SVGGraphics2D sg2D = new SVGGraphics2D(doc);
GraphicsNode gn1 = builder.build(ctx,doc1);
SVGGraphics2D sg2D1 = new SVGGraphics2D(doc1);
GraphicsNode gn2 = builder.build(ctx,doc2);
SVGGraphics2D sg2D2 = new SVGGraphics2D(doc2);
System.out.println("svg2D = "+sg2D);
System.out.println("svg2D1 = "+sg2D1);
System.out.println("svg2D2 = "+sg2D2);
System.out.println("gn = "+gn);
System.out.println("gn1 = "+gn1);
System.out.println("gn2 = "+gn2);
//gn.paint(sg2D2);
//gn1.paint(sg2D);
gn2.paint(sg2D2);
gn2.setVisible(true);
/***** *****/
//fais le clipping un rectangle
//dimension du clipping
sg2D.setClip(0,0,200,300);
//different test d affichage ca marche
sg2D.drawString("test marche ou pas",10,150);
sg2D.drawLine(200,200,110,200);
//dimension de l image finale
//sg2D.setSVGCanvasSize(new Dimension(640,480));
//ecrit normalement sur le fichier de sortie mon clipping
sg2D.stream(rep+Sortie);
System.out.println("fichier " + Sortie + " a été généré");
}
/************************************/
when i compil it i wrote this at the referrences of gn2.paint(sg2D2) :
Exception in thread "main" java.lang.NullPointerException
at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestination(Unknown Source)
at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorModel(Unknown
Source)
at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorSpace(Unknown
Source)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(Unknown
Source)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(Unknown
Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at org.apache.batik.gvt.ShapeNode.paint(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown
Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown
Source)
at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(Unknown
Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at javaapplication1.Main.main(Main.java:122)
i verify my sg2D and the doc it'snt null : what the problem.
if a comment //gn2.paint(sg2D2) he dont show the clipping of my svg
file(batik3D.svg)
thanks for your help
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org