// Token: 0x06003C71 RID: 15473 RVA: 0x00117698 File Offset: 0x00115898
 internal static Color GetColor(UnsafeNativeMethods.TF_DA_COLOR dacolor, ITextPointer position)
 {
     if (dacolor.type == UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_SYSCOLOR)
     {
         return(TextServicesDisplayAttribute.GetSystemColor(dacolor.indexOrColorRef));
     }
     if (dacolor.type == UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_COLORREF)
     {
         int  indexOrColorRef = dacolor.indexOrColorRef;
         uint num             = (uint)TextServicesDisplayAttribute.FromWin32Value(indexOrColorRef);
         return(Color.FromArgb((byte)((num & 4278190080U) >> 24), (byte)((num & 16711680U) >> 16), (byte)((num & 65280U) >> 8), (byte)(num & 255U)));
     }
     Invariant.Assert(position != null, "position can't be null");
     return(((SolidColorBrush)position.GetValue(TextElement.ForegroundProperty)).Color);
 }
Beispiel #2
0
        /// <summary>
        ///   Convert TF_DA_COLOR to Color.
        /// </summary>
        internal static Color GetColor(UnsafeNativeMethods.TF_DA_COLOR dacolor, ITextPointer position)
        {
            if (dacolor.type == UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_SYSCOLOR)
            {
                return(GetSystemColor(dacolor.indexOrColorRef));
            }
            else if (dacolor.type == UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_COLORREF)
            {
                int  color = dacolor.indexOrColorRef;
                uint argb  = (uint)FromWin32Value(color);
                return(Color.FromArgb((byte)((argb & 0xff000000) >> 24), (byte)((argb & 0x00ff0000) >> 16), (byte)((argb & 0x0000ff00) >> 8), (byte)(argb & 0x000000ff)));
            }

            Invariant.Assert(position != null, "position can't be null");
            return(((SolidColorBrush)position.GetValue(TextElement.ForegroundProperty)).Color);
        }