Working with Brushes
Contents
[
Hide
]
Aspose.Drawing for .NET API provides the capability to draw graphics elements. Brushes are one of the key element of working with graphics and are used to fill the internal of a drawing object such as an ellipse, circle, etc with the specified color.
Using Solid Brush to Draw Graphics in C#
To draw graphics with a solid brush, the following steps can be used.
- Create an object of the Bitmap class
- Initialize the Graphics object from above bitmap
- Create a new Brush using the SolidBrush class
- Use the FillEllipse method as an example to draw a solid filled Ellipse
- Save the output to any desirable output 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-.NET | |
using System.Drawing; | |
Bitmap bitmap = new Bitmap(1000, 800, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); | |
Graphics graphics = Graphics.FromImage(bitmap); | |
Brush brush = new SolidBrush(Color.Blue); | |
graphics.FillEllipse(brush, 100, 100, 800, 600); | |
bitmap.Save("Solid.png"); |