How does scaling work for skins?
#1
OK, I have a skin which has a definition for 1920x1080 screens (similar to Estuary) and it all runs quite happily on devices which have differing resolutions and aspect ratios. Such as:
- iPad 2, 1024x768, 4:3
- Surface Pro 3, 2440x16-something, 3:2

All fine except for one thing: coordinates in a python script, in which I want to put something X pixels up from the bottom (scaled to suit the screen).
It needs to work in with other XML controls.

I notice that window.getWidth and getHeight return the native screen sizes unscaled. So I can't use those. But if I use 1080 for the height, hoping that it will get scaled along with everything else, that doesn't work either: things end up about 3/4 of the way down the screen, and I suspect it is the different aspect ratios to blame.

Does automatic scaling work on the width alone? How does Kodi scale skins when the aspect ratios are very different?
HDHomerun Quatro, RaspPi/TVHeadend, NUC/Win10/Kodi, Mousetuary skin, Mouse on couch!
Reply
#2
By experimentation, I found that this worked:

Code:
screen_width = 1920
screen_height = (1920 * self.getHeight()) / self.getWidth()

I'm guessing there is some interaction with the resolutions in the <extension> section of addon.xml. All my devices have aspect ratios that are represented there (though at different resolutions) so I suspect that Kodi picks a matching aspect ratio and scales the resolution from there. Since the width is always 1920, only the height needs to change.

Code:
    <extension point="xbmc.gui.skin" debugging="false">
        <res width="1920" height="1440" aspect="4:3" default="false" folder="xml" />
        <res width="1920" height="1280" aspect="3:2" default="false" folder="xml" />
        <res width="1920" height="1200" aspect="16:10" default="false" folder="xml" />
        <res width="1920" height="1080" aspect="16:9" default="true" folder="xml" />
        <res width="2560" height="1080" aspect="21:9" default="false" folder="xml" />
    </extension>

There may be a better way of doing this, so if anyone knows what/if, let me know...
HDHomerun Quatro, RaspPi/TVHeadend, NUC/Win10/Kodi, Mousetuary skin, Mouse on couch!
Reply

Logout Mark Read Team Forum Stats Members Help
How does scaling work for skins?0