|
Resolution Independence In just under a year the people of Scotland will go to the polls to vote in the Scottish independence referendum. We at RunRev headquarters however, have been busy fighting a much more important campaign. The campaign for Resolution Independence. For too long have the points been ruled over by the pixels. It's time they were set free. We're not going to lie, it's been an arduous battle with many a below belt shot being thrown. But we got there in the end. And this is the story of how... What is Resolution Independence? Traditionally, the programmer has been more concerned with the resolution of a device, be it a desktop computer or a mobile phone, rather than it's pixel density. The resolution of a device is simply the number of pixels wide and high it is. For example 1024x768 or 960x640. The pixel density is the number of pixels the device packs in to an area, measured in pixels per inch (PPI). Whilst it's important for the programmer to take these numbers into consideration, it's often not the best way to do things. For example, I'm sure many of you will have experienced writing an app designed for a non-retina iPhone only to find everything at half the size when run on a retina device, in spite of the physical dimensions of the device being the same. The doubling in resolution between non-retina and retina devices is not to give the programmer more screen real estate to work with but rather to improve the crispness and quality of the display. Notionally both device types have the same dimensions, it's just the pixel density is doubled on retina devices. And that's the way the programmer should think of things. Rather than being concerned with the specific density and resolution, the programmer should layout their apps for an abstract density and resolution, letting LiveCode and the device's operating system take care of all the scaling. This means that the app you designed for non-retina devices will now automatically scale up to fit nicely on retina devices whilst taking advantage of the extra quality the higher density device offers. And this doesn't just apply to iPhones. Android devices as well as most desktop OSs now all support a variety of different pixel densities. It's important to note that whilst resolution independence will take care of the scaling of your app, it won't position controls for devices with different aspect ratios. That's a different problem and one that currently the programmer must take care of. So how do I use it? So, for iOS, the natural density is that of the non-retina resolutions. The programmer should think of their stack as a set of points at non-retina resolutions. When it comes to running the stack on retina devices (which are at twice the density), LiveCode will take care of all the scaling. This notion of "natural density" and "hi-density" applies to most OSs:
But what do I need to do?
What about images?
When an image is required, the current scale factor is rounded up to the nearest standard density (one of 0.25, 0.5, 0.75, 1, 1.5, 2 and 4). The image with the lowest scale factor that is greater or equal to the nearest standard density is then selected. For example, if the scale factor is 1.75 and there is an 'extra-high' image available that is used. What about displays with different aspect ratios? The scaling mode can be one of the following:
Potentially most interesting is the "no border" mode. This allows developers to produce their app with a core viewable area that will be visible on all devices. The contents outside of this core area can be thought of as just background that will be clipped on certain devices where the aspect ratio of screen does not match that of the stack. What's In 6.5 DP1? We urge all those interested to try these early releases out. Though on the surface, not much has changed, internally a lot of restructuring has gone on. This is full independence, not devolution max! The more people that test it on the widest range of devices possible, the better. Specifically, LiveCode's graphics layer has been completely re-written, including both image and text rendering. As such, nearly every one of LiveCode's drawing routines have been touched. Where possible, we've tried to match previous behavior as closely as possible, but we do expect some rendering glitches in early DPs. Please report any you find, in our Quality Center, and we'll get right on to addressing them so that the final release of 6.5 is as solid and stable as possible. Though the primary reason for the update is to support resolution independence, we do get the side benefits of having a modern 2D graphics library. This includes a clean developer API allowing for easy integration into other modules, potential performance improvements, transparent pattern support and support for graphic rendering on the server platforms (planned for a future release). So there you have it, independence has been achieved. The points have been set free. But this is only the beginning. Much has changed and we need your help to make sure we get everything right.
|
Tweet
|