| Paste number 49811: | shadow offset |
| Pasted by: | simonpe^ |
| When: | 1 year, 8 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+12FN |
| Channel: | #macdev |
| Paste contents: |
[self setBounds:NSMakeRect(-margin*bounds,-margin*bounds,bounds*(1+2*margin),bounds*(1+2*margin))];
NSRect boundsRect = [self bounds];
CGRect pageRect = CGRectMake( boundsRect.origin.x, boundsRect.origin.y, boundsRect.size.width, boundsRect.size.height );
CGContextRef myContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextBeginPage(myContext, &pageRect);
//
// Draw the path
//
CGContextSaveGState(myContext); // Save the context so we can add shadows
CGContextSetShadow (myContext, shadowOffset, 5); // Set shadow
CGContextSetLineJoin(myContext,kCGLineJoinBevel); // Set the join style
CGContextSetRGBStrokeColor(myContext,0.2f,0.2f,1.0f,1.0f); // Set the stroke color
CGContextBeginPath ( myContext ); // Begin drawing
for ( int i = 0 ; i < xvec.size()-1 ; i++)
{
CGContextMoveToPoint(myContext, xvecScaled[i], yvecScaled[i]);
CGContextAddLineToPoint(myContext, xvecScaled[i+1], yvecScaled[i+1]);
}
CGContextStrokePath( myContext );
CGContextRestoreGState(myContext);This paste has no annotations.