// Token: 0x060033B9 RID: 13241 RVA: 0x000E696C File Offset: 0x000E4B6C
        internal string GetBorderAttributeString(ConverterState converterState)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" BorderThickness=\"");
            stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderLeft.EffectiveWidth));
            stringBuilder.Append(",");
            stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderTop.EffectiveWidth));
            stringBuilder.Append(",");
            stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderRight.EffectiveWidth));
            stringBuilder.Append(",");
            stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderBottom.EffectiveWidth));
            stringBuilder.Append("\"");
            ColorTableEntry colorTableEntry = null;

            if (this.BorderLeft.CF >= 0L)
            {
                colorTableEntry = converterState.ColorTable.EntryAt((int)this.BorderLeft.CF);
            }
            if (colorTableEntry != null)
            {
                stringBuilder.Append(" BorderBrush=\"");
                stringBuilder.Append(colorTableEntry.Color.ToString(CultureInfo.InvariantCulture));
                stringBuilder.Append("\"");
            }
            else
            {
                stringBuilder.Append(" BorderBrush=\"#FF000000\"");
            }
            return(stringBuilder.ToString());
        }
示例#2
0
        // Token: 0x06003409 RID: 13321 RVA: 0x000E7AD0 File Offset: 0x000E5CD0
        private ColorTableEntry GetInProgressEntry()
        {
            if (this._inProgress)
            {
                return(this.EntryAt(this.Count - 1));
            }
            this._inProgress = true;
            ColorTableEntry colorTableEntry = new ColorTableEntry();

            this.Add(colorTableEntry);
            return(colorTableEntry);
        }
示例#3
0
        // Token: 0x0600337C RID: 13180 RVA: 0x000E60E4 File Offset: 0x000E42E4
        internal string GetBorderAttributeString(ConverterState converterState)
        {
            if (this.IsNone)
            {
                return(string.Empty);
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" BorderThickness=\"");
            if (!this.BorderAll.IsNone)
            {
                stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderAll.EffectiveWidth));
            }
            else
            {
                stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderLeft.EffectiveWidth));
                stringBuilder.Append(",");
                stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderTop.EffectiveWidth));
                stringBuilder.Append(",");
                stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderRight.EffectiveWidth));
                stringBuilder.Append(",");
                stringBuilder.Append(Converters.TwipToPositiveVisiblePxString((double)this.BorderBottom.EffectiveWidth));
            }
            stringBuilder.Append("\"");
            ColorTableEntry colorTableEntry = null;

            if (this.CF >= 0L)
            {
                colorTableEntry = converterState.ColorTable.EntryAt((int)this.CF);
            }
            if (colorTableEntry != null)
            {
                stringBuilder.Append(" BorderBrush=\"");
                stringBuilder.Append(colorTableEntry.Color.ToString());
                stringBuilder.Append("\"");
            }
            else
            {
                stringBuilder.Append(" BorderBrush=\"#FF000000\"");
            }
            if (this.Spacing != 0L)
            {
                stringBuilder.Append(" Padding=\"");
                stringBuilder.Append(Converters.TwipToPositivePxString((double)this.Spacing));
                stringBuilder.Append("\"");
            }
            return(stringBuilder.ToString());
        }
        // Token: 0x060032D0 RID: 13008 RVA: 0x000E4988 File Offset: 0x000E2B88
        internal static bool ColorToUse(ConverterState converterState, long cb, long cf, long shade, ref Color c)
        {
            ColorTableEntry colorTableEntry  = (cb >= 0L) ? converterState.ColorTable.EntryAt((int)cb) : null;
            ColorTableEntry colorTableEntry2 = (cf >= 0L) ? converterState.ColorTable.EntryAt((int)cf) : null;

            if (shade < 0L)
            {
                if (colorTableEntry == null)
                {
                    return(false);
                }
                c = colorTableEntry.Color;
                return(true);
            }
            else
            {
                Color color  = (colorTableEntry != null) ? colorTableEntry.Color : Color.FromArgb(byte.MaxValue, 0, 0, 0);
                Color color2 = (colorTableEntry2 != null) ? colorTableEntry2.Color : Color.FromArgb(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
                if (colorTableEntry2 == null && colorTableEntry == null)
                {
                    c = Color.FromArgb(byte.MaxValue, (byte)(255L - 255L * shade / 10000L), (byte)(255L - 255L * shade / 10000L), (byte)(255L - 255L * shade / 10000L));
                    return(true);
                }
                if (colorTableEntry == null)
                {
                    c = Color.FromArgb(byte.MaxValue, (byte)((ulong)color2.R + (ulong)((long)(byte.MaxValue - color2.R) * (10000L - shade) / 10000L)), (byte)((ulong)color2.G + (ulong)((long)(byte.MaxValue - color2.G) * (10000L - shade) / 10000L)), (byte)((ulong)color2.B + (ulong)((long)(byte.MaxValue - color2.B) * (10000L - shade) / 10000L)));
                    return(true);
                }
                if (colorTableEntry2 == null)
                {
                    c = Color.FromArgb(byte.MaxValue, (byte)((ulong)color.R - (ulong)color.R * (ulong)shade / 10000UL), (byte)((ulong)color.G - (ulong)color.G * (ulong)shade / 10000UL), (byte)((ulong)color.B - (ulong)color.B * (ulong)shade / 10000UL));
                    return(true);
                }
                c = Color.FromArgb(byte.MaxValue, (byte)((ulong)color.R * (ulong)(10000L - shade) / 10000UL + (ulong)color2.R * (ulong)shade / 10000UL), (byte)((ulong)color.G * (ulong)(10000L - shade) / 10000UL + (ulong)color2.G * (ulong)shade / 10000UL), (byte)((ulong)color.B * (ulong)(10000L - shade) / 10000UL + (ulong)color2.B * (ulong)shade / 10000UL));
                return(true);
            }
        }
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private ColorTableEntry GetInProgressEntry()
        {
            if (_inProgress)
            {
                return EntryAt(Count - 1);
            }
            else
            {
                _inProgress = true;

                ColorTableEntry entry = new ColorTableEntry();

                Add(entry);

                return entry;
            }
        }
        internal int AddColor(Color color)
        {
            // First return existing one
            for (int i = 0; i < Count; i++)
            {
                if (ColorAt(i) == color)
                {
                    return i;
                }
            }

            // OK, need to add one
            ColorTableEntry entry = new ColorTableEntry();
            entry.Color = color;
            Add(entry);
            return Count - 1;
        }