Tag: drawing

CALayer and view disappeared

I have a large image managed with CATiledLayer (like the Large Image Downsizing iOS sample code). I had a drawing view (UIView overrided with drawing methods) on it but when I zoom a lot, I get the following message and my view disappeared.. -[<CALayer: 0xb253aa0> display]: Ignoring bogus layer size (25504.578125, 15940.361328) Is there a […]

How to Draw a line pixel by pixel using objective C

I want to draw a line(on iphone) such that i can view each pixel being draw. I am currently calling the drawRect method using a timer. Following is the code where i am drawing a wave using the values from an array: static int i=0; int x = 10; int y = 0; int x2; […]

My program is spending most of its time in objc_msgSend. Does that mean that Objective-C has bad performance?

I have written an application that has a number of custom views and generally draws a lot of lines and bitmaps. Since performance is somewhat critical for the application, I spent a good amount of time optimizing draw performance. Now, activity monitor tells me that my application is usually using about 12% CPU and Instrument […]

Efficiency Problems with Finger Drawing

I want to develop an app to draw touching the iPhone screen an searching how to do it I have found an example recipe (09-Paint) into the chapter eight of the Erica Sadun iPhone Developers Cookbook 3.0 Code Samples. In the example, as you could see under this lines, the touches over the screen are […]

Set order on displaying paths/images

I have a couple of arcs and rects in a UIView, and a UIImageView as well. I want to have the UIImageView in the background. I have ordered it in IB so that the image view is behind my labels and buttons. First, I need to put an image in the image view, which I […]

CoreGraphics: Using finger strokes to erase part of image?

I’m working on drawing code to erase part of an image. I’m not an expert on CoreGraphics and could use some help. This routine works fine, however, when moving fast, it loses touches (Not very smooth). Can this routine be modified to make CGContextClearRect smoother? Is there a better, faster way to do this? -(void)drawRect:(CGRect)rect […]

Crazy rounded rect UIBezierPath behavior on iOS 7. What is the deal?

The simple UIView below draws a rounded rectangle. When I pass a corner radius of 65 or below it rounds correctly, but 66 and above and it generates a perfect circle! What is going on here? It should only show a circle when the corner radius is equal to 1/2 the frame width, but it […]

Is there a way to get the x,y co-ordinates of all points of a NSBezierPath object?

If i have a NSBezierPath object , is there a way to get co-ordinates(x,y) of all the points drawn. I want to move a NSRect along the path.

setNeedsDisplay not working?

I have a problem redrawing a custom view in simple cocoa application. Drawing is based on one parameter that is being changed by a simple NSSlider. However, although i implement -setParameter: and -parameter methods and bind slider’s value to that parameter in interface builder i cannot seem to make a custom view to redraw itself. […]

Stroking paths using a pattern color to simulate brush texture

I am making a finger painting app and I am having a hard time giving my brush a nice brush-like feel and texture. I have this code: UIColor * brushTexture = [UIColor colorWithPatternImage:[UIImage imageNamed:@”Brush_Black.png”]]; CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), brushTexture.CGColor); but my output is like this: The texture of my brush is tiled. How can I make it fit […]