public static short GetColorIndex( DxfIndexedColor indexedColors, ArgbColor color, out int colorDifference) { return(DxfIndexedColor.GetColorIndex(indexedColors.colors, color, out colorDifference)); }
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); } } }
internal static short smethod_0(WW.Cad.Model.Color color) { switch (color.ColorType) { case ColorType.ByLayer: return(256); case ColorType.ByBlock: return(0); case ColorType.None: return(0); default: return(DxfIndexedColor.GetColorIndex(color.ToArgbColor(DxfIndexedColorSet.AcadClassicIndexedColors))); } }
public short GetBestMatchingIndex(ArgbColor color) { int colorDifference; return(DxfIndexedColor.GetColorIndex(this.colors, color, out colorDifference)); }
private static int smethod_11(int rgb1, int rgb2) { return(DxfIndexedColor.smethod_10(ArgbColor.FromArgb(rgb1, false), ArgbColor.FromArgb(rgb2, false))); }
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)); }
internal static ArgbColor[] smethod_6(DxfIndexedColor.Struct14 colorSetType) { ArgbColor[] argbColorArray = new ArgbColor[257]; argbColorArray[0] = argbColorArray[256] = ArgbColor.Empty; double[][] numArray1 = new double[24][]; double[][] numArray2 = new double[24][]; for (int index1 = 0; index1 < 24; ++index1) { int index2 = (16 + index1) % 24; int index3 = (8 + index1) % 24; int index4 = index1 % 24; numArray1[index1] = new double[3] { DxfIndexedColor.double_0[index2], DxfIndexedColor.double_0[index3], DxfIndexedColor.double_0[index4] }; numArray2[index1] = new double[3] { 0.5 * (DxfIndexedColor.double_0[index2] + 1.0), 0.5 * (DxfIndexedColor.double_0[index3] + 1.0), 0.5 * (DxfIndexedColor.double_0[index4] + 1.0) }; } double[] numArray3; switch (colorSetType.enum38_0) { case DxfIndexedColor.Enum38.const_0: numArray3 = new double[5] { 1.0, 0.8, 0.6, 0.5, 0.3 }; break; default: numArray3 = new double[5] { 1.0, 0.65, 0.5, 0.3, 0.15 }; break; } int num1; int num2; switch (colorSetType.enum39_0) { case DxfIndexedColor.Enum39.const_0: num1 = 51; num2 = (int)byte.MaxValue; break; case DxfIndexedColor.Enum39.const_2: num1 = 0; num2 = 229; break; default: num1 = 0; num2 = (int)byte.MaxValue; break; } argbColorArray[1] = ArgbColors.Red; argbColorArray[2] = ArgbColors.Yellow; argbColorArray[3] = ArgbColor.FromRgb(0, (int)byte.MaxValue, 0); argbColorArray[4] = ArgbColors.Cyan; argbColorArray[5] = ArgbColors.Blue; argbColorArray[6] = ArgbColors.Magenta; argbColorArray[7] = colorSetType.enum37_0 != DxfIndexedColor.Enum37.const_0 ? ArgbColors.Black : ArgbColors.White; argbColorArray[8] = ArgbColor.FromGray(128); argbColorArray[9] = ArgbColor.FromGray(192); for (int index1 = 10; index1 < 250; ++index1) { int index2 = index1 / 10 - 1; double[][] numArray4 = index1 % 2 == 0 ? numArray1 : numArray2; int index3 = index1 % 10 / 2; double[] numArray5 = numArray4[index2]; argbColorArray[index1] = ArgbColor.FromRgb(DxfIndexedColor.smethod_9(numArray3[index3] * numArray5[0] * (double)byte.MaxValue), DxfIndexedColor.smethod_9(numArray3[index3] * numArray5[1] * (double)byte.MaxValue), DxfIndexedColor.smethod_9(numArray3[index3] * numArray5[2] * (double)byte.MaxValue)); } for (int index = 0; index < 6; ++index) { argbColorArray[250 + index] = ArgbColor.FromGray(num1 + index * (num2 - num1) / 5); } return(argbColorArray); }
internal static ArgbColor[] smethod_5(ArgbColor backgroundColor) { return(DxfIndexedColor.smethod_6(DxfIndexedColor.smethod_4(backgroundColor))); }
internal static short GetColorIndex(ArgbColor color, out int colorDifference) { return(DxfIndexedColor.GetColorIndex(DxfIndexedColor.AcadClassicIndexedColors.colors, color, out colorDifference)); }
public static short GetColorIndex(ArgbColor color) { int colorDifference; return(DxfIndexedColor.GetColorIndex(color, out colorDifference)); }