Working with Brushes
Contents
[
Hide
]
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:
- Create an instance of the
Bitmap
class. - Initialize the
Graphics
class from the created bitmap. - Create a new Brush using the
SolidBrush
class. - Utilize a method like
fillEllipse()
method to draw a solid-filled ellipse as an example. - Save the output in any desired image format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |