I have an NSBezierPath object. Its path can make a shape like a triangle, octagon or whatever. I could create an NSImage object by clipping a color rectangle with this path. But that's not what I want to do because I want to add a stroke to the path. For now, I have the following code in creating a path making some shape.
[[NSColor greenColor] set];
NSBezierPath *path = [NSBezierPath bezierPath];
makeBezierPath *makebezier = [[makeBezierPath alloc] init]; // NSBezierPath subclass
path = [makebezier makePath:4:1:NSMakeRect(0,0,200.0f,200.0f)];
[path fill];
[path setLineWidth:10.0f];
[path closePath];
[[NSColor greenColor] set];
[path stroke];
I would like to make an NSImage object right out of this path. Is that possible? The other reference I have found so far is this one. I could display the shape with an NSView subclass and then convert that view into NSImage, which is not what I want to do, either.
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire