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; } }
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; } }
public TextureSequence(string filename) { frames = new TextureList(); name = "Texture Sequence"; LoadFromFile(filename); }
public TextureSequence() { frames = new TextureList(); name = "Texture Sequence"; }