views:

208

answers:

2

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:

beveled circle

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 able to approximate it.

Any ideas? This is on the iPhone, and I'd like to use built-in frameworks and avoid any external libraries if at all possible.

A: 

There are really only a few useful approaches you can take to this problem.

  1. Use your basic shape drawing techniques and combine them with a one or more gradient curves. (Implicit object construction) with curves/fills.

  2. Custom build a UIView and build the object up per-pixel in a drawRect.

  3. Pre-render your beveled/shadowed shapes and load them into an image and blit them into a UIImageView.

David Sowsy
A: 

You might want to look at the approach used by the developer here. He's still working out the implementation details, but his bevels look pretty impressive.

Brad Larson
That's interesting stuff. However, I need to be able to fill my shapes with arbitrary colours, so I can't pre-render anything like that developer did.
Shaggy Frog