Making inbuilt plugins Skin resolution aware (1 Viewer)

morpheus_xx

Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    • Thread starter
    • Moderator
    • #1
    The "Default" skin of MP2 is the base for all other skins. It's developed as a basic, fast and extensible skin. It's designed as 1280x720 resolution.

    All (or the majority) of the other Skins (Reflexion, Titanium, ApolloOne, BlueVision) are full HD (1920x1080).

    Because of the MP2 skin resource lookup chain, a fallback for missing screens and resources happens, selection the "Default" versions in the end.

    Where is the problem?
    Inbuilt plugins come with Skin support for Default, some of them also for Reflexion and Titanium. The most differences come from defined constants, like image sizes, grid widths, margins etc.
    So to add support for greater sizes requires some changes to support all new 1080 Skins.

    How can we solve this?

    My idea is to define constants inside Skins for both common sizes: 720 and 1080.

    I've created a custom MultiValueConverter which decides internally if it should use the first or second argument (720 or 1080 resolution).

    The XAML attributes then should use the new converter and bind both 720/1080 resources to it. It's not much more work then using single resources, but save all other designers most of the work.

    Examples
    Weather icon:
    XML:
                <Image x:Name="BigIcon" Source="{Binding CurrentLocation.Condition.BigIconProperty}" Stretch="Uniform">
                  <Image.Width>
                    <MultiBinding Converter="{StaticResource SkinResolutionMultiValueConverter}">
                      <Binding Source="{StaticResource WeatherIconBigWidth720}"/>
                      <Binding Source="{StaticResource WeatherIconBigWidth1080}"/>
                    </MultiBinding>
                  </Image.Width>
                  <Image.Height>
                    <MultiBinding Converter="{StaticResource SkinResolutionMultiValueConverter}">
                      <Binding Source="{StaticResource WeatherIconBigHeight720}"/>
                      <Binding Source="{StaticResource WeatherIconBigHeight1080}"/>
                    </MultiBinding>
                  </Image.Height>
                </Image>
    Where the constants are defined as:
    XML:
      <ResourceWrapper x:Key="WeatherIconBigWidth720">128</ResourceWrapper>
      <ResourceWrapper x:Key="WeatherIconBigHeight720">128</ResourceWrapper>
    
      <ResourceWrapper x:Key="WeatherIconBigWidth1080">192</ResourceWrapper>
      <ResourceWrapper x:Key="WeatherIconBigHeight1080">192</ResourceWrapper>
    So it's now no longer required to define the same constants for each 1080 skin over and over again, but only once inside the plugin.

    Full changes for "Weather": https://github.com/MediaPortal/MediaPortal-2/commit/6b13c779e604a601d32be539cf9d08933d579510

    Same for "News": https://github.com/MediaPortal/MediaPortal-2/commit/3e13557b0ad3a43baa09ebb317f4e251f1003983

    This change is especially thought for all new Skins which are under development (ApolloOne + BlueVision).

    @Designers and @Developers
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    766
    386
    Germany Germany
    I think it might go even more simple in usage, if you create an custom Extension instead of an ValueConverter.
    XML:
    <Image x:Name="BigIcon" Source="{Binding CurrentLocation.Condition.BigIconProperty}" Stretch="Uniform"
           Width="{ResolutionResource WeatherIconBigWidth}" Height="{ResolutionResource WeatherIconBigHeight}"/>
    Internally the ResolutionResourceExtension would work exactly like the StaticResourceExtension, except that it appends the Resolution to the key Name.
    The Resources would be defined exactly like in your sample.
    Iknow that this might be a bit confusing at first, but finally the Skin XAML code would be way shorter and more easy to read.
     

    ge2301

    MP2 Design
  • Team MediaPortal
  • January 11, 2014
    6,622
    2,387
    Stuttgart
    Germany Germany
    Country flag
    How about 4k resolution? I don't have such TV (And I won't buy), but the trend will be in this direction by time.
    Or is it not of interest, because 4k = 4 times 1080, so same aspect ratio?

    EDIT: With post of Osre it's clear now
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    766
    386
    Germany Germany
    The Extension could look for more than 720 and 1080, and take the one which fits best.
    By this only the resources Needs to be updated to Support other resolutions.
    The Extension could always take the next smaler resource.
    Lets say you have 1920x1200, then it would take 1080.
    If you have 4k, and no exta value is defined for 4k, then it would take 1080 too.
    If aou add the 4k resource, it would be taken instead.
    By this any resoulution can be supported with a specific value.
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,085
    3,685
    Lehmden
    Germany Germany
    Country flag
    Hi.
    Any chance to get any 4:3 resolution available too? I'm asking as in bedroom I still have a 4:3 CRT TV running and my extra VGA monitor also is 4:3. Most of the Time I'm watching on my FullHD 1080P 16:9 TV but sometimes I need to use MP2 with 4:3 aspect... And I'm sure I'm not the only one in the whole world who still uses some 4:3 screens.
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    766
    386
    Germany Germany
    You also could add an Parameter to the Extension which scales the actual value (if it's an numeric one) according to the actual Resolution.
    Lets say you have a resource value of 100 for 1080.
    Your actual Resolution is 1200.
    When you turn on the Auto scaling, then the following would happen.
    1. Look for 1200 value
    2. if 1200 value not found -> look for next smaler one
    3. 1080 value found: 100
    4. if AutoScale == true: value = value * actualResolution / resourceResoulution
      -> 111.11 = 100 * 1200 / 1080
     

    osre

    Retired Team Member
  • Premium Supporter
  • December 14, 2014
    766
    386
    Germany Germany
    Hi.
    Any chance to get any 4:3 resolution available too? I'm asking as in bedroom I still have a 4:3 CRT TV running and my extra VGA monitor also is 4:3. Most of the Time I'm watching on my FullHD 1080P 16:9 TV but sometimes I need to use MP2 with 4:3 aspect... And I'm sure I'm not the only one in the whole world who still uses some 4:3 screens.
    May be the Extension could Support not only specifying height, but also width in the resource name?
    Resouce names like "MyWidth640_480".
    The Extension would then prefere resources with same aspect Ratio, if the height is not off too much (some Kind of weighting)
    If the resource Name is only height, then an aspect Ratio of 16:9 is used automatically.
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,085
    3,685
    Lehmden
    Germany Germany
    Country flag
    Hi.
    Would be a "killer feature" if MP2 could support different aspect ratios as today there are much more than 16:9 or 4:3. My Tablet as example has 1920x1200 px (something like 16:10 ratio), there are TV available with 2.35:1, and so on...
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    • Thread starter
    • Moderator
    • #9
    Hi.
    Any chance to get any 4:3 resolution available too? I'm asking as in bedroom I still have a 4:3 CRT TV running and my extra VGA monitor also is 4:3. Most of the Time I'm watching on my FullHD 1080P 16:9 TV but sometimes I need to use MP2 with 4:3 aspect... And I'm sure I'm not the only one in the whole world who still uses some 4:3 screens.
    This is not so easy: the Skins are designed at a specific dimension (1280x720, 1920x1080) (see skin.xml). Now there are 2 dimensions: skin vs. screen, where scaling happens. This scaling also happens for windowed mode (with completely free aspect ratio) as well. I think the resolution specific resources can only work with the Skin dimension, not the screen ones.

    The proposed Extensions is a great idea, I will implement it! (thanks osre(y)). It will work as suggested: try skin's resolution first, then fallback to lower versions.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    N [Proposal] Make text input using remote control easier MediaPortal 2 4
    N [Proposal] Make text input possible with remote control in SMS style MediaPortal 2 1
    J Make the mouse cursor "inactive" when Enter is pressed Feature Requests 2
    joecrow 1.25.0 Radio Time plugin fails after Resume from Sleep with MP 1.25 Bugreports 4
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    E aktuelle englische Forums Webseite von - Showtime Plugin v3 Plugins & Erweiterungen 4
    mrmojo666 [Tv Server Plugin ]Direct Show Video Control Plugin 0.0.0.1 for Hauppauge PVR cards MediaPortal 1 Plugins 0
    joecrow MultiShortcut Plugin (Uavailable) in DWHD skin General Support 58
    vapourEyes Building TV Plugin General Development (no feature request here!) 49
    Golf4 Nach Windows-Updates läuft TV-Plugin nicht mehr Allgemeines Support- und Diskussionsforum 0
    joecrow How about a Launcher plugin for MP1? MediaPortal 1 6
    D [solved] TVServer Plugin must be missing something. General Development (no feature request here!) 1
    framug Nouveau plugin XmlTvFR pour récupérer le guide télé français Kazer / ZguideTv (WebEPGfr) 11
    emphatic Allow remote control mapping of all plugins Improvement Suggestions 0
    D Where should plugins be located on hard drive? General Support 0
    D how to disengage from one version of a plugin to use another Newcomers Forum 0
    cbr954rr How to disable a pre-configured plugin? General 2
    mrmojo666 [Plugin]Marantz Control Plugin 0.0.0.2 MediaPortal 1 Plugins 2
    mrmojo666 beginner: trying to write a plugin, need help to catch event General Development (no feature request here!) 3
    framug [Rejected] Fix PowerScheduler plugin for MP2 single seat Submit: Code Patches 9
    doskabouter [Question] Stale plugins Developer Discussions 9
    M MP1 stops responding after Starting Plugins General Support 14
    Terra LAVFilter Plugin cannot be updated (MP1.23) MediaPortal 1 Plugins 10
    L Mediaportal 1.21 and Windows 10: user schedules de-activated when powerscheduler plugin is selected General Support 1
    C Can the XmlTv Plugin handle 600+ channels? General 3
    Similar threads

























    Top Bottom