quartz-2d

iPhone: Clip user-supplied UIImage by a given CGPath

In my iPhone application, I need to let user to clip user-supplied UIImage by given dynamically generated CGPath. All that is outside given (closed) CGPath should be clipped out, and the resulting image should be trimmed by path's bounding rectangle. Image should be clipped with soft border. That is, there should be a soft gradient in ...

iPhone: Blur UIImage

In my iPhone application I have a black-and-white UIImage. I need to blur that image (Gaussian blur would do). iPhone clearly knows how to blur images, as it does that when it draws shadows. However I did not found anything related in the API. Do I have to do blurring by hand, without hardware acceleration? ...

Obj-C... "Incompatible types in initialization" error

My code: CGPoint *tp_1 = CGPointMake(160, 240); gives an "Incompatible types in initialization" error... why is this?? ...

Quartz2D: How to draw an arc of a circle?

Hi, I would like to draw an arc of a circle like in this sketch: The angle of the arc should be variable and it should be colored with a gradient (e.g. starting with red and going to green). How do you do this in Quartz2D? Thanks for your answers! Stefan ...

How do I create a new image by drawing on top of an existing one using Quartz?

i have a view with uiimageview i assign this uiimageview image by camera..now i want to do some drawing onto image....using coregraphics.i want to do something like this... select an area by touching and drawing line when line joins something like circle or any shape..i want to change that particular area in to something else for example...

CGContextRectToClip

Hi, i'm using CGContextRectToClip(aContext, aRect), the new rect for clipping is a intersection between the previous rect and aRect. I used CGContextSaveGSState and CGContextRestoreState to restore the previous rect of clipping, but seems don't work. Clipping rect is part of state, i hope yes. ...

Creating PDF with CGContextDrawPDFPage Fails with white text

I'm trying to merge multiple PDFs, i'm copying one-by-one all pages into PDF, but the pages have white color text. means text are not in displayable manner. counld you help..? Thanks In advance...! My Function to Merge PDF: -(void)mergePDFs:(NSArray*)pdfList{ CGContextRef pdfContext; CFStringRef path; CFURLRef url; CFMutabl...

Threaded drawing on the iPhone

Apples documentation states that in general Quartz2D is thread-safe. However when drawing to an image context during a NSOperation I'm experiencing crashes (EXC_BAD_ACCESS). This is my current setup: UIGraphicsBeginImageContext(imageSize); CGContextRef context = UIGraphicsGetCurrentContext(); // drawing code UIImage *image = UIGraphic...

iphone 2d drawing newbie question

Hi All, I've been programming the iphone for a couple of months now and have 3 apps in the store already. However, I have not done any kind of graphics programming in the platform. Given that I'm planning on starting my 5th app (the 4th is under Apple's review) I wanted to ask for some pointers as to where to get information for this ...

Quartz 2D vs OpenGL ES Learning Curve

Hi, I have been developing iPhone Applications for a couple of months. I would like to know your views about the Quartz vs OpenGL ES 1.x or 2.0 learning curve. You can tell your perspective. My Questions are *I am a wannabe game developer, So is it a good idea to first develop in quartz , then move on to OpenGL ES or does it not mak...

Mac dev - Help getting started with 2d games

I want to make some simple 2d games/clones (for Mac), but I have a few questions: Should I use Quartz 2d or OpenGL (I don't plan to try 3d anytime soon) There seems to be a lot of typedef'd things like CGFloat/GLfloat, which should I use? Should I use Objective-C for the game too (classes) or just C? (I assume I'll use Objective-C and ...

UIImage Rotation Offset

I have the following code - (void)ComputeRotationWithRadians:(CGFloat)rad { CGFloat width = exportImage.size.width; CGFloat height = exportImage.size.height; UIGraphicsBeginImageContext(CGSizeMake(width, height)); CGContextRef ctxt = UIGraphicsGetCurrentContext(); CGContextScaleCTM(ctxt, 1.0, -1.0); CGContextTran...

Quartz 2D Path rotation

Hi everyone. I'm fairly new to Quartz 2D. Imagine the following scenario: You have a circle-shaped mini map view. I'm drawing triangle (the arc isn't important right now) on top of the map. This shape represents the visible area. I need to have the triangle shape rotate along the mini map as the user changes orientation. Currently th...

CALayer filters and bounds

Hi, I'm just starting writing some Core Animation code and I've just spent a frustrating day trying to figure out a particular problem. I have two layer-backed views that together make up a wizard/ assistant style user interface: 1) a custom background view that fills the entire window with an edge-to-edge gradient and a nice image on...

iPhone: Quartz2d vs. OpenGL ES

OK, I'm still brand new to iPhone development. I have a free game on the app store, Winner Pong, but it's just a Pong clone (who would've guessed) that uses the standard UIImageViews for the sprites. Now I want to do something a little more complicated, and port my game for the Xbox 360, Trippin Alien, to the iPhone. I obviously can't ke...

Can you animate gradients using Quartz in an iPhone?

Hi, I am new to iPhone development and am currently toying with recreating a charting tool I developed for Silverlight. Currently I'm using a gradient to 'fill' a rectangle representing a bar within a chart. Is it possible to animate this gradient so it changes colour when a user touches the bar within the chart. I have looked through...

What's the difference between Quartz Core, Core Graphics and Quartz 2D?

I wonder if someone can distinguish precisely between these? For my understanding, Core Graphics is just a "Framework Package" which contains Quartz Core and Quartz 2D. But I'm not sure about if Quartz 2D actually is Quartz Core? Maybe someone can draw some lines there? What makes up the differences between these? When looking at the do...

Quartz 2D Graphics Contexts

Why do Quartz 2D Graphics Contexts functions have to be called from within the drawRect method? Because if I call a CGGraphics context function from anywhere except from within drawRect I get messages like this: <Error>: CGContextFillRects: invalid context <Error>: CGContextSetFillColorWithColor: invalid context Actually in a subcl...

Drawing an equation in Quartz

Hello everyone, I have got experience in iPhone programming but not really in graphics programming. I decided to make a 2d game and choose Quartz 2D for this purpose (I'm familiar with Open GL, but quartz seems to be easier for a 2d game). Is there a built-in way to draw a graph of a math formula in Quartz? For beginning it will be on...

UIImageView's CALayer's anchorPoint "accessing unknown component of property" error

I'm trying to rotate an image about the bottom right corner. To do this I know I need to set the layer's anchorPoint, but I can't access it. I've included the QuartzCore framework in my project. To simplify the problem as much as possible, I've reduced the method to these three lines, which still throw the error "error: accessing unknown...