iOS-UIImage图片绘制颜色
程序员文章站
2022-09-07 13:05:54
- (UIImage *)dtk_setImageColor:(UIColor *)imageColor{ //获取画布 UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); //画笔沾取颜色 [imageColor setFill... ......
- (uiimage *)dtk_setimagecolor:(uicolor *)imagecolor{ //获取画布 uigraphicsbeginimagecontextwithoptions(self.size, no, 0.0f); //画笔沾取颜色 [imagecolor setfill]; cgrect bounds = cgrectmake(0, 0, self.size.width, self.size.height); //绘制一次 uirectfill(bounds); //再绘制一次 [self drawinrect:bounds blendmode:kcgblendmodeoverlay alpha:1.0f]; //获取图片 [self drawinrect:bounds blendmode:kcgblendmodedestinationin alpha:1.0f]; uiimage *image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return image; }
上一篇: Python-接口自动化(四)
下一篇: 疫情过后第一天