Example #1
0
        protected virtual void loadCompact(aBinaryReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            mVisible = (reader.Read8() != 0);
            reader.Step(1);

            mName = reader.Read32();

            int left   = reader.ReadS16();
            int top    = reader.ReadS16();
            int width  = reader.ReadS16();
            int height = reader.ReadS16();

            mRect.set(left, top, (left + width), (top + height));

            setBasePosition(bloAnchor.TopLeft);
            mAngle        = 0.0d;
            mAlpha        = 255;
            mInheritAlpha = true;
        }
Example #2
0
        public static bloRectangle loadRectangle(xElement element, bloRectangle defRectangle = default(bloRectangle))
        {
            if (element == null)
            {
                return(defRectangle);
            }
            var rectangle = new bloRectangle();

            if (element.Element("x") != null && element.Element("y") != null && element.Element("width") != null && element.Element("height") != null)
            {
                rectangle.move(element.Element("x"), element.Element("y"));
                rectangle.resize(element.Element("width"), element.Element("height"));
            }
            else if (element.Element("left") != null && element.Element("top") != null && element.Element("right") != null && element.Element("bottom") != null)
            {
                rectangle.set(element.Element("left"), element.Element("top"), element.Element("right"), element.Element("bottom"));
            }
            else
            {
                rectangle = defRectangle;
            }
            return(rectangle);
        }