core-graphics

How to superimpose views over each captured frame inside CVImageBuffer, realtime not post process

只谈情不闲聊 提交于 2019-12-06 17:58:31
问题 I have managed to setup a basic AVCaptureSession which records a video and saves it on device by using AVCaptureFileOutputRecordingDelegate . I have been searching through docs to understand how we can add statistics overlays on top of the video which is being recorded. i.e. As you can see in the above image. I have multiple overlays on top of video preview layer. Now, when I save my video output I would like to compose those views onto the video as well. What have I tried so far? Honestly, I

How To Remove Line in Core Graphics

老子叫甜甜 提交于 2019-12-06 16:26:52
I draw a line using CGContextAddLineToPoint in my app now i want to remove line from given points how can i do this i am using touches for drawing line You can erase, Given the two points, draw the line with same attributes(lineWidth etc.,) by setting the CGContextSetBlendMode(context, kCGBlendModeClear) . 来源: https://stackoverflow.com/questions/10601691/how-to-remove-line-in-core-graphics

Rendering UIImage/CGImage into CGPDFContext results in… blankness!

痴心易碎 提交于 2019-12-06 15:54:51
I'm trying to take an image that I have in a image object and render into a Core Graphics PDF context-- happens to be on an iPhone but this question surely applies equally to desktop Quartz. This UIImage is a simple color-on-white image at about 600x800 resolution. If I (say) turn it into a PNG file, that file looks exactly as expected-- so the data is OK. Here's what I'm doing to generate the PDF: NSMutableData * outputData = [[NSMutableData alloc] init]; CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData((CFMutableDataRef)outputData); CFMutableDictionaryRef attrDictionary = NULL

How to make a filling progress circle in iOS?

筅森魡賤 提交于 2019-12-06 15:03:14
I need to make a progress circle like this: I have created a CAShapeLayer for the circle, and animate its strokeEnd property like this: pieShape = CAShapeLayer() pieShape.path = UIBezierPath(arcCenter: CGPointMake(29, 29), radius: 27.0, startAngle: CGFloat(startAngle), endAngle: CGFloat(endAngle), clockwise: true).CGPath pieShape.fillColor = UIColor.clearColor().CGColor pieShape.strokeColor = UIColor.blackColor().CGColor pieShape.lineWidth = 4.0 self.layer.addSublayer(pieShape) let countDownAnimation = CABasicAnimation(keyPath: "strokeEnd") countDownAnimation.duration = durationInSeconds

Xcode 6.0.1, Swift, UIKit, CoreGraphics missing

♀尐吖头ヾ 提交于 2019-12-06 14:15:17
To make it short: Do never ever give a project a frameworks name! I called my project "CoreGraphics". Original question: I cant use CoreGraphics in a newly created simple Single View Application I start Xcode 6.0.1 (6A317) New Project: Single View Application: Swift New File: Cocoa Touch Class "CustomView" of type UIView I uncomment the template for drawRect(rect: CGRect) {} Compiler Error: Use of undeclared type 'CGRect'. import UIKit is in place I tried to add CoreGraphics to "Linked Frameworks and Libraries" I already restarted Xcode (and my Mac) Update I installed Xcode 6.1 (6A1046a)

Converting a CGLayer to a *transparent* UIImage and PNG file in CoreGraphics iphone

两盒软妹~` 提交于 2019-12-06 14:01:31
问题 I've been making a simple painting app for the iphone. I'm trying to convert the drawn image to a transparent PNG (I don't want a white background). I'd also like to get a UIImage representation to use in a UIImageView. Currently, I respond to touch events and draw paths to a CGLayer which is then drawn to my views context. I have access to both the CGLayer as well as the view itself. Currently, I output my view to an image using: UIGraphicsBeginImageContext(drawingView.bounds.size);

iOS - Change color channels levels programmatically

我们两清 提交于 2019-12-06 13:26:46
Is it possible to adjust color levels using Core Graphics? I would like to adjust channels using parametrized curves in the Gimp or other graphic editor style. You can use this: ios-image-filters (like photoshop) if you want to manipulate levels, here's your method, built straight onto the UIImage class: - (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white 来源: https://stackoverflow.com/questions/7567934/ios-change-color-channels-levels-programmatically

PDF rendering using CGContextDrawPDFPage : cannot find CropBox

一曲冷凌霜 提交于 2019-12-06 13:06:50
I need to display the content of PDF files that i receive from a Web Service. My problem is that all PDF boxes returns the same value. Do you have any idea what can be wrong with the files i'm using ? CGPDFPageRef drawPDFPageRef = CGPDFPageRetain( CGPDFDocumentGetPage(pdf, 1) ); CGRect cropBoxRect = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFCropBox); CGRect mediaBoxRect = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFMediaBox); cropBoxRect = (0,0,595,842) mediaBoxRect = (0,0,595,842) When i display the PDF in a UIWebView the content is ok This is the PDF rendered by a UIWebView This is the PDF

How to add Image at the particular area in a template image

馋奶兔 提交于 2019-12-06 12:42:07
This is a template image ( http://i.stack.imgur.com/9ME6A.jpg ) in which multiple circular area are available. we need, when we click on any circular area (one by one ) then gallery should be open and after selecting the image from gallery that image should be shown on the selected circular area. Please provide me any link or demo for my problem. i am stucking here. Thanks! Make a viewController with 5 "UIImageView" views. Arrange as you need it Place there your smile images. Add UITapGestureRecognizer into every UIImageView and catch them Open UIImagePicker and make your VC as a delegate

Convert MKCircle Radius to CoreGraphics Arc Radius

人盡茶涼 提交于 2019-12-06 12:39:59
问题 How can I convert an MKCircle's radius (in meters) into a value I can use to draw a circle using core graphics in an MKOverlayPathView subclass? In the following code the radius is hardcoded to 50 but I need it to reflect the radius of the MKCircle. For the position I use MKMapPointForCoordinate() to convert the MKCircle's coordinate to an MKMapPoint, then convert the MKMapPoint to a point using MKOverlayPathView's pointForMapPoint:. But how can I convert the MKCircle's radius into a relative