Exemple #1
0
        ////////////////////////////////////////////////////////////////////
        // Constructor
        ////////////////////////////////////////////////////////////////////

        public PdfAxialShading
        (
            PdfDocument Document,
            Double PosX,
            Double PosY,
            Double Width,
            Double Height,
            PdfShadingFunction ShadingFunction
        ) : base(Document, false)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('A');

            // color space red, green and blue
            AddToDictionary("/ColorSpace", "/DeviceRGB");

            // shading type axial
            AddToDictionary("/ShadingType", "2");

            // bounding box
            AddToDictionary("/BBox", String.Format(NFI.DecSep, "[{0} {1} {2} {3}]", ToPt(PosX), ToPt(PosY), ToPt(PosX + Width), ToPt(PosY + Height)));

            // assume the direction of color change is along x axis
            AddToDictionary("/Coords", String.Format(NFI.DecSep, "[{0} {1} {2} {1}]", ToPt(PosX), ToPt(PosY), ToPt(PosX + Width)));

            // add shading function to shading dictionary
            AddToDictionary("/Function", ShadingFunction);
            return;
        }
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF axial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="PosX">Position X</param>
        /// <param name="PosY">Position Y</param>
        /// <param name="Width">Width</param>
        /// <param name="Height">Height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfAxialShading(
			PdfDocument		Document,
			Double			PosX,
			Double			PosY,
			Double			Width,
			Double			Height,
			PdfShadingFunction	ShadingFunction
			)
            : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "2");

            // bounding box
            Dictionary.AddRectangle("/BBox", PosX, PosY, PosX + Width, PosY + Height);

            // assume the direction of color change is along x axis
            Dictionary.AddRectangle("/Coords", PosX, PosY, PosX + Width, PosY);

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);
            return;
        }
Exemple #3
0
 /// <summary>
 /// PDF radial shading constructor for one unit bounding box
 /// </summary>
 /// <param name="Document">Parent PDF document object.</param>
 /// <param name="ShadingFunction">Shading function.</param>
 public PdfRadialShading
 (
     PdfDocument Document,
     PdfShadingFunction ShadingFunction
 ) : this(Document, 0.0, 0.0, 1.0, 1.0, ShadingFunction)
 {
 }
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF radial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="PosX">Position X</param>
        /// <param name="PosY">Position Y</param>
        /// <param name="Width">Width</param>
        /// <param name="Height">Height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfRadialShading
        (
            PdfDocument Document,
            Double PosX,
            Double PosY,
            Double Width,
            Double Height,
            PdfShadingFunction ShadingFunction
        ) : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type radial
            Dictionary.Add("/ShadingType", "3");

            // bounding box
            Dictionary.AddRectangle("/BBox", PosX, PosY, PosX + Width, PosY + Height);

            // set center to bounding box center and radius to half the diagonal
            Dictionary.AddFormat("/Coords", "[{0} {1} {2} {0} {1} 0]", ToPt(PosX + Width / 2), ToPt(PosY + Height / 2), ToPt(Math.Sqrt(Width * Width + Height * Height) / 2));

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);
            return;
        }
Exemple #5
0
        ////////////////////////////////////////////////////////////////////
        // Constructor
        ////////////////////////////////////////////////////////////////////

        public PdfRadialShading
        (
            PdfDocument Document,
            Double PosX,
            Double PosY,
            Double Width,
            Double Height,
            PdfShadingFunction ShadingFunction
        ) : base(Document, false)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('R');

            // color space red, green and blue
            AddToDictionary("/ColorSpace", "/DeviceRGB");

            // shading type radial
            AddToDictionary("/ShadingType", "3");

            // bounding box
            AddToDictionary("/BBox", String.Format(NFI.DecSep, "[{0} {1} {2} {3}]", ToPt(PosX), ToPt(PosY), ToPt(PosX + Width), ToPt(PosY + Height)));

            // set center to bounding box center and radius to half the diagonal
            AddToDictionary("/Coords", String.Format(NFI.DecSep, "[{0} {1} {2} {0} {1} 0]",
                                                     ToPt(PosX + Width / 2), ToPt(PosY + Height / 2), ToPt(Math.Sqrt(Width * Width + Height * Height) / 2)));

            // add shading function to shading dictionary
            AddToDictionary("/Function", ShadingFunction);
            return;
        }
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF radial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="PosX">Position X</param>
        /// <param name="PosY">Position Y</param>
        /// <param name="Width">Width</param>
        /// <param name="Height">Height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfRadialShading(
			PdfDocument		Document,
			Double			PosX,
			Double			PosY,
			Double			Width,
			Double			Height,
			PdfShadingFunction	ShadingFunction
			)
            : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type radial
            Dictionary.Add("/ShadingType", "3");

            // bounding box
            Dictionary.AddRectangle("/BBox", PosX, PosY, PosX + Width, PosY + Height);

            // set center to bounding box center and radius to half the diagonal
            Dictionary.AddFormat("/Coords", "[{0} {1} {2} {0} {1} 0]", ToPt(PosX + Width / 2), ToPt(PosY + Height / 2), ToPt(Math.Sqrt(Width * Width + Height * Height) / 2));

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);
            return;
        }
Exemple #7
0
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     PDF axial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="BBoxLeft">Bounding box left position</param>
        /// <param name="BBoxBottom">Bounding box bottom position</param>
        /// <param name="BBoxWidth">Bounding box width</param>
        /// <param name="BBoxHeight">Bounding box height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfAxialShading
        (
            PdfDocument Document,
            double BBoxLeft,
            double BBoxBottom,
            double BBoxWidth,
            double BBoxHeight,
            PdfShadingFunction ShadingFunction
        ) : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "2");

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);

            // bounding box
            this.BBoxLeft   = BBoxLeft;
            this.BBoxBottom = BBoxBottom;
            BBoxRight       = BBoxLeft + BBoxWidth;
            BBoxTop         = BBoxBottom + BBoxHeight;

            // assume the direction of color change is along x axis
            Mapping     = MappingMode.Relative;
            StartPointX = 0.0;
            StartPointY = 0.0;
            EndPointX   = 1.0;
            EndPointY   = 0.0;
        }
Exemple #8
0
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF axial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="PosX">Position X</param>
        /// <param name="PosY">Position Y</param>
        /// <param name="Width">Width</param>
        /// <param name="Height">Height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfAxialShading
        (
            PdfDocument Document,
            Double PosX,
            Double PosY,
            Double Width,
            Double Height,
            PdfShadingFunction ShadingFunction
        ) : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "2");

            // bounding box
            Dictionary.AddRectangle("/BBox", PosX, PosY, PosX + Width, PosY + Height);

            // assume the direction of color change is along x axis
            Dictionary.AddRectangle("/Coords", PosX, PosY, PosX + Width, PosY);

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);
            return;
        }
Exemple #9
0
        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF radial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="BBoxLeft">Bounding box left position</param>
        /// <param name="BBoxBottom">Bounding box bottom position</param>
        /// <param name="BBoxWidth">Bounding box width</param>
        /// <param name="BBoxHeight">Bounding box height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfRadialShading
        (
            PdfDocument Document,
            double BBoxLeft,
            double BBoxBottom,
            double BBoxWidth,
            double BBoxHeight,
            PdfShadingFunction ShadingFunction
        ) : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "3");

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);

            // bounding box
            this.BBoxLeft   = BBoxLeft;
            this.BBoxBottom = BBoxBottom;
            this.BBoxRight  = BBoxLeft + BBoxWidth;
            this.BBoxTop    = BBoxBottom + BBoxHeight;

            // assume the direction of color change is along x axis
            this.Mapping      = MappingMode.Relative;
            this.StartCenterX = 0.5;
            this.StartCenterY = 0.5;
            this.StartRadius  = 0.0;
            this.EndCenterX   = 0.5;
            this.EndCenterY   = 0.5;
            this.EndRadius    = Math.Sqrt(0.5);
            return;
        }