menu

Document Processing

PdfBlendBase Class - C# PDF Library API Reference | Syncfusion

    Show / Hide Table of Contents

    PdfBlendBase Class

    Represents the base class for PdfBlend and PdfColorBlend classes.

    Inheritance
    System.Object
    PdfBlendBase
    PdfBlend
    PdfColorBlend
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public abstract class PdfBlendBase : Object
    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 brush.  
    PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), 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 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 brush.           
    Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), 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 rectangle.
    graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Constructors

    PdfBlendBase()

    Initializes a new instance of the PdfBlendBase class.

    Declaration
    protected PdfBlendBase()

    PdfBlendBase(Int32)

    Initializes a new instance of the PdfBlendBase class with the specified elements count

    Declaration
    protected PdfBlendBase(int count)
    Parameters
    Type Name Description
    System.Int32 count

    The number of the elements.

    Properties

    Count

    Gets the number of elements that specify the blend.

    Declaration
    protected int Count { get; }
    Property Value
    Type
    System.Int32

    Positions

    Gets or sets the array of positions

    Declaration
    public float[] Positions { get; set; }
    Property Value
    Type
    System.Single[]
    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 brush.  
    PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), 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 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 brush.           
    Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), 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 rectangle.
    graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Methods

    Gcd(Int32, Int32)

    Determines greatest common divisor of the specified u and v.

    Declaration
    protected static int Gcd(int u, int v)
    Parameters
    Type Name Description
    System.Int32 u

    The u.

    System.Int32 v

    The v.

    Returns
    Type Description
    System.Int32

    The GCD value

    Gcd(Single, Single)

    Determines greatest common divisor of the specified u and v.

    Declaration
    protected static float Gcd(float u, float v)
    Parameters
    Type Name Description
    System.Single u

    The u.

    System.Single v

    The v.

    Returns
    Type Description
    System.Single

    The GCD value

    Gcd(Single[])

    Calculate the GCD of the specified values.

    Declaration
    protected static float Gcd(float[] values)
    Parameters
    Type Name Description
    System.Single[] values

    The values.

    Returns
    Type Description
    System.Single

    The calculated GCD value.

    SetArray(Array)

    Sets the array.

    Declaration
    protected Array SetArray(Array array)
    Parameters
    Type Name Description
    System.Array array

    The array, which has values.

    Returns
    Type Description
    System.Array

    The array if it's passed all tests.

    Back to top Generated by DocFX
    OSZAR »
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved
    OSZAR »