quartz-core

color replacement in image for iphone application

自闭症网瘾萝莉.ら 提交于 2019-11-27 05:17:35
问题 Basically i want to implement color replacement feature for my paint application. Below are original and expected output Original: After changing wall color selected by user along with some threshold for replacement I have tried two approaches but could not got working as expected Approach 1: Queue-based Flood Fill algorithm for color replacement but with i got below output with terribly slow and wall shadow has not been preserved. Approach 2: So i have tried to look at another option and

How to access iOS private APIs in Swift?

眉间皱痕 提交于 2019-11-27 02:14:03
问题 How can I call non-public iOS functions and acces non public properies from Swift? Specifically, I would like to use one non-public class in QuartzCore framework. One solution that came to my mind is to create "bridging" Objective-C project that would wrap this non-public APIs into public ones and than call this Objective-C functions from Swift. However, my solution is pure Swift now and I would prefer to keep it that way. Is there any more staitforward way? (for example adding something to

CALayer with transparent hole in it

拟墨画扇 提交于 2019-11-26 23:29:42
I have a simple view (left side of the picture) and i need to create some kind of overlay (right side of the picture) to this view. This overlay should have some opacity, so the view bellow it is still partly visible. Most importantly this overlay should have a circular hole in the middle of it so it doesn't overlay the center of the view (see picture bellow). I can easily create a circle like this : int radius = 20; //whatever CAShapeLayer *circle = [CAShapeLayer layer]; circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0,radius,radius) cornerRadius:radius].CGPath; circle

How to make a circular UIView

↘锁芯ラ 提交于 2019-11-26 21:40:50
I want to make a UIView or UIImageView that is a circle. Or a circle that i can change the size of using a slider, and the color of with a pickerview. willc2 I can at least show you a shortcut for drawing circles of arbitrary size. No OpenGL, no Core Graphics drawing needed. Import the QuartzCore framework to get access to the .cornerRadius property of your UIView or UIImageView. #import <QuartzCore/QuartzCore.h> Also manually add it to your project's Frameworks folder. Add this method to your view controller or wherever you need it: -(void)setRoundedView:(UIImageView *)roundedView toDiameter:

iOS: what's the fastest, most performant way to make a screenshot programmatically?

自古美人都是妖i 提交于 2019-11-26 16:55:37
in my iPad app, I'd like to make a screenshot of a UIView taking a big part of the screen. Unfortunately, the subviews are pretty deeply nested, so it takes to long to make the screenshot and animate a page curling afterwards. Is there a faster way than the "usual" one? UIGraphicsBeginImageContext(self.bounds.size); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); If possible, I'd like to avoid caching or restructuring my view. I've found a better method that uses the snapshot API

How to draw radial gradients in a CALayer?

旧时模样 提交于 2019-11-26 12:04:02
问题 I know CAGradientLayer doesn\'t support radial gradient at the moment and only has option of kCAGradientLayerAxial . I want something like below: I have looked around for this issue and found that there is a way around this. But the explanations were not clear to me. So I want to know if I can draw radial gradients using CAGradientLayer and if so, then how to do it? 回答1: From what I understood, you just need a layer that draws a gradient, and CGContextDrawRadialGradient works perfectly for

iOS: what&#39;s the fastest, most performant way to make a screenshot programmatically?

℡╲_俬逩灬. 提交于 2019-11-26 06:04:26
问题 in my iPad app, I\'d like to make a screenshot of a UIView taking a big part of the screen. Unfortunately, the subviews are pretty deeply nested, so it takes to long to make the screenshot and animate a page curling afterwards. Is there a faster way than the \"usual\" one? UIGraphicsBeginImageContext(self.bounds.size); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); If possible, I\