2011-04-08 217 views
3

我试图与2px的透明边框绘制图像:CoreGraphics中:图像透明背景

CGContextRef context = UIGraphicsGetCurrentContext(); 

CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 0.0); 

CGContextAddRect(context, CGRectMake(0.0, 0.0, outputImageSize.width, outputImageSize.height)); 
CGContextDrawPath(context, kCGPathFill); 


[image drawInRect:CGRectMake(2.0, 
          ((outputImageSize.height - userPhotoImageSize.height)/2.0) +2.0, 
          userPhotoImageSize.width -4.0, 
          userPhotoImageSize.height -4.0)]; 


UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); 

UIGraphicsEndImageContext(); 

它使越来越黑边(背景)... =(任何想法


解决了,其中我设置图像uiimageview只是简单的黑色背景=(上述代码的作品!

+0

这是从哪里调用? – 2011-04-11 02:02:04

回答

1

解决了,我设置图像uiimageview只是简单的黑色背景=(上述代码w兽人!