iOS 5 和 interpolatedColorAtLocation。获取特定位置处的渐变颜色

发布于 2024-12-28 01:39:46 字数 158 浏览 4 评论 0原文

如何在 iOS 5 中获取特定位置的渐变颜色? 我有一个垂直条,其渐变从红色到绿色,左侧是一个三角形,显示条中的位置。如何用该位置的条形颜色填充三角形? 我认为在 Mac OS X 中它是“interpolatedColorAtLocation”,但是 iOS 5 呢?

谢谢你的帮助。

How can I get the color in a gradient at a specific position in iOS 5?
I have a vertical bar with a gradient from red to green and on the left side is a triangle showing the position in the bar. How can I fill the triangle with the color of the bar at that position?
I think in Mac OS X it's "interpolatedColorAtLocation" but how about iOS 5?

Thank you for help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月下凄凉 2025-01-04 01:39:46

iOS 中没有这方面的 API。您必须自己进行渐变插值,或者将渐变绘制到 CGBitmapContext 中,然后在位图的原始数据中查找像素值。

There's no API for this in iOS. You'll have to do the gradient interpolation yourself, or draw your gradient into a CGBitmapContext and then find the pixel value in the bitmap's raw data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文