视网膜显示上UIImage并置中的奇怪arctefact [英] Strange arctefact in UIImage juxtaposition on retina display
问题描述
我的应用程序中有一个非常奇怪的问题,仅在 Retina显示屏和不是模拟器上出现.
I have a very strange problem in my app which only happen on Retina display and not simulator.
我开发了一组带有嵌入式openstreetmaps图块(部分地图)的应用程序.
I developped a set of applications with embedded openstreetmaps tiles (pieces of map).
在每个应用程序中,我都有很多在UIScrollView中显示的地图(256像素/256像素). 在非视网膜设备和视网膜模拟器上完美运行.
In each app, I have a lot of pieces of map (256px/256px) that I display in a UIScrollView. It works perfectly on non-retina devices and on retina simulator.
问题:每个图块以randow颜色显示最后一行像素(大多数时间是黑色的)
The problem : each tile appear with the last row of pixel in a randow color (most time it's black)
为说明起见,我使用设备和模拟器对同一位置的屏幕截图进行了制作.它们被分组在一张图片中:
To illustrate, I made to screenshot of the same place, with device and simulator. They are grouped in one picture :
您可以看到黑色像素线不是在图块外,而是在图块的最后一个像素线中(这两个屏幕之间没有偏移)
You can see that the black pixel line is not out of the tile, but in the tile last pixel line (cause no shift beetwen the two screens)
甚至更奇怪:有时,当图块中的颜色变化很小时,像素线呈现随机元素的颜色,有时甚至根本没有出现!
More strange even : sometimes, when little color variation are in the tile, the pixel line take the color of a random element, and sometimes it doesn't appear at all !
在这里,蓝线,灰线,黑线.....
Here, blue line, gray lines, black lines.....
我简化了很多代码,仅在这2格加载中出现了毛刺:
I simplified a lot the code, and the glitch stays with only this 2-tiles loading :
int W = 256;
int H = 256;
NSString * map1 = [[NSBundle mainBundle] pathForResource:@"test1.png" ofType:nil];
NSString * map2 = [[NSBundle mainBundle] pathForResource:@"test2.png" ofType:nil];
UIImageView * pieceOfMap1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, H*0, W, H)];
UIImageView * pieceOfMap2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, H*1, W, H)];
[pieceOfMap1 setImage:[UIImage imageWithContentsOfFile:map1]];
[pieceOfMap2 setImage:[UIImage imageWithContentsOfFile:map2]];
[self.view addSubview:pieceOfMap1];
[self.view addSubview:pieceOfMap2];
我尝试使用128x128 @ 2x磁贴,但是问题仍然存在!
它可以来自OpenStreetMaps图片吗?
I tryed with 128x128 @2x tiles, but the problem persists !
Could it come from OpenStreetMaps images ?
我的两个磁贴可在此处下载: http://dl.free.fr/n08C6JIqW
My two tiles are downloadable here : http://dl.free.fr/n08C6JIqW
推荐答案
好的.
我只是在photoshop中打开两个测试图块,未做任何更改,然后再次保存为png.
I just open the two test tiles in photoshop, made no change, then saved again in png.
黑线不再出现.
因此,它来自开放的街道地图PNG图像(要获取其中的一个,请转到 http://www. openstreetmap.org/,在地图上右击,然后保存图片)
So it comes from the open street map PNG images (to get one of them, go to http://www.openstreetmap.org/, right clic on the map, then save image)
问题已得到部分解释,但现在我有2067个文件要在Photoshop中使用...
The problem is partly explained, but now I have 2067 files to photoshop...
我用谷歌搜索,但没有发现任何可以解释的东西...
I googled it, but I found nothing which would explain something...
如果没有其他解释,我会接受我自己的回答,但是如果有人给我一些东西来理解为什么,我会很高兴的.
If no other explanation, i will accept my own answer, but if someone give me something to understand why, I would be glad.
这篇关于视网膜显示上UIImage并置中的奇怪arctefact的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!