WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
FastImage.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
6 using System.Drawing;
7 using System.Drawing.Imaging;
8 
9 namespace DirectOutput.General.BitmapHandling
10 {
11  public class FastImage:NamedItemBase
12  {
13 
14 
15 
16 
17 
18  private Dictionary<int,FastBitmap> _Frames=new Dictionary<int,FastBitmap>();
19 
20  public Dictionary<int,FastBitmap> Frames
21  {
22  get { return _Frames; }
23  private set { _Frames = value; }
24  }
25 
26  public void LoadImageFile(string ImageFilePath)
27  {
28  Frames = new Dictionary<int, FastBitmap>();
29 
30  Image Img = Image.FromFile(ImageFilePath);
31 
32  FrameDimension dimension = new FrameDimension(Img.FrameDimensionsList[0]);
33  // Number of frames
34  int FrameCount = Img.GetFrameCount(dimension);
35  // Return an Image at a certain index
36 
37  for (int FrameNumber = 0; FrameNumber < FrameCount; FrameNumber++)
38  {
39  Img.SelectActiveFrame(dimension, FrameNumber);
40 
41  FastBitmap F = new FastBitmap(Img);
42 
43  Frames.Add(FrameNumber, F);
44  }
45 
46  }
47 
48 
49  void FastBitmap_AfterNameChanged(object sender, NameChangeEventArgs e)
50  {
51  LoadImageFile(e.NewName);
52  }
53 
54 
55  public FastImage(string Name) :this()
56  {
57  this.Name = Name;
58  }
59 
60  public FastImage():base()
61  {
62  this.AfterNameChanged += new EventHandler<NameChangeEventArgs>(FastBitmap_AfterNameChanged);
63 
64  }
65 
66  ~FastImage()
67  {
68  this.AfterNameChanged -= new EventHandler<NameChangeEventArgs>(FastBitmap_AfterNameChanged);
69  }
70 
71  }
72 }
Abstract base class for named items. Implements the name property and the necessary events...
void LoadImageFile(string ImageFilePath)
Definition: FastImage.cs:26
The namespace DirectOutput.General contains classes for general use.