Level : WORDPRESS BOOK LINKEDIN PATENT Send Mail 동냥하기 hajunho.com

drawrect

OpenSRC+ChatGPT / / 2020. 11. 25. 16:41
반응형

 

CGRect r = CGRectMake(0, image.size.height - 80, image.size.width, 75);

    image = [self drawRectangleOnImage:image rect:r];

    [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];

 

 

//  Converted to Swift 5.3 by Swiftify v5.3.19197 - https://swiftify.com/

let r = CGRect(x: 0, y: image.size.height - 80, width: image.size.width, height: 75)

image = drawRectangle(onImage: image, rect: r)

image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height))

 

-(UIImage *)drawRectangleOnImage:(UIImage *)img rect:(CGRect )rect{

    CGSize imgSize = img.size;

    CGFloat scale = 0;

    UIGraphicsBeginImageContextWithOptions(imgSize, NO, scale);

    [img drawAtPoint:CGPointZero];

    [[UIColor whiteColor] setFill];

    UIRectFill(rect);

    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return newImage;

}

 

//  Converted to Swift 5.3 by Swiftify v5.3.19197 - https://swiftify.com/

func drawRectangle(on img: UIImage?, rect: CGRect) -> UIImage? {

    let imgSize = img?.size

    let scale: CGFloat = 0

    UIGraphicsBeginImageContextWithOptions(imgSize ?? CGSize.zero, false, scale)

    img?.draw(at: CGPoint.zero)

    UIColor.white.setFill()

    UIRectFill(rect)

    let newImage = UIGraphicsGetImageFromCurrentImageContext()

    UIGraphicsEndImageContext()

    return newImage

}

반응형

'OpenSRC+ChatGPT' 카테고리의 다른 글

pkg mng system. brew -> port  (0) 2020.11.27
#define to let  (0) 2020.11.26
date  (0) 2020.11.25
drawText  (0) 2020.11.24
포로그래메트리  (0) 2020.10.04
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기