quartz-2d

using quartz to draw temperature map

Hello, I'm developing an iPhone app where I have a route that I display on a map. The route is made up of a bunch of waypoints and for each waypoint I have the (air) temperature at that spot. I would like to color the route according to the temperature values. Now I was wondering if I could somehow map my temperature scale, ranging from...

How to delete NSBezierPath

H, I have an NSBezierPath that I created and I called -stroke on it. How do I remove/delete it from the view without deallocating the object. Thanks - Rebecca ...

iphone quartz draw border around line

Hello, what's the best way to draw a (black) border around a line in quartz for iphone? I'm drawing lines on streets on map and if the line is yellow (which is a legit use case), it blends in with the street color. One thing I could do is lay my lines over a little thicker black line, but this doesn't sound very efficient. ...

iphone quartz drawing 2 lines on top of each other causes worm effect

Hi, I'm using Quartz-2D for iPhone to display a route on a map. The route is colored according to temperature. Because some streets are colored yellow, I am using a slightly thicker black line under the route line to create a border effect, so that yellow parts of the route are spottable on yellow streets. But, even if the black line is...

Problem with setNeedsDisplayInRect (quartz2d, iPhone)

Hi everyone. I have written a function that draws x number of squares in a random position every 2 seconds. A square cannot be drawn in the same position twice. Once the app has completed a cycle the grid will be filled in. Now, this works fine when the number of squares drawn is <=8, however when this is higher a square is randomly draw...

Finding a sublayers position on the screen after several CATransforms?

My iPhone app has a mainView. added as a sublayer to this MainView is CircleView. CircleView rotates as the phone turns and tilts as the phone tilts, using 3 concatenated CATransform3D transforms. DotView is added as a sublayer to CircleView. After all these transoforms, I have no easy (or apparent) way of knowing the coordinates of dotV...

"Beveled" Shapes in Quartz 2D

I'm familiar with some of the basics of Quartz 2D drawing, like drawing basic shapes and gradients and so on, but I'm not sure how to draw a shape with a "beveled" look, like this: Essentially we've got a shine on one corner, and maybe some shading in the opposite corner. I think -- I didn't make this image, although I'd like to be ab...

What's the right memory management pattern for buffer->CGImageRef->UIImage ?

I have a function that takes some bitmap data and returns a UIImage * from it. It looks something like so: UIImage * makeAnImage() { unsigned char * pixels = malloc(...); // ... CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, pixels, pixelBufferSize, NULL); CGImageRef imageRef = CGImageCreate(..., provid...

Fastest / most efficient way to draw moving speech bubbles on screen - CoreAnimation, Quartz2D?

I am adding some functionality to an iPhone app, and could use some help in picking the fastest / most efficient / best practice approach for solving this problem: At the upper-half of my screen, I have speech bubbles (think comic book) that are UIImageViews translating across the screen (dynamic x & y position). It is a UIImageView bec...

Possible to reuse UILabels on a scrollview?

Hi, I'm trying to implement a view that shows a grid of information without using a UITableView, however, since I'm displaying about 36 different statistics, with its label I will have to initialize and use 72 UILabels. Does having so many UILabels mean that my iPhone app's performance will be significantly negatively affected? Is there...

iPhone: Crash While Drawing CGLayers Stored in Array

I'm trying to build a drawing app with redo and undo functionality. My idea is to draw lines in a layer in "touchMoved", then saving the layer in "touchEnded". I'm not shure that I am drawing to the layer correct, everything works fine though, until I clear the image I'm drawing in on and try to redraw the layers in the array. - (void)...

Does Quartz for iPhone draw non visible portions of a view?

Hi folks, I am wondering which is the best way, in terms of speed and efficiency, to draw a frame around an image on iPhone, especially when I have to draw lots of these images: 1) Drawing the image and then the frame around or 2) Drawing a rect, filling it with a color and then drawing the image within that rect leaving some offset pi...

Recreate scope bar of UISearchBar

I want to recreate the scope bar of a UISearchBar, just for use as tabs. I'd like to adopt the UISearchBar scope bar's style. I've thought about Quartz 2D to draw these tabs in combination with UIControl for managing the different states of the tabs. What are you thinking of? ...

Custom UIBarButtonItem with quartz

Hi! How can I draw a button with quartz that has exactly the same style as a UIBarButtonItem. The button should be able to show different colors. I downloaded the Three20 project, but this project is really complex, you'd need a lot of time to overlook the whole framework. I just want to draw a custom UIBarButtonItem. Thanks for help. ...

How to darken a custom UIButton

Hello! I've subclassed the UIButton class and now a custom view will be drawn using quartz 2d. It all looks fine, but how can I darken the button at clicking it. How can I set the views for the different states if I am using quartz in the same class to draw the button? Thanks for your help ...

OSX hide window effect on the iPhone

Hi everyone, Is it possible to 'easily' make on the iphone a MAC OSX hide window effect on a UIView? When I say easily, I mean using existing libraries or tools... Thanks ...

How do I clip or change alpha of an image (pixels) in Quartz?

Hi, I'm working on making an iPhone App where there are two ImageViews and when you touch the top one, wherever you tapped, the bottom one shows instead. Basically what I want to do is cut an ellipse/roundedrect out of an image. To do this I was thinking on either clipping the image, or changing the alpha pixels in the rect to zero. I a...

How do I make my own recordedPath in GLPaint Sample Code

Hi, I've recently downloaded the GLPaint sample code and looked at a very interesting part in it. There is a recordedPaths NSMutableArray that has points in it that are then read and drawn by GLPaint. It's declared here: NSMutableArray *recordedPaths; recordedPaths = [NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] p...

Is it possible to save an image with Core Graphics on the iPhone?

The following code converts a PDF page into a JPEG. It runs as expected on Snow Leopard: ... //get the image from the bitmap context CGImageRef image = CGBitmapContextCreateImage(outContext); //create the output destination CGImageDestinationRef outfile = CGImageDestinationCreateWithURL(fileUrl, kUTTypeJPEG, 1, NULL); //add the image ...

Quartz 2D stroke alignment

Is it possible to adjust the alignment, from the default centered, of a stroke when using kCGPathFillStroke as the drawing mode? For example, when drawing a closed path using: CGContextDrawPath(context, kCGPathFillStroke); The stroke lies 50% outside/50% inside the drawn path. The stroke color has a non-opaque alpha so the net effect...