Esempio n. 1
0
 public LColor DivSelfAlpha(LColor c)
 {
     return(DivSelfAlpha(c.a));
 }
Esempio n. 2
0
 public static string GetColorName(LColor color)
 {
     return(LColorList.Get().Find(color));
 }
Esempio n. 3
0
 /**
  * 转换字符串为color
  *
  * @param c
  */
 public LColor(string c)
 {
     if (c == null)
     {
         SetColor(LColor.white);
         return;
     }
     c = c.Trim().ToLower();
     // 识别字符串格式颜色
     if (c.StartsWith("#"))
     {
         SetColor(HexToColor(c));
     }
     else if (c.StartsWith("Rgb"))
     {
         int start = c.IndexOf('(');
         int end   = c.LastIndexOf(')');
         if (start != -1 && end != -1 && end > start)
         {
             string   result = c.Substring(start + 1, end).Trim();
             string[] list   = StringUtils.Split(result, ',');
             if (list.Length == 3)
             {
                 SetColor(ConvertInt(list[0].Trim()), ConvertInt(list[1].Trim()), ConvertInt(list[2].Trim()));
             }
             else if (list.Length == 4)
             {
                 SetColor(ConvertInt(list[0].Trim()), ConvertInt(list[1].Trim()), ConvertInt(list[2].Trim()),
                          ConvertInt(list[3].Trim()));
             }
         }
     }
     else if (c.StartsWith("Argb"))
     {
         int start = c.IndexOf('(');
         int end   = c.LastIndexOf(')');
         if (start != -1 && end != -1 && end > start)
         {
             string   result = c.Substring(start + 1, end).Trim();
             string[] list   = StringUtils.Split(result, ',');
             if (list.Length == 3)
             {
                 SetColor(ConvertInt(list[1].Trim()), ConvertInt(list[2].Trim()), ConvertInt(list[0].Trim()));
             }
             else if (list.Length == 4)
             {
                 SetColor(ConvertInt(list[1].Trim()), ConvertInt(list[2].Trim()), ConvertInt(list[3].Trim()),
                          ConvertInt(list[0].Trim()));
             }
         }
     }
     else if (c.StartsWith("transparent"))
     {
         SetColor(unchecked ((int)TRANSPARENT));
     }
     else if (MathUtils.IsNan(c))
     {
         SetColor(ConvertInt(c));
     }
     else if (StringUtils.IsHex(c))
     {
         SetColor(HexToColor(c));
     }
     else
     {
         LColor color = LColorList.Get().Find(c);
         if (color != null)
         {
             SetColor(color);
         }
         else
         {
             SetColor(HexToColor(c));
         }
     }
 }
Esempio n. 4
0
 public LColor Lerp(LColor target, float alpha)
 {
     return(Lerp(this, target, alpha));
 }
Esempio n. 5
0
 public static bool PutName(string colorName, LColor color)
 {
     return(LColorList.Get().PutColor(colorName, color));
 }
Esempio n. 6
0
 public static LColor Lerp(LColor value1, LColor value2, float amount)
 {
     return(new LColor(Lerp(value1.GetRed(), value2.GetRed(), amount),
                       Lerp(value1.GetGreen(), value2.GetGreen(), amount), Lerp(value1.GetBlue(), value2.GetBlue(), amount),
                       Lerp(value1.GetAlpha(), value2.GetAlpha(), amount)));
 }
Esempio n. 7
0
 public LColor MulCopy(LColor c)
 {
     return(Multiply(c));
 }
Esempio n. 8
0
 public LColor DivCopy(LColor c)
 {
     return(Divide(c));
 }
Esempio n. 9
0
 public LColor SubCopy(LColor c)
 {
     return(Subtraction(c));
 }
Esempio n. 10
0
 public LColor AddCopy(LColor c)
 {
     return(Addition(c));
 }