How do I create a new image by drawing on top of an existing one using Quartz?

前端 未结 3 1123
一向
一向 2021-02-10 11:15

i have a view with uiimageview i assign this uiimageview image by camera..now i want to do some drawing onto image....using coregraphics.i want to do something like this... sele

3条回答
  •  独厮守ぢ
    2021-02-10 12:03

    A lot easier solution would be

    (UIImage *) modifyImage:(UIImage *)inputImage
    {
       UIGraphicsBeginImageContext(inputImage.size);
       [inputImage drawInRect:CGRectMake(0, 0, inputImage.size.width, inputImage.size.height);
       CGContextRef ctx = UIGraphicsGetCurrentContext();
       //Drawing code using above context goes here
       /*
        *
        */
       UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
       UIGraphicsEndImageContext();
       return outputImage;
    }
    

提交回复
热议问题