Working with Brushes

Aspose.Drawing for Java API empowers you to draw various graphics elements, and brushes play a pivotal role in this process. Brushes are utilized to fill the interior of a drawing object, such as an ellipse or circle, with a specified color.

Drawing Graphics with a Solid Brush in Java

To draw graphics with a solid brush, follow these steps:

  1. Create an instance of the Bitmap class.
  2. Initialize the Graphics class from the created bitmap.
  3. Create a new Brush using the SolidBrush class.
  4. Utilize a method like fillEllipse() method to draw a solid-filled ellipse as an example.
  5. Save the output in any desired image format.
// For complete examples and data files, please go to https://github.com/aspose-drawing/Aspose.Drawing-for-JAVA
import com.aspose.drawing.*;
Bitmap bitmap = new Bitmap(1000, 800, com.aspose.drawing.imaging.Format32bppPArgb);
Graphics graphics = Graphics.fromImage(bitmap);
Brush brush = new SolidBrush(Color.getBlue());
graphics.fillEllipse(brush, 100, 100, 800, 600);
bitmap.save("Solid.png");

Drawing with solid brush