Exemplo n.º 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);
			}
		}
Exemplo n.º 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);
     }
 }
Exemplo n.º 3
0
        /// <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;
            }
        }
Exemplo n.º 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);
			}
		}
Exemplo n.º 5
0
		public Svg (Picture pPicture, RectF pBounds, RectF pComputedBounds)
		{
			Picture = pPicture;
			Bounds = pBounds;
			ComputedBounds = pComputedBounds;
		}
Exemplo n.º 6
0
		public PictureBitmapDrawable (Picture pic)
		{
			Picture = pic;
		}
Exemplo n.º 7
0
 public void DrawImage(Picture image, float x, float y, float width, float height)
 {
     this.DrawImage(image, new Rectangle(x, y, width, height));
 }
Exemplo n.º 8
0
 public void DrawImage(Picture image, Rectangle rect)
 {
     this.canvas.DrawPicture(image, (Android.Graphics.RectF)rect);
 }