-
大小: 12.39MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-07-10
- 语言: Java
- 标签: batik highcharts
资源简介
通过Batik,你可以在JAVA可以使用的地方操作SVG文档,您还可以在你的应用程序使用Batik模块来生成 , 处理和转码SVG图像。Batik很容易让基于Java的应用程序或小程序来处理SVG内容。
代码片段和文件信息
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License Version 2.0
(the “License“); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing software
distributed under the License is distributed on an “AS IS“ BASIS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import java.io.IOException;
import java.net.URL;
import javax.swing.Japplet;
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
import org.apache.batik.swing.JSVGCanvas;
import org.apache.batik.util.xmlResourceDescriptor;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
* A applet demonstrating the JSVGCanvas.
*
* @version $Id$
*/
public class appletDemo extends Japplet {
protected JSVGCanvas canvas;
protected Document doc;
protected Element svg;
public void init() {
// Create a new JSVGCanvas.
canvas = new JSVGCanvas();
getContentPane().add(canvas);
try {
// Parse the barChart.svg file into a Document.
String parser = xmlResourceDescriptor.getxmlParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
URL url = new URL(getCodebase() “barChart.svg“);
doc = f.createDocument(url.toString());
svg = doc.getDocumentElement();
// Change the document viewBox.
svg.setAttributeNS(null “viewBox“ “40 95 370 265“);
// Make the text look nice.
svg.setAttributeNS(null “text-rendering“ “geometricPrecision“);
// Remove the xml-stylesheet PI.
for (Node n = svg.getPreviousSibling();
n != null;
n = n.getPreviousSibling()) {
if (n.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
doc.removeChild(n);
break;
}
}
// Remove the Batik sample mark ‘use‘ element.
for (Node n = svg.getLastChild();
n != null;
n = n.getPreviousSibling()) {
if (n.getNodeType() == Node.ELEMENT_NODE
&& n.getLocalName().equals(“use“)) {
svg.removeChild(n);
break;
}
}
} catch (Exception ex) {
}
}
public void start() {
// Display the document.
canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
canv
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2008-01-06 11:07 batik-1.7\
文件 62675 2008-01-01 10:20 batik-1.7\CHANGES
文件 11357 2006-11-16 12:27 batik-1.7\LICENSE
文件 684 2007-12-26 22:27 batik-1.7\NOTICE
文件 2862 2007-01-18 22:18 batik-1.7\README
目录 0 2008-01-06 11:04 batik-1.7\docs\
目录 0 2008-01-06 11:04 batik-1.7\docs\demo\
目录 0 2008-01-06 11:04 batik-1.7\docs\dev\
目录 0 2008-01-06 11:04 batik-1.7\docs\images\
目录 0 2008-01-06 11:04 batik-1.7\docs\skin\
目录 0 2008-01-06 11:04 batik-1.7\docs\skin\css\
目录 0 2008-01-06 11:04 batik-1.7\docs\skin\images\
目录 0 2008-01-06 11:04 batik-1.7\docs\skin\sc
目录 0 2008-01-06 11:04 batik-1.7\docs\skin\translations\
目录 0 2008-01-06 11:04 batik-1.7\docs\tools\
目录 0 2008-01-06 11:04 batik-1.7\docs\tools\images\
目录 0 2008-01-06 11:04 batik-1.7\docs\using\
目录 0 2008-01-06 11:04 batik-1.7\docs\using\images\
目录 0 2008-01-06 11:04 batik-1.7\docs\using\sc
目录 0 2008-01-06 11:07 batik-1.7\extensions\
文件 56270 2008-01-06 11:07 batik-1.7\batik-rasterizer.jar
文件 15216 2008-01-06 11:07 batik-1.7\batik-slideshow.jar
文件 553673 2008-01-06 11:07 batik-1.7\batik-squiggle.jar
文件 18152 2008-01-06 11:07 batik-1.7\batik-svgpp.jar
文件 6080 2008-01-06 11:07 batik-1.7\batik-ttf2svg.jar
文件 5238 2008-01-06 11:07 batik-1.7\batik.jar
文件 1871 2008-01-06 11:04 batik-1.7\docs\.htaccess
文件 31 2008-01-06 11:04 batik-1.7\docs\broken-li
文件 25821 2008-01-06 11:04 batik-1.7\docs\contributors.html
文件 11294 2008-01-06 11:04 batik-1.7\docs\demo.html
文件 1924 2008-01-06 11:04 batik-1.7\docs\demo\ap
............此处省略693个文件信息
评论
共有 条评论