1 /* 2 * This file is part of the "GKMap". 3 * GKMap project borrowed from GMap.NET (by radioman). 4 * 5 * Copyright (C) 2009-2018 by radioman (email@radioman.lt). 6 * This program is licensed under the FLAT EARTH License. 7 */ 8 9 using System; 10 using System.IO; 11 12 namespace GKMap 13 { 14 /// <summary> 15 /// image abstraction proxy 16 /// </summary> 17 public abstract class PureImageProxy 18 { FromStream(Stream stream)19 public abstract PureImage FromStream(Stream stream); 20 FromArray(byte[] data)21 public PureImage FromArray(byte[] data) 22 { 23 MemoryStream m = new MemoryStream(data, 0, data.Length, false, true); 24 var pi = FromStream(m); 25 if (pi != null) { 26 m.Position = 0; 27 pi.Data = m; 28 } else { 29 m.Dispose(); 30 } 31 32 return pi; 33 } 34 } 35 36 /// <summary> 37 /// image abstraction 38 /// </summary> 39 public abstract class PureImage : IDisposable 40 { 41 public MemoryStream Data; 42 43 internal bool IsParent; 44 internal long Ix; 45 internal long Xoff; 46 internal long Yoff; 47 Dispose()48 public abstract void Dispose(); 49 } 50 } 51