diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-09 12:33:45 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-09 12:33:45 +0200 |
| commit | 83a4710020bc9e254241bdce880d20bcbcec0bee (patch) | |
| tree | 6c3d80154d1e791996de2de11f3fa8398662a7f9 /src/BmpPicture.cs | |
| parent | 0c200d4ae4f0f4a7a7c58c3affc7670eb6b2dcff (diff) | |
use Interface.GetStreamFromPath to handle either file or resource in
every loading places
Diffstat (limited to 'src/BmpPicture.cs')
| -rw-r--r-- | src/BmpPicture.cs | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/BmpPicture.cs b/src/BmpPicture.cs index 053c8fbf..2f6d11d6 100644 --- a/src/BmpPicture.cs +++ b/src/BmpPicture.cs @@ -32,32 +32,14 @@ namespace go {} public BmpPicture (string path) : base(path) {} - - protected override void loadFromRessource (string resId) + protected override void loadFromStream (Stream stream) { - Stream stream = null; - - //first, search for ressource in main executable assembly - stream = System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream(resId); - if (stream == null)//try to find ressource in golib assembly - stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resId); - if (stream == null) - return; - using (MemoryStream ms = new MemoryStream ()) { stream.CopyTo (ms); loadBitmap (new System.Drawing.Bitmap (ms)); } } - protected override void loadFromFile (string path) - { - if (!File.Exists(path)) - return; - - loadBitmap (new System.Drawing.Bitmap (path)); - } - //load image via System.Drawing.Bitmap, cairo load png only void loadBitmap (System.Drawing.Bitmap bitmap) { |