iTextSharp.text.Rectangle.Normalize C# (CSharp) Метод

Normalize() публичный Метод

public Normalize ( ) : void
Результат void
        public virtual void Normalize()
        {
            if (llx > urx) {
                float a = llx;
                llx = urx;
                urx = a;
            }
            if (lly > ury) {
                float a = lly;
                lly = ury;
                ury = a;
            }
        }

Usage Example

Пример #1
0
        public override IList <IElement> Start(IWorkerContext ctx, Tag tag)
        {
            float     height  = 0;   //TODO check viewbox
            float     width   = 0;   //TODO check viewbox
            Rectangle r       = null;
            String    viewbox = "";
            IDictionary <String, String> attributes = tag.Attributes;

            if (attributes != null)
            {
                try {
                    if (attributes.ContainsKey("height"))
                    {
                        height = float.Parse(attributes["height"]);
                    }
                }catch {
                    //TODO
                }
                try{
                    if (attributes.ContainsKey("width"))
                    {
                        width = float.Parse(attributes["width"]);
                    }
                }catch {
                    //TODO
                }
                try{
                    if (attributes.TryGetValue("viewBox", out viewbox))
                    {
                        r = new Rectangle(0, 0);
                        StringTokenizer st = new StringTokenizer(viewbox);
                        if (st.HasMoreTokens())
                        {
                            r.Right = float.Parse(st.NextToken());
                        }
                        if (st.HasMoreTokens())
                        {
                            r.Bottom = -float.Parse(st.NextToken());
                        }
                        if (st.HasMoreTokens())
                        {
                            r.Left = r.Right + float.Parse(st.NextToken());
                        }
                        if (st.HasMoreTokens())
                        {
                            r.Top = r.Bottom + float.Parse(st.NextToken());
                        }
                        r.Normalize();
                    }
                } catch {
                    //TODO
                }
            }
            if (r == null)
            {
                r = new Rectangle(width, height);
            }
            else if (width == 0 && height == 0)
            {
                width  = r.Width;
                height = r.Height;
            }
            IList <IElement> elems = new List <IElement>();

            elems.Add(new Svg(height, width, r, tag.CSS));
            return(elems);
        }
All Usage Examples Of iTextSharp.text.Rectangle::Normalize