Expose ControlImage AspectRatio
#16
ah, sorry 'bout that. stupid mistake on my part.

is fixed in cvs now.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#17
thanks, works great.

edit: i know you said you couldn't take into account pixel ratios using setcoordinateresolution() when doing images, as it would intefere with full screen images. now that you have added aspectratio to the imagecontrol, my thought is backgrounds would always want to be stretched (2), so stretch would not account for this, but maybe the other settings keep and scale should. i have noticed that images are better than they were originally at least they don't look as stretched horizontally as they did when i posted pictures here in this thread. your comment is below that. but maybe it could be done?



For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#18
the problem then is that while the images will change size, the positioning of those images would not change. so you'd get gaps in the layout. also, as it only applies to image controls, all other controls (buttons, lists etc.) would not scale (ie would look stretched).

cheers,
jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#19
hi jonathan,

you've mentioned your a lecturer in mathmatics, so this is for you. Smile

i'm trying to create a function in python that would calculate the width of a control based on the design resolution used in  setcoordinateresolution() and the current resolution used by getresolution().

this is easy if you go from or to a 1:1 pixel ratio. what i'm trying to do then is adjust the original width to a 1:1 ratio by multiplying the width by the pixel ratio multiplier i calculated using the ratios you supplied for the design resolution. then i divide it by the current resolution's pixel ratio multiplier.

does this make sense? here is the formula.

Quote:hdtv_1080i           = 0     # (1920x1080, 16:9, pixels are 1:1)
hdtv_720p            = 1     # (1280x720, 16:9, pixels are 1:1)
hdtv_480p_4x3        = 2     # (720x480, 4:3, pixels are 4320:4739)
hdtv_480p_16x9       = 3     # (720x480, 16:9, pixels are 5760:4739)
ntsc_4x3             = 4     # (720x480, 4:3, pixels are 4320:4739)
ntsc_16x9            = 5     # (720x480, 16:9, pixels are 5760:4739)
pal_4x3              = 6     # (720x576, 4:3, pixels are 128:117)
pal_16x9             = 7     # (720x576, 16:9, pixels are 512:351)
pal60_4x3            = 8     # (720x480, 4:3, pixels are 4320:4739)
pal60_16x9           = 9     # (720x480, 16:9, pixels are 5760:4739)

import xbmcgui

pixelwidthmultiplier = [1.0,1.0,0.91158472251529858619962017303229,1.215446296687064781599493564043,\
0.91158472251529858619962017303229,1.215446296687064781599493564043,1.09401709401709401709

40170940171,\
1.4586894586894586894586894586895,0.91158472251529858619962017303229,1.2154462966870647815

99493564043]

def setwidth(width, designresolution):
 resolution = xbmcgui.window().getresolution()
 print width, designresolution, resolution
 if (resolution == designresolution):
   print "same"
   return width
 width = int((width * pixelwidthmultiplier[designresolution]) / pixelwidthmultiplier[resolution])
 print width
 return width

the pixelwidthmultiplier's were calculated by dividing the width by the height.

edit: had the division and multiplication backwards.



For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#20
seems fine to me.

multiplying by the pixel ratio of the design resolution effectively gives it in a measure relative to the designers tv screen.

dividing by the pixel ratio of the users resolution then gets that same measure back into the pixel units of the users resolution.

cheers,
jonathan

ps: the default behaviour of python with images is now back to usual - it had been defaulting to "keep" aspect ratio, instead of stretch.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#21
thanks,

and about stretch, that's good. i noticed a few scripts would have needed updating.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#22
(nuka1195 @ may 02 2006,20:47 Wrote:i used rapidshare.

controlimage test

hi,

aspect ratio is broken again. the preceding link still works.

thanks



For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Expose ControlImage AspectRatio0