Cutting skills in iPhone applications

Source: Internet
Author: User

DetailsIPhone applicationsMediumCutting skillsThis is the content to be introduced in this article. It mainly introduces the application skills in the iphone, but there are not many content. Let's take a look at the details.IPhone applicationsInCutting skillsList.

1. Obtain the image Context

2. Construct the cut path (SHAPE)

3. Build a cut area

4. paste your painting

 
 
  1. // 1CGContextRef context = UIGraphicsGetCurrentContext();  
  2. // 2CGRect bounds = CGRectMake(0.0f, 0.0f, SIDELENGTH, SIDELENGTH);  
  3.  
  4. CGMutablePathRef path = CGPathCreateMutable();CGPathAddEllipseInRect(path, NULL, bounds);  
  5. // 3CGContextAddPath(context, path);CGContextClip(context);  
  6. // 4[LOGO drawInRect:bounds]; 

Screenshot

 
 
  1. // Create a bitmap-based image context and specify the size as CGSizeMake (200,400)
  2. UIGraphicsBeginImageContext (CGSizeMake (200,400 ));
  3.  
  4. // RenderInContext presents the receiver and Its subrange to the specified context
  5. [Self. view. layer renderInContext: UIGraphicsGetCurrentContext ()];
  6. // Returns an image based on the current image context.
  7. UIImage * aImage = UIGraphicsGetImageFromCurrentImageContext ();
  8. // Remove the image context at the top of the stack based on the current bitmap
  9. UIGraphicsEndImageContext ();
  10.  
  11. // Return the data of the specified image in png format
  12. ImageData = UIImagePNGRepresentation (aImage );

Summary: DetailsIPhone applicationsMediumCutting skillsI hope this article will help you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.