quartz-graphics

CGImageCreateWithMask works great but the masked out area is black in my resulting image, how can I set it to be white?

I've masked out my image thusly: CGImageRef maskRef = [[UIImage imageNamed:@"testMask2.png"] CGImage]; CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef), CGImageGetHeight(maskRef), CGImageGetBitsPerComponent(maskRef), ...

kCGBlendModeClear doesn't clear, why?

Hello folks, I'm writing some lines of code to get acquainted with the basics of Quartz 2d. I am trying to draw and image an then clear it through the kCGBlendModeClear blend mode. Here's the code of my UIView subclass code, whose background color is set to orange through IB: - (void)drawRect:(CGRect)rect { UIImage *brush = [UIImag...

Differentiate table line from big letters

I'm doing some graphics processing and I have a logic where in I have a bitmap with edges and I disregard all table edges from the letters E.g. 0000000000 0111111110 0100000010 0102220010 0100200010 0100200010 0100000010 0111111110 0000000000 0 - background color 1 - ignored edges 2 - edges I need My logic is just simple, if a number...

maximum image size in CIFilter / CIKernel?

Does anyone know what the limitations are on image size with custom CIFilters? I've created a filter that performs as expected when the images are up to 2 mega pixels but then produce very strange results when the images are larger. I've tested this both in my cocoa app as well as in quartz composer. The filter I've developed is a geomet...

Create PDF from CSV on iPhone

An iPhone app which I am creating generates reports from a Core Data database as a CSV file, which can then be emailed so that the user may use that data elsewhere outside of the app. I would also like to offer the ability to generate the same reports as a PDF file (of course, with nicer formatting) allowing the user to immediately print...

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]...

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...

Compile error trying to use CAGradientLayer

Hi, I'm trying to use CAGradientLayer and getting an unhelpful compile error. Can't figure out whats wrong. All I'm doing so far is: CAGradientLayer *gradient = [CAGradientLayer layer]; I've imported <QuartzCore/QuartzCore.h> and I'm getting the warning > _OBJC_CLASS_$CAGradientLayer referenced from: objc-class-ref-to-CAGradientL...

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 ...

iphone: QuartzCore and animations work in simulator but not in device

I currently have 3 simple UIImageViews that animate across a UIView in my app. The animations work fine in the simulator. However, when I test the app on the device, all I see is a blank UIView. Are there any special libraries/header files I need to import to fix the problem of animation not appearing on the device? ...

How to draw horizontal & vertical lines one pixel wide in Quartz?

Hi, I am having trouble drawing one pixel wide lines. All lines are perfectly horizontal or vertical (I am not drawing diagonal lines) but they do not draw cleanly. It looks like it is drawing across two pixels at a reduced alpha. No doubt due to antialiasing. I've searched the docs and forums and have come across a statement saying that...

UIView infinite loop Animation to call a method after every repeat cycle

I am at my wits end trying to come up with a design pattern for this paradigm. I haven't had much luck on this site but at this stage I'll try anything. I am trying to implement a radar type animation and hence I am rotating a view 360 degrees to represent the radius rotating around the circle. I have placed points around this circle an...

water effect in cocos2d

Hi, I'd like to have a water effect on a background layer in my app. The effect doesn't need to react to touch or anything - it just needs to wave an image a little bit. CCWaves3D seem ok, but leave have nasty black artifacts around the edges when I run it. Similarly CCShaky3D. CCLiquid brings my app down from 20fps to 5fps.. Is there ...

Image drawn with CGContextDrawImage is slightly transparent.

Hello! I have a transparent image that I draw strokes into and later on I draw this image over a textured background using CGContextDrawImage. The problem is that even the parts that have been stroked by a pure black color ([UIColor blackColor]) come out as slightly transparent on the textured background. The stroke looks like this: CG...

Best practice of copying and serializing Quartz references

I have objects containing Quartz-2D references (describing colors, fill patterns, gradients and shadows) in Cocoa. I would like to implement the NSCoding protocol in my objects and thus need to serialize those opaque Quartz-2D structures. Possible solutions might be: Define a set of properties in my objects that allow to setup the dat...

Moving multiple UIImageViews simultaneously

Hi there, simple question, I've got a superview holding multiple sub UIIMageViews that I'd like to move simultaneously. I now about UIIView Animations but not how to launch multiples animation at a time. Any clue about that ? example animations would be : growing, shrinking, alpha changes, moving along different (radom generated) pat...

CGContextDrawPDFPage memory leak

I have used CGContextDrawPDFPage two times in my project. One is for displaying the PDF and the other is for making the thumb image of the PDF. I am using the PDF to image code from http://github.com/0xced/pdfrasterize/blob/master/CGPDFAdditions.c I am calling the PDF to image method like this in my code NSURL *url = [NSURL fileURLW...

PDF calculate Glyph sizes

I (think) have every values for Text-Rendering in a PDF. * Position (Text Matrix) * FontDescriptor with Widths Array * FontBBox * StemV/StemH * FontName * Descent * Ascent * CapHeight * XHeight * ItalicAngle My problem is I don't know what to do with these values. I went through the PDF Spec 1.7 a couple of times and cannot find a for...

Drawing class to allow layer control

Hi, I would like to implement a drawing class with the help of Quartz. I want to be able to save parts of what is drawn on separate layers. I want these layers to be retrievable, so I can delete/hide/show layers on command. Can I save multiple CGLayerRef as a NSMutableArray property of my class and then be able to retrieve them? If yes...