Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created May 23, 2024 12:47
Show Gist options
  • Save aspose-com-gists/ef3e2783e7b9817011e40a30ffa0c701 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ef3e2783e7b9817011e40a30ffa0c701 to your computer and use it in GitHub Desktop.
Draw an Eclipse
public class Main {
public static void main(String[] args) throws java.io.IOException {
String dir = "/Desktop/";
String outpath = dir+"eclipse.bmp";
BmpOptions saveOptions = new BmpOptions();
saveOptions.setBitsPerPixel(32);
// Create an instance of Image
try (Image image = new PsdImage(100, 100)) {
// Create and initialize an instance of Graphics class and Clear Graphics surface
Graphics graphic = new Graphics(image);
graphic.clear(Color.getYellow());
// Invoke the drawEllipse method to draw a dotted ellipse shape by specifying the Pen object having a red color and a surrounding Rectangle.
graphic.drawEllipse(new Pen(Color.getRed()), new RectangleF(30, 10, 40, 80));
// Export image to bmp file format by calling the save method.
image.save(outpath, saveOptions);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment