Beispiel #1
0
		internal static Bitmap MakeBitmapFromPicture (Picture pic, int width, int height)
		{
			using (var bmp = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888)) {
				using (var c = new Canvas (bmp)) {
					var dst = new RectF (0, 0, width, height); 
					c.DrawPicture (pic, dst);
				}
				// Returns an immutable copy
				return Bitmap.CreateBitmap (bmp);
			}
		}
Beispiel #2
0
 public static Svg ParseSvgFromReader(TextReader reader, ISvgColorMapper pSVGColorMapper)
 {
     try {
         var xmlReader = XmlReader.Create (reader);
         Picture picture = new Picture();
         var svgHandler = new SVGHandler (picture, pSVGColorMapper);
         svgHandler.Parse (xmlReader);
         Svg svg = new Svg(picture, svgHandler.getBounds(), svgHandler.getComputedBounds());
         return svg;
     } catch (Exception e) {
         throw new SVGParseException(e);
     }
 }
        /// <summary>
        /// A new picture is rendered to the screen
        /// </summary>
        /// <param name="view"></param>
        /// <param name="picture"></param>
        public void OnNewPicture(WebView view, Picture picture)
        {
            if (!_set)
            {
                // TODO: only add if not there, also include jquery mobile
                view.LoadUrl(@"javascript:!function(){var jsFile = window.document.createElement('script');
                        jsFile.setAttribute('type', 'text/javascript');
                        jsFile.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
                        window.document.getElementsByTagName('head')[0].appendChild(jsFile);}()");

                LoadTrigger.Set();
                _set = false;
            }
        }
Beispiel #4
0
		public static Svg ParseSvgFromReader (TextReader reader, ISvgColorMapper pSVGColorMapper)
		{
			try {
				var readerSettings = new XmlReaderSettings();
				readerSettings.XmlResolver = null;
				readerSettings.DtdProcessing = DtdProcessing.Ignore;
				var xmlReader = XmlReader.Create (reader, readerSettings);
				Picture picture = new Picture();
				var svgHandler = new SVGHandler (picture, pSVGColorMapper);
				svgHandler.Parse (xmlReader);
				Svg svg = new Svg(picture, svgHandler.getBounds(), svgHandler.getComputedBounds());
				return svg;
			} catch (Exception e) {
				throw new SVGParseException(e);
			}
		}
Beispiel #5
0
		public Svg (Picture pPicture, RectF pBounds, RectF pComputedBounds)
		{
			Picture = pPicture;
			Bounds = pBounds;
			ComputedBounds = pComputedBounds;
		}
		public PictureBitmapDrawable (Picture pic)
		{
			Picture = pic;
		}
Beispiel #7
0
 public void DrawImage(Picture image, float x, float y, float width, float height)
 {
     this.DrawImage(image, new Rectangle(x, y, width, height));
 }
Beispiel #8
0
 public void DrawImage(Picture image, Rectangle rect)
 {
     this.canvas.DrawPicture(image, (Android.Graphics.RectF)rect);
 }