Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cacaodev/355567 to your computer and use it in GitHub Desktop.
Save cacaodev/355567 to your computer and use it in GitHub Desktop.
issue #585
- (void)drawRect:(CGRect)rect
{
var ctx = [[CPGraphicsContext currentContext] graphicsPort];
CGContextSetFillColor(ctx, [CPColor redColor]);
var path = CGPathCreateMutable();
CGPathAddRect(path,NULL,CGRectMake(10,10,50,50));
CGContextAddPath(ctx, path);
CGContextFillPath(ctx);
CGContextSetFillColor(ctx, [CPColor blueColor])
path = CGPathCreateMutable();
CGPathAddRect(path,NULL,CGRectMake(80,10,50,50));
CGContextAddPath(ctx, path);
CGContextFillPath(ctx);
}
- (void)drawRect:(NSRect)rect
{
CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort];
CGContextSetRGBFillColor(ctx, 1, 0, 0, 1);
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path,NULL,CGRectMake(10,10,50,50));
CGContextAddPath(ctx, path);
CGContextFillPath(ctx);
CGContextSetRGBFillColor(ctx, 0, 0, 1, 1);
path = CGPathCreateMutable();
CGPathAddRect(path,NULL,CGRectMake(80,10,50,50));
CGContextAddPath(ctx, path);
CGContextFillPath(ctx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment