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


C# CGBitmapContext.MoveTo方法代码示例

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


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

示例1: GetCell

		public override UITableViewCell GetCell (UITableView tv)
		{
			var cell = tv.DequeueReusableCell (ikey);
			if (cell == null){
				cell = new UITableViewCell (UITableViewCellStyle.Default, ikey);				
			}
			
			if (scaled == null)
				return cell;
			
			Section psection = Parent as Section;
			bool roundTop = psection.Elements [0] == this;
			bool roundBottom = psection.Elements [psection.Elements.Count-1] == this;
			
			using (var cs = CGColorSpace.CreateDeviceRGB ()){
				using (var bit = new CGBitmapContext (IntPtr.Zero, dimx, dimy, 8, 0, cs, CGImageAlphaInfo.PremultipliedFirst)){
					// Clipping path for the image, different on top, middle and bottom.
					if (roundBottom){
						bit.AddArc (rad, rad, rad, (float) Math.PI, (float) (3*Math.PI/2), false);
					} else {
						bit.MoveTo (0, rad);
						bit.AddLineToPoint (0, 0);
					}
					bit.AddLineToPoint (dimx, 0);
					bit.AddLineToPoint (dimx, dimy);
					
					if (roundTop){
						bit.AddArc (rad, dimy-rad, rad, (float) (Math.PI/2), (float) Math.PI, false);
						bit.AddLineToPoint (0, rad);
					} else {
						bit.AddLineToPoint (0, dimy);
					}
					bit.Clip ();
					bit.DrawImage (rect, scaled.CGImage);
															
					cell.ImageView.Image = UIImage.FromImage (bit.ToImage ());
					cell.TextLabel.Text = "image profile";
				}
			}
			return cell;
		}
开发者ID:21Off,项目名称:21Off,代码行数:41,代码来源:PhotoElement.cs

示例2: InitializeCell

		public override void InitializeCell(UITableView tableView)
		{
			if (_Scaled != null)
			{
				bool roundTop = Section.Elements[0] == this;
				bool roundBottom = Section.Elements[Section.Elements.Count - 1] == this;
	
				using (var cs = CGColorSpace.CreateDeviceRGB())
				{
					using (var bit = new CGBitmapContext(IntPtr.Zero, dimx, dimy, 8, 0, cs, CGImageAlphaInfo.PremultipliedFirst))
					{
						// Clipping path for the image, different on top, middle and bottom.
						if (roundBottom)
						{
							bit.AddArc(rad, rad, rad, (float)Math.PI, (float)(3 * Math.PI / 2), false);
	
						}
						else
						{
							bit.MoveTo(0, rad);
							bit.AddLineToPoint(0, 0);
						}
						bit.AddLineToPoint(dimx, 0);
						bit.AddLineToPoint(dimx, dimy);
	
						if (roundTop)
						{
							bit.AddArc(rad, dimy - rad, rad, (float)(Math.PI / 2), (float)Math.PI, false);
							bit.AddLineToPoint(0, rad);
	
						}
						else
						{
							bit.AddLineToPoint(0, dimy);
						}
						bit.Clip();
						bit.DrawImage(rect, _Scaled.CGImage);
	
						Cell.ImageView.Image = UIImage.FromImage(bit.ToImage());
					}
				}
			}
		}
开发者ID:anujb,项目名称:MonoMobile.MVVM,代码行数:43,代码来源:ImageElement.cs

示例3: newImage

        public static UIImage newImage(RectangleF rect,UIColor color)
        {
            using (var cs = CGColorSpace.CreateDeviceRGB ()){
                using (var context = new CGBitmapContext (IntPtr.Zero, (int)rect.Width, (int)rect.Height, 8, (int)rect.Height*4, cs, CGImageAlphaInfo.PremultipliedLast)){

                    rect.X += 5;
                    rect.Y += 5;
                    rect.Width -= 10;
                    rect.Height -= 10;

                    color.SetColor ();
                    context.MoveTo (rect.X,rect.Y);
                    context.AddLineToPoint (rect.X,rect.Height);
                    context.AddLineToPoint (rect.Width,rect.Height);
                    context.AddLineToPoint (rect.Width,rect.Y);
                    context.ClosePath ();
                    context.FillPath ();

                return UIImage.FromImage (context.ToImage());
                }
            }
        }
开发者ID:Clancey,项目名称:Facetroids,代码行数:22,代码来源:Graphics.cs

示例4: UpdateRouteView

        public void UpdateRouteView()
        {
            using(var context = new CGBitmapContext(null, (int)_RouteView.Frame.Width, (int)_RouteView.Frame.Height, 8,
                (int)(4 * _RouteView.Frame.Width), CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
            {
                context.SetStrokeColor(LineColor.CGColor);
                context.SetFillColor(0.0f, 0.0f, 1.0f, 1.0f);
                context.SetLineWidth(3.0f);

                for (int i = 0; i < _Routes.Count(); i++)
                {
                    var route = _Routes[i];
                    var point = _MapView.ConvertCoordinate(route.Coordinate, _RouteView);

                    if(i == 0)
                        context.MoveTo(point.X, _RouteView.Frame.Height - point.Y);
                    else
                        context.AddLineToPoint(point.X, _RouteView.Frame.Height - point.Y);
                }

                context.StrokePath();

                var cgImage = context.ToImage();
                var image = UIImage.FromImage(cgImage);

                _RouteView.Image = image;
            }
        }
开发者ID:anujb,项目名称:MapWithRoutes,代码行数:28,代码来源:MapView.cs


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