Bing Maps pushpin for hi-resolution or retina displays - bing-maps

I'm working with a custom image for a pushpin using the Bing Maps v7 javascript libabry. Everything works fine except the icons appear low-res / pixelated on an ipad or iphone with retina display. I've tried changing the height width but that doesn't seem to help.
Any ideas out there?

One thing that is really important with High definition screens is the actual resolution of the screen you're using.
To determine and adapt the url to use appropriate image with a higher resolution (by changing the path based on a variable), you can use:
var retina = window.devicePixelRatio > 1;
If retina is set to true, then you would compose a specific path to the image to point to the correct one.
You should check this question and answers to be able to understand how things work regarding the image and also be able to deliver and adapt the result in the good resolution:
Serving high res images to retina display

Related

Cocos2d/Cocos2d-x Retina Issues

I have a multiplatform iOS/Android game that I programmed in Cocos2d-x. I have only one set of images to use (I'm only after high res devices) that get scaled according to the device's resolution. For example all images are for the iPad but if you are using a Galaxy S then the image locations and scaling are affected by GalaxyS_screenWidth/iPadscreenWidth.
This works fine for all Android devices and on iPad, iPad2 and old iPhones, but with Retina iPhone there is a problem. On the iPhone 4 all my images look extremely pixelated, a result from the images being scaled to iPhone non-retina resolution then scaled back up to fill the screen.
I tried enabling Retina Mode and the images are half of their intended size (maybe due to the usage of get winsize() which uses points) and scaling manually causes other sorts of problems. I tried playing with a lot of options and attributes but to no avail, so what should I do now?
EDIT:
This is not only a graphics issue, as text gets automatically scaled down then up and appears pixelated.
EDIT 2:
Fonts are bitmaps so my bad. But I don't want to use retina as all images are already retina by default. All of my images are set up for the iPad so for iPhone 4 I just scale them down a bit. This works with Android phones.
For example I have an image, depending on screen resolution obtained through getwinsize():
If current resolution width is 1024 then image stays the same.
If current resolution width is 900 then image gets scaled by 900/1024, no problem.
If device is iPhone 4 resolution width is 480, so image gets scaled by 480/1024, then cocos2d-x automatically scales the resulting image by 2 thus the pixelation. I tried using getwinsizeinpixels, I tried multiplying the screen size, I tried many things but nothing worked out of the box unless I am to redo many of my code.
So the question is, how can I just let the damn engine treat the iPhone 4 as an Android phone with resolution of 960x640?
If you want Retina resolution images to look like Retina resolution images, then those images need to be in Retina resolution (960x480).
If you first scale down the image to 480x320 and then upscale it on the device, it will of course look blurred. You can't magically make the Retina pixels appear from a lower resolution image by scaling it up.
SI couldn't get to the bottom of it so I employed a hack. I enabled Retina Display then I scaled everything x2 through code except for the text. Sounds stupid, but it worked, and pixelation is gone. Thanks everyone who spent time trying to help me.
I tried enabling Retina Mode and the images are half of their intended size
when you enable retina support, cocos2d gets images by appending #"-hd" to their provided filenames. Such images are meant to be double the "visual" size (in iOS terms, pixels vs. points), so that they can be sort of scaled down to make full use of device resolution.
If you have a look at the CCDirectorIOS class, you will find there a couple of methods dealing with this, especially those dealing with the scalingFactor. I don't know what kind of changes you should do to make it work, but if you step into those methods and look at the value of various objects, you might find a way to modify cocos2D default behavior for your specific case.
If this seems to complicated, one thing you could try is changing the CC_RETINA_DISPLAY_FILENAME_SUFFIX so that cocos2d will not look for specially-named files for the retina iPhone, but just use the normal ones.
For example all images are for the iPad but if you are using a Galaxy S then the image locations and scaling are affected by GalaxyS_screenWidth/iPadscreenWidth.
Another thing you might try is not using winSize, but winSizeInPixels, so that when you scale down, you down do it down to the point resolution, but just to the pixel resolution (which is double the point resolution).
Hope this helps.

Images for Retina display

If i want my application to be compatible with the Retina display, am i obliged to recreate all my images by doubling their sizes? even the icon?
if you will not use high resolution images your images will look pixelated/blurr.So better to use high res images as well.Some Key points are:
Displaying graphics depending on the device model can be done by duplicating image files and adding an ‘#2x’ suffix. So, when the normal image file is named ‘button.png’, the hi-res version should be ‘button#2x.png’.
You don’t need any additional code for this. In Interface Builder or your code, assign the normal version (without the suffix) to an object. The same goes for the application icon. The resolution of the 2x icon should be 114 by 114 pixels. You will need to add a separate ‘Icon’ property in the Info.plist file for this icon.
If for some reason you do want to perform a check in your code, you can do so by checking the scale factor of the display. Older models will return a scale factor of 1.0, while the iPhone 4 will return 2.0. You can check this with:
float factor = [UIScreen mainScreen].scale;
Depending on the type of application you’re developing further optimizations can be made to utilize the new retina display the best you can.
A very good information here
hope it help you :)
You're not obligated, it just will look very pixelated if you don't.
As for the icon, I believe you are obligated to provide multiple sizes when submitting to the AppStore.
Maybe you'll want to take a look at iRetiner.
You could also check this previous stackoverflow thread : how to set image for ipad application that support retina display
A summary of the icons and what is required can be found in the human interface guidelines. I highly recommend providing high resolution artwork for the retina display even though it is not required. Your default now should be to design artwork at the higher resolution, then scale down for older devices. I doubt Apple would choose to highlight an application as new and noteworthy if it looks pixelated on the latest devices.

How to set high resolution images for iphone4 using css

In iphone4 images are not showing in high resolution its shows low resolution images.
How to change high resolution images for iphone4 using css?
To clarify, we are developing in phonegap using html and jquery The high-res images end up pixelated in the application. The .png images have the designation of #2x.png and the raw files match the png files.
We have utilized the practices in
http://aralbalkan.com/3331
and
http://davidehlers.com/2011/03/iphone...
The images appear slightly smaller than the raw images are, and significantly pixelated. I have attached an overlay of the issue that Venky is referring to. This is the buttonsml#2x.png on the right, placed on top of the screenshot of the app from an iPhone4.
Not sure about CSS but in normal way you can append "#2x" to normal image name and that would be goes for Retina Display. So may be you don't need to mention that in CSS and just put #2x in image and add it in to the project. For example for icon.png it would be icon#2x.png.
Hope this help.
I've gotten this to work by using the #2x versions in the image tags, and specifying a width/height that's half the size of the #2x image. For example, with a 200 x 80 "item#2x.png", I'd use:
<img src="item#2x.png" width="100" height="40">
It works well inside a UIWebView. Not sure about doing it with CSS though.
You have to use high resolution images. The SDK will automatically select the high resolution version (#2x) if you load the image in code (UIImage imageNamed), but if you are doing through any other method you will have to do it yourself.

Scaling down Retina res icons to standard res

I have my ui for my app but I would like to work within interface builder for the ui. I only have a Retina scaled set (640 x 960). There are a lot of .png's but I don't know what I should do to be able to implement both 320 x 480 scale ui and 640 x 960 scale ui. Is there a way to do something from within xcode or is there a way to scale down the images using preview or similar. If the only way would be to use a scaling program, then what should I scale them to?
Thanks
You will love this little tool, free in the Mac Store
http://itunes.apple.com/au/app/unretiner/id411277085?mt=12
[EDIT]
It also sounds like you're not sure about how to implement both retina and normal interfaces.
You will need a pair of images for each "graphic object" and the retina version should have it's filename appended with #2x. So in the case of an image called "background.png" you will have one called "background#2x.png" for retina, and "background.png" for the older screens.
In your interface builder files you can simply choose the "background.png" version and the OS will pick up the retina version and apply it when needed.
The tool mentioned above will also save the "unretinized" files with the correct filename so if you use an image with the #2x appended, it will scale it down and rename it too!
You can use Preview to scale the images. Open the image, go into the Tools menu and select Adjust Size.... Change the Width (and height) to 50 percent and press OK.
Then use File/Save as... to save your new not-retina image.
I'm not an iPhone developer, but I believe the correct way to handle this would be to have two sets of icons: one for the iPhone 3GS and earlier and one for the iPhone 4. Scaling icons down will make them look muddy.

When I create an iphone window based app, how to tell interface builder create window for retina pixel size?

I hope to create an iphone window based app for retina screen?
But I found that the size of window in mainwindow.xib is fixed.
How to adjust it or there is any to tell interface builder create window for retina pixel size?
Welcome any comment
Thanks
interdev
There's no need to do anything in terms of the various components you layout in Interface Builder, as it's based around points, not pixels - and as all the iPhone screens sizes are the same in points no action is required.
In terms of any images you're loading, you will need to supply higher resolution (twice the pixel size) versions, but as long as these are named "[original name]#2x.[extension]" they'll simply work automatically.
For more information on the image naming, see the "Specifying High-Resolution Images in iOS" section of the Resource Programming Guide and if you want to delve a little deeper, there's a discussion on "Points Versus Pixels" within the Drawing and Printing Guide for iOS.
UPDATE - As of the iPhone 5, the iPhone screens are no longer all the same point size. :-)
The window will be automatically resized for you, you do need concern about the size of your image elements, since retina display uses a bigger size of resolution. You need name your images like this:
regular image name: myimage.png
retina image name: myimage#2x.png
When running in an iPhone4 your program will identify the token "#2x" and change the images for that kind of device.
Design your layout using the size of: 640x960 (double of the original: 320x480)
Good luck.