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
- // 1CGContextRef context = UIGraphicsGetCurrentContext();
- // 2CGRect bounds = CGRectMake(0.0f, 0.0f, SIDELENGTH, SIDELENGTH);
-
- CGMutablePathRef path = CGPathCreateMutable();CGPathAddEllipseInRect(path, NULL, bounds);
- // 3CGContextAddPath(context, path);CGContextClip(context);
- // 4[LOGO drawInRect:bounds];
Screenshot
- // Create a bitmap-based image context and specify the size as CGSizeMake (200,400)
- UIGraphicsBeginImageContext (CGSizeMake (200,400 ));
-
- // RenderInContext presents the receiver and Its subrange to the specified context
- [Self. view. layer renderInContext: UIGraphicsGetCurrentContext ()];
- // Returns an image based on the current image context.
- UIImage * aImage = UIGraphicsGetImageFromCurrentImageContext ();
- // Remove the image context at the top of the stack based on the current bitmap
- UIGraphicsEndImageContext ();
-
- // Return the data of the specified image in png format
- ImageData = UIImagePNGRepresentation (aImage );
Summary: DetailsIPhone applicationsMediumCutting skillsI hope this article will help you.