jlinegraph/src/main/java/it/cavallium/jlinegraph/AWTBufferedGraphRenderer.java

20 lines
518 B
Java
Raw Permalink Normal View History

2021-12-07 00:46:15 +01:00
package it.cavallium.jlinegraph;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
public class AWTBufferedGraphRenderer implements IGraphRenderer<BufferedImage> {
@Override
2022-09-15 19:08:02 +02:00
public BufferedImage renderGraph(Graph graph, GraphBounds bounds) {
BufferedImage image = new BufferedImage((int) bounds.maxX(),
(int) bounds.maxY(),
2021-12-07 00:46:15 +01:00
BufferedImage.TYPE_INT_ARGB
);
Graphics2D graphics2D = image.createGraphics();
2022-09-15 19:08:02 +02:00
AWTGraphRenderer.renderGraph(graphics2D, graph, bounds);
2021-12-07 00:46:15 +01:00
return image;
}
}