Ios 是否可以在UIImage上同时应用橡皮擦大小、橡皮擦不透明度和橡皮擦硬度?
我们已经创建了橡皮擦大小,橡皮擦不透明度和橡皮擦硬度。 我们可以在UIImage上同时应用橡皮擦大小和橡皮擦不透明度,如下所示Ios 是否可以在UIImage上同时应用橡皮擦大小、橡皮擦不透明度和橡皮擦硬度?,ios,objective-c,swift,core-graphics,core-image,Ios,Objective C,Swift,Core Graphics,Core Image,我们已经创建了橡皮擦大小,橡皮擦不透明度和橡皮擦硬度。 我们可以在UIImage上同时应用橡皮擦大小和橡皮擦不透明度,如下所示 CGContextRef context = UIGraphicsGetCurrentContext(); [img_BG drawInRect:area_BG]; CGContextSetLineCap(context, kCGLineCapRound); CGContextSetLineWidth(context, self.actualSizeEraser); C
CGContextRef context = UIGraphicsGetCurrentContext();
[img_BG drawInRect:area_BG];
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.actualSizeEraser);
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGContextSetAlpha(context, opacity);
CGContextBeginPath(context);
CGContextMoveToPoint(context, ox, oy);
CGContextAddLineToPoint(context, nx, ny);
CGContextStrokePath(context);
CGContextRef context = UIGraphicsGetCurrentContext();
[img_BG drawInRect:area_BG];
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.actualSizeEraser);
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
CGContextMoveToPoint(context, ox, oy);
CGContextAddLineToPoint(context, nx, ny);
CGContextSetShadowWithColor(context, CGSizeMake(0.1, -0.1), softness, strokeColor);
CGContextStrokePath(context);
我们也可以在UIImage上同时应用橡皮擦大小和橡皮擦硬度,如下所示
CGContextRef context = UIGraphicsGetCurrentContext();
[img_BG drawInRect:area_BG];
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.actualSizeEraser);
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGContextSetAlpha(context, opacity);
CGContextBeginPath(context);
CGContextMoveToPoint(context, ox, oy);
CGContextAddLineToPoint(context, nx, ny);
CGContextStrokePath(context);
CGContextRef context = UIGraphicsGetCurrentContext();
[img_BG drawInRect:area_BG];
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.actualSizeEraser);
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
CGContextMoveToPoint(context, ox, oy);
CGContextAddLineToPoint(context, nx, ny);
CGContextSetShadowWithColor(context, CGSizeMake(0.1, -0.1), softness, strokeColor);
CGContextStrokePath(context);
现在我们要在UIImage上同时应用橡皮擦大小、橡皮擦不透明度和橡皮擦硬度。
如果有人这样做了,请分享想法
谢谢