Skip to content

Instantly share code, notes, and snippets.

@taberh
Created September 14, 2012 01:45
Show Gist options
  • Save taberh/3719322 to your computer and use it in GitHub Desktop.
Save taberh/3719322 to your computer and use it in GitHub Desktop.
Use Core Graphics draw triangle
void drawTriangle(CGContextRef context, CGPoint startPoint, CGPoint secondPoint, CGPoint lastPoint)
{
CGContextSaveGState(context);
CGContextMoveToPoint(context, startPoint.x, startPoint.y);
CGContextAddLineToPoint(context, secondPoint.x, secondPoint.y);
CGContextAddLineToPoint(context, lastPoint.x, lastPoint.y);
CGContextClosePath(context);
CGContextFillPath(context);
CGContextRestoreGState(context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment