public FrameImage(FrameImage frameImage) { image = new Bitmap(frameImage.getImageWidth(), frameImage.getImageHeight()); Graphics g = Graphics.FromImage(image); g.DrawImage(frameImage.getImage(), 0, 0); }
public void add(FrameImage frameImage, double timeToNextFrame) { ignoreFrames.Add(false); frameImages.Add(frameImage); delayFrames.Add(timeToNextFrame); }
public void LoadFrame() { frameImages = new Hashtable(); StreamReader reader = new StreamReader(framefile); string line = null; if (reader.ReadLine() == null) { Console.WriteLine("No data"); return; } else { reader = new StreamReader(framefile); while ((line = reader.ReadLine()).Equals("")) { ; } int n = int.Parse(line); for (int i = 0; i < n; i++) { FrameImage frame = new FrameImage(); while ((line = reader.ReadLine()).Equals("")) { ; } frame.setName(line); while ((line = reader.ReadLine()).Equals("")) { ; } string[] str = line.Split(' '); string path = str[1]; while ((line = reader.ReadLine()).Equals("")) { ; } str = line.Split(' '); int x = int.Parse(str[1]); while ((line = reader.ReadLine()).Equals("")) { ; } str = line.Split(' '); int y = int.Parse(str[1]); while ((line = reader.ReadLine()).Equals("")) { ; } str = line.Split(' '); int w = int.Parse(str[1]); while ((line = reader.ReadLine()).Equals("")) { ; } str = line.Split(' '); int h = int.Parse(str[1]); Image imageData = Image.FromFile(projectDirectory + path); Image image = getSubimage(imageData, x, y, w, h); imageData.Dispose(); frame.setImage(image); instance.frameImages.Add(frame.getName(), frame); } } reader.Close(); }
public FrameImage getFrameImage(string name) { FrameImage frameImage = new FrameImage((FrameImage)instance.frameImages[name]); return(frameImage); }