2012-02-25 9 views
1

私のiPhoneアプリケーションでは、画像に異なる罫線を適用したいと考えています。私はカメラから画像をキャプチャしています。今、私はいくつかの異なる境界線を持っており、その境界線を画像に適用したいと思います。それ、どうやったら出来るの ??iPhoneで罫線のある画像

答えて

2
- (UIImage*)imageWithBorderFromImage:(UIImage*)source 
{ 
    CGSize size = [source size]; 
    UIGraphicsBeginImageContext(size); 
    CGRect rect = CGRectMake(0, 0, size.width, size.height); 
    [source drawInRect:rect blendMode:kCGBlendModeNormal alpha:1.0]; 

    CGContextRef context = UIGraphicsGetCurrentContext(); 
    CGContextSetRGBStrokeColor(context, 1.0, 0.5, 1.0, 1.0); 
    CGContextStrokeRect(context, rect); 
    UIImage *testImg = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 
    return testImg; 

} Hafeez氏aadil

+0

感謝 – DipakSonara

関連する問題