当前位置: 首页>>代码示例>>Java>>正文


Java EpsGraphics类代码示例

本文整理汇总了Java中net.sf.epsgraphics.EpsGraphics的典型用法代码示例。如果您正苦于以下问题:Java EpsGraphics类的具体用法?Java EpsGraphics怎么用?Java EpsGraphics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EpsGraphics类属于net.sf.epsgraphics包,在下文中一共展示了EpsGraphics类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderGraph

import net.sf.epsgraphics.EpsGraphics; //导入依赖的package包/类
@Override
public void renderGraph(JGraph<?> graph, File file) throws PortException {
    // Get graph bounds. If not available, do nothing (probably empty graph)
    Rectangle2D bounds = graph.getGraphBounds();
    if (bounds == null) {
        return;
    }

    try (FileOutputStream fos = new FileOutputStream(file);) {
        EpsGraphics g2d = new EpsGraphics(graph.getModel()
            .getName(), fos, 0, 0, (int) bounds.getWidth(), (int) bounds.getHeight(),
            ColorMode.COLOR_RGB);
        // Render
        toGraphics(graph, g2d);

        // Cleanup
        g2d.close();
    } catch (IOException e) {
        throw new PortException(e);
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:GraphToEPS.java

示例2: exportToEPS

import net.sf.epsgraphics.EpsGraphics; //导入依赖的package包/类
public static void exportToEPS(File file, int width, int height, JFreeChart chart) throws GraphException, IOException
{
	FileOutputStream fileOutputStream = new FileOutputStream(file);

	EpsGraphics g2d = new EpsGraphics(chart.getTitle().getText(), fileOutputStream, 0, 0, width, height, ColorMode.COLOR_RGB);

	// Don't export fonts as vectors, no hope of getting same font as publication.
	// g2d.setAccurateTextMode(false); // Does not rotate y-axis label.

	chart.draw(g2d, new Rectangle(width, height));

	g2d.close();
	g2d.dispose();
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:15,代码来源:Graph.java

示例3: close

import net.sf.epsgraphics.EpsGraphics; //导入依赖的package包/类
public void close() throws IOException {
	if (figureFormat.equals(Constant.PNG)) {
		// png output
		File outputPNG = new File(figureName + ".png");
		ImageIO.write(pngImage, "png", outputPNG);
	} else if (figureFormat.equals(Constant.EPS)) {
		((EpsGraphics) graphWriter).close();
		epsImage.close();
	}
	graphWriter.dispose();
	bedWriter.close();
}
 
开发者ID:lancelothk,项目名称:BSPAT,代码行数:13,代码来源:FigureWriter.java

示例4: close

import net.sf.epsgraphics.EpsGraphics; //导入依赖的package包/类
public void close() throws IOException {
	if (figureFormat.equals(PNG)) {
		// png output
		File outputPNG = new File(figureName.endsWith(".png") ? figureName : figureName + "." + PNG);
		ImageIO.write(pngImage, PNG, outputPNG);
	} else if (figureFormat.equals(EPS)) {
		((EpsGraphics) graphWriter).close();
		epsImage.close();
	}
	graphWriter.dispose();
}
 
开发者ID:lancelothk,项目名称:BSPAT,代码行数:12,代码来源:FigureWriter.java

示例5: exportToEPS

import net.sf.epsgraphics.EpsGraphics; //导入依赖的package包/类
/**
 * Exports the current graph to EPS.
 *
 * @param file the eps file to export to.
 * @throws IOException if IO goes wrong.
 */
public void exportToEPS(File file) throws IOException {

    EpsGraphics dummy = new EpsGraphics("Title", new ByteArrayOutputStream(),
            0, 0, 1, 1, ColorMode.BLACK_AND_WHITE);

    NLPInstance filtered = filterInstance();

    Dimension dim = renderer.render(filtered, dummy);

    EpsGraphics g = new EpsGraphics("Title", new FileOutputStream(file), 0, 0,
            (int) dim.getWidth() + 2, (int) dim.getHeight(), ColorMode.COLOR_RGB);

    renderer.render(filtered, g);

    g.flush();
    g.close();
}
 
开发者ID:riedelcastro,项目名称:whatswrong,代码行数:24,代码来源:NLPCanvas.java

示例6: export

import net.sf.epsgraphics.EpsGraphics; //导入依赖的package包/类
/**
 * Export jfreechart to image format. File must have an extension like jpg,
 * png, pdf, svg or eps. Otherwise export will fail.
 *
 * @param file
 *            Destination The file
 * @param chart
 *            JFreechart the chart object
 * 
 * @param width
 *            The width of the image
 * @param height
 *            The height of the image
 * 
 * @throws Exception
 *             An exception
 */
public static void export(File file, JFreeChart chart, int width, int height) throws Exception {

	FileOutputStream out = new FileOutputStream(file);
	Graphics2D g = new EpsGraphics(file.getName(), out, 0, 0, width, height, ColorMode.COLOR_RGB);

	chart.draw(g, new Rectangle2D.Double(0, 0, width, height));
	out.write(g.toString().getBytes());
	out.close();

}
 
开发者ID:ogreyesp,项目名称:JCLAL,代码行数:28,代码来源:ExternalBasicChart.java


注:本文中的net.sf.epsgraphics.EpsGraphics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。