quartz-graphics

iPhone smooth sketch drawing algorithm

核能气质少年 提交于 2019-11-26 03:46:42
问题 I am working on a sketching app on the iPhone. I got it working but not pretty as seen here And I am looking for any suggestion to smooth the drawing Basically, what I did is when user places a finger on the screen I called - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event then I collect a single touch in an array with - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event and when the user lefts a finger from the screen, I called - (void) touchesEnded:(NSSet *

How do I draw a line on the iPhone?

走远了吗. 提交于 2019-11-26 03:09:40
问题 I am a beginner at iPhone programming, and would like to draw a line to the phone screen for the purpose of study using Quartz and UIKit. How do I start drawing? 回答1: The first step is to define a subclass of UIView, to create a space to draw in. If you're starting with a new application, the easiest way will be to start with the "Window-based application" template. Then go New File and create an "Objective-C Class" with "Subclass of" set to "UIView", and give it a name, say MyView.m. Now

Get PDF hyperlinks on iOS with Quartz

僤鯓⒐⒋嵵緔 提交于 2019-11-26 02:40:25
问题 I\'ve spent all day trying to get hyperlinks metadata from PDFs in my iPad application. The CGPDF* APIs are a true nightmare, and the only piece of information I\'ve found on the net about all this is that I have to look for an \"Annots\" dictionary, but I just can\'t find it in my PDFs. I even used the old Voyeur Xcode sample to inspect my test PDF file, but no trace of this \"Annots\" dictionary... You know, this is a feature I see on every PDF reader - this same question has been asked

Retrieving a pixel alpha value for a UIImage

馋奶兔 提交于 2019-11-26 00:47:54
问题 I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from [UIImageView image] and created a RGBA byte array from this. Alpha is premultiplied. CGImageRef image = uiImage.CGImage; NSUInteger width = CGImageGetWidth(image); NSUInteger height = CGImageGetHeight(image); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); rawData = malloc(height * width * 4); bytesPerPixel = 4; bytesPerRow = bytesPerPixel * width; NSUInteger