NSBezierPath is a class responsible for constructing and drawing paths in Cocoa.
Questions tagged [nsbezierpath]
150 questions
3
votes
1 answer
Filter on CALayer except for a shape which is an union of (non necessarily distinct) rectangles
I want to apply a CIFilter to a CALayer except for an area which is an union of rectangles.
I post my not working code, it does exactly the opposite, i.e. the filter is applied only in the rectangles and not outside!
func…

Nisba
- 3,210
- 2
- 27
- 46
3
votes
3 answers
How do I draw a top-right rounded corner on a NSButton?
There are several ways to four draw rounded corners in Cocoa, either using CALayer or NSBezierPath. But how can I draw a single rounded corner on a NSButton?
The current structure of the button is:
NSButton *button = [[NSButton alloc]…

Christoffer
- 25,035
- 18
- 53
- 77
3
votes
1 answer
How to get the path Quartz is using to stroke a NSBezierPath
I'm using this code to stroke a NSBezierPath with a wide, dashed, black line.
(c and strForBezier are defined somewhere else)
NSGlyph glyph;
for(n = 0; n < len; n++) {
glyph = [font glyphWithName: [strForBezier substringWithRange:NSMakeRange(n,…

alecail
- 3,993
- 4
- 33
- 52
3
votes
2 answers
Draw line in Cocoa?
How i can draw a line in a specific window after a button click?
i'm using this:
NSBezierPath * path = [NSBezierPath bezierPath];
[path setLineWidth: 4];
NSPoint startPoint = { 21, 21 };
NSPoint endPoint = { 128,128 };
…

Corninos
- 31
- 1
- 2
2
votes
1 answer
How to create custom font at runtime using NSFont
I'm writing a Mac application that needs to be able to create, load, and use custom fonts at runtime using Cocoa. I've researched the NSFont class thoroughly, and all I can find is API's to load existing fonts and change simple parameters (E.G.…

exists-forall
- 4,148
- 4
- 22
- 29
2
votes
1 answer
Redrawed inset NSShadow on a Custom View using -setClip method
I have and odd problem, related with the answer of this question:
Draw an Inset NSShadow and Inset Stroke
I use this code into the drawRect method of a custom view. I have exactly this:
- (void)drawRect:(NSRect)rect
{
// Create and fill the…

Jordi Tost
- 99
- 1
- 9
2
votes
2 answers
Which is the best SVG to NSBezierPath library/class?
I am looking for the best SVG to NSBezierPath parser, it's ok if the class/library only takes a string of SVG commands, here is an example:
M 435.722 403.542 h -232.44 v -293 h 232.44 c 0 0 0 35.108 0 81.019 c 0.049 2.551 0.079 5.135 0.154 7.748 c…

Robin
- 8,197
- 11
- 45
- 74
2
votes
1 answer
How to blur the border of the mask for an NSImage?
I am trying to blur the border of the mask for an NSImage in swift and I can't figure out, how to do this. The mask is supposed to be created from a CGMutablePath, so that it can be changed programmatically. This is what it looks like at the…

Frederik Mrozek
- 155
- 6
2
votes
2 answers
how to get buffer zone around a uibezierpath
i have some uibezierpaths. as paths, they don't really have thickness.
but, I am hoping to find a way to define an area around a path like the grayish areas around the lines in this picture
basically, i want to test whether drawn lines fall within…

Lordof Theflies
- 301
- 1
- 6
- 16
2
votes
1 answer
How do I draw a rectangle with equal line widths into an NSStatusItemButton?
The following code draws a rectangle with NSBezierPath into an NSImage, which is then set as the image for an NSStatusItemButton.
import Cocoa
class ViewController: NSViewController {
let statusItem: NSStatusItem =…

Johannes Bittner
- 3,503
- 2
- 23
- 21
2
votes
1 answer
Drawing lines and points with Cocoa
I'm trying to draw some dots connected with lines. The dot consists of the "nucleus" with orbital area around it.
The problem appears when I try to move those dots which gives me distorted lines:
In my drawRect: method I iterate over an array of…

Eimantas
- 48,927
- 17
- 132
- 168
2
votes
3 answers
How can I get NSScrollView to respect a clipping path
I am trying to make a NSScrollView with clipped corners, similar to the Twitter app:
I have a NSScrollView subclass which I added the following code:
- (void)drawRect:(NSRect)dirtyRect {
NSBezierPath *pcath = [NSBezierPath…

coneybeare
- 33,113
- 21
- 131
- 183
2
votes
1 answer
NSBezierPath Cubic Bezier CurveTo looks like a straight line
I am creating an application that reads in SVG files, parses them, and redraws them in Cocoa using NSBezierPath. The following vector path:
M0 126C0.0507812 106.402 0.443359 78.6089 24.0781 76.0034 29.9937 75.3516 34.063 75.6162 39.6509 74 50.0083…

diatrevolo
- 2,782
- 26
- 45
2
votes
1 answer
Cocoa NSView: Making circles but they are getting cropped
the outer edges of my circle at each point of the compass are getting cropped (presumably by the rect frame). How do I get the circle to display within the frame? (This is getting created from a button click):
In my AppController.m
#import…

PruitIgoe
- 6,166
- 16
- 70
- 137
2
votes
2 answers
How to get bounds of UIBezierPath excluding control points
NSBezierPath provides an API called bounds that returns bounds without control points.
Is there any equivalent API in UIBezierPath to return the path bounds excluding control points?

spd
- 2,114
- 1
- 29
- 54