Ejemplo n.º 1
0
        internal void AddFillRect(float x, float y, float width, float height, StyleInfo si, PdfPattern patterns)
        {
            // Get the fill color - could be a gradient or pattern etc...
            Color  c     = si.BackgroundColor;
            double red   = c.R;
            double green = c.G;
            double blue  = c.B;

            red   = Math.Round((red / 255), 3);
            green = Math.Round((green / 255), 3);
            blue  = Math.Round((blue / 255), 3);


            //Fill the rectangle with the background color first...
            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t{3} {4} {5} {6} re\tf\tQ\t",
                                  red, green, blue,                              // color
                                  x, pSize.yHeight - y - height, width, height); // positioning

            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c     = si.Color;
                red   = Math.Round((c.R / 255.0), 3);
                green = Math.Round((c.G / 255.0), 3);
                blue  = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                elements.AppendFormat("\r\n {0} {1} {2} {3} re\tf", x, pSize.yHeight - y - height, width, height);
                elements.AppendFormat("\tQ");
            }
        }
Ejemplo n.º 2
0
/// <summary>
/// Page Polygon
/// </summary>
/// <param name="pts"></param>
/// <param name="si"></param>
/// <param name="url"></param>
/// <param name="patterns"></param>
        internal void AddPolygon(PointF[] pts, StyleInfo si, string url, PdfPattern patterns)
        {
            if (si.BackgroundColor.IsEmpty)
            {
                return;         // nothing to do
            }
            // Get the fill color - could be a gradient or pattern etc...
            Color  c     = si.BackgroundColor;
            double red   = c.R;
            double green = c.G;
            double blue  = c.B;

            red   = Math.Round((red / 255), 3);
            green = Math.Round((green / 255), 3);
            blue  = Math.Round((blue / 255), 3);

            //Fill the polygon with the background color first...
            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t",
                                  red, green, blue); // color
            AddPoints(elements, pts);

            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c     = si.Color;
                red   = Math.Round((c.R / 255.0), 3);
                green = Math.Round((c.G / 255.0), 3);
                blue  = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                AddPoints(elements, pts);
            }
            elements.AppendFormat("\tQ");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Page Polygon
        /// </summary>
        /// <param name="pts"></param>
        /// <param name="si"></param>
        /// <param name="url"></param>
        /// <param name="patterns"></param>
        internal void iAddPolygon(PointF[] pts, StyleInfo si, string url, PdfPattern patterns)
        {
            if (si.BackgroundColor.IsEmpty)
                return;		 // nothing to do

            // Get the fill color - could be a gradient or pattern etc...
            System.Drawing.Color c = si.BackgroundColor;
            iAddPoints(pts);
            cb.SetRGBColorFill(c.R, c.G, c.B);
            cb.ClosePathFillStroke();

            //Not sure about iTextSharp Pattern => Need check
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                StringBuilder elements = new StringBuilder();
                c = si.Color;
                double red = Math.Round((c.R / 255.0), 3);
                double green = Math.Round((c.G / 255.0), 3);
                double blue = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                elements.AppendFormat("\tQ");
                PdfPatternPainter pdfp = cb.CreatePattern(60f, 60f, 60f, 60f);
                pdfp.SetLiteral(elements.ToString());
                cb.SetPatternFill(pdfp);
                iAddPoints(pts);
                cb.ClosePathFillStroke();
            }
        }
Ejemplo n.º 4
0
        private void iAddFillRect(float x, float y, float width, float height, StyleInfo si, PdfPattern patterns)
        {
            System.Drawing.Color c;
            //Not sure about iTextSharp Pattern => Need check
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c = si.Color;
                double red = Math.Round((c.R / 255.0), 3);
                double green = Math.Round((c.G / 255.0), 3);
                double blue = Math.Round((c.B / 255.0), 3);
                StringBuilder elements = new StringBuilder();
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                elements.AppendFormat("\r\n {0} {1} {2} {3} re\tf", x, _pSize.yHeight - y - height, width, height);
                elements.AppendFormat("\tQ");
                PdfPatternPainter pdfp = cb.CreatePattern(60f, 60f, 60f, 60f);
                pdfp.SetLiteral(elements.ToString());
                cb.SetPatternFill(pdfp);
            }
            // Get the fill color - could be a gradient or pattern etc...
            c = si.BackgroundColor;
            cb.SetRGBColorFill(c.R, c.G, c.B);
            cb.Rectangle(x, _pSize.yHeight - y - height, width, height);
            //cb.ClosePathFillStroke();
            cb.Fill();

        }
Ejemplo n.º 5
0
/// <summary>
/// Page Polygon
/// </summary>
/// <param name="pts"></param>
/// <param name="si"></param>
/// <param name="url"></param>
/// <param name="patterns"></param>
        internal void AddPolygon(PointF[] pts, StyleInfo si, string url, PdfPattern patterns)
        {
            if (si.BackgroundColor.IsEmpty)
                return;         // nothing to do
            
            // Get the fill color - could be a gradient or pattern etc...
            Color c = si.BackgroundColor;
            double red = c.R;
            double green = c.G;
            double blue = c.B;
            red = Math.Round((red / 255), 3);
            green = Math.Round((green / 255), 3);
            blue = Math.Round((blue / 255), 3);

            //Fill the polygon with the background color first...			
            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                "\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t", 
                red, green, blue);		// color
            AddPoints(elements, pts);

            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c = si.Color;
                red = Math.Round((c.R / 255.0), 3);
                green = Math.Round((c.G / 255.0), 3);
                blue = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                AddPoints(elements, pts);
            }
            elements.AppendFormat("\tQ");
        }
Ejemplo n.º 6
0
		internal void AddFillRect(float x,float y, float width, float height,StyleInfo si,PdfPattern patterns)
		{
			// Get the fill color - could be a gradient or pattern etc...
			Color c = si.BackgroundColor;
			double red=c.R;
			double green=c.G; 
			double blue=c.B;
			red = Math.Round((red/255),3);
			green = Math.Round((green/255),3);
			blue = Math.Round((blue/255),3);
			
			
			//Fill the rectangle with the background color first...			
			elements.AppendFormat(NumberFormatInfo.InvariantInfo,
				"\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t{3} {4} {5} {6} re\tf\tQ\t",
				red, green, blue,		// color
				x, pSize.yHeight-y-height, width, height);	// positioning	
			
            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
			{			
				string p = patterns.GetPdfPattern(si.PatternType.ToString());                
				c = si.Color;              
				red = Math.Round((c.R/255.0),3);
				green = Math.Round((c.G/255.0),3);
				blue = Math.Round((c.B/255.0),3);
				elements.AppendFormat("\r\nq");			
				elements.AppendFormat("\r\n /CS1 cs");
				elements.AppendFormat("\r\n {0} {1} {2} /{3} scn",red,green,blue,p);
				elements.AppendFormat("\r\n {0} {1} {2} RG",red,green,blue);
				elements.AppendFormat("\r\n {0} {1} {2} {3} re\tf",x, pSize.yHeight-y-height, width, height);
				elements.AppendFormat("\tQ");
			}
		}