PdfRpt.Core.Helper.GradientBackground.ApplyGradientBackground C# (CSharp) Method

ApplyGradientBackground() public static method

Draws a rectangular gradient background color.
public static ApplyGradientBackground ( RowType pdfRowType, PdfRpt.Core.Contracts.CellSharedData sharedData, Rectangle position, PdfContentByte canvases ) : void
pdfRowType RowType Main table's row types
sharedData PdfRpt.Core.Contracts.CellSharedData PdfCells Shared Data
position iTextSharp.text.Rectangle The coordinates of the cell
canvases iTextSharp.text.pdf.PdfContentByte An array of PdfContentByte to add text or graphics
return void
        public static void ApplyGradientBackground(RowType pdfRowType, CellSharedData sharedData, Rectangle position, PdfContentByte[] canvases)
        {
            BaseColor startColor = null;
            BaseColor endColor = null;

            switch (pdfRowType)
            {
                case RowType.HeaderRow:
                    if (sharedData.Template.HeaderBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.HeaderBackgroundColor[0];
                    endColor = sharedData.Template.HeaderBackgroundColor[1];
                    break;
                case RowType.PreviousPageSummaryRow:
                    if (sharedData.Template.PreviousPageSummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.PreviousPageSummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.PreviousPageSummaryRowBackgroundColor[1];
                    break;
                case RowType.SummaryRow:
                case RowType.AllGroupsSummaryRow:
                    if (sharedData.Template.SummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.SummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.SummaryRowBackgroundColor[1];
                    break;
                case RowType.PageSummaryRow:
                    if (sharedData.Template.PageSummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.PageSummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.PageSummaryRowBackgroundColor[1];
                    break;
            }

            DrawGradientBackground(position, canvases, startColor, endColor);
        }