Exemplo n.º 1
0
        // ----------------------------------------------------------
        // public
        // ----------------------------------------------------------
        public XTFrame GetFrame(string name)
        {
            if (this.m_frames == null)
            {
                XElement e = XTPListXML.GetSubElement(this.m_root, "frames/" + name);
                if (e == null)
                {
                    return(null);
                }
                return(new XTFrame(name, e));
            }
            XTFrame frame = null;

            if (!this.m_frames.TryGetValue(name, out frame))
            {
                XElement e = XTPListXML.GetSubElement(this.m_root, "frames/" + name);
                if (e == null)
                {
                    return(null);
                }
                frame = new XTFrame(name, e);
                this.m_frames[name] = frame;
            }
            return(frame);
        }
Exemplo n.º 2
0
        //-----------------------------------------------------------
        // private
        //-----------------------------------------------------------
        private XTFrameInfo CreateFrameInfo(XTFrame frame)
        {
            Size      size       = frame.Frame.Size;
            Point     pos        = frame.Frame.Location;
            Rectangle dstRect    = new Rectangle(0, 0, size.Width, size.Height);
            Bitmap    frameImage = new Bitmap(size.Width, size.Height);
            Graphics  g          = Graphics.FromImage(frameImage);

            g.DrawImage(this.m_texture, dstRect, pos.X, pos.Y, size.Width, size.Height, GraphicsUnit.Pixel);
            g.Dispose();
            //if (frame.Rotated)
            //	frameImage.RotateFlip(RotateFlipType.Rotate90FlipXY);
            return(new XTFrameInfo(frame, frameImage));
        }
Exemplo n.º 3
0
        // -------------------------------------------
        public XTFrameInfo GetFrameInfo(string name)
        {
            XTFrame frame = this.m_plist.GetFrame(name);

            if (frame == null)
            {
                return(null);
            }
            if (this.m_frames == null)
            {
                return(this.CreateFrameInfo(frame));
            }
            XTFrameInfo frameImage;

            if (!this.m_frames.TryGetValue(name, out frameImage))
            {
                frameImage          = this.CreateFrameInfo(frame);
                this.m_frames[name] = frameImage;
            }
            return(frameImage);
        }
Exemplo n.º 4
0
 public IEnumerable <XTFrame> IterFrames()
 {
     if (this.m_frames == null)
     {
         foreach (PListElement e in XTPListXML.IterSubElements(this.m_root, "frames"))
         {
             yield return(new XTFrame(e.Key, e.Value));
         }
     }
     else
     {
         XTFrame frame;
         foreach (PListElement e in XTPListXML.IterSubElements(this.m_root, "frames"))
         {
             if (!this.m_frames.TryGetValue(e.Key, out frame))
             {
                 frame = new XTFrame(e.Key, e.Value);
                 this.m_frames[e.Key] = frame;
             }
             yield return(frame);
         }
     }
 }
Exemplo n.º 5
0
 protected XTFrame(XTFrame frame)
     : this(frame.m_name, frame.m_root)
 {
 }
Exemplo n.º 6
0
 public XTFrameInfo(XTFrame frame, Image image)
     : base(frame)
 {
     this.m_image = image;
 }