开发者

"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 wi开发者_JS百科th a "beveled" look, like this:

beveled circle http://www.shaggyfrog.com/junk/beveled-circle.jpg

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜