当前位置: 首页>>代码示例>>C#>>正文


C# Canvas.DrawPicture方法代码示例

本文整理汇总了C#中Android.Graphics.Canvas.DrawPicture方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawPicture方法的具体用法?C# Canvas.DrawPicture怎么用?C# Canvas.DrawPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Graphics.Canvas的用法示例。


在下文中一共展示了Canvas.DrawPicture方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeBitmapFromPicture

		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);
			}
		}
开发者ID:jdluzen,项目名称:xamsvg,代码行数:11,代码来源:SvgFactory.cs

示例2: GetBitmapFromSvgString

 public static Bitmap GetBitmapFromSvgString(string svgString, int width, int height)
 {
     var svg = SVGParser.ParseSVGFromString (svgString);
     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 (svg.Picture, dst);
     }
     // Returns an immutable copy
     return Bitmap.CreateBitmap (bmp);
 }
开发者ID:Andrea,项目名称:FriendTab,代码行数:11,代码来源:SvgUtils.cs

示例3: GetBitmapFromSvgRes

        public static Bitmap GetBitmapFromSvgRes(Android.Content.Res.Resources resources, int resID,
		                                          int width, int height)
        {
            var svg = SVGParser.ParseSVGFromResource (resources,
                                                      resID);
            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 (svg.Picture, dst);
            }
            // Returns an immutable copy
            return Bitmap.CreateBitmap (bmp);
        }
开发者ID:Andrea,项目名称:FriendTab,代码行数:13,代码来源:SvgUtils.cs

示例4: GetPin

        public Bitmap GetPin(float ratio, int number, int width, int height, float alpha = 1)
        {
            int key = number + ((int)(ratio * 10000)) << 6;
            Bitmap bmp;
            if (pinCache.TryGetValue (key, out bmp))
                return bmp;

            var svg = SVGParser.ParseSVGFromResource (context.Resources,
                                                      Resource.Raw.pin,
                                                      SvgColorMapperFactory.FromFunc (c => ColorReplacer (c, ratio, alpha)));
            bmp = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888);
            using (var c = new Canvas (bmp)) {
                var dst = new RectF (0, 0, width, height);
                c.DrawPicture (svg.Picture, dst);
                c.DrawText (number.ToString (), width / 2 - 1, 16.ToPixels (), textPaint);
            }

            pinCache [key] = bmp;
            return bmp;
        }
开发者ID:SpiderMaster,项目名称:BikeNow,代码行数:20,代码来源:PinFactory.cs

示例5: DispatchDraw

        protected override void DispatchDraw(Canvas canvas)
        {
            base.DispatchDraw (mPicture.BeginRecording (Width, Height));

            mPicture.EndRecording ();

            int x = Width / 2;
            int y = Height / 2;

            if (false)
                canvas.DrawPicture (mPicture);
            else {
                DrawPict (canvas, 0, 0, x, y, 1, 1);
                DrawPict (canvas, x, 0, x, y, -1, 1);
                DrawPict (canvas, 0, y, x, y, 1, -1);
                DrawPict (canvas, x, y, x, y, -1, -1);
            }
        }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:18,代码来源:PictureLayout.cs

示例6: DrawPict

 private void DrawPict(Canvas canvas, int x, int y, int w, int h, float sx, float sy)
 {
     canvas.Save ();
     canvas.Translate (x, y);
     canvas.ClipRect (0, 0, w, h);
     canvas.Scale (0.5f, 0.5f);
     canvas.Scale (sx, sy, w, h);
     canvas.DrawPicture (mPicture);
     canvas.Restore ();
 }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:10,代码来源:PictureLayout.cs


注:本文中的Android.Graphics.Canvas.DrawPicture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。