Class PdfGradientBrush
Encapsulates a PdfBrush with a gradient brush.
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.UWP.dll
Syntax
public abstract class PdfGradientBrush : PdfBrush, ICloneable, IPdfWrapper
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF gradient brush.
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), Color.Red, Color.Blue);
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF gradient brush.
Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), Color.Red, Color.Blue)
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Properties
AntiAlias
Gets or sets a value indicating whether use anti aliasing algorithm.
Declaration
public bool AntiAlias { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF gradient brush.
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), Color.Red, Color.Blue);
//Set anti alias.
brush.AntiAlias = true;
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF gradient brush.
Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), Color.Red, Color.Blue)
'Set anti alias.
brush.AntiAlias = True
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Background
Gets or sets the background color of the brush.
Declaration
public PdfColor Background { get; set; }
Property Value
Type |
---|
PdfColor |
Remarks
This value is optional. If null is assigned to it, the associated entry is removed from the appropriate dictionary.
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF gradient brush.
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), Color.Red, Color.Blue);
//Set the background.
brush.Background = Color.Black;
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 300, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF gradient brush.
Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), Color.Red, Color.Blue)
'Set the background.
brush.Background = Color.Black
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 300, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Methods
CloneAntiAliasingValue(PdfGradientBrush)
Clones the anti aliasing value.
Declaration
protected void CloneAntiAliasingValue(PdfGradientBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfGradientBrush | brush | The brush. |
CloneBackgroundValue(PdfGradientBrush)
Clones the background value.
Declaration
protected void CloneBackgroundValue(PdfGradientBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfGradientBrush | brush | The brush. |
Explicit Interface Implementations
IPdfWrapper.Element
Gets the wrapped element.
Declaration
IPdfPrimitive IPdfWrapper.Element { get; }
Returns
Type |
---|
IPdfPrimitive |