
UIImage *eyes = [UIImage imagenamed:@"eyes"]; UIImage *mouth = [UIImage imagenamed:@"mouth"]; UIGraphicsBeginImageContext(CGSizeMake(150,150)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillcolor(context,1); CGContextFillRect(context,bounds); [eyes drawInRect:bounds blendMode:kCGBlendModeMultiply Alpha:1]; [mouth drawInRect:bounds blendMode:kCGBlendModeMultiply Alpha:1]; // how can i Now get a CGImageRef here to use in a masking operation? UIGraphicsEndImageContext();
现在,正如你在评论中看到的那样,我想知道我是如何实际使用我建立的图像的.我在这里使用核心图形而不仅仅是构建UIImage的原因是我正在创建的透明度非常重要.如果我只是从上下文中获取UIImage,当它被用作掩码时,它将仅适用于所有内容……更重要的是,使用此方法使用部分透明的掩码会有任何问题吗?
解决方法CGImageRef result = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext());总结
以上是内存溢出为你收集整理的ios – 如何从上下文绘制的图像中获取CGImageRef?全部内容,希望文章能够帮你解决ios – 如何从上下文绘制的图像中获取CGImageRef?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)