public LColor DivSelfAlpha(LColor c) { return(DivSelfAlpha(c.a)); }
public static string GetColorName(LColor color) { return(LColorList.Get().Find(color)); }
/** * 转换字符串为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)); } } }
public LColor Lerp(LColor target, float alpha) { return(Lerp(this, target, alpha)); }
public static bool PutName(string colorName, LColor color) { return(LColorList.Get().PutColor(colorName, color)); }
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))); }
public LColor MulCopy(LColor c) { return(Multiply(c)); }
public LColor DivCopy(LColor c) { return(Divide(c)); }
public LColor SubCopy(LColor c) { return(Subtraction(c)); }
public LColor AddCopy(LColor c) { return(Addition(c)); }