Exemplo n.º 1
0
        void LoadFromFile(string f)
        {
            if (!String.IsNullOrEmpty(f))
            {
                if (File.Exists(f))
                {
                    _filename = f;
                    if (frames == null)
                    {
                        frames = new TextureList();
                    }
                    frames.Clear();

                    Image          gifImg    = Image.FromFile(f);
                    FrameDimension dimension = new FrameDimension(gifImg.FrameDimensionsList[0]);

                    int frameCount = gifImg.GetFrameCount(dimension);

                    for (int i = 0; i < frameCount; i++)
                    {
                        gifImg.SelectActiveFrame(dimension, i);
                        Bitmap  frame = new Bitmap(gifImg);
                        Texture tex   = new Texture();
                        tex.LoadFromBitmap(frame);
                        frames.Add(tex);
                    }
                }
            }
            else
            {
                frames = null;
            }
        }
Exemplo n.º 2
0
        public SequenceEditorWindow(TextureList seq)
        {
            InitializeComponent();

            Value              = seq;
            Width              = 600;
            Height             = 400;
            this.Text          = "Редактор анимации";
            this.StartPosition = FormStartPosition.CenterParent;
            //
            for (int i = 0; i < seq.Count; i++)
            {
                PictureBox img = new PictureBox();
                img.Parent   = panel;
                img.Width    = 128;
                img.Height   = 128;
                img.SizeMode = PictureBoxSizeMode.Zoom;
                img.Tag      = seq[i];
                img.Click   += img_Click;

                MemoryStream ms = new MemoryStream();
                ms.Write(seq[i].bytes, 0, seq[i].bytes.Length);
                ms.Seek(0, SeekOrigin.Begin);
                Bitmap bmp = new Bitmap(ms);
                ms.Dispose();

                img.Image = bmp;
            }
        }
Exemplo n.º 3
0
 public TextureSequence(string filename)
 {
     frames = new TextureList();
     name   = "Texture Sequence";
     LoadFromFile(filename);
 }
Exemplo n.º 4
0
 public TextureSequence()
 {
     frames = new TextureList();
     name   = "Texture Sequence";
 }