[Approved] Support for keepaspectratio in Coverflow (1 Viewer)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #21
    I'll submit a patch soon, but I had to get the scrollbar posX working when the facadeview is not the precise resolution of the screen. This will include a fix for scrollbar scaling as well, as it has to be done in the facade to not destroy existing features.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #22
    OK, here's the deal.

    4 new XML values added to coverflow facade:

    Code:
        [XMLSkinElement("keepaspectratio")] protected bool _keepAspectRatio = true;
        [XMLSkinElement("thumbZoom")] protected bool _zoom = false;
        [XMLSkinElement("cardAlign")] protected Alignment _imageAlignment = Alignment.ALIGN_CENTER;
        [XMLSkinElement("cardVAlign")] protected VAlignment _imageVAlignment = VAlignment.ALIGN_BOTTOM;

    I fixed the scrollbar not being scaled and positioned to skin-size, but I still think there is an issue with Coverflow when the width of the control is NOT the same as the skin-resolution.

    IE: If I make the coverflow posX=560 and width=800 I would expect that it was 800 pixel wide and centered in the screen on 1920x1080 (560x2 + 800 = 1920), but it is not.

    As long as the skinner makes sure it is the same width as the skin, there is no problem :confused:

    @DieBagger: Please review the patch, test it and see if the attached screenshots is what you would expect.

    I'm open to suggestions, and it's OK for me if the patch makes it into a later version ;)

    I made the patch against SVN 27393.

    Off for now, on tomorrow morning again :)
     

    Attachments

    • fullhd_res_thumbzoom-no_keepaspectratio-no.jpg
      fullhd_res_thumbzoom-no_keepaspectratio-no.jpg
      223.6 KB
    • fullhd_res_thumbzoom-no_keepaspectratio-yes.jpg
      fullhd_res_thumbzoom-no_keepaspectratio-yes.jpg
      167.6 KB
    • fullhd_res_thumbzoom-yes_keepaspectratio-no.jpg
      fullhd_res_thumbzoom-yes_keepaspectratio-no.jpg
      223.4 KB
    • fullhd_res_thumbzoom-yes_keepaspectratio-yes.jpg
      fullhd_res_thumbzoom-yes_keepaspectratio-yes.jpg
      187.7 KB
    • Enable keepaspectratio - thumbZoom - fix scrollbar sclaing issue.patch
      4.3 KB

    ajp8164

    Portal Pro
    January 9, 2008
    575
    1,166
    Atlanta, GA
    Home Country
    United States of America United States of America
    OK, here's the deal.

    4 new XML values added to coverflow facade:

    Code:
        [XMLSkinElement("keepaspectratio")] protected bool _keepAspectRatio = true;
        [XMLSkinElement("thumbZoom")] protected bool _zoom = false;
        [XMLSkinElement("cardAlign")] protected Alignment _imageAlignment = Alignment.ALIGN_CENTER;
        [XMLSkinElement("cardVAlign")] protected VAlignment _imageVAlignment = VAlignment.ALIGN_BOTTOM;

    I fixed the scrollbar not being scaled and positioned to skin-size, but I still think there is an issue with Coverflow when the width of the control is NOT the same as the skin-resolution.

    IE: If I make the coverflow posX=560 and width=800 I would expect that it was 800 pixel wide and centered in the screen on 1920x1080 (560x2 + 800 = 1920), but it is not.

    As long as the skinner makes sure it is the same width as the skin, there is no problem :confused:

    @DieBagger: Please review the patch, test it and see if the attached screenshots is what you would expect.

    I'm open to suggestions, and it's OK for me if the patch makes it into a later version ;)

    I made the patch against SVN 27393.

    Off for now, on tomorrow morning again :)

    Hi Pilehave,

    I'm not sure about the scrollbar patch where you have provided for coverflow:

    Code:
    int scrollbarPosX = (_positionX / 2) + (_width / 2) - (scrollbarWidth / 2);

    This geometry establishes an x position that I'm not sure makes sense. If the goal is to scale the final position with respect to the screen scaling then we use a special scaling method; GUIGraphicsContext.ScaleHorizontal(ref int x) for example.

    On the problem of positioning the coverflow using x position; well, it's broken :oops: Here is the offending line; it only takes into account the coverflow control width.

    Code:
    GUIGraphicsContext.Translate(Width / 2, YPosition, 0);

    Perhaps a more correct implementation would be:

    Code:
    GUIGraphicsContext.Translate(XPosition + Width / 2, YPosition, 0);

    To take into account scaling probably need something like the following. Not sure what the effect would be because I don't think the other critical calculations are scaled (haven't tried any of this).

    Code:
    int x = XPosition;
    int y = YPosition;
    int w = Width;
    GUIGraphicsContext.ScalePosToScreenResolution(ref x, ref y)
    GUIGraphicsContext.ScaleHorizontal(ref w)
    GUIGraphicsContext.Translate(x + w / 2, y, 0);
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #25
    Hi Pilehave,

    I'm not sure about the scrollbar patch where you have provided for coverflow:

    Code:
    int scrollbarPosX = (_positionX / 2) + (_width / 2) - (scrollbarWidth / 2);

    This geometry establishes an x position that I'm not sure makes sense. If the goal is to scale the final position with respect to the screen scaling then we use a special scaling method; GUIGraphicsContext.ScaleHorizontal(ref int x) for example.



    I think it is neccesary to use all 3 numbers to position it correctly, both _positionX and _width are already scaled as they derive from the facadecontrol. scrollbarWidth is scaled just above the quted code with ScaleHorizontal().

    But I found that this code should be used instead (previous one had an error) :oops:, which will position the scrollbar correctly when the facade is not centered; some skinners may want to position the facade more to the left or right:

    Code:
    int scrollbarPosX = (_positionX) + (_width / 2) - (scrollbarWidth / 2);

    If we can make coverflow horizontal positionable (<-- is that even a word?) it would be really nice :)
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #26
    OK, I applied

    Code:
    GUIGraphicsContext.Translate(XPosition + Width / 2, YPosition, 0);

    to coverflow and I think the scaling seems to be in order, and I positioned the scrollbar with the fixe from previous post. See attached screenshots (never mind that the title and itemcount is not positioned with the facade).

    576.jpg
    720x576 (window inner height)

    720.jpg
    1280x720 (window inner height)

    Above examples has the coverflow posX=800 and width=720
     

    ajp8164

    Portal Pro
    January 9, 2008
    575
    1,166
    Atlanta, GA
    Home Country
    United States of America United States of America
    pilehave - post a final patch with these changes (so I'm sure to get them all) and I'll commit them now as a bug fix (to get into 1.2).
    :D
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #28
    @pilehave - post a final patch with these changes (so I'm sure to get them all) and I'll commit them now as a bug fix (to get into 1.2).
    :D

    This should be it :D
     

    Attachments

    • Coverflow vs SVN 27432.patch
      4.8 KB

    catavolt

    Design Group Manager
  • Team MediaPortal
  • August 13, 2007
    14,428
    10,455
    Königstein (Taunus)
    Home Country
    Germany Germany
    AW: Support for keepaspectratio in Coverflow

    Just testing SVN 27444. When changing e.g. posX to 100 and width to 1166 to have the coverflow centered with 100 px space on either side (skin resolution 1366 x 768), nothing happens. Neither the posX nor the width are respected.
     

    Users who are viewing this thread

    Top Bottom