Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2498 | - | 1 | |
2 | namespace GMap.NET |
||
3 | { |
||
4 | using System; |
||
5 | using System.IO; |
||
6 | |||
7 | /// <summary> |
||
8 | /// image abstraction proxy |
||
9 | /// </summary> |
||
10 | public abstract class PureImageProxy |
||
11 | { |
||
12 | abstract public PureImage FromStream(Stream stream); |
||
13 | abstract public bool Save(Stream stream, PureImage image); |
||
14 | |||
15 | public PureImage FromArray(byte[] data) |
||
16 | { |
||
17 | MemoryStream m = new MemoryStream(data, 0, data.Length, false, true); |
||
18 | var pi = FromStream(m); |
||
19 | if(pi != null) |
||
20 | { |
||
21 | m.Position = 0; |
||
22 | pi.Data = m; |
||
23 | } |
||
24 | else |
||
25 | { |
||
26 | m.Dispose(); |
||
27 | } |
||
28 | m = null; |
||
29 | |||
30 | return pi; |
||
31 | } |
||
32 | } |
||
33 | |||
34 | /// <summary> |
||
35 | /// image abstraction |
||
36 | /// </summary> |
||
37 | public abstract class PureImage : IDisposable |
||
38 | { |
||
39 | public MemoryStream Data; |
||
40 | |||
41 | internal bool IsParent; |
||
42 | internal long Ix; |
||
43 | internal long Xoff; |
||
44 | internal long Yoff; |
||
45 | |||
46 | #region IDisposable Members |
||
47 | |||
48 | public abstract void Dispose(); |
||
49 | |||
50 | #endregion |
||
51 | } |
||
52 | } |