org.jfree.graphics2d
Class GraphicsUtils

java.lang.Object
  extended by org.jfree.graphics2d.GraphicsUtils

public final class GraphicsUtils
extends Object

A collection of static utility methods for shapes and images.


Method Summary
static BufferedImage convertRenderedImage(RenderedImage img)
          Converts a rendered image to a BufferedImage.
static Shape copyOf(Shape shape)
          Returns a shape that is (more or less) equivalent to the supplied shape.
static GeneralPath createPolygon(int[] xPoints, int[] yPoints, int nPoints, boolean close)
          Creates a polygon from the specified x and y coordinate arrays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyOf

public static Shape copyOf(Shape shape)
Returns a shape that is (more or less) equivalent to the supplied shape. For some known shape implementations (Line2D, Rectangle2D, RoundRectangle2D, Arc2D, Ellipse2D, and Polygon) the copy will be an instance of that class. For other shapes, a Path2D containing the outline of the shape is returned.

Parameters:
shape - the shape (null not permitted).
Returns:
A copy of the shape or shape outline (never null).

createPolygon

public static GeneralPath createPolygon(int[] xPoints,
                                        int[] yPoints,
                                        int nPoints,
                                        boolean close)
Creates a polygon from the specified x and y coordinate arrays.

Parameters:
xPoints - the x-points.
yPoints - the y-points.
nPoints - the number of points to use for the polyline.
close - closed?
Returns:
A polygon.

convertRenderedImage

public static BufferedImage convertRenderedImage(RenderedImage img)
Converts a rendered image to a BufferedImage. This utility method has come from a forum post by Jim Moore at:

http://www.jguru.com/faq/view.jsp?EID=114602

Parameters:
img - the rendered image.
Returns:
A buffered image.


Copyright © 2015. All rights reserved.