
Originally Posted by
Thurallor
One important thing to note is that if you want images to overlay each other, and be able to see the back image through the transparent parts of the front image, you need to put them in separate top-level windows (Turbine.UI.Window). If you just put them in separate controls (Turbine.UI.Control) within the same window, it won't work.
This is incorrect.
You can overlay a control with a .tga background over another control with a .tga background and see them layered with correct transparency. For instance, load MoorMap and turn on the debug window and execute the following code:
Code:
resourcePath="GaranStuff/MoorMap/Resources/"
mapPath="GaranStuff/MoorMap/Maps/"
testWindow=Turbine.UI.Lotro.Window()
testWindow:SetSize(400,400)
testWindow:SetPosition(200,200)
testWindow:SetText("Test Window")
testWindow:SetVisible(true)
background=Turbine.UI.Control()
background:SetParent(testWindow)
background:SetSize(380,340)
background:SetPosition(10,40)
background:SetBackground(mapPath.."Cliving.jpg")
testButton=Turbine.UI.Control()
testButton:SetParent(background)
testButton:SetSize(32,32)
testButton:SetPosition(10,45)
testButton:SetBlendMode(Turbine.UI.BlendMode.Overlay)
testButton:SetBackground(resourcePath.."Annotations.tga")
testButton2=Turbine.UI.Control()
testButton2:SetParent(background)
testButton2:SetSize(32,32)
testButton2:SetPosition(10,45)
testButton2:SetBlendMode(Turbine.UI.BlendMode.Overlay)
testButton2:SetBackground(resourcePath.."Barber_Icon.tga")
This will generate three images all overlayed with transparency, the topmost with the 16x16 barbershop icon tiled with transparency over the mini-icon of the 32x32 annotations icon which in turn is transparent over the background of the top left corner of the Cliving map. While this is a relatively ugly sample, it clearly shows that you can layer multiple transparent images. This also shows that the controls can either be contained within the control behind them or simply use ZOrder (or order of definition) to control which is topmost. The key is to use .tga images and set the BlendMode to Overlay. Note, a whole separate, more complicated set of rules applies if any of the controls or their parents use SetStretchMode to stretch their images so try to stay away from SetStretchMode when layering controls with transparency.