日本国旗

来源:互联网 发布:php ajax post 编辑:程序博客网 时间:2024/04/27 21:01


#import "drawpicture.h"


@implementation drawpicture


- (void)drawRect:(CGRect)rect {

    CGContextRef context =UIGraphicsGetCurrentContext();

    

    CGContextMoveToPoint(context,100, 100);

  //  CGContextAddLineToPoint(context, 100, 100);

   // CGContextAddRect(context,CGRectMake(100, 100, 200, 100));

    CGContextAddEllipseInRect(context,CGRectMake(125,125, 50, 50));

    

    //画边框

    //    CGContextStrokePath(context);

    //只填充

    //    CGContextFillPath(context);

    

    //设置填充色

     //   [[UIColor redColor] setFill];

    [[UIColorcolorWithRed:1green:0blue:0alpha:0.5]setFill];

    

    //设置边框颜色

    //    [[UIColor blueColor] setStroke];

    

    //    [[UIColor greenColor] set];

    

    //EVEN-ODD奇偶规则填充

    CGContextDrawPath(context,kCGPathEOFillStroke);

    

  //  CGContextMoveToPoint(context, 200, 200);

  //  CGContextAddArc(context, 100, 200, 100, 0, M_PI_2, 0);

   // CGContextAddLineToPoint(context, 0, 100);

    

    //control point

//CGContextAddCurveToPoint(context, 50, 0, 50, 200, 100, 100);

  //  CGContextAddQuadCurveToPoint(context, 150, 0, 200, 100);

    CGContextAddRect(context,CGRectMake(100,100, 150, 100));

    CGContextStrokePath(context);

    

}


@end


0 0
原创粉丝点击