“斜角” Quartz 2D 中的形状
我熟悉 Quartz 2D 绘图的一些基础知识,例如绘制基本形状和渐变等,但我不确定如何绘制具有“斜角”外观的形状,如下所示:
斜面圆 http://www.shaggyfrog.com/junk/beveled-circle.jpg
本质上我们一个角有光泽,另一角可能有一些阴影。我想——我没有制作这张图片,尽管我希望能够近似它。
有什么想法吗?这是在 iPhone 上,我想使用内置框架并尽可能避免任何外部库。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,您可以采取几种有用的方法来解决这个问题。
使用基本的形状绘制技术并将它们与一条或多条渐变曲线结合起来。 (隐式对象构造)带有曲线/填充。
自定义构建一个 UIView 并在一个绘制矩形中按像素构建该对象。
预渲染斜角/阴影形状并将它们加载到图像中并将它们传输到 UIImageView 中。
There are really only a few useful approaches you can take to this problem.
Use your basic shape drawing techniques and combine them with a one or more gradient curves. (Implicit object construction) with curves/fills.
Custom build a UIView and build the object up per-pixel in a drawRect.
Pre-render your beveled/shadowed shapes and load them into an image and blit them into a UIImageView.