xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frizzell, Michael A" <michael.frizz...@eds.com>
Subject RE: Filter Problem with Java
Date Thu, 15 Aug 2002 16:20:31 GMT
Followed your suggestion with the NS stuff. I'd previously done that in
other parts of the code, but took it out in this one after looking at what
someone said to be working code. Also, the version of batik I'm using is
probably 2 months old. Could this be an issue?
	Mike

	public void addFilter() {

		Element newDefs = doc.createElementNS(svgNS,"defs");
		newDefs.setAttributeNS(null, "id", "filterdefs");
		root.appendChild(newDefs);

		Element cmatrix =
doc.createElementNS(svgNS,"feColorMatrix");
		   		cmatrix.setAttributeNS(null, "type",
"matrix");
		   		cmatrix.setAttributeNS(null, "values", "0 0
0 0 0 0 0 0 .9 0 0 0 0 .9 0 0 0 0 1 0");

		Element merge = doc.createElementNS(svgNS,"feMerge");
		Element merge1 = doc.createElementNS(svgNS,"feMergeNode");
	   	merge1.setAttributeNS(null, "in", "coloredBlur");
   		Element merge2 = doc.createElementNS(svgNS,"feMergeNode");
   		merge2.setAttributeNS(null, "in", "SourceGraphic");
   		merge.appendChild(merge1);
  	 	merge.appendChild(merge2);


		Element gblur = doc.createElementNS(svgNS,"feGaussianBlur");
  		gblur.setAttributeNS(null, "stdDeviation", "5");
   		gblur.setAttributeNS(null, "result", "coloredBlur");

   		Element MyFilter = doc.createElementNS(svgNS,"filter");
		MyFilter.setAttributeNS(null, "id", "glow");
		MyFilter.appendChild(cmatrix);
		MyFilter.appendChild(gblur);
		MyFilter.appendChild(merge);

		newDefs.appendChild(MyFilter);


	}

-----Original Message-----
From: Thomas E Deweese [mailto:thomas.deweese@kodak.com]
Sent: Thursday, August 15, 2002 10:18 AM
To: Batik Users
Subject: Filter Problem with Java


>>>>> "FMA" == Frizzell, Michael A <michael.frizzell@eds.com> writes:

FMA> This problem occurs only when I try and use a
FMA> "filter:url(#Filter_Name)" inside the style tag of a given
FMA> item. Whenever I run the file with that filter info in the style
FMA> tag it returns a "java.lang.NullPointerException".

FMA> Successful fixes: 

FMA> - Print out the dom that I'm creating to a file, use a rasterizer
FMA> to import the xml and create the jpg.

FMA> My filter code looks as such:

FMA> public void addFilter() { 

FMA> Element newDefs = doc.createElement("defs");

     I think you want 'doc.createElementNS(svg_ns, "defs");'
Likewise for all your other elements.  The DOM is not quite as
user friendly as the raw XML.


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

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


Mime
View raw message