Class SolidBrush

Class SolidBrush

Namespace: Aspose.Imaging.Brushes
Assembly: Aspose.Imaging.dll (25.7.0)

Solid brush is intended for drawing continiously with specific color. This class cannot be inherited.

public sealed class SolidBrush : Brush, IDisposable
   {
       protected override void Dispose(bool disposing)
       {
           base.Dispose(disposing);
       }
       public void Dispose()
       {
           this.Dispose(true);
           GC.SuppressFinalize(this);
       }
   }

Inheritance

object DisposableObject Brush SolidBrush

Implements

IDisposable

Inherited Members

Brush.DeepClone() , Brush.Equals(object) , Brush.GetHashCode() , Brush.Opacity , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

This example uses Graphics class to create primitive shapes on the Image surface. To demonstrate the operation, the example creates a new Image in PNG format and draw primitive shapes on Image surface using Draw methods exposed by Graphics class

using System.IO;
   using Aspose.Imaging;
   using Aspose.Imaging.Brushes;
   using Aspose.Imaging.Fonts;
   using Aspose.Imaging.Sources;
   using (FileStream stream = new FileStream(@"C:\temp\output.png", FileMode.Create))
   {
       ImageOptions.PngOptions pngOptions = new ImageOptions.PngOptions();
       pngOptions.Source = new StreamSource(stream);
       using (Image image = Image.Create(pngOptions, 500, 500))
       {
           Graphics graphics = new Graphics(image);
           graphics.Clear(Color.Wheat);
           graphics.DrawArc(new Pen(Color.Black, 2), new Rectangle(200, 200, 100, 200), 0, 300);
           graphics.DrawBezier(new Pen(Color.Blue, 2), new Point(250, 100), new Point(300, 30), new Point(450, 100), new Point(235, 25));
           graphics.DrawCurve(new Pen(Color.Green, 2), new[] { new Point(100, 200), new Point(100, 350), new Point(200, 450) });
           graphics.DrawEllipse(new Pen(Color.Yellow, 2), new Rectangle(300, 300, 100, 100));
           graphics.DrawLine(new Pen(Color.Violet, 2), new Point(100, 100), new Point(200, 200));
           graphics.DrawPie(new Pen(Color.Silver, 2), new Rectangle(new Point(200, 20), new Size(200, 200)), 0, 45);
           graphics.DrawPolygon(new Pen(Color.Red, 2), new[] { new Point(20, 100), new Point(20, 200), new Point(220, 20) });
           graphics.DrawRectangle(new Pen(Color.Orange, 2), new Rectangle(new Point(250, 250), new Size(100, 100)));
           Brushes.SolidBrush brush = new Brushes.SolidBrush();
           brush.Color = Color.Purple;
           brush.Opacity = 100;
           graphics.DrawString("This image is created by Aspose.Imaging API", new Font("Times New Roman", 16), brush, new PointF(50, 400));
           image.Save();
       }
   }

Constructors

SolidBrush()

Initializes a new instance of the Aspose.Imaging.Brushes.SolidBrush class.

public SolidBrush()
   {
   }

Examples

This example uses Graphics class to create primitive shapes on the Image surface. To demonstrate the operation, the example creates a new Image in PNG format and draw primitive shapes on Image surface using Draw methods exposed by Graphics class

using System.IO;
   using Aspose.Imaging;
   using Aspose.Imaging.Brushes;
   using Aspose.Imaging.Fonts;
   using Aspose.Imaging.Sources;
   System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create);
   Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
   pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
   {
       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
       graphics.Clear(Aspose.Imaging.Color.Wheat);
       graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
       graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));
       graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });
       graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
       graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
       graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);
       graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });
       graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));
       Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
       brush.Color = Color.Purple;
       brush.Opacity = 100;
       graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
       image.Save();
   }

SolidBrush(Color)

Initializes a new instance of the Aspose.Imaging.Brushes.SolidBrush class.

public SolidBrush(Color color)
   {
   }

Parameters

color Color

The solid brush color.

Properties

Color

Gets or sets the brush color.

[JsonProperty]
public Color Color
{
    get;
    set;
}

Property Value

Color

Examples

This example uses Graphics class to create primitive shapes on the Image surface. To demonstrate the operation, the example creates a new Image in PNG format and draw primitive shapes on Image surface using Draw methods exposed by Graphics class

using System.IO;
   using Aspose.Imaging;
   using Aspose.Imaging.Brushes;
   using Aspose.Imaging.Fonts;
   using Aspose.Imaging.Sources;
   FileStream stream = new FileStream(@"C:\temp\output.png", FileMode.Create);
   ImageOptions.PngOptions pngOptions = new ImageOptions.PngOptions();
   pngOptions.Source = new StreamSource(stream);
   using (Image image = Image.Create(pngOptions, 500, 500))
   {
       Graphics graphics = new Graphics(image);
       graphics.Clear(Color.Wheat);
       graphics.DrawArc(new Pen(Color.Black, 2), new Rectangle(200, 200, 100, 200), 0, 300);
       graphics.DrawBezier(new Pen(Color.Blue, 2), new Point(250, 100), new Point(300, 30), new Point(450, 100), new Point(235, 25));
       graphics.DrawCurve(new Pen(Color.Green, 2), new[] { new Point(100, 200), new Point(100, 350), new Point(200, 450) });
       graphics.DrawEllipse(new Pen(Color.Yellow, 2), new Rectangle(300, 300, 100, 100));
       graphics.DrawLine(new Pen(Color.Violet, 2), new Point(100, 100), new Point(200, 200));
       graphics.DrawPie(new Pen(Color.Silver, 2), new Rectangle(new Point(200, 20), new Size(200, 200)), 0, 45);
       graphics.DrawPolygon(new Pen(Color.Red, 2), new[] { new Point(20, 100), new Point(20, 200), new Point(220, 20) });
       graphics.DrawRectangle(new Pen(Color.Orange, 2), new Rectangle(new Point(250, 250), new Size(100, 100)));
       SolidBrush brush = new Brushes.SolidBrush();
       brush.Color = Color.Purple;
       brush.Opacity = 100;
       graphics.DrawString("This image is created by Aspose.Imaging API", new Font("Times New Roman", 16), brush, new PointF(50, 400));
       image.Save();
   }
 English