core-graphics

Animating on some part of UIBezier path

痴心易碎 提交于 2019-12-25 06:27:47
问题 I have two UIBezierPath... First path shows the total path from to and fro destination and the second path is a copy of the first path but that copy should be a percentage of the first path which I am unable to do. Basically I would like the plane to stop at the part where green UIBezier path ends and not go until the past green color. I am attaching a video in hte link that will show the animation I am trying to get. http://cl.ly/302I3O2f0S3Y Also a similar question asked is Move CALayer via

Animating on some part of UIBezier path

本小妞迷上赌 提交于 2019-12-25 06:27:29
问题 I have two UIBezierPath... First path shows the total path from to and fro destination and the second path is a copy of the first path but that copy should be a percentage of the first path which I am unable to do. Basically I would like the plane to stop at the part where green UIBezier path ends and not go until the past green color. I am attaching a video in hte link that will show the animation I am trying to get. http://cl.ly/302I3O2f0S3Y Also a similar question asked is Move CALayer via

Merge connected UIBezierPaths

自闭症网瘾萝莉.ら 提交于 2019-12-25 05:09:54
问题 Is there some way (code or pseudo-code algorithm) to utilize UIBezierPath instance methods like appendPath to "merge" any number of connected, distinct UIBezierPath s into a single big path? In a document with many paths, I am trying to reduce the encoded file size by perhaps reducing the number of paths as there is surely some redundant information there. If I am barking up the wrong tree, let me know. 回答1: well if its only an esthetically problem...just set the first point of the 2nd bezier

CGPDFDocumentCreateWithURL fails (Toll-Free bridging of NSURL to CFURLRef)

梦想的初衷 提交于 2019-12-25 04:54:12
问题 I've got the following function: - (void)loadPdfFromPath:(NSString*)path { NSURL *pathUrl = [NSURL URLWithString:path]; _pdfDocument = CGPDFDocumentCreateWithURL((CFURLRef)pathUrl); } Which from the documentation I'm lead to believe will work because you can case from an NSURL* to a CFURLRef via Toll-Free Bridging. However, this function fails, and I get the following output in the log: CFURLCreateDataAndPropertiesFromResource: error code -15. NB: -15 = kCFURLImproperArgumentsError However,

Repeating busy circle animation

断了今生、忘了曾经 提交于 2019-12-25 03:54:42
问题 I am currently trying to create a busy animation that looks like this: The broken part of the loop continually spins around the circle to signal that an operation is in progress. I am defining two circles using CAShapeLayer, one circle is 'filling in' the circle with strokeEnd and the other is 'clearing' with strokeStart. The 'clearing circle' starts 1/10 of the way in front of the 'filling circle': NSInteger radius = self.frame.size.width / 2; CGFloat lineWidth = radius / 7.5; UIColor *color

iOS: How to efficiently blur an image?

被刻印的时光 ゝ 提交于 2019-12-25 03:22:38
问题 I have an image that is stored a RGBA format in memory. I've written a blur routine that works fine for small blur radii, however big ones like 16 point take forever. Is there an efficient way using CoreImage etc to blur an image? Will using it cause any loss in image quality? 回答1: Have you tried the built-in CIGaussianBlur? One thing you could do to improve your performance is the following: Use the CILanczosScaleTransform filter to scale-down your image. Perform a low-radius blur using

Flip the Image when saving out to disk

与世无争的帅哥 提交于 2019-12-25 02:47:20
问题 I am currently using the following code to write a CGContext to a PNG on disk: CGImageRef image = CGBitmapContextCreateImage(context); UIImage *myImage = [UIImage imageWithCGImage:image]; NSData *data = UIImagePNGRepresentation(myImage); [data writeToFile:path atomically:YES]; I found that the orientation of the resultant file is flipped from the way it appears on the screen(on an iPhone). What is the best way to flip this image on save so that when I later load the image it will be up right?

Smooth UIBezierPath

情到浓时终转凉″ 提交于 2019-12-25 00:14:03
问题 I created in a playground a uibezierpath added manually values and it works fine. The results is : Now my goal is to smooth the curve and remove these "sharp" corners. I'm thinking on a interpolation function but not sure. Below my actual code : //: Playground - noun: a place where people can play import Foundation import UIKit import CoreGraphics import QuartzCore class DemoView: UIView { override func draw(_ rect: CGRect) { let origin = CGPoint(x: frame.size.width / 2, y: frame.size.height

Gradient Color To CGContextRef

亡梦爱人 提交于 2019-12-24 21:20:09
问题 I am drawing 4 arcs using CGContextRef.I can fill colour but now i want to set gradient color to that arcs.I did it.it is working fine.Now i want to set different color to each arc.Is there any way to do it?please help me.I am attaching my code and screenshot of that arc.Code : CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); CGFloat comps[] = {1.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0}; CGFloat locs[] = {0,1}; CGGradientRef g = CGGradientCreateWithColorComponents(space, comps, locs, 2);

Unable to Release Quartz 2D and Core Text created Images

若如初见. 提交于 2019-12-24 21:15:41
问题 I am having a problem deleting my OpenGL ES textures are created via Quartz 2D and Core Text as shown below : - (void)drawText:(CGContextRef)contextP startX:(float)x startY:(float) y withText:(NSString *)standString { CGContextTranslateCTM(contextP, 0, (bottom-top)*2); CGContextScaleCTM(contextP, 1.0, -1.0); CGRect frameText = CGRectMake(1, 0, (right-left)*2, (bottom-top)*2); NSMutableAttributedString * attrString = [[NSMutableAttributedString alloc] initWithString:standString]; [attrString