Class PdfColorBlend
Represents the arrays of colors and positions used for interpolating color blending in a multicolor gradient.
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public sealed class PdfColorBlend : PdfBlendBase
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 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 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 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 rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Constructors
PdfColorBlend()
Initializes a new instance of the PdfColorBlend class.
Declaration
public 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 brush.
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), 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 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 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 rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
PdfColorBlend(Int32)
Initializes a new instance of the PdfColorBlend class with the specified elements count
Declaration
public PdfColorBlend(int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count | The count of the element. |
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 color blend
PdfColorBlend cblend = new PdfColorBlend(2);
//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 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 color blend
Dim cblend As New PdfColorBlend(2)
'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 rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Properties
Colors
Gets or sets the array of colors.
Declaration
public PdfColor[] Colors { 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 brush.
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), 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 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 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 rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)