예제 #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);
			}
		}
예제 #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);
     }
 }
예제 #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;
            }
        }
예제 #4
0
파일: SvgParser.cs 프로젝트: jdluzen/xamsvg
		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);
			}
		}
예제 #5
0
파일: Svg.cs 프로젝트: jdluzen/xamsvg
		public Svg (Picture pPicture, RectF pBounds, RectF pComputedBounds)
		{
			Picture = pPicture;
			Bounds = pBounds;
			ComputedBounds = pComputedBounds;
		}
예제 #6
0
		public PictureBitmapDrawable (Picture pic)
		{
			Picture = pic;
		}
예제 #7
0
 public void DrawImage(Picture image, float x, float y, float width, float height)
 {
     this.DrawImage(image, new Rectangle(x, y, width, height));
 }
예제 #8
0
 public void DrawImage(Picture image, Rectangle rect)
 {
     this.canvas.DrawPicture(image, (Android.Graphics.RectF)rect);
 }