擦除石英2D中的操作

时间:2010-05-23 20:16:10

标签: iphone sdk quartz-graphics quartz-2d

有关如何在Quartz 2D中执行擦除操作的任何建议吗?

2 个答案:

答案 0 :(得分:0)

CGContextClearRect(UIGraphicsGetCurrentContext(), rect);

答案 1 :(得分:0)

   if (clear) {

        CGContextSetBlendMode(UIGraphicsGetCurrentContext(),kCGBlendModeNormal);
        CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [UIColor              colorWithPatternImage:[UIImage imageNamed:@"rainbow-colors-orange-320x480.jpg"]].CGColor);
       // your background image. make sure it is same size

   } else {
        CGContextSetBlendMode(UIGraphicsGetCurrentContext(),kCGBlendModeNormal);
        NSUInteger red, green, blue;
        sscanf([stringColor UTF8String], "#%02X%02X%02X", &red, &green, &blue);
        UIColor *colors = [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1];
        CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [colors CGColor]);

   }