quartz-graphics

Quartz 2d / Core Graphics: What is the right way to draw some text?

I've been at this for awhile, it seems that there's many ways to go about this in quartz 2d: 1) Draw text using core graphics methods... CGContextSelectFont CGContextSetRGBFillColor CGContextShowTextAtPoint and on and on, which is horribly low level. 2) using NSString drawAtPoint (so far the method I like) NSString* text = @"Hello"...

Initiate key presses in Cocoa

Hi, Im writing a server to receive key events from an iPhone. I can send a message from the iPhone and have my server display it, on the Mac, now i just need to translate that into a Key press, and simulate that press in Cocoa. Could anyone offer me a starting point, as i guess this is quite low level. Thanks ...

Draw shadow beyond c lipped region on Iphone

In a UIView, is it possible to draw a drop shadow beyond a clip path? I tried to use CGContextSetShadow() before clipping and it doesn't work. ...

register for WindowServer CGScreenRefreshCallback CGScreenUpdateMoveCallback in C++

Hi everybody, I'm trying to register for CGScreenRefreshCallback and CGScreenUpdateMoveCallback ( here's what apple's saying about http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/doc/uid/TP30001070-CH1g-F16970 ) using C++ only. I wrote this simple te...

How to avoid background erasing when drawing lines?

I'm writing a paint app. When drawing a line in CGContext, the background with the size of the bounding box of the line is always got erased - the underlying lines in that box will be cleared. How to avoid the background erasing? ...

How could Dan Briklin's Note Taker draw lines so smoothly?

I tried to write a similar hand drawing app. But the line drawing is always a little slow. If you'd written a similar app and got the line drawing optimized, please explain a bit. Dan's Note Taker Lite. ...

Clipping a CALayer to arbitrary path

Hi All, Is it possible to clip a CALayer to an arbitrary path? I am aware that I can clip to the superlayer's bounds, but in this case I need to be far more prescriptive. TIA, Adam ...

Can't add a corner radius and a shadow

Hiya, I'm trying to draw a shadow and a corner radius on an image. I can add them separately, but I've got no way to add both effects at the same time. I'm adding a shadow with: [layer setShadowOffset:CGSizeMake(0, 3)]; [layer setShadowOpacity:0.4]; [layer setShadowRadius:3.0f]; [layer setShouldRasterize:YES]; Here, layer is a CALaye...

DrawRect method slowing over time. Why?

I posted this elsewhere bus was unable to get help. So basically I'm trying to make it so the user can "draw" an Image onto a view. The way I'm trying to accomplish this is by every 9ish pixel of movement on the screen, I create a mask of the line drawn and then clip the image with that mask. It actually works beautifully at first, and...

CATiledLayer or CALayer drawing UIImage not working

Good day all; I am trying to manually (not using sublayers) draw images within a CATiledLayer but it is not behaving as it should with the defined solution. I undertand that when you call 'CGContextDrawImage' you must scale and translate so as to flip it but I cannot for the life of me, get it to work. I have a method called - (void...

Drawing image at same position/size/rotation on a larger resolution image

I open an UIImagePickerController where the user can see "through" his iPhone and position a (product) image on top of the camera view with different gestures. The position, size and rotation of the product image can change. The user can then create a snapshot of the background image from the camera with the product image on top of it. ...

Implementing CATiledLayer on a UIWebView for fast scrolling

I have a big webview in my iPad app and scrolling performance seems to be a big issue, especially the first time you browse the webview. In mobile Safari, the scrolling is extremely smooth and the page simply appears as a transparent checkerboard pattern and loads in as it comes into view. From what I've read, the way to handle this is u...

Best way to flip a UIImage in a CALayer who's origin is not at (0,0)

Greetings... I come in peace, shoot to kill... I have a container of type UIView (A Grid) and add many sublayers to the layer of the UIView (CALayers representing cells within the grid). Within the Cell, I render many UIImages at different locations using CGContextDrawImage. I am well aware of the need to Translate and Scale, but the s...

Getting a CGImageRef out of a PDFDocument.

I have a PDFDocument (made up of PDFPages ofcourse) and I need a CGImageRef to stick into my IKImageView. Currently, I get the datarepresentation from the PDFPage, put it into an NSImage, then get the TIFFRepresentation of the NSImage, put it into a CGImageSource, and then get the CGImage out of the source. That seemsneedlessly complic...

Does CGContextSetTextMatrix work for offscreen bitmaps?

I'm creating an image offscreen using a context from CGBitmapContextCreate(). While drawing text, I tried to use the: CGContextSetTextMatrix(contextRef, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, 0.0)); but my text was still upside down. If I used the standard transforms it was correct: CGContextTranslateCTM(contextRef, 0.0, co...

Improving drawing performance on custom UIView

I have a custom UIView which is composed of many images, their positions are changing in response to the user touch. The view must track the user touch and i'm experiencing a performance bottleneck in the drawing of such view, preventing me to follow the input in realtime. At the beginning i was drawing everything in the [UIView drawRec...

How to ignore transformations when drawing an image with drawAsPatternInRect:

I draw a background image in a view with the following code: CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGContextSaveGState(currentContext); UIImage *image = [UIImage imageNamed:@"background.jpg"]; [image drawAsPatternInRect:rect]; CGContextRestoreGState(currentContext); This works well. But when I change the size...

Anyone know what program the Apple store demos likely use to make their interactive desktop....

I have a project that I am attempting to do and we want something similar to what the Apple store does. We thought it was a Quartz Composer interactive desktop but I've been putting together an xcode cocoa solution to do it too. Here is an image of what I'm wondering about it is just a Title and 3 images that link out to url locations. ...

What are some great Quartz 2D drawing tutorials?

I'm searching for some great Quartz 2D drawing tutorials aimed at the iPhone. I'm new to Quartz and want to start off with something easy and then progress to more difficult stuff. Does anyone know of any Quartz 2D drawing tutorials that they would recommend? ...

How can I determine if two paths in Quartz 2d intersect?

If I create two paths in Quartz 2d, is there a way to determine if they intersect? Vaguely thought one could make a context and set one path as the clipping path, then draw the other path through that; but then how to determine if the resultant path is empty? ...