core-graphics

Coloring of a rectangle

Hi Everyone, I'm a newbie to Graphics.I'm drawing a rectangle which will change its color after one second. - (void)drawRect:(CGRect)rect { [self setWidthHeightOfRectangle]; [self changeColorOfNumbers]; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextClearRect(ctx, rect); // Draw a solid square CGCo...

CGPDFDocumentCreateWithURL problem

Possible Duplicate: Load PDF from documents directory - iPhone I am trying to create a PDF from a file I have stored in the documents directory (1.pdf). Here is my code: // Get Documents Directory NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documen...

Garbage Collector and Core Graphics

Hi, I'm writing a create CGImageRef from a Path method. This is: - (CGImageRef)createImage:(NSString*)path { // Create NSURL NSURL *url = [NSURL fileURLWithPath:path]; CFURLRef cfURL = (CFURLRef)url; // Create image from source CGImageRef image = NULL; CGImageSourceRef imageSource = NULL; imageSource = CGIm...

Anyone know iOS library or sample for drawing diagrams like mind maps/ visio/ gra

Anyone know iOS library or sample for drawing diagrams like mind maps/ visio/ graphing sw. Doesnt have to be full library or full example. Can be UIKit or OpenGLES I want to have a app that is like a tree structure with root topic the sub topic etc. Clicking on root will open subfolders and so on and they get laid out so they dont over ...

How to display an image on a MKOverlayView?

UPDATE: I'm still struggeling with this problem, although I may have some leads. Maybe it has something to do in what way the images are projected on the MKMapView, Google Maps uses the Mercator projection to project it's images onto a map. If you compare the above image to that of the previous uploaded images, then it looks like t...

CGScreenRegisterMoveCallback still not working?

Are Move calls still not sent by the window server, which makes registering CGScreenRegisterMoveCallback callbacks with CGScreenRegisterMoveCallback() futile? According to http://lists.apple.com/archives/quartz-dev/2008/Jan/msg00052.html this is a bug that's yet to be corrected (though it's been almost 3 years now). Is there an alterna...

Load PDF from documents directory - iPhone

Instead of loading a PDF from the resources folder I would like to load it from the documents directory. I have been trying to do this for days but the CGPDFDocumentRef keeps returning NULL. Here is my code: // Get Documents Directory NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocu...

How do I adjust a Quartz 2D context to account for a Retina display?

I have a Quartz 2D game which draws directly onto a context. For this reason I am having to adapt the code so that it scales if appropriate for a Retina display. I am doing this using the following code: - (CGFloat) displayScale { if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { return [[UIScreen mainScreen]scale]...

Load PDF on iPhone

Hi all, I am using the 'Leaves' framework to add a page turn effect to my app. It displays PDF's using quartz and this works fine if you are loading a PDF from the main bundle. Here is the working code: CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("SampleIssue.pdf"), NULL, NULL); pdf = CGPDFDocumentCreateWi...

Is it possible to inject a CIBumpDistortion filter to a specific area of the screen on Mac OS X (Snow Leopard)?

I want to temporarily distort the area under the mouse using a CIBumpDistortion to increase the visibility of the mouse pointer. At the moment, I have a transparent-background NSWindow that floats around under the pointer and shows a cross-hair that fades in when you move the mouse, and out when you stop. This is working okay, but a Bu...

How to scale up an UIImage without smoothening anything?

I want to scale up an UIImage in such a way, that the user can see the pixels in the UIImage very sharp. When I put that to an UIImageView and scale the transform matrix up, the UIImage appears antialiased and smoothed. Is there a way to render in a bigger bitmap context by simply repeating every row and every column to get bigger pixel...

Why is my CGGradient not working with a preset UIColor?

I have this working code: NSMutableArray *shadowColors = [NSMutableArray arrayWithCapacity:2]; color = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; // Declaration using components [shadowColors addObject:(id)[color CGColor]]; color = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.0]; // Declaration using components ...

Create a mask from difference between two images (iPhone).

How can I detect the difference between 2 images, creating a mask of the area that's different in order to process the area that's common to both images (gaussian blur for example)? Also, some code of this procedure would be very much appreciated. EDIT: I'm using this code (from this answer) to get the RGBA value of pixels: + (NSAr...

Decode images in background thread?

Hello! I have a background thread that loads images and displays them in the main thread. I noticed that the background thread has almost nothing to do, because the actual image decoding seems to be done in the main thread: So far I’ve tried calling [UIImage imageNamed:], [UIImage imageWithData:] and CGImageCreateWithJPEGDataProvider ...

Draw an image in Additive Blend Mode without using OpenGL

Hey guys, 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 ...

CGContext pdf page aspect fit

I am displaying a pdf page on the CGContext using the code - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { CGContextSetRGBFillColor(ctx, 1.0, 1.0, 1.0, 1.0); CGContextFillRect(ctx, layer.bounds); CGContextTranslateCTM(ctx, 0.0, layer.bounds.size.height); CGContextScaleCTM(ctx, 1.0, -1.0); CGConte...

Core Animation and drawRect:

Hello, I have a UITableViewCell drawn using drawRect:. I'm drawing an shape in drawRect and would like to animate this shape (using some parameter) when using the cell goes into edit mode. However, I couldn't find how to use animated parameters within drawRect. Could someone point me to the right documentation or is it impossible? Tha...

Create a grouped tableview with gradient on its border

Hey everybody, I need to create a grouped tableview with gradient on its border (not on its cells). I made some research on the web but I'm not sure I understand how to proceed. A little help could really unblock me in my project :). Thanks ...

Continuously drawing into an iPhone bitmap object? What am I missing?

I am pretty sure this is a straightforward problem I must be confused about (I am a total newbie on the iPhone): I am trying to continuously draw shapes using the CG APIs into a bitmap object, and to always show an up-to-date version of that bitmap on the screen, inside a UIScrollView object so the user can pan, zoom, etc. Using UIView...

Iphone App: How to fill an image with empty areas with coregraphics?

Hello I'm a begginer developing apps for Iphone and was wondering if is possible to do the following: I have an image .png wich is a simple draw of a figure bounded with black edges and empty areas. I wonder if there is a method or a mode to fill the closed empty areas of the image. Its like as the pot of MSpaint filling. I have thi...