Exemple #1
0
        public static PenLineCap ToEto(this CGLineCap value)
        {
            switch (value)
            {
            case CGLineCap.Butt:
                return(PenLineCap.Butt);

            case CGLineCap.Round:
                return(PenLineCap.Round);

            case CGLineCap.Square:
                return(PenLineCap.Square);

            default:
                throw new NotSupportedException();
            }
        }
Exemple #2
0
        void SetStrokeStartLineCap()
        {
            PenLineCap winLineCap = Element.StrokeStartLineCap;
            CGLineCap  iosLineCap = CGLineCap.Butt;

            switch (winLineCap)
            {
            case PenLineCap.Flat: iosLineCap = CGLineCap.Butt; break;

            case PenLineCap.Square: iosLineCap = CGLineCap.Square; break;

            case PenLineCap.Round: iosLineCap = CGLineCap.Round; break;

            case PenLineCap.Triangle: iosLineCap = CGLineCap.Round; break;
            }

            Control.DrawingLayer.SetStrokeLineCap(iosLineCap);
        }
Exemple #3
0
		public void SetBorderLineCap(LineCap lineCap)
		{
			CGLineCap iLineCap = CGLineCap.Butt;

			switch (lineCap)
			{
				case LineCap.Butt:
					iLineCap = CGLineCap.Butt;
					break;
				case LineCap.Square:
					iLineCap = CGLineCap.Square;
					break;
				case LineCap.Round:
					iLineCap = CGLineCap.Round;
					break;
			}

			_strokeLineCap = iLineCap;

			SetNeedsDisplay();
		}
        void UpdateStrokeLineCap()
        {
            PenLineCap lineCap  = Element.StrokeLineCap;
            CGLineCap  iLineCap = CGLineCap.Butt;

            switch (lineCap)
            {
            case PenLineCap.Flat:
                iLineCap = CGLineCap.Butt;
                break;

            case PenLineCap.Square:
                iLineCap = CGLineCap.Square;
                break;

            case PenLineCap.Round:
                iLineCap = CGLineCap.Round;
                break;
            }

            Control.ShapeLayer.UpdateStrokeLineCap(iLineCap);
        }
Exemple #5
0
		extern static	void CGContextSetLineCap(IntPtr c, CGLineCap cap);
Exemple #6
0
 public unsafe CGPath CopyByStrokingPath(CGAffineTransform transform, nfloat lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, nfloat miterLimit)
 {
     return(MakeMutable(CGPathCreateCopyByStrokingPath(handle, &transform, lineWidth, lineCap, lineJoin, miterLimit)));
 }
Exemple #7
0
 extern static IntPtr CGPathCreateCopyByStrokingPath(IntPtr handle, IntPtr zero, float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit);
Exemple #8
0
 public void SetLineCap(CGLineCap cap)
 {
     CGContextSetLineCap(handle, cap);
 }
Exemple #9
0
		public unsafe CGPath CopyByStrokingPath (nfloat lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, nfloat miterLimit)
		{
			return MakeMutable (CGPathCreateCopyByStrokingPath (handle, null, lineWidth, lineCap, lineJoin, miterLimit));
		}
Exemple #10
0
		unsafe extern static IntPtr CGPathCreateCopyByStrokingPath (/* CGPathRef */ IntPtr path, CGAffineTransform *transform, nfloat lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, /* CGFloat */ nfloat miterLimit);
Exemple #11
0
 extern static void CGContextSetLineCap(/* CGContextRef */ IntPtr c, CGLineCap cap);
Exemple #12
0
 public void SetStrokeLineCap(CGLineCap strokeLineCap)
 {
     this.strokeLineCap = strokeLineCap;
     CalculateBasicPathStrokeBounds();
     SetNeedsDisplay();
 }
        public static XIR.Image RemoteRepresentation(this CGLineCap obj)
        {
            var aPath       = new CGPath();
            var lineWidth   = 10;
            var sampleWidth = 50;

            aPath.MoveToPoint(new CGPoint(lineWidth, lineWidth));
            aPath.AddLineToPoint(new CGPoint(lineWidth + sampleWidth, lineWidth));

            // let's make sure we leave a little room for the line width drawing as well by adding the lineWidth as well
            var width  = (int)aPath.PathBoundingBox.Right + lineWidth;
            var height = (int)aPath.PathBoundingBox.Bottom + lineWidth;

            var bytesPerRow = width * 4;

            using (var context = new CGBitmapContext(
                       IntPtr.Zero, width, height,
                       8, bytesPerRow, CGColorSpace.CreateDeviceRGB(),
                       CGImageAlphaInfo.PremultipliedFirst)) {
                context.SaveState();
                context.SetStrokeColor(new CGColor(0, 0, 0));
                context.SetLineWidth(lineWidth);
                context.AddPath(aPath);
                switch ((CGLineCap)obj)
                {
                case CGLineCap.Square:
                    context.SetLineCap(CGLineCap.Square);
                    break;

                case CGLineCap.Butt:
                    context.SetLineCap(CGLineCap.Butt);
                    break;

                case CGLineCap.Round:
                    context.SetLineCap(CGLineCap.Round);
                    break;
                }

                context.DrawPath(CGPathDrawingMode.Stroke);

                context.RestoreState();

                // Second, we draw the inset line to demonstrate the bounds
                aPath = new CGPath();
                aPath.MoveToPoint(new CGPoint(lineWidth, lineWidth));
                aPath.AddLineToPoint(new CGPoint(lineWidth + sampleWidth, lineWidth));
                context.SetLineCap(CGLineCap.Butt);
                context.SetStrokeColor(NSColor.White.CGColor);
                context.SetLineWidth(1);

                context.SaveState();

                context.AddPath(aPath);
                context.DrawPath(CGPathDrawingMode.Stroke);

                context.RestoreState();


                // Third, we draw the inset line endings which are two circles
                var circleWidth = 2;
                aPath = new CGPath();
                aPath.AddEllipseInRect(new CGRect(lineWidth - (int)(circleWidth / 2), lineWidth - (int)(circleWidth / 2), circleWidth, circleWidth));
                aPath.AddEllipseInRect(new CGRect(lineWidth + sampleWidth - (int)(circleWidth / 2), lineWidth - (int)(circleWidth / 2), circleWidth, circleWidth));
                context.SetLineWidth(circleWidth);
                context.SetStrokeColor(NSColor.White.CGColor);
                context.AddPath(aPath);
                context.DrawPath(CGPathDrawingMode.Stroke);

                return(RemoteRepresentation(context));
            }
        }
Exemple #14
0
		public void SetLineCap (CGLineCap cap)
		{
			CGContextSetLineCap (handle, cap);
		}
Exemple #15
0
		extern static IntPtr CGPathCreateCopyByStrokingPath (IntPtr handle, ref CGAffineTransform transform, float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit);
Exemple #16
0
 extern static void CGContextSetLineCap(IntPtr c, CGLineCap cap);
Exemple #17
0
		public CGPath CopyByStrokingPath (CGAffineTransform transform, float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit)
		{
			return MakeMutable (CGPathCreateCopyByStrokingPath (handle, ref transform, lineWidth, lineCap, lineJoin, miterLimit));
		}
Exemple #18
0
 extern static IntPtr CGPathCreateCopyByStrokingPath(IntPtr handle, ref CGAffineTransform transform, float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit);
Exemple #19
0
		extern static IntPtr CGPathCreateCopyByStrokingPath (IntPtr handle, IntPtr zero, float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit);
Exemple #20
0
 public CGPath CopyByStrokingPath(float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit)
 {
     return(MakeMutable(CGPathCreateCopyByStrokingPath(handle, IntPtr.Zero, lineWidth, lineCap, lineJoin, miterLimit)));
 }
Exemple #21
0
		public CGPath CopyByStrokingPath (float lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, float miterLimit)
		{
			return MakeMutable (CGPathCreateCopyByStrokingPath (handle, IntPtr.Zero, lineWidth, lineCap, lineJoin, miterLimit));
		}
Exemple #22
0
 unsafe extern static IntPtr CGPathCreateCopyByStrokingPath(/* CGPathRef */ IntPtr path, CGAffineTransform *transform, nfloat lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, /* CGFloat */ nfloat miterLimit);
Exemple #23
0
        public override MKOverlayRenderer OverlayRenderer(MKMapView mapView, IMKOverlay overlay)
        {
            UIColor    fill        = UIColor.Clear;
            UIColor    border      = UIColor.Clear;
            float      borderWidth = 0;
            CGLineJoin lineJoin    = CGLineJoin.Round;
            CGLineCap  lineCap     = CGLineCap.Round;
            float      dashPhase   = 0;
            string     style;

            if (PolygonStyles.TryGetValue(overlay, out style))
            {
                switch (style)
                {
                case "border":
                    fill   = UIColor.FromRGB(0.99f, 0.94f, 0.91f);
                    border = UIColor.FromRGB(0.94f, 0.65f, 0.56f);
                    break;

                case "podium":
                    fill = UIColor.FromRGB(0.94f, 0.49f, 0f);
                    break;

                case "podiumgrond":
                    fill = UIColor.FromRGB(0f, 0.44f, 0.58f);
                    break;

                case "pavilioen":
                    fill = UIColor.FromRGB(0.89f, 0.69f, 0.77f);
                    break;

                case "loods":
                    fill = UIColor.FromRGB(0.85f, 0.89f, 0.51f);
                    break;

                case "kampeergrond":
                    fill = UIColor.FromRGB(0.32f, 0.69f, 0.19f);
                    break;

                case "kampeergrond-ongebruikt":
                    fill = UIColor.FromRGB(0.99f, 0.97f, 0.96f);
                    break;

                case "aanbod":
                    fill = UIColor.FromRGB(0.85f, 0.05f, 0.15f);
                    break;

                case "vijver":
                    fill = UIColor.FromRGBA(0.00f, 0.62f, 0.89f, 0.6f);
                    break;

                case "bos":
                    fill        = UIColor.FromRGB(0.49f, 0.13f, 0.43f);
                    border      = UIColor.FromRGB(0.22f, 0.69f, 0.42f);
                    borderWidth = 1;
                    break;

                case "weg-hard":
                    borderWidth = 4;
                    lineCap     = CGLineCap.Square;
                    border      = UIColor.White;
                    break;

                case "weg-hard-2":
                    borderWidth = 3;
                    lineCap     = CGLineCap.Square;
                    border      = UIColor.White;
                    break;

                case "weg-halfhard":
                    borderWidth = 3;
                    lineCap     = CGLineCap.Square;
                    border      = UIColor.White;
                    break;

                case "weg-zand":
                    borderWidth = 1;
                    dashPhase   = 0.2f;
                    border      = UIColor.FromRGB(0.94f, 0.65f, 0.56f);
                    break;

                case "faciliteit":
                    border = UIColor.FromRGB(0.05f, 0.46f, 0.58f);
                    break;

                default:
                    fill = UIColor.Black;
                    break;
                }
            }
            if (overlay is MKPolygon)
            {
                return new MKPolygonRenderer(overlay as MKPolygon)
                       {
                           FillColor = fill, StrokeColor = border, LineWidth = borderWidth, LineJoin = lineJoin
                       }
            }
            ;
            if (overlay is MKPolyline)
            {
                return new MKPolylineRenderer(overlay as MKPolyline)
                       {
                           FillColor = fill, StrokeColor = border, LineWidth = borderWidth, LineCap = CGLineCap.Square, LineDashPhase = dashPhase
                       }
            }
            ;
            return(null);
        }
Exemple #24
0
 public unsafe CGPath CopyByStrokingPath(nfloat lineWidth, CGLineCap lineCap, CGLineJoin lineJoin, nfloat miterLimit)
 {
     return(MakeMutable(CGPathCreateCopyByStrokingPath(handle, null, lineWidth, lineCap, lineJoin, miterLimit)));
 }
Exemple #25
0
		extern static void CGContextSetLineCap (/* CGContextRef */ IntPtr c, CGLineCap cap);