FairyGUI.ColorFilter.Tint C# (CSharp) Method

Tint() public method

Tints the image in a certain color, analog to what can be done in Adobe Animate.
public Tint ( Color color, float amount = 1.0f ) : void
color Color the RGB color with which the image should be tinted.
amount float the intensity with which tinting should be applied. Range (0, 1).
return void
        public void Tint(Color color, float amount = 1.0f)
        {
            float q = 1 - amount;

            float rA = amount * color.r;
            float gA = amount * color.g;
            float bA = amount * color.b;

            ConcatValues(
                q + rA * LUMA_R, rA * LUMA_G, rA * LUMA_B, 0, 0,
                gA * LUMA_R, q + gA * LUMA_G, gA * LUMA_B, 0, 0,
                bA * LUMA_R, bA * LUMA_G, q + bA * LUMA_B, 0, 0,
                0, 0, 0, 1, 0);
        }

Usage Example

    static int Tint(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.ColorFilter obj  = (FairyGUI.ColorFilter)ToLua.CheckObject <FairyGUI.ColorFilter>(L, 1);
                UnityEngine.Color    arg0 = ToLua.ToColor(L, 2);
                obj.Tint(arg0);
                return(0);
            }
            else if (count == 3)
            {
                FairyGUI.ColorFilter obj  = (FairyGUI.ColorFilter)ToLua.CheckObject <FairyGUI.ColorFilter>(L, 1);
                UnityEngine.Color    arg0 = ToLua.ToColor(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                obj.Tint(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.ColorFilter.Tint"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
All Usage Examples Of FairyGUI.ColorFilter::Tint