quartz-2d

How to search text in pdf document with quartz

泄露秘密 提交于 2019-12-03 08:51:46
问题 I'm using quartz to display pdf. I need to get the indexes of pages where my searching text exists. Anyone can help me? Thanks. Solution: There is a sample of code that extracts a text from the page and check it for the sequences. #import <Foundation/Foundation.h> @interface PDFSearcher : NSObject { CGPDFOperatorTableRef table; NSMutableString *currentData; } @property (nonatomic, retain) NSMutableString * currentData; -(id)init; -(BOOL)page:(CGPDFPageRef)inPage containsString:(NSString *

How to create a CGLayer from a UIView for off-screen drawing

本小妞迷上赌 提交于 2019-12-03 08:18:03
I have read what I believe to be the relevant parts of the Quartz 2D Programming Guide, but cannot find an answer to the following (they don't seem to talk a lot about iOS in the document): My application displays a drawing in a UIView . Every now and then I have to update the drawing in some way, e.g. change the fill colour of one of the shapes (I keep CGPathRefs to the important shapes to be able to redraw them with a different fill colour later). As described in the Section "Drawing With a CGLayer" on page 169 of the aforementioned document, I was thinking of drawing the entire drawing into

How to display text using Quartz on the iPhone?

為{幸葍}努か 提交于 2019-12-03 08:16:59
I've been trying to display text using a Quartz context, but no matter what I've tried I simply haven't had luck getting the text to display (I'm able to display all sorts of other Quartz objects though). Anybody knows what I might be doing wrong? example: -(void)drawRect:(CGRect)rect { // Drawing code CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSelectFont(context, "Arial", 24, kCGEncodingFontSpecific); CGContextSetTextPosition(context,80,80); CGContextShowText(context, "hello", 6); //not even this works CGContextShowTextAtPoint(context, 1,1, "hello", 6); } Darron Here is a

In iOS Development, using Core Graphics and/or Quartz 2D, how can I draw a circle filled with a gradient in such a manner that it looks like a sphere?

徘徊边缘 提交于 2019-12-03 07:55:14
So far I have looked at using CGContextDrawLinearGradient() and CGContextDrawRadialGradient(), however, with the former I can't figure out how to make the gradient look like a sphere, and with the latter, I can't figure out how to make the gradient into the shape of a sphere, because every time I try, it turns out in the shape of the full cylinder instead of only a sphere. The code I am using to current draw a 2D circle is shown below. I would like to use a gradient or any other method possible using only Core Graphics and/or Quartz 2D to fill the circle in a manner that makes it look like a

How do I achieve continuous rotation of an NSImage inside NSImageView?

百般思念 提交于 2019-12-03 06:01:33
问题 FUTURE VIEWERS: I have managed to finish this rotation animation and code with description can be found on tho question. NSImage rotation in NSView is not working Before you proceed please up vote Duncan C 's answer. As I manage to achieve this rotation from his answer. I have an image like this, I want to keep rotating this sync icon, On a different thread. Now I tried using Quartz composer and add the animation to QCView but it is has very crazy effect and very slow too. Question : How do I

Recreate Siri Button Glow Animation

空扰寡人 提交于 2019-12-03 05:23:43
问题 Is there any way of duplication the siri button glow animation? It looks absolutely gorgeous, but I have no idea at the moment how to start... are there online preformatted pngs that are rotated? or is it done with CoreAnimation? 回答1: I believe that Siri animation is made with CAEmitterLayer and CAEmitterCell and then animated with core animation, but I might be totally wrong. Here's some code that imitates the effect: // create emitter layer self.emitterLayer = [CAEmitterLayer layer]; self

Drawing triangle/arrow on a line with CGContext

一笑奈何 提交于 2019-12-03 05:15:51
问题 I am using the framework of route-me for working with locations. In this code the path between two markers(points) will be drawn as a line. My Question: "What code should I add if I want to add an arrow in the middle(or top) of the line, so that it points the direction" Thanks - (void)drawInContext:(CGContextRef)theContext { renderedScale = [contents metersPerPixel]; float scale = 1.0f / [contents metersPerPixel]; float scaledLineWidth = lineWidth; if(!scaleLineWidth) { scaledLineWidth *=

How to add a transparent gradient mask to a context

会有一股神秘感。 提交于 2019-12-03 03:58:56
I am using quartz 2d to draw a pie chart. I use layer to draw a reflection of the pie chart on the bottom. I would like to add a transparent alpha gradient to the reflection to make the it more and more transparent until it gets invisible. Someone has an idea ? @EDIT : more details My pie chart is in a CGLayerRef. I first draw this layer to the CGContextRef. Then I do a CGContextTranslateCTM(context, 0, rect.size.height); CGContextScaleCTM(context, 1.0, -1.0); To be upside down. Then i draw my layer a new time Thanks in advance, Loic You need to use an image mask. You can make the mask by

Quartz 2D or OpenGL ES? Pros and cons in the long term, possibility of migration to other platforms

跟風遠走 提交于 2019-12-03 03:45:00
I'm having a hard time deciding whether to go with Quartz2D or OpenGL for an iPad game. It will be 2D mostly, but effect-intense (simultaneous lighting effects for 10-30 objects, 10-20 simultaneous animations on the screen). So far, assuming i'm equally dumb in both technologies and have to learn them from the ground, i came to this list. (I've read several topics here, on SO, with names like "Quartz or OpenGL", but i'm still left with some questions) Quartz : Better time-to-market, because of ready to use absractions like UIView, UIImageView, CoreAnimation abstractions Open GL ES Closer to

3d text effect in iOS

别来无恙 提交于 2019-12-03 00:56:52
问题 I want to render some text on one of my screens that has a 3dish look to it. I am using UIKit and standard views controllers etc. The effect will look something like this: Can this be done somehow with UIKit & iOS? Ordinarily I would just use a static png however, the text is dynamic and updates based on user data 回答1: The following code might not be perfect, but it should be a good starting point. Basically you draw the font twice, slightly changing the size and the offset. Depending on the