AdjustBrightness() public method

Changes the brightness. Typical values are in the range (-1, 1). Values above zero will make the image brighter, values below zero will make it darker.
public AdjustBrightness ( float value ) : void
value float
return void
示例#1
0
 static public int AdjustBrightness(IntPtr l)
 {
     try {
         FairyGUI.ColorFilter self = (FairyGUI.ColorFilter)checkSelf(l);
         System.Single        a1;
         checkType(l, 2, out a1);
         self.AdjustBrightness(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int AdjustBrightness(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.ColorFilter obj = (FairyGUI.ColorFilter)ToLua.CheckObject <FairyGUI.ColorFilter>(L, 1);
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.AdjustBrightness(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#3
0
        public virtual void Setup_BeforeAdd(XML xml)
        {
            string str;
            string[] arr;

            id = xml.GetAttribute("id");
            name = xml.GetAttribute("name");

            arr = xml.GetAttributeArray("xy");
            if (arr != null)
                this.SetXY(int.Parse(arr[0]), int.Parse(arr[1]));

            arr = xml.GetAttributeArray("size");
            if (arr != null)
            {
                initWidth = int.Parse(arr[0]);
                initHeight = int.Parse(arr[1]);
                SetSize(initWidth, initHeight, true);
            }

            arr = xml.GetAttributeArray("scale");
            if (arr != null)
                SetScale(float.Parse(arr[0]), float.Parse(arr[1]));

            arr = xml.GetAttributeArray("skew");
            if (arr != null)
                this.skew = new Vector2(float.Parse(arr[0]), float.Parse(arr[1]));

            str = xml.GetAttribute("rotation");
            if (str != null)
                this.rotation = int.Parse(str);

            arr = xml.GetAttributeArray("pivot");
            if (arr != null)
            {
                float f1 = float.Parse(arr[0]);
                float f2 = float.Parse(arr[1]);
                //处理旧版本的兼容性(旧版本发布的值是坐标值,新版本是比例,一般都小于2)
                if (f1 > 2)
                {
                    if (sourceWidth != 0)
                        f1 = f1 / sourceWidth;
                    else
                        f1 = 0;
                }
                if (f2 > 2)
                {
                    if (sourceHeight != 0)
                        f2 = f2 / sourceHeight;
                    else
                        f2 = 0;
                }
                this.SetPivot(f1, f2, xml.GetAttributeBool("anchor"));
            }
            else
                this.SetPivot(0, 0, false);

            str = xml.GetAttribute("alpha");
            if (str != null)
                this.alpha = float.Parse(str);

            this.touchable = xml.GetAttributeBool("touchable", true);
            this.visible = xml.GetAttributeBool("visible", true);
            this.grayed = xml.GetAttributeBool("grayed", false);

            str = xml.GetAttribute("blend");
            if (str != null)
                this.blendMode = FieldTypes.ParseBlendMode(str);

            str = xml.GetAttribute("filter");
            if (str != null)
            {
                switch (str)
                {
                    case "color":
                        ColorFilter cf = new ColorFilter();
                        this.filter = cf;
                        arr = xml.GetAttributeArray("filterData");
                        cf.AdjustBrightness(float.Parse(arr[0]));
                        cf.AdjustContrast(float.Parse(arr[1]));
                        cf.AdjustSaturation(float.Parse(arr[2]));
                        cf.AdjustHue(float.Parse(arr[3]));
                        break;
                }
            }

            str = xml.GetAttribute("tooltips");
            if (str != null)
                this.tooltips = str;
        }