Texture ColorDiffuse affected by BorderTexture
#1
Question 
I'm trying to create an include which will display a simple background image.  I had accomplished what I was originally trying to do when I had one last idea - add an option to change the transparency of the background.  I figured just changing the alpha channel on colordiffuse for the texture should do that but my results were unexpected.  When the image has a border (bordersize and bordertexture attributes) then colordiffuse on the texture appears to merge the color of the texture and the final color of the border.  Is this the way it's supposed to work?  If I exclude the bordersize and bordertexture attributes then it works as I was expecting but there is of course no border.   
xml:

    <include name="BuildPanelBackground">
        <param name="height" />
        <param name="width" />
        <param name="bordersize" />
        <param name="bordercolor" default="labelheader"/>
        <param name="color" default="black" />
        <param name="coloralpha" default="E6" />
        <definition>
            <control type="image">
                <width>$PARAM[width]</width>
                <height>$PARAM[height]</height>
                <bordersize>$PARAM[bordersize]</bordersize>
                <bordertexture colordiffuse="$PARAM[bordercolor]">colors/white.png</bordertexture>
                <texture colordiffuse="$PARAM[coloralpha]FFFFFF">colors/$PARAM[color].png</texture>
            </control>
        </definition>
    </include>

This is the result when using the code shown above.  No transparency and the otherwise black background is now a bit blue (like the border)Image


Now when I remove the bordersize and bordertexture lines.  The background is black with very slight transparency.  This is what I was expecting however I would like to get this result with the border too.
Image


I thought maybe the problem is because I'm using colordiffuse on the bordertexture too so I got rid of that.
xml:

                <bordertexture>colors/white.png</bordertexture>

The results were this
Image

I'd like to get this working the way I was expecting, with the option fo transparency and a border but I'm willing to forgo the transparency if that's not possible.  What I'm really more interested in at this point is understanding why I'm getting the results I am. 

I'd greatly appreciate it if someone could help explain this.

Thank you
Reply
#2
(2021-07-16, 02:11)pfp-az Wrote: <texture colordiffuse="$PARAM[coloralpha]FFFFFF">colors/$PARAM.png</texture>

not sure if it's the cause of your issue, but colors/$PARAM.png doesn't make sense ;-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thank you for pointing that out.  I've fixed the code shown in the original post to be correct. I've been tweaking it so many times trying to figure it out and must have missed that before copying it to post here.
Reply
#4
I'm still curious why I got the results I did with the original code but I found another way to get what I wanted.   

xml:

    <include name="BuildPanelBackground">
        <param name="height" />
        <param name="width" />
        <param name="bordersize" />
        <param name="bordercolor" default="labelheader"/>
        <param name="color" default="black" />
        <param name="coloralpha" default="E6" />
        <definition>
            <!-- background -->
            <control type="image">
                <width>$PARAM[width]</width>
                <height>$PARAM[height]</height>
                <texture colordiffuse="$PARAM[coloralpha]FFFFFF">colors/$PARAM.png</texture>
            </control>
            <!-- top border -->
            <control type="image">
                <top>0</top>
                <left>0</left>
                <width>$PARAM[width]</width>
                <height>$PARAM[bordersize]</height>
                <texture colordiffuse="$PARAM[bordercolor]">colors/white.png</texture>
            </control>
            <!-- left border -->
            <control type="image">
                <top>0</top>
                <left>0</left>
                <width>$PARAM[bordersize]</width>
                <height>$PARAM[height]</height>
                <texture colordiffuse="$PARAM[bordercolor]">colors/white.png</texture>
            </control>
            <!-- right border -->
            <control type="image">
                <top>0</top>
                <right>$PARAM[width]r</right>
                <width>$PARAM[bordersize]</width>
                <height>$PARAM[height]</height>
                <texture colordiffuse="$PARAM[bordercolor]">colors/white.png</texture>
            </control>
            <!-- bottom border -->
            <control type="image">
                <left>0</left>
                <bottom>$PARAM[height]r</bottom>
                <width>$PARAM[width]</width>
                <height>$PARAM[bordersize]</height>
                <texture colordiffuse="$PARAM[bordercolor]">colors/white.png</texture>
            </control>
        </definition>
    </include>
Reply
#5
I wondered why just not use a real bordertexture.

for an image control you can use 2 layers.

layer 1 (bottom) = bordertexture tag
layer 2 (top) = texture tag

the bordersize tag is supposed to define layer 2"cropping" and you define twith a numeric value im pixels
( they read either "left,top,right,bottom" when using commatas, if not it'applied to all borders. )

the border tag attribute defines
Used to specify a region of the texture to be considered a border that should not be scaled when the texture is scaled to fit a control's dimensions. The portion in the border region will remain unscaled. Particularly useful to achieve rounded corners that do not change size when a control is resized. Note that zoom animations and GUI rescaling will still affect the border region - it is just the scaling of the texture to the control size which is unaffected. Using border="5" will give a 5 pixel border all around the texture. You can specify each of the border amounts on each edge individually using border="left,top,right,bottom".

https://kodi.wiki/view/Image_Control

https://kodi.wiki/view/Texture_Attributes


so best is a have bordertexture which can be fit in.
in that case a frame.
and you can avoid using 4 image controls.
Skins |  Titan M O D   •   S W A N (WIP)
Reply

Logout Mark Read Team Forum Stats Members Help
Texture ColorDiffuse affected by BorderTexture0