Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSRect rect = NSMakeRect(10, 10, 10, 10);
- NSBezierPath* circlePath = [NSBezierPath bezierPath];
- [circlePath appendBezierPathWithOvalInRect: rect];
- [[NSColor blackColor] setStroke];
- [[NSColor redColor] setFill];
- [path stroke];
- [path fill];
- - (void)drawRect:(NSRect)rect
- {
- // Get the graphics context that we are currently executing under
- NSGraphicsContext* gc = [NSGraphicsContext currentContext];
- // Save the current graphics context settings
- [gc saveGraphicsState];
- // Set the color in the current graphics context for future draw operations
- [[NSColor blackColor] setStroke];
- [[NSColor redColor] setFill];
- // Create our circle path
- NSRect rect = NSMakeRect(10, 10, 10, 10);
- NSBezierPath* circlePath = [NSBezierPath bezierPath];
- [circlePath appendBezierPathWithOvalInRect: rect];
- // Outline and fill the path
- [circlePath stroke];
- [circlePath fill];
- // Restore the context to what it was before we messed with it
- [gc restoreGraphicsState];
- }
- CGContextRef c = UIGraphicsGetCurrentContext();
- CGContextSetRGBFillColor(c, 40, 0, 255, 0.1);
- CGContextSetRGBStrokeColor(c, 0, 40, 255, 0.5);
- // Draw a green solid circle
- CGContextSetRGBFillColor(c, 0, 255, 0, 1);
- CGContextFillEllipseInRect(c, CGRectMake(100, 100, 25, 25));
Add Comment
Please, Sign In to add comment