开发者

"Beveled" Shapes in Quartz 2D

开发者 https://www.devze.com 2022-12-17 07:46 出处:网络
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:

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

精彩评论

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

关注公众号