Tiger 上的 NSGradient
我正在创建一个必须在 Tiger 上运行的应用程序,并且我需要在 NSView 上绘制渐变。不幸的是,NSGradient 仅适用于 Leopard 及以上版本。谷歌根本不是我的朋友。如何在 Mac OS X 10.4 上为 NSView 绘制渐变?
谢谢!
I'm creating an app that must run on Tiger and I need to draw a gradient onto a NSView. Unfortunately, NSGradient is only available on Leopard and above. Google wasn't my friend at all. How do I draw a gradient to a NSView on Mac OS X 10.4?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Apple 推出
NSGradient
CTGradient
代码>.它是CGShading
C API 的包装器。A lot of developers used
CTGradient
before Apple introducedNSGradient
. It's a wrapper around theCGShading
C API.您将需要使用
CGShading
对象来绘制渐变,并自己为其编写插值函数(Quartz 2D 编程指南)。You will need to use a
CGShading
object to draw the gradient, and write the interpolation function for it yourself (an example is given in the Quartz 2D Programming Guide).