quartz-graphics

How can I draw a shadow beyond a UIView's bounds?

心已入冬 提交于 2019-12-04 20:33:47
I'm using the method described at How do I draw a shadow under a UIView? to draw shadow behind a view's content. The shadow is clipped to the view's bounds, although I disabled "Clip Subviews" in Interface Builder for the view. Is it possible to draw a shadow around a view and not only in a view? I don't want to draw the shadow inside the view because the view would receive touch events for the shadow area, which really belongs to the background. It is not encouraged to draw outside view bounds. Maybe you can include the shadow directly in your background... Regards, Instead of manual drawing

Drawing a path with CAKeyFrameAnimation on iPhone

谁说我不能喝 提交于 2019-12-04 20:21:40
问题 I want to draw a path gradually, i.e. I want the path to appear as if it is drawn by hand. I have managed to create the path I need. I have also managed to create a CAKeyFrameAnimation that uses this path. But so far I can only move an object along this path. I would like to both move an object (say a pencil) along the path, and have the path appear as if it is drawn. Any pointers? 回答1: Create a CAShapeLayer with your path and animate the layer's strokeEnd from 0.0 to 1.0 . (This is new in

Combining UIView animation blocks and OpenGL ES rendering

这一生的挚爱 提交于 2019-12-04 20:07:37
问题 I am developing an iP* game and I make use of both UIKit and OpenGL ES 2.0. The UIKit elements are rendered over the OpenGL view and occupy a significant (arbitrary) amount of screen space. I must admit that Apple has done an excellent work and the frame rate of the game is always 60 FPS. In order to come to this conclusion I made many tests regarding the performance: I added lots of static (not moving) UIViews over the OpenGL view -- OK! I animated using custom code the same UIViews

Snap to grid effect with Quartz 2d? iphone dev

我怕爱的太早我们不能终老 提交于 2019-12-04 19:19:41
Still an iphone dev starter but trying. I would like to have the user touch the screen at which point a pin (dot) will be placed on the view. I have accomplished this (yey) but i would like to have snap to grip effect, and can not come up with a solution. This is how i am placing that dot: CGPoint drawPoint = CGPointMake(lastTouch.x - horizontalOffset, lastTouch.y - >verticalOffset); [drawImage drawAtPoint:drawPoint]; //Tell the image to draw itself I have a grid as a background on a Viewcontroller, overlapping that grid i have a UIView with custom drawing that displays a pin every time the

How to draw a triangle with QUARTZ 2D?

此生再无相见时 提交于 2019-12-04 19:09:14
I'm developing an iPhone app with 3.1.3 SDK. I'm trying to draw a triangle with transparent fill an 1px black stroke with this code: CGContextMoveToPoint(ctx, position.X, position.Y - (size.height / 2)); CGContextAddLineToPoint(ctx, position.X - (size.width / 2), position.Y + (size.height / 2)); CGContextAddLineToPoint(ctx, position.X + (size.width / 2), position.Y + (size.height / 2)); CGContextFillPath(ctx); CGContextSetLineWidth(ctx, 1.0); CGContextStrokePath(ctx); CGContextSetFillColorWithColor(ctx, [[UIColor clearColor] CGColor]); But I get a black filled triangle. What am I doing wrong?

How do I take a screenshot of a view which has transform?

有些话、适合烂在心里 提交于 2019-12-04 18:30:36
I'm able to crop a view with this code - (UIImage *)captureScreenInRect:(CGRect)captureFrame { CALayer *layer; layer = self.view.layer; UIGraphicsBeginImageContext(self.view.bounds.size); CGContextClipToRect (UIGraphicsGetCurrentContext(),captureFrame); [layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return screenImage; } But I have an imageview zoomed in with transform and it isn't shown to scale. How do I capture EXACTLY what the user sees on the screen Aaron Brager The Stack Overflow

iOS CoreImage Edge detection

こ雲淡風輕ζ 提交于 2019-12-04 17:48:52
I am writing an iOS as and I need to be able to do edge detection in the image. I actually want something similar to Photoshop's trace contour. Since I basically need to get the simplest set of lines to work with.. Thing is I cannot seem to figure out how to do it and frankly I have 0 interest in OpenCV since I spent 5 hours today trying to get any of the 10 or so zips of it I downloaded to compile, in any way shape or form. So I was hoping maybe some one could point me the right way to do it with what's built in to the os.. or maybe an example If haven't used it myself, but are you looking

How can I highlight a chunk of text on an image taken by Camera view

元气小坏坏 提交于 2019-12-04 16:37:48
I am working on an OCR project. My first task is to take an image from iPhone camera and then locate a specific word on the image. Below is a sample image taken by my device, now I want to find the position of word "STATIONERY" and highlight it with a yellow rectangle on image. How can I do that? Do I need to first use an OCR SDK for that (like ABBYY) or can I do this otherwise? If you need to get the coordinates of a specific word, of course you need to perform OCR first. Keep in mind you'll probable have some difficulties with that paticullar image you've attached because of its bottom part.

Draw an image in Additive Blend Mode without using OpenGL

蓝咒 提交于 2019-12-04 14:47:17
I want to draw an image using an additive blend mode. But I don't want to use OpenGL. I can't find anything to do this, maybe there's something in Quartz2D? Can anyone point me in the right direction? Cheers, Rich Krzysztof Zabłocki Sure there is enum CGBlendMode which you can use to specify blending operation. use method: CGContextSetBlendMode() or [image drawInRect:CGRectMake(0, 0, width, height) blendMode:mode alpha:1]; more at developer site: link text 来源: https://stackoverflow.com/questions/3908160/draw-an-image-in-additive-blend-mode-without-using-opengl

Add an annotation on a pdf

空扰寡人 提交于 2019-12-04 14:07:11
问题 I have to develop a iPad app which can view a PDF file and draw some predefined annotations on it dynamically. It's like http://plangrid.com/ do. I went though WWDC videos, stackoverflow and some other blogs. But could not find a way to add a controller bar on the PDF. And drag a annotation from it and drop on the PDF. I have an idea about to view a PDF. I followed ZoomingPDFViewer example. Please advise me. I'm using XCode 4 and iOS 4.3. 回答1: I'm not sure if you found the following