本文整理汇总了Java中net.sf.epsgraphics.ColorMode类的典型用法代码示例。如果您正苦于以下问题:Java ColorMode类的具体用法?Java ColorMode怎么用?Java ColorMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColorMode类属于net.sf.epsgraphics包,在下文中一共展示了ColorMode类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: renderGraph
import net.sf.epsgraphics.ColorMode; //导入依赖的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.ColorMode; //导入依赖的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: exportToEPS
import net.sf.epsgraphics.ColorMode; //导入依赖的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
示例4: export
import net.sf.epsgraphics.ColorMode; //导入依赖的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.ColorMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论