Tag: 视网膜显示

以编程方式创build视网膜截图导致非视网膜图像

我试图以编程方式采取视网膜屏幕截图,我已经尝试了在网上find的每一种方法,但我无法得到截图视网膜。 我了解以下私有API: UIGetScreenImage(); 不能用作苹果会拒绝你的应用程序。 但是,这种方法返回正是我所需要的(屏幕截图的640×960)。 我已经在我的iPhone 4以及视网膜硬件上的iPhone 4模拟器上尝试了这种方法,但生成的图像始终是320×480。 -(UIImage *)captureView { AppDelegate *appdelegate = [[UIApplication sharedApplication]delegate]; if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) UIGraphicsBeginImageContextWithOptions(appdelegate.window.bounds.size, NO, 0.0); else UIGraphicsBeginImageContext(appdelegate.window.bounds.size); [appdelegate.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSLog(@"SIZE: %@", NSStringFromCGSize(image.size)); NSLog(@"scale: %f", [UIScreen mainScreen].scale); return image; } 我也尝试过苹果推荐的方式: – (UIImage*)screenshot { // Create a graphics context with the target size […]

使用CoreGraphics绘制视网膜显示 – 图像像素化

在我的iOS应用程序中,我正在尝试使用CoreGraphics绘制曲线。 绘图本身工作正常,但在视网膜显示图像绘制使用相同的分辨率,并没有得到像素加倍。 结果是一个像素化的图像。 我正在绘制使用以下function: – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self.canvasView]; UIGraphicsBeginImageContext(self.canvasView.frame.size); [canvasView.image drawInRect:self.canvasView.frame]; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetShouldAntialias(ctx, YES); CGContextSetLineCap(ctx, kCGLineCapRound); CGContextSetLineWidth(ctx, 5.0); CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0); CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, lastPoint.x, lastPoint.y); CGContextAddLineToPoint(ctx, currentPoint.x, currentPoint.y); CGContextStrokePath(ctx); canvasView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); lastPoint = currentPoint; // some […]

Cocos2D +仅禁用Retina iPadgraphics

当我将基于cocos2d的游戏从Xcode 4.3+导出时,我现在遇到了一个问题。 虽然我并不打算在游戏中包含iPad Retinagraphics,但似乎该游戏需要Retina iPadgraphics,并且现在正在iPad视网膜上正确加载一切。 有没有一种快速简单的方法来禁用iPad视网膜图像只有从基于比例的用户界面加载资产? 谢谢!

限制iphone应用程序只安装在具有Retina显示器的设备(iphone 4 / 4S)

我正在开发一个iphone应用程序。 但我想限制我的应用程序只安装在设备上的视网膜显示器。 所以我的决定是添加UIRequiredDeviceCapabilities密钥在plist文件与所需的前置摄像头,以便我的应用程序将只安装在具有视网膜显示器的设备上。 所以我的问题是苹果拒绝我的应用程序,因为我的应用程序不使用前置摄像头仍然我已经添加到UIRequiredDeviceCapabilities? 也有人有任何其他的解决scheme来限制安装在只有Retina Display的设备上? 任何forms的帮助表示赞赏。 谢谢。

如何检测MonoTouch中的视网膜显示

只是这个问题,我想检测我的MonoTouch应用程序的视网膜显示。 谢谢。

JSTileMap如何处理视网膜和ipad / iphone瓷砖地图?

我已经使用Tiled创build了一个基本的地图。 我正在使用JSpileMap和SpriteKit来获取场景中的地图。 据我所知,JSTileMap(而不是SKTexture)自动处理视网膜和不同的设备。 到目前为止,我还没有取得好成绩,这是我的设置: 我有一个.tmx文件,使用map.png在基本分辨率下创build,因为它是瓦片集。 .tmx出现在项目中,但我故意没有添加map.png(我不想支持非视网膜iPhone)。 在这个项目中,我只添加了以下的png:map@2x~iphone.png(视网膜iPhone,使用48×48的贴图)map〜ipad.png(非视网膜的iPad,使用48×48的贴图)map@2x~ipad.png(视网膜iPad,使用96×96瓷砖) 这里是我得到的结果(清理版本和重置模拟器上的内容和设置后): 视网膜iPhone – 瓷砖是错误的地方 iPad – 没有显示地图,JSTileMapparsing错误 视网膜iPad – 瓷砖在错误的地方 如果我只用一个普通的香草map.png(用48×48的方块): 视网膜iPhone – 瓷砖地图显示,但太大,当然 iPad – 瓷砖地图显示完美 视网膜iPad – 瓷砖地图显示完美,并缩放。 我知道我可以使用一个24×24的tile.png,显然它会扩展一切。 我宁愿不使用缩放的瓷砖集,因为质量会受到影响。 提前致谢。 Ë

优化Flash的编程技巧AIR for iOS的视网膜显示?

有没有什么可以做的,以优化现有的视网膜显示屏的SWFs? 或者,无论如何,在创build新的SWF时准备视网膜显示? 从我所看到的和阅读的,SWFs看起来很差。

UIView的contentScaleFactor依赖于实现drawRect:?

我偶然发现了一件奇怪的事情。 它看起来像UIView的contentScaleFactor始终是1,即使在Retina设备,除非你实现drawRect: 考虑这个代码: @interface MyView : UIView @end @implementation MyView – (id) initWithFrame: (CGRect) frame { self = [super initWithFrame: frame]; if (self) { NSLog(@"%s %g %g %g", __PRETTY_FUNCTION__, self.contentScaleFactor, self.layer.contentsScale, [UIScreen mainScreen].scale); } return self; } – (void) didMoveToWindow { if (self.window) NSLog(@"%s %g %g %g", __PRETTY_FUNCTION__, self.contentScaleFactor, self.layer.contentsScale, [UIScreen mainScreen].scale); } @end 在Retina设备上打印下列内容: […]

如何NSBundle pathForResource:ofType:和UIImage imageWithContentsOfFile:处理比例和设备修饰符?

在我的iOS资源文件夹中,我有图像: foo~iphone.png foo@2x~iphone.png foo~ipad.png foo@2x~ipad.png 我加载它们: NSString *fileName = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"png"]; UIImage *image = [UIImage imageWithContentsOfFile:fileName]; 实验: 在iPhone上, filename是/path/to/bundle/foo~iphone.png ,在视网膜iPhone上,它加载@2x版本。 在iPad上, filename名为/path/to/bundle/foo~ipad.png ,在视网膜iPad上加载@2x版本。 也就是说,它加载我希望的图像,但是pathForResource处理设备修改器, imageWithContentsOfFile处理缩放修改器。 我想知道为什么。 pathForResource的文档中没有提到设备修饰符,而imageWithContentsOfFile的文档中没有提到关于scale修饰符的内容。 是否有单独的文件,准确地表明每个function?

SKTexture和UIImage的scale属性

是否有任何理由为什么一个SKTexture似乎忽略了通过textureWithImage:构造图像的textureWithImage: 我有一个图像资源可用,“retina_image@2x.png” 当我尝试创build一个纹理,而首先创build一个UIImage: UIImage* image = [UIImage imageNamed:@"retina_image"]; SKTexture* texture_image = [SKTexture textureWithImage:image]; NSLog(@"image size %@, scale %f", NSStringFromCGSize(image.size), image.scale); NSLog(@"texture from image, size %@", NSStringFromCGSize(texture_image.size)); 我得到以下结果: image size {50, 50}, scale 2.000000 texture from image, size {100, 100} 虽然我期望得到 image size {50, 50}, scale 2.000000 texture from image, size {50, 50} 由于图像的大小(以点为单位)是50×50 当您直接使用资源构build纹理时,也是如此: SKTexture* […]