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/SvgPicture.cs | |
| parent | 0c200d4ae4f0f4a7a7c58c3affc7670eb6b2dcff (diff) | |
use Interface.GetStreamFromPath to handle either file or resource in
every loading places
Diffstat (limited to 'src/SvgPicture.cs')
| -rw-r--r-- | src/SvgPicture.cs | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/SvgPicture.cs b/src/SvgPicture.cs index 9fb3b8eb..4a0bf922 100644 --- a/src/SvgPicture.cs +++ b/src/SvgPicture.cs @@ -33,18 +33,8 @@ namespace go {} public SvgPicture (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); @@ -52,16 +42,7 @@ namespace go Dimensions = new Size (hSVG.Dimensions.Width, hSVG.Dimensions.Height); } } - - protected override void loadFromFile (string path) - { - if (!File.Exists(path)) - return; - - hSVG = new Rsvg.Handle (path); - Dimensions = new Size (hSVG.Dimensions.Width, hSVG.Dimensions.Height); - } - + public override void Paint (Cairo.Context gr, Rectangle rect, string subPart = "") { float widthRatio = (float)rect.Width / Dimensions.Width; |