uibezierpath

UIBezierPath Removal Issue

让人想犯罪 __ 提交于 2019-12-11 11:09:46
问题 I am trying to make a game where a ball is bouncing off a user drawn line. The code for drawing the line is included below and works fine but how would I remove the line once the ball makes contact with it or the player draws a new line? path = [UIBezierPath bezierPath]; // Start Coords of Line [path moveToPoint:CGPointMake(pos2x, pos2y)]; [path addLineToPoint:CGPointMake(pos1x, pos1y)]; // End Coords of Line CAShapeLayer *shapeLayer = [CAShapeLayer layer]; shapeLayer.path = [path CGPath];

Objective-C How to avoid drawing on same color image having stroke color of UIBezierPath

我是研究僧i 提交于 2019-12-11 09:23:41
问题 We are working on a paint application using UIBezierPath , We did paint strokes using bezier path, with blue color RGB values and 0.5 Alpha for transparent stroke using paths array.. we almost complete the application, But there are some performance issues to drayong paint strokes from PathsArray which is having alredy drawn Bezierpaths, like paint strokes getting slow after drawing some number of strokes, So to avoid this performance issue we used an temperary image view behind the

Create an UIImage from Uibezierpath Array in Swift

那年仲夏 提交于 2019-12-11 08:44:56
问题 I want to create an UIImage from an Array of multiple UIBezierPaths in Swift. I tried the following code: func convertPathsToImage(paths: [UIBezierPath]) -> UIImage{ let imageWidth: CGFloat = 200 let imageHeight: CGFloat = 200 let colorSpace:CGColorSpace = CGColorSpaceCreateDeviceRGB()! let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.PremultipliedLast.rawValue) let context = CGBitmapContextCreate(nil, Int(imageWidth), Int(imageHeight), 8, 0, colorSpace, bitmapInfo.rawValue)

How to draw and interact with UIBezierPath

ぐ巨炮叔叔 提交于 2019-12-11 08:25:03
问题 I would like to implement and design a map for a building floor in my application. Before starting, I would like to have some advices. I'm planning to use UIBezierPath to draw the shapes. Each UIBezierPath will represent a shop on my map. Here is an illustration (map_with_UIBezierPath) My code structure is the following: I have a UIViewController And a UiView. In the UIViewController "viewDidLoad" method, I instantiate the UIView and in the UIView "drawRect" method, I draw the shapes like

How can i draw smooth freehand drawing using shapelayer and bezierpath over an image

纵然是瞬间 提交于 2019-12-11 06:59:21
问题 let path = UIBezierPath() shapeLayer.strokeColor = UIColor.blue.cgColor shapeLayer.lineWidth = 3 path.move(to: startPoint) path.addLine(to: point) shapeLayer.lineJoin = kCALineJoinRound shapeLayer.path = path.cgPath tempImage.layer.addSublayer(shapeLayer) I am using the above code. Calling the above code each tome the touch is moved. I am not getting a continuous drawing . only the final portion of my drawing is visible.Is there anything i am missing here. 回答1: I achieved a smooth drawing

How to add a UIBezierPath to a MKMapView using overlays

一笑奈何 提交于 2019-12-11 06:56:02
问题 I 've been trying to add a half circle to a map view using a custom MKOverlayPathView subclass and a custom class which confirms to but I cannot get anything to show up on the map view. I use a UIBezierPath to create the path for the circle, but no matter what I try, I cannot see my path... Does anyone have an example program in which a UIBezierPath is being used as overlay? Thank you! Tim Edit: Answer to Anna's question: I can draw MKCircleViews without any problem, but I seem to struggle

how to draw smoothly with a flat nib pen / traped brush effect like Instagram using core graphics..?

淺唱寂寞╮ 提交于 2019-12-11 06:35:24
问题 I tried some code to calculate control points between start and end point of bezier path with touch move , add lines to bezier path and fill with colour to give flat pen effect like Instagram but unable to get smooth curved lines with fast finger move. from the below code I am able to get angled lines not smooth like instagram in image if (_bezierPath == nil || _brushType == BrushTypeNeon) { _bezierPath = [UIBezierPath new]; } [_bezierPath moveToPoint:(CGPoint){self.controlPoint1.x + self

How to get a bezier path from a UIImage removing its alpha parts?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 04:33:45
问题 Given this image: Is there a way to get a bezier path of the non-alpha parts from this image? Here, it would be the part delimited by the cat. I know how to mask an image with another one: func maskImage(image: UIImage, withMask maskImage: UIImage) -> UIImage { let maskRef = maskImage.cgImage let mask = CGImage( maskWidth: maskRef!.width, height: maskRef!.height, bitsPerComponent: maskRef!.bitsPerComponent, bitsPerPixel: maskRef!.bitsPerPixel, bytesPerRow: maskRef!.bytesPerRow, provider:

How to make universal round draws (with lineDashPattern) with UIbezierPath on Swift

*爱你&永不变心* 提交于 2019-12-11 04:29:57
问题 I'm about to make a universal Tuner app but when I try to draw an Analog meter it gets messed on different devices. Maybe it's very hardcoded.. Check this: The labels are under the same UIView too. Check the code to draw these paths: override func draw(_ rect: CGRect) { let center = CGPoint(x:bounds.width/2, y: bounds.height) var radius: CGFloat = max(bounds.width, bounds.height+50) // Define the thickness of the arc. let arcWidth: CGFloat = 1 let startAngle: CGFloat = π let endAngle: CGFloat

Getting a CGPoint on a UIBezierpath

送分小仙女□ 提交于 2019-12-11 04:14:49
问题 In my app I have a MKOverlayPathView where I draw a QuadCurve between two points which works just fine. Here is the code I use: MKMapPoint mkDepPoint = MKMapPointForCoordinate([(RoutePath *)self.overlay startCoordinate]); MKMapPoint mkArrPoint = MKMapPointForCoordinate([(RoutePath *)self.overlay endCoordinate]); CGPoint dePoint = [self pointForMapPoint:mkDepPoint]; CGPoint arrPoint = [self pointForMapPoint:mkArrPoint]; CGPoint s = depPoint; CGPoint e = arrPoint; ... some awesome code ...