Questions tagged [nsbezierpath]

NSBezierPath is a class responsible for constructing and drawing paths in Cocoa.

150 questions
0
votes
0 answers

How to get the y value(s) of an NSBezierPath given any x value as input

I have an NSBezierPath which is shows a visual description of some data. As such, I not only need to see the NSBezierPath visually, I also would like to query it at any x value to determine the corresponding y value(s). In short, I would like to use…
dmann200
  • 529
  • 4
  • 11
0
votes
1 answer

Remove a drawn NSRect or other drawn object

How do I remove a drawn NSRect or other object other than drawing another rect over it?
evdude100
  • 437
  • 4
  • 18
0
votes
1 answer

Completely remove NSBezierPath?

In my code, I have a function that draws lines on the screen using the following code: func drawLine (pointArray:[[[Double]]]) -> NSBezierPath{ var path:NSBezierPath = NSBezierPath() let color = NSColor(red:0.0, green: 1.0, blue:0.0,…
Ztan
  • 25
  • 1
  • 6
0
votes
1 answer

NSBezierPath line thins out

I'm trying to draw a power function curve in a 300x300 pixel rectangle using NSBezierPath as follows: -(void)drawPowerCurve:(float)power points:(int)numbPoints{ NSBezierPath * path = [NSBezierPath bezierPath]; [path setLineWidth: 1.0]; …
Jim Merkel
  • 352
  • 2
  • 9
0
votes
1 answer

How to interpolate an NSBezierPath/UIBezierPath and retrieve normal Vector at location?

I have an NSBezierPath. I would like to interpolate along in a way that interpolate (0) = starting point interpolate (1) = end point interpolate (0.5) = middlePoint. I would like as well a function that provides a normal vector at the point. I…
Wizard of Kneup
  • 1,863
  • 1
  • 18
  • 35
0
votes
0 answers

How To Correctly Use SpriteKit's SKRegion.byIntersection(with:)?

I am trying to leverage the byIntersection(with:) method of SKRegion in SpriteKit, since it is part of the standard iOS distribution and I would rather not include yet another library if I can avoid it or, God forbid, write my own, since arbitrary…
jmdecombe
  • 782
  • 6
  • 16
0
votes
1 answer

Swift: NSBezier

This is the code inside my custom view class: func drawTestingPoint(_ point: CGPoint, target: Int, output: Int) { let path = NSBezierPath() path.appendArc(withCenter: point, radius: 5, startAngle: 0, endAngle: 360) …
l30c0d35
  • 777
  • 1
  • 8
  • 32
0
votes
1 answer

macOS Use CGContextRef and always black

I try to use this solution to build a gradient circle by @Johnny Rockex on macOS.But I got some problems. In the @Johnny Rockex original answer //3.1 setup UIBezierPath * bezierPath; CGPoint center = CGPointMake(dimension/2,…
Koiost
  • 105
  • 1
  • 11
0
votes
1 answer

Cocoa NSBezierPath - stroke. Crashes with color different from predefined one

I have the following problem. I'm writing my own class which must draw a circle of specified size, fill it with gradient. I made it with a circle being a NSBezierPath, to which I draw my gradient using [gradient drawInBezierPath:circle…
BartoNaz
  • 2,743
  • 2
  • 26
  • 42
0
votes
1 answer

Turn a BezierPath into an SVG file

I have a NSBezierPath produced from code below, and I want to turn this path into a svg file (see the svg code below) that I can import into Adobe Illustrator. Any ideas how to do this? BezierPath description NSColor* color0 = [NSColor…
Bob Ueland
  • 1,804
  • 1
  • 15
  • 24
0
votes
1 answer

What is the correct way to determine the bounds of NSBezierPath to ensure correct repainting on macOS

I am having some trouble figuring out the correct way to determine the bounds of NZBezierPath for redrawing correctly. As you can see from the picture below the thin border line seems to be falling outside the NSBezierPath.bounds rectangle. The code…
Duncan Groenewald
  • 8,496
  • 6
  • 41
  • 76
0
votes
1 answer

NSBezierPath AddClip to mask NSImage - Size issue

On a macOS (OSX) desktop app, I use NSBezierPath to draw a random closed shape which looks like this. As you can see the dashed line shows the closed path which was drawn. Now am trying to extract the masked image as per this path. But i get a…
KamyFC
  • 858
  • 9
  • 17
0
votes
1 answer

Drawing an NSBezierPath Shape with NSView Subclass

I'm trying to draw a shape that is created with NSBezierPath on an NSView canvas. I've created a subclass of NSView. // NSView // import Cocoa class DisplayView: NSView { var path: NSBezierPath var fillColor: NSColor var strokeColor:…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
0
votes
1 answer

CGPathRef / Bezier Curves in OpenGL-ES

I am considering porting an iPhone project from core animation to OpenGL-ES. I need to render a button that is constructed from CGPathRef s. But it seems that GL has no provision for Bezier Curves. Can anyone provide some code that renders a Bezier…
P i
  • 29,020
  • 36
  • 159
  • 267
0
votes
1 answer

How to draw smooth path with NSBezierPath

I am draing path with NSBezierPath currently: - (void)drawRect:(NSRect)dirtyRect { [[NSColor blueColor] set]; [path stroke]; } But the line seems pretty ugly(not smooth) Then I googled for some solutions and I got this: -…
supersurabbit
  • 441
  • 1
  • 8
  • 14