Ejemplo n.º 1
0
 /// <summary>
 /// load the image for rendering from the path given as argument
 /// </summary>
 /// <param name="path">image path, may be embedded</param>
 public override void Load(Interface iface, string path)
 {
     Path = path;
     if (sharedResources.ContainsKey(path))
     {
         sharedPicture sp = sharedResources [path];
         image      = (byte[])sp.Data;
         Dimensions = sp.Dims;
         return;
     }
     using (Stream stream = iface.GetStreamFromPath(path)) {
         loadBitmap(new System.Drawing.Bitmap(stream));
     }
     sharedResources [path] = new sharedPicture(image, Dimensions);
 }
Ejemplo n.º 2
0
        public override void Load(Interface iface, string path)
        {
            Path = path;
            if (sharedResources.ContainsKey(path))
            {
                sharedPicture sp = sharedResources [path];
                hSVG       = (Rsvg.Handle)sp.Data;
                Dimensions = sp.Dims;
                return;
            }
            using (Stream stream = iface.GetStreamFromPath(path)) {
                using (MemoryStream ms = new MemoryStream()) {
                    stream.CopyTo(ms);

                    hSVG       = new Rsvg.Handle(ms.ToArray());
                    Dimensions = new Size(hSVG.Dimensions.Width, hSVG.Dimensions.Height);
                }
            }
            sharedResources [path] = new sharedPicture(hSVG, Dimensions);
        }