quartz-graphics

CGContextSetLineWidth(context, 1) - the width is almost alwayas at least 2 pixels instead 1

末鹿安然 提交于 2019-12-05 16:10:28
问题 With CGContextSetLineWidth(context, 1) the width is almost alwayas at least 2 pixels instead 1 QQCandleStickLayer.m -(id)init { self = [super init]; if(self != nil) { self.delegate = self; self.opaque = NO; } return self; } - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context{ CGContextSetLineWidth(context, 1.0f); CGContextSetAllowsAntialiasing(context, false); CGContextSetShouldAntialias(context, false); CGContextSetInterpolationQuality(context,kCGInterpolationNone);

Event taps: Varying results with CGEventPost, kCGSessionEventTap, kCGAnnotatedSessionEventTap, CGEventTapPostEvent

送分小仙女□ 提交于 2019-12-05 15:23:20
I'm running into a thorny problem with posting an event from an event tap. I'm tapping for NSSystemDefined at kCGHIDEventTap, then replacing the event with a new one. The problem I'm running in to is that depending on how I post the event, it's being seen only by some applications. My test applications are Opera, Firefox, Quicksilver, and Xcode. Here are the different techniques I've tried within my event tap callback, with results. I'm expecting an action (the "correct response") from each app; "system beep" means the nothing-is-bound-to-that-key system sound. Create a new event, and return

How to compare a shape drawn on the screen to a letter?

限于喜欢 提交于 2019-12-05 12:03:43
I want to check the drawn shape matches a letter from the alphabet. It's a kids app for learning. When any one draw the shape then how can i detect it's a correct letter? I don't have any sample code for you but this is how I'd do this, I think. You need to define or get a bezier path describing the shape of each letter - this would be an outline of a solid letter, not just a line drawing the letter shape. There may be a way to get this from the api, obtaining a bezier path from a glyph, or you may have to design them yourself. You then need to scale the bezier path so it is roughly the same

How to scan links in a PDF document?

纵饮孤独 提交于 2019-12-05 06:21:34
问题 How can I scan links in a PDF Document? Do I have to use Quartz? Which methods/functions? 回答1: Yes, you need to use Quartz. You have to parse it out from the PDF. This guide can help you. http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html#//apple_ref/doc/uid/TP30001066-CH220-TPXREF101 I recommend reading the PDF specification so you will know what to look for. 回答2: The links are stored in the Annotations object so

Siri chat bubble color's in iOS

大城市里の小女人 提交于 2019-12-05 05:25:04
问题 I tried creating the Siri chat bubble in core graphics. I am at a stage where I can draw the shape. I am stuck with the color's here. Wanaa get the border color and the fill color code. here is what I did so far.. - (void)drawInContext:(CGContextRef)context { CGRect rect = gradientRectFrame; CGFloat radius = 30; CGFloat originBufferX = 0.0; CGFloat originBufferY = 0.0; CGFloat rightAngleTriangleWidth = 20.0; CGFloat rightAngleTriangleHeight = 20.0; CGFloat fullRectWidth = rect.size.width;

Curving/warping views with CoreAnimation or OpenGL for carousel effect

你离开我真会死。 提交于 2019-12-05 03:21:47
Right now I'm populating a UIScrollView with a series of views. The views need to be warped to make the UIScrollView appear like a carousel. In other words when the user scrolls it needs to be like a circle. I've never done anything quite like this before, but I'm assuming CoreAnimation is out of the question and OpenGL needs to be used. If this is possible with CoreAnimation or Quartz then I really just need a sample on how to warp the views and I can figure the rest out myself but I'm not familiar with OpenGL. In my experience, it is a bit tricky to get the values right. The way to give a

Create the indented look found in UINavigationBarButton - programmatically

拈花ヽ惹草 提交于 2019-12-05 02:51:24
问题 I'm trying to programmatically recreate the indented button look that can be seen on a UINavigationBarButton. Not the shiny two tone look or the gradient, just the perimeter shading: It looks like an internal dark shadowing around the entire view perimeter, slightly darker at the top? And then an external highlighting shadow around the lower view perimeter. I've played a bit with Core Graphics, and experimented with QuartzCore and shadowing with view.layer.shadowRadius and .shadowOffset, but

iPhone Performance Differences in Quartz Drawing vs. Pre-Baked Images (which I guess simplifies to Quartz vs. Quartz)

≡放荡痞女 提交于 2019-12-05 00:53:04
问题 New to Quartz and I am curious on the drawing speeds of simple shapes, gradients, and shadows; specifically comparing Quartz drawing functions to Quartz image drawing on the iPhone. Say that I need to draw a filled, stroked, and shadowed rectangle. I'm assuming that importing a pre-baked rect as a PNG and drawing it using drawInRect: or drawAtPoint: is faster than using Quartz's drawing functions to draw the same thing, since the latter requires explicit calculations. On the other hand,

UIbezierpaths in a zoomable view

℡╲_俬逩灬. 提交于 2019-12-04 22:37:31
问题 I draw bezierpaths in a zoomable UIView (drawing layer of a pdf reader). When I zoom in the document the UIView zoom in too, but then all the drawings and lines looks much more pixelated. Is there a way to render those paths without too much pixelation? It supposed that bezier paths are vectorial based... Thanks in advance! 回答1: You are correct that a UIBezierPath is vector based. However, when you draw a path into a view, it uses the contentScale property on the views layer to determine the

Rotate image in Quartz? Image is upside down! (iPhone)

梦想的初衷 提交于 2019-12-04 20:36:15
I don't want to transform the ENTIRE context. I'm making a game with Quartz, and I'm drawing my player with lines, rects and ellipses. And then I have diamong.png which I rendered at 0,0 in the top left of the screen. Problem is... It renders upside down! How would I rotate it 180 degrees? Here's some of my code: CGImageRef diamondImage = CGImageRetain([UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Diamond.png" ofType:nil]].CGImage); CGContextDrawImage(context, CGRectMake(0, 0, 32, 24), diamondImage); If it's of any help, I'm using Landscape mode, with home button