Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfRadialGradientBrush

    Show / Hide Table of Contents

    Class PdfRadialGradientBrush

    Represent radial gradient brush.

    Inheritance
    System.Object
    PdfBrush
    PdfGradientBrush
    PdfRadialGradientBrush
    Implements
    ICloneable
    Inherited Members
    PdfGradientBrush.CloneAntiAliasingValue(PdfGradientBrush)
    PdfGradientBrush.CloneBackgroundValue(PdfGradientBrush)
    PdfGradientBrush.Background
    PdfGradientBrush.AntiAlias
    PdfBrush.ICloneable.Clone()
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfRadialGradientBrush : PdfGradientBrush, 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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Constructors

    PdfRadialGradientBrush(PointF, Single, PointF, Single, PdfColor, PdfColor)

    Initializes a new instance of the PdfRadialGradientBrush class.

    Declaration
    public PdfRadialGradientBrush(PointF centreStart, float radiusStart, PointF centreEnd, float radiusEnd, PdfColor colorStart, PdfColor colorEnd)
    Parameters
    Type Name Description
    PointF centreStart

    The start centre.

    System.Single radiusStart

    The start radius.

    PointF centreEnd

    The end centre.

    System.Single radiusEnd

    The end radius.

    PdfColor colorStart

    The start color.

    PdfColor colorEnd

    The end color.

    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Properties

    Blend

    Gets or sets a PdfBlend that specifies positions and factors that define a custom falloff for the gradient.

    Declaration
    public PdfBlend Blend { get; set; }
    Property Value
    Type Description
    PdfBlend
    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Create PDF blend
    PdfBlend blend = new PdfBlend();
    //Set factors
    blend.Factors = new float[] {1};
    //Set poistions
    blend.Positions = new float[] {0};
    //Set blend to the brush.
    brush.Blend = blend; 
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    'Create PDF blend
    Dim blend As New PdfBlend()
    'Set factors
    blend.Factors = New Single() {1}
    'Set poistions
    blend.Positions = New Single() {0}
    'Set blend to the brush.
    brush.Blend = blend
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Extend

    Gets or sets the value indicating whether the gradient should extend starting and ending points.

    Declaration
    public PdfExtend Extend { get; set; }
    Property Value
    Type Description
    PdfExtend
    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Set the extend mode.
    brush.Extend = PdfExtend.Both;
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
     'Set the extend mode.
    brush.Extend = PdfExtend.Both
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    InterpolationColors

    Gets or sets a ColorBlend that defines a multicolor linear gradient.

    Declaration
    public PdfColorBlend InterpolationColors { get; set; }
    Property Value
    Type Description
    PdfColorBlend
    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Create PDF color blend
    PdfColorBlend cblend = new PdfColorBlend();
    //Set colors
    cblend.Colors = new PdfColor[] { Color.Blue, Color.Red };
    //Set poistions
    cblend.Positions = new float[] { 0, 1 };
    //Set internpolation colors to the brush.
    brush.InterpolationColors = cblend;            
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    'Create PDF color blend
    Dim cblend As New PdfColorBlend()
    'Set colors
    cblend.Colors = New PdfColor() { Color.Blue, Color.Red}
    'Set poistions
    cblend.Positions = New Single() { 0, 1}
    'Set internpolation colors to the brush.
    brush.InterpolationColors = cblend
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    LinearColors

    Gets or sets the starting and ending colors of the gradient.

    Declaration
    public PdfColor[] LinearColors { get; set; }
    Property Value
    Type Description
    PdfColor[]
    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    PdfColor startColor = new PdfColor(Color.Black);
    PdfColor endColor = new PdfColor(Color.Green);
    //Set linear colors.
    brush.LinearColors = new PdfColor[] { startColor, endColor };
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    Dim startColor As New PdfColor(Color.Black)
    Dim endColor As New PdfColor(Color.Green)
    'Set linear colors.
    brush.LinearColors = New PdfColor() { startColor, endColor}
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Rectangle

    Gets or sets the rectangle.

    Declaration
    public RectangleF Rectangle { get; set; }
    Property Value
    Type Description
    RectangleF

    The rectangle.

    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 100)); 
    //Get the radial brush bounds.
    RectangleF rect = brush.Rectangle; 
    //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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Get the radial brush bounds.
    Dim rect As RectangleF = brush.Rectangle
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Methods

    Clone()

    Creates a new copy of a brush.

    Declaration
    public override PdfBrush Clone()
    Returns
    Type Description
    PdfBrush

    A new instance of the Brush class.

    Overrides
    PdfBrush.Clone()
    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.  
    PdfRadialGradientBrush brush = new PdfRadialGradientBrush(new PointF(50, 50), 0, new PointF(50, 50), 50, Color.Red, Color.Blue);
    //Draw the ellipse.
    graphics.DrawEllipse(brush, new RectangleF(0, 0, 100, 100));    
    PdfColor startColor = new PdfColor(Color.Black);
    PdfColor endColor = new PdfColor(Color.Green);
    //Clone the existing brush.
    PdfRadialGradientBrush cBrush = brush.Clone() as PdfRadialGradientBrush;
    //Set linear colors.
    cBrush.LinearColors = new PdfColor[] { startColor, endColor };
    //Draw ellipse.
    graphics.DrawEllipse(cBrush, new RectangleF(0, 150, 100, 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 PdfRadialGradientBrush(New PointF(50, 50), 0, New PointF(50, 50), 50, Color.Red, Color.Blue)
    'Draw the ellipse.
    graphics.DrawEllipse(brush, New RectangleF(0, 0, 100, 100))
    'Clone the existing brush.
    Dim cBrush As PdfRadialGradientBrush = TryCast(brush.Clone(), PdfRadialGradientBrush)
    'Set linear colors.
    cBrush.LinearColors = New PdfColor() { startColor, endColor}
    'Draw rectangle.
    graphics.DrawEllipse(cBrush, New RectangleF(0, 150, 100, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Implements

    ICloneable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved