2021-07-16, 02:11
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.
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)
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.
I thought maybe the problem is because I'm using colordiffuse on the bordertexture too so I got rid of that.
The results were this
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
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)
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.
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
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