Example #1
0
        /// <summary>
        ///     PDF Shading function constructor
        /// </summary>
        /// <param name="Document">Document object parent of this function.</param>
        /// <param name="Brush">System.Windows.Media gradient brush</param>
        public PdfShadingFunction
        (
            PdfDocument Document,
            SysMedia.GradientBrush Brush
        ) : base(Document, ObjectType.Stream)
        {
            // build dictionary
            Constructorhelper(Brush.GradientStops.Count);

            // add color array to contents stream
            foreach (var Stop in Brush.GradientStops)
            {
                ObjectValueList.Add(Stop.Color.R); // red
                ObjectValueList.Add(Stop.Color.G); // green
                ObjectValueList.Add(Stop.Color.B); // blue
            }
        }
Example #2
0
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     PDF Shading function constructor
        /// </summary>
        /// <param name="Document">Document object parent of this function.</param>
        /// <param name="ColorArray">Array of colors.</param>
        ////////////////////////////////////////////////////////////////////
        public PdfShadingFunction
        (
            PdfDocument Document, // PDF document object
            Color[] ColorArray    // Array of colors. Minimum 2.
        ) : base(Document, ObjectType.Stream)
        {
            // build dictionary
            Constructorhelper(ColorArray.Length);

            // add color array to contents stream
            foreach (var Color in ColorArray)
            {
                ObjectValueList.Add(Color.R); // red
                ObjectValueList.Add(Color.G); // green
                ObjectValueList.Add(Color.B); // blue
            }
        }