BlendMode

From LoTROInterface Wiki

Jump to: navigation, search


Specifies a blending method.


Fields

SetBlendMode( Turbine.UI.BlendMode.Name )

SetBackColorBlendMode( Turbine.UI.BlendMode.Name )


Name Description
AlphaBlend Overlays the source over the destination using the source alpha to interpolate between the source and destination colors.
Color Performs a blend between a new color generated by applying the hue and saturation of the source and the color value of the destination. The new color and the destination color are then interpolated between using the source alpha.
Grayscale Compute a new color by copying the max of R,G, and B to all three color channels. This new color is then blended with the destination color based on the source alpha.
Multiply Computes a new color by multiplying each color channel by the source color channel and then interpolating between the new color and the destination color based on the source alpha. Multiply will never brighten a pixel.
None None.
Normal Uses the source color value.
Overlay Overlays the source over the destination. If the source alpha is zero destination color will remain unchanged, for any other alpha value the source color replaces the destination.
Screen Compute a new color by multiplying the inverses of each color channel by the inverse of the source color channel and then inverting the result. The new color is then blended with the destination color based on the source alpha. Screen will never darken a pixel.
Undefined Specifies no blending.


Alternative- With Value

SetBlendMode( Value );

SetBackColorBlendMode( Value );


Name Value
AlphaBlend 4
Color 1
Grayscale 6
Multiply 3
None 8
Normal 0 or 2
Overlay 5
Screen 7
Undefined 8


Remarks

Blend Mode is used by various UI elements to determine how colors and images are combined. For example, Controls use the blend mode to determine how their background image is combined with the underlying window and then how the background color will be combined on top of that composite.

Examples

This example demonstrates how a control background image can be blended with a color.


Blending a background image
-- Create a test window to display a status icon.
testWindow = Turbine.UI.Window();
testWindow:SetPosition( 100, 100 );
testWindow:SetSize( 40, 40 );
testWindow:SetVisible( true );

-- Create a status icon and add it to the window.
testIcon = Turbine.UI.Control();
testIcon:SetParent( testWindow );
testIcon:SetBackground( "Resources/StatusIcon.tga" );
testIcon:SetSize( 40, 40 );
testIcon:SetBackColor( Turbine.UI.Color( 1, 1, 0, 0 ) );

testIcon.MouseClick = function( sender, args )
-- With each click, cycle through the various blend modes.
statusIcon:SetBlendMode( ( testIcon:GetBlendMode() + 1 ) % 9 );
end
Personal tools