public static System.Windows.Media.Color ColorIndexToMediaColor(int cla) { if (cla == 7) { return(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)); } var acirgb = EntityColor.LookUpRgb((byte)cla); var b = (byte)acirgb; var g = (byte)(acirgb >> 8); var r = (byte)(acirgb >> 16); return(System.Windows.Media.Color.FromRgb(r, g, b)); }
/// <summary> /// TODO /// </summary> /// <param name="color"></param> /// <returns></returns> private System.Drawing.Color AcadColorAciToDrawingColor(Color color) { var aci = Convert.ToByte(color.ColorIndex); var aRgb = EntityColor.LookUpRgb(aci); var ch = BitConverter.GetBytes(aRgb); if (!BitConverter.IsLittleEndian) { Array.Reverse(ch); } int r = ch[2]; int g = ch[1]; int b = ch[0]; return(System.Drawing.Color.FromArgb(r, g, b)); }