i have a class that draws a shape from a png image, so that i can use the shape to draw the border of custom buttons that i need for my project. here\'s the code for the cla
For tips, look at Smoothing a jagged path. The algorithm to obtain the (crude) outline was relatively quick in the final versions. Creating a GeneralPath
is astonishingly faster than appending Area
objects.
The important part is this method:
public Area getOutline(Color target, BufferedImage bi) {
// construct the GeneralPath
GeneralPath gp = new GeneralPath();
boolean cont = false;
int targetRGB = target.getRGB();
for (int xx=0; xx