protected static void ApplyAcadCorrection(ArgbColor[] colors, ArgbColor backgroundColor) { int mask = DxfIndexedColor.smethod_12(backgroundColor); int rgb1 = backgroundColor.Rgb; for (int index = 1; index <= (int)byte.MaxValue; ++index) { int rgb2 = colors[index].Rgb; if (DxfIndexedColor.smethod_11(rgb2 & mask, rgb1 & mask) < 29) { colors[index] = DxfIndexedColor.smethod_7(rgb2, rgb1, mask); } } }
private static ArgbColor smethod_7(int rgb, int backgroundRgb, int mask) { int num1 = 0; int val2 = 0; if (mask == 16777215) { foreach (int num2 in DxfIndexedColor.int_4) { int num3 = (int)byte.MaxValue << num2; int num4 = (int)((long)(rgb >> num2) & (long)byte.MaxValue) - (int)((long)(backgroundRgb >> num2) & (long)byte.MaxValue); if (num4 >= 0 && num4 <= 29) { int val1 = DxfIndexedColor.smethod_8((int)((long)(rgb >> num2) & (long)byte.MaxValue)); if (Math.Abs(val1 - val2) < 6) { num1 |= num3; val2 = Math.Max(val1, val2); } else if (val1 > val2) { val2 = val1; num1 = num3; } } } } else { if (DxfIndexedColor.smethod_12(ArgbColor.FromArgb(rgb, false)) == 16777215) { return(ArgbColor.FromArgb(rgb, false)); } foreach (int num2 in DxfIndexedColor.int_4) { int num3 = (int)byte.MaxValue << num2; if ((num3 & mask) != 0 && (int)((long)(rgb >> num2) & (long)byte.MaxValue) - (int)((long)(backgroundRgb >> num2) & (long)byte.MaxValue) >= 0) { num1 |= num3; val2 = Math.Max(DxfIndexedColor.smethod_8((int)((long)(rgb >> num2) & (long)byte.MaxValue)), val2); } } } if (num1 == 0) { int num2 = 256; foreach (int num3 in DxfIndexedColor.int_4) { int num4 = (int)byte.MaxValue << num3; if ((num4 & mask) != 0) { int num5 = Math.Abs((int)(((long)(rgb >> num3) & (long)byte.MaxValue) - ((long)(backgroundRgb >> num3) & (long)byte.MaxValue))); if (num5 <= num2 + 6) { num2 = num5; int val1 = DxfIndexedColor.smethod_8((int)((long)(rgb >> num3) & (long)byte.MaxValue)); if (Math.Abs(val1 - val2) < 6) { num1 |= num4; val2 = Math.Max(val1, val2); } else { val2 = val1; num1 = num4; } } } } } int argb = 0; foreach (int num2 in DxfIndexedColor.int_4) { int num3 = (int)byte.MaxValue << num2; if ((num3 & mask) != 0 && (num3 & num1) != 0) { argb |= val2 << num2; } else { argb |= rgb & num3; } } if (argb == 16711422) { argb = 16053492; } return(ArgbColor.FromArgb(argb, false)); }