quartz-graphics

What are the alternatives to Core-Plot for drawing graphs in iPhone SDK

人走茶凉 提交于 2019-11-27 19:56:18
问题 Are there any alternatives to Core-Plot for drawing graphs in iPhone SDK? I am having hard time integrating core-plot in my app. Lot of issues. Can you please suggest some alternatives to core-plot? 回答1: Some of the alternatives that I found were: http://sebkade.wordpress.com/2010/05/06/basic-graph-class-for-iphone/ http://www.rgraph.net/ http://www.ivisualization.com/ http://www.vvi.com/apps/vvidget http://cocoacontrols.com/platforms/ios/controls/tapku-graph (thanks Sudo for this link) http:

How can I check if a user tapped near a CGPath?

一世执手 提交于 2019-11-27 19:54:07
Scenario: I have a set of CGPath s. They are mostly just lines (i.e. not closed shapes). They are drawn on the screen in a UIView 's draw method. How can I check if the user tapped near one of the paths? Here's what I had working: UIGraphincsBeginImageContext(CGPathGetBoundingBox(path)); CGContextRef g = UIGraphicsGetCurrentContext(); CGContextAddPath(g,path); CGContextSetLineWidth(g,15); CGContextReplacePathWithStrokedPath(g); CGPath clickArea = CGContextCopyPath(g); //Not documented UIGraphicsEndImageContext(); So what I'm doing is creating an image context, because it has the functions I

CGContextDrawAngleGradient?

匆匆过客 提交于 2019-11-27 18:54:01
Dipping my feet into some more Core Graphics drawing, I'm attempting to recreate a wicked looking metallic knob, and I've landed on what is probably a show-stopping issue. There doesn't seem to be any way to draw angle gradients in Core Graphics. I see there's CGContextDrawRadialGradient() and CGContextDrawLinearGradient() , but there's nothing that I see that would allow me to draw an angle gradient. Does anyone know of a workaround, or a bit of framework hidden away somewhere to accomplish this without pre-rendering the knob into an image file? AngleGradientKnob http://dl.dropbox.com/u

Performing a double click using CGEventCreateMouseEvent()

浪子不回头ぞ 提交于 2019-11-27 18:51:14
I'm using the following code to simulate a click of the mouse: void PostMouseEvent(CGMouseButton button, CGEventType type, const CGPoint point) { CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, point, button); CGEventSetType(theEvent, type); CGEventPost(kCGHIDEventTap, theEvent); CFRelease(theEvent); } void LeftClick(const CGPoint point) { PostMouseEvent(kCGMouseButtonLeft, kCGEventMouseMoved, point); NSLog(@"Click!"); PostMouseEvent(kCGMouseButtonLeft, kCGEventLeftMouseDown, point); PostMouseEvent(kCGMouseButtonLeft, kCGEventLeftMouseUp, point); } I can use basically the same code

UIImageWriteToSavedPhotosAlbum save as PNG with transparency?

自闭症网瘾萝莉.ら 提交于 2019-11-27 18:25:42
I'm using UIImageWriteToSavedPhotosAlbum to save a UIImage to the user's photo album. The problem is that the image doesn't have transparency and is a JPG. I've got the pixel data set correctly to have transparency, but there doesn't seem to be a way to save in a transparency-supported format. Ideas? EDIT: There is no way to accomplish this, however there are other ways to deliver PNG images to the user. One of which is to save the image in the Documents directory (as detailed below). Once you've done that, you can email it, save it in a database, etc. You just can't get it into the photo

iOS iPhone is it possible to clone UIView and have it draw itself to two UIViews?

允我心安 提交于 2019-11-27 14:59:05
问题 I'm thinking of a way to have a UIView render itself onto another UIView as well as the first one. So I have my main UIView with it's bounds, and the UIView also renders itself in some other UIView. Is this possible ? Does it require extensive layer operations? 回答1: Don't know whats your real intention is, but this will draw the view twice, userinteraction etc. will not work on the second view. Also this solution does not take care of different frame sizes. Header of the View you want to

Convert html file to PDF Document in iOS using Cocoa-Touch

邮差的信 提交于 2019-11-27 14:15:20
问题 I want to convert local html file on iPhone to PDF document. I have used the following code I found online to generate PDF file from Picture, I tried to replace the image with the html file but it failed. I would very much appreciate your help. Thanks in advance, // Our method to create a PDF file natively on the iPhone // This method takes two parameters, a CGRect for size and // a const char, which will be the name of our pdf file void CreatePDFFile (CGRect pageRect, const char *filename) {

CALayer and Off-Screen Rendering

假装没事ソ 提交于 2019-11-27 14:07:54
问题 I have a Paging UIScrollView with a contentSize large enough to hold a number of small UIScrollViews for zooming, The viewForZoomingInScrollView is a viewController that holds a CALayer for drawing a PDF page onto. This allows me to navigate through a PDF much like the ibooks PDF reader. The code that draws the PDF (Tiled Layers) is located in: - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx; And simply adding a 'page' to the visible screen calls this method automatically. When

Detect if CGPoint within polygon

断了今生、忘了曾经 提交于 2019-11-27 13:01:42
问题 I have a set of CGPoints which make up a polygon shape, how can I detect if a single CGPoint is inside or outside of the polygon? Say, the shape was a triangle and the CGPoint was moving hoizontally, how could I detect when it crossed the triangle line? I can use CGRectContainsPoint when the shape is a regular 4-sided shape but I can't see how I would do it with an odd shape. 回答1: You can create a CG(Mutable)PathRef (or a UIBezierPath that wraps a CGPathRef ) from your points and use the

How exactly to make a CGImageRef from an image on disk

浪尽此生 提交于 2019-11-27 12:35:11
问题 I've looked around everywhere to no avail. I'm doing some image loading in a thread and since UIKit is not thread safe I'm going to have to store the images as CGImageRefs but I can't figure out how to do this. I haven't played with any of the Quartz stuff before so it's confusing me. Basically I just need to load a JPG from the disk into a CGImageRef. Also for bonus points, is there anyway to load a GIF into a CGImageRef? 回答1: gcamp is more or less correct, you are pretty safe to use this on