iPhone UIImage 重叠渲染错误
我在 iPhone OS 3.0 上遇到了一个奇怪的渲染错误...
我有两张图像。一种是不透明的 PNG,主要是黑色,带有向上渐变的白色渐变。
第二个是带有半透明云的透明 PNG。
当我使用 UIImageView 覆盖两者时,云彩和白色渐变的交集会触发一个渲染错误,该错误会导致看起来相当奇怪的图形故障,从而消除顶部图像(在本例中为云彩)中的所有不透明度,并导致出现故障的部分要在当前视图中所有图层之上渲染的图像的大小(包括技术上位于其下方的图层)。
它仅发生在图像的两个部分的交叉处。因此,通常只有一个非常小的块遇到错误,而其余图像则正常渲染。
有谁见过这个并且有人有解决办法吗?我想在继续核心动画之前进行检查,这有望解决问题(因为我认为 CA 甚至 OpenGL 更容易处理重叠的 Alpha 通道)。
截图在这里找到:
http://www.jasconi.us/glitch.jpg
可以看到右下角两个图像的交点。
I've come across a strange render bug on iPhone OS 3.0...
I have two images. One is a non-transparent PNG that is predominately black with a white gradient fading upward.
The second is a transparent PNG with translucent clouds.
When I overlay the two using UIImageView, the intersection of the clouds and white gradient triggers a render bug that causes a rather odd looking graphical glitch that removes all opacity from the image on top (in this case the clouds), and causes the glitched portion of the image to render on top of all layers in the current view (including ones it is technically underneath).
It only occurs at the intersection of the two portions of the images. So typically only a very small block is experiencing the error while the rest of the images render normally.
Has anyone seen this and does anyone have a fix? I want to check before I move on to Core Animation which will hopefully address the problem (since I imagine that CA or even OpenGL is more apt to handle overlapping alpha channels).
Screenshot found here:
http://www.jasconi.us/glitch.jpg
You can see the intersect of the two images at the lower right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从你的描述来看,这似乎是苹果代码中的一个错误。我会将其报告给苹果并等待修复。
同时,您可以尝试在 Core Animation 或 OpenGL 中实现相同的功能,希望错误出现在更高级别的 UIImageView 中,但由于 UIImageView 本身使用 Core Animation,因此这个错误可能是不可避免的,直到它出现为止。固定的。
From your description, this seems to be a bug in Apple's code. I would report it to Apple and wait for a fix.
In the meantime, you can try to implement the same functionality in Core Animation or OpenGL in the hope that the bug is in the higher-level UIImageView, but since the UIImageView itself uses Core Animation, it's possible that this bug is simply unavoidable until it's fixed.
我假设您使用 UIImageView 显示它们?如果是这样,您是否在透明视图上将不透明设置为NO?
I assume you're displaying them using UIImageView? If so, have you set opaque to NO on the transparent view?