Return to Snippet

Revision: 54424
at December 23, 2011 04:08 by ppaulojr


Initial Code
- (void) drawLine:(CGPoint) pt {
    

    UIGraphicsBeginImageContext(mainimg.frame.size);
    [mainimg.image drawInRect:CGRectMake(0, 0, mainimg.frame.size.width, mainimg.frame.size.height)];
    
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetLineCap(ctx, kCGLineCapButt);
    CGContextSetLineWidth(ctx,2.0);
    CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0);
    CGContextBeginPath(ctx);
    CGContextAddEllipseInRect (ctx,CGRectMake(pt.x-2.0, pt.y-2.0, 4, 4));
    CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor);
    CGContextFillPath(ctx);

    CGContextStrokePath(ctx);
    mainimg.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
}

Initial URL
http://www.netfilter.com.br

Initial Description
mainimg is a UIImageView

Initial Title
Draw Over UIImageView

Initial Tags


Initial Language
Objective C