public GenericTextRunProperties( Typeface typeface, double size, double hintingSize, TextDecorationCollection textDecorations, Brush forgroundBrush, Brush backgroundBrush, BaselineAlignment baselineAlignment, TextEffectCollection textEffects, CultureInfo culture) { if (typeface == null) throw new ArgumentNullException("typeface"); ValidateCulture(culture); _typeface = typeface; _emSize = size; _emHintingSize = hintingSize; _textDecorations = textDecorations; _foregroundBrush = forgroundBrush; _backgroundBrush = backgroundBrush; _baselineAlignment = baselineAlignment; _textEffects = textEffects; _culture = culture; }
/// <summary> /// Initializes a new instance of the <see cref="TextFormattingRunProperties"/> class. /// </summary> public TextFormattingRunProperties(Typeface typeface, Double size, Color foreground) { _typeface = typeface; _size = _hintingSize = size; _foreground = foreground; _foregroundBrush = new SolidColorBrush(foreground); _backgroundBrush = Brushes.Transparent; _textDecorations = new TextDecorationCollection(); _textEffects = new TextEffectCollection(); _cultureInfo = CultureInfo.CurrentCulture; if (_foregroundBrush.CanFreeze) { _foregroundBrush.Freeze(); } if (_backgroundBrush.CanFreeze) { _backgroundBrush.Freeze(); } if (_textEffects.CanFreeze) { _textEffects.Freeze(); } if (_textDecorations.CanFreeze) { _textDecorations.Freeze(); } }
/// <summary> /// Enable the TextEffect on the target. If the texteffect is /// already enabled, this will be a no-op. /// </summary> public void Enable() { TextEffectCollection textEffects = DynamicPropertyReader.GetTextEffects(_element); if (textEffects == null) { textEffects = new TextEffectCollection(); // use it as reference to avoid creating a copy (Freezable pattern) _element.SetValue(TextElement.TextEffectsProperty, textEffects); } // check whether this instance is already enabled for (int i = 0; i < textEffects.Count; i++) { if (textEffects[i] == _effect) { return; // no-op } } // use this as reference. textEffects.Add(_effect); }
/// <summary> /// Creates a new VisualLineElementTextRunProperties instance that copies its values /// from the specified <paramref name="textRunProperties"/>. /// For the <see cref="TextDecorations"/> and <see cref="TextEffects"/> collections, deep copies /// are created if those collections are not frozen. /// </summary> public VisualLineElementTextRunProperties(TextRunProperties textRunProperties) { if (textRunProperties == null) { throw new ArgumentNullException("textRunProperties"); } backgroundBrush = textRunProperties.BackgroundBrush; baselineAlignment = textRunProperties.BaselineAlignment; cultureInfo = textRunProperties.CultureInfo; fontHintingEmSize = textRunProperties.FontHintingEmSize; fontRenderingEmSize = textRunProperties.FontRenderingEmSize; foregroundBrush = textRunProperties.ForegroundBrush; typeface = textRunProperties.Typeface; textDecorations = textRunProperties.TextDecorations; if (textDecorations != null && !textDecorations.IsFrozen) { textDecorations = textDecorations.Clone(); } textEffects = textRunProperties.TextEffects; if (textEffects != null && !textEffects.IsFrozen) { textEffects = textEffects.Clone(); } typographyProperties = textRunProperties.TypographyProperties; numberSubstitution = textRunProperties.NumberSubstitution; }
/// <summary> /// </summary> /// <exception cref="ArgumentNullException"> /// <para><paramref name="textEffects"/> is <see langword="null"/>.</para> /// </exception> public void SetTextEffects(TextEffectCollection textEffects) { if (textEffects == null) { throw new ArgumentNullException("textEffects"); } _textEffects = textEffects; _altered = true; }
public HexTextRunProperties(TextRunProperties other) { this._BackgroundBrush = other.BackgroundBrush; this._CultureInfo = other.CultureInfo; this._FontHintingEmSize = other.FontHintingEmSize; this._FontRenderingEmSize = other.FontRenderingEmSize; this._ForegroundBrush = other.ForegroundBrush; this._TextDecorations = other.TextDecorations; this._TextEffects = other.TextEffects; this._Typeface = other.Typeface; }
public HexTextRunProperties(TextRunProperties other) { this._BackgroundBrush = other.BackgroundBrush; this._CultureInfo = other.CultureInfo; this._FontHintingEmSize = other.FontHintingEmSize; this._FontRenderingEmSize = other.FontRenderingEmSize; this._ForegroundBrush = other.ForegroundBrush; this._TextDecorations = other.TextDecorations; this._TextEffects = other.TextEffects; this._Typeface = other.Typeface; }
public TerminalTextRunProperties() { this.typeface = new Typeface("Arial"); this.fontRenderingEmSize = 12; this.fontHintingEmSize = 12; this.textDecorations = new TextDecorationCollection(); this.foregroundBrush = Brushes.Black; this.backgroundBrush = Brushes.Transparent; this.cultureInfo = CultureInfo.CurrentCulture; this.textEffects = new TextEffectCollection(); }
public FontRendering() { _fontSize = 64f; _alignment = TextAlignment.Left; _textDecorations = new TextDecorationCollection(); _typeface = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); _foregroundBrush = Brushes.Black; _backgroundBrush = Brushes.Transparent; _textEffects = new TextEffectCollection(); }
public GenericTextRunProperties(FontRendering newRender) { _typeface = newRender.Typeface; _emSize = newRender.FontSize; _emHintingSize = newRender.FontSize; _textDecorations = newRender.TextDecorations; _foregroundBrush = newRender.ForegroundBrush; _backgroundBrush = newRender.BackgroundBrush; _baselineAlignment = BaselineAlignment.Baseline; _textEffects = newRender.TextEffects; _culture = CultureInfo.CurrentUICulture; }
/// <inheritdoc /> public TextRunProperties1(Brush backgroundBrush, BaselineAlignment baselineAlignment, CultureInfo cultureInfo, double fontHintingEmSize, double fontRenderingEmSize, Brush foregroundBrush, TextDecorationCollection textDecorations, TextEffectCollection textEffects, Typeface typeface) { _backgroundBrush = backgroundBrush; _baselineAlignment = baselineAlignment; _cultureInfo = cultureInfo; _fontHintingEmSize = fontHintingEmSize; _fontRenderingEmSize = fontRenderingEmSize; _foregroundBrush = foregroundBrush; _textDecorations = textDecorations; _textEffects = textEffects; _typeface = typeface; }
/// <summary> Disables the <see cref="T:System.Windows.Media.TextEffect" /> on the effect target. </summary> // Token: 0x06003927 RID: 14631 RVA: 0x00103270 File Offset: 0x00101470 public void Disable() { TextEffectCollection textEffects = DynamicPropertyReader.GetTextEffects(this._element); if (textEffects != null) { for (int i = 0; i < textEffects.Count; i++) { if (textEffects[i] == this._effect) { textEffects.RemoveAt(i); return; } } } }
public GenericTextRunProperties(FontRendering newRender, TextEffectCollection effects, TextDecorationCollection decorations = null) { _typeface = newRender.Typeface; _emSize = newRender.FontSize; _emHintingSize = newRender.FontSize; _textDecorations = decorations; _foregroundBrush = newRender.TextColor; _backgroundBrush = null; _baselineAlignment = BaselineAlignment.Baseline; _culture = CultureInfo.CurrentUICulture; _effects = effects; if (_textDecorations == null) { _textDecorations = new TextDecorationCollection(); } }
public FontRendering( double emSize, TextAlignment alignment, TextDecorationCollection decorations, Typeface face, Brush foreBrush, Brush backBrush, TextEffectCollection textEffectCollection) { _fontSize = emSize; _alignment = alignment; _textDecorations = decorations; _typeface = face; _foregroundBrush = foreBrush; _backgroundBrush = backBrush; _textEffects = textEffectCollection; }
/// <summary> /// Disable TextEffect on the target. If the texteffect is /// already disabled, this will be a no-op. /// </summary> public void Disable() { TextEffectCollection textEffects = DynamicPropertyReader.GetTextEffects(_element); if (textEffects != null) { for (int i = 0; i < textEffects.Count; i++) { if (textEffects[i] == _effect) { // remove the exact instance of the effect from the collection textEffects.RemoveAt(i); return; } } } }
/// <summary>Enables the <see cref="T:System.Windows.Media.TextEffect" /> on the target text. </summary> // Token: 0x06003926 RID: 14630 RVA: 0x00103210 File Offset: 0x00101410 public void Enable() { TextEffectCollection textEffectCollection = DynamicPropertyReader.GetTextEffects(this._element); if (textEffectCollection == null) { textEffectCollection = new TextEffectCollection(); this._element.SetValue(TextElement.TextEffectsProperty, textEffectCollection); } for (int i = 0; i < textEffectCollection.Count; i++) { if (textEffectCollection[i] == this._effect) { return; } } textEffectCollection.Add(this._effect); }
/// <summary> /// Creates a new VisualLineElementTextRunProperties instance that copies its values /// from the specified <paramref name="textRunProperties"/>. /// For the <see cref="TextDecorations"/> and <see cref="TextEffects"/> collections, deep copies /// are created if those collections are not frozen. /// </summary> public VisualLineElementTextRunProperties(TextRunProperties textRunProperties) { if (textRunProperties == null) throw new ArgumentNullException("textRunProperties"); backgroundBrush = textRunProperties.BackgroundBrush; baselineAlignment = textRunProperties.BaselineAlignment; cultureInfo = textRunProperties.CultureInfo; fontHintingEmSize = textRunProperties.FontHintingEmSize; fontRenderingEmSize = textRunProperties.FontRenderingEmSize; foregroundBrush = textRunProperties.ForegroundBrush; typeface = textRunProperties.Typeface; textDecorations = textRunProperties.TextDecorations; if (textDecorations != null && !textDecorations.IsFrozen) { textDecorations = textDecorations.Clone(); } textEffects = textRunProperties.TextEffects; if (textEffects != null && !textEffects.IsFrozen) { textEffects = textEffects.Clone(); } }
public static TTextBlock TextEffects <TTextBlock>(this TTextBlock @this, TextEffectCollection textEffects) where TTextBlock : TextBlock { @this.TextEffects = textEffects; return(@this); }
/// <summary> /// Sets the <see cref="TextEffects"/>. /// </summary> public void SetTextEffects(TextEffectCollection value) { textEffects = value; }
/// <summary> /// Sets the <see cref="TextEffects"/>. /// </summary> public void SetTextEffects(TextEffectCollection value) { ExtensionMethods.CheckIsFrozen(value); textEffects = value; }
/// <summary> /// Enable the TextEffect on the target. If the texteffect is /// already enabled, this will be a no-op. /// </summary> public void Enable() { TextEffectCollection textEffects = DynamicPropertyReader.GetTextEffects(_element); if (textEffects == null) { textEffects = new TextEffectCollection(); // use it as reference to avoid creating a copy (Freezable pattern) _element.SetValue(TextElement.TextEffectsProperty, textEffects); } // check whether this instance is already enabled for (int i = 0; i < textEffects.Count; i++) { if (textEffects[i] == _effect) return; // no-op } // use this as reference. textEffects.Add(_effect); }
// Token: 0x06003BF9 RID: 15353 RVA: 0x00114A24 File Offset: 0x00112C24 internal static bool ValuesAreEqual(object value1, object value2) { if (value1 == value2) { return(true); } if (value1 == null) { if (value2 is TextDecorationCollection) { TextDecorationCollection textDecorationCollection = (TextDecorationCollection)value2; return(textDecorationCollection.Count == 0); } if (value2 is TextEffectCollection) { TextEffectCollection textEffectCollection = (TextEffectCollection)value2; return(textEffectCollection.Count == 0); } return(false); } else if (value2 == null) { if (value1 is TextDecorationCollection) { TextDecorationCollection textDecorationCollection2 = (TextDecorationCollection)value1; return(textDecorationCollection2.Count == 0); } if (value1 is TextEffectCollection) { TextEffectCollection textEffectCollection2 = (TextEffectCollection)value1; return(textEffectCollection2.Count == 0); } return(false); } else { if (value1.GetType() != value2.GetType()) { return(false); } if (value1 is TextDecorationCollection) { TextDecorationCollection textDecorationCollection3 = (TextDecorationCollection)value1; TextDecorationCollection textDecorations = (TextDecorationCollection)value2; return(textDecorationCollection3.ValueEquals(textDecorations)); } if (value1 is FontFamily) { FontFamily fontFamily = (FontFamily)value1; FontFamily obj = (FontFamily)value2; return(fontFamily.Equals(obj)); } if (value1 is Brush) { return(TextSchema.AreBrushesEqual((Brush)value1, (Brush)value2)); } string a = value1.ToString(); string b = value2.ToString(); return(a == b); } }
/// <summary> /// Initializes a new instance of the <see cref="TextFormattingRunProperties"/> class. /// </summary> public TextFormattingRunProperties(Typeface typeface, Double size, Color foreground) { _typeface = typeface; _size = _hintingSize = size; _foreground = foreground; _foregroundBrush = new SolidColorBrush(foreground); _backgroundBrush = Brushes.Transparent; _textDecorations = new TextDecorationCollection(); _textEffects = new TextEffectCollection(); _cultureInfo = CultureInfo.CurrentCulture; if (_foregroundBrush.CanFreeze) { _foregroundBrush.Freeze(); } if (_backgroundBrush.CanFreeze) { _backgroundBrush.Freeze(); } if (_textEffects.CanFreeze) { _textEffects.Freeze(); } if (_textDecorations.CanFreeze) { _textDecorations.Freeze(); } }
/// <summary> /// Sets the <see cref="TextEffects"/>. /// </summary> public void SetTextEffects(TextEffectCollection value) { ExtensionMethods.CheckIsFrozen(value); textEffects = value; }
//corregir, si hay lección nueva, se espera espacio y el usuario erra, pinta la primer letra private void animarTexto() { TextEffectCollection colecciónEfectos = new TextEffectCollection(); TextEffect efecto = new TextEffect(); if (!adminAct.swhayLecciónNueva) //si no es lección nueva { efecto.PositionStart = posiciónCarácterActualEnPalabra; } else { efecto.PositionStart = txtTexto.Text.Length - textoEspacio.Length; } if (posiciónCarácterActualEnPalabra < txtTexto.Text.Length - textoEspacio.Length && !adminAct.swhayLecciónNueva) //si está en la palabra y no es una lección nueva efecto.PositionCount = 1; else efecto.PositionCount = textoEspacio.Length; //ScaleTransform transformación = new ScaleTransform(2, 2); //efecto.Transform = transformación; efecto.Foreground = seleccionarPincelAnimación(); colecciónEfectos.Add(efecto); txtTexto.TextEffects = colecciónEfectos; }
/// <summary> /// </summary> /// <exception cref="ArgumentNullException"> /// <para><paramref name="textEffects"/> is <see langword="null"/>.</para> /// </exception> public void SetTextEffects(TextEffectCollection textEffects) { if (textEffects == null) { throw new ArgumentNullException("textEffects"); } _textEffects = textEffects; _altered = true; }
// Compares two values for equality /// <summary> /// Property comparison helper. /// Compares property values for equivalence from serialization /// standpoint. In editing we consider properties equal /// if they have the same serialized representation. /// Differences coming from current dynamic state changes /// should not affect comparison if they are not going to be /// visible after serialization. /// Instantiation dirrefences are also insignificant. /// </summary> /// <param name="value1"> /// </param> /// <param name="value2"> /// </param> /// <returns> /// True if two values have the same serialized representation /// </returns> internal static bool ValuesAreEqual(object value1, object value2) { if ((object)value1 == (object)value2) // this check includes two nulls { return(true); } // Comparing null with empty collections if (value1 == null) { if (value2 is TextDecorationCollection) { TextDecorationCollection decorations2 = (TextDecorationCollection)value2; return(decorations2.Count == 0); } else if (value2 is TextEffectCollection) { TextEffectCollection effects2 = (TextEffectCollection)value2; return(effects2.Count == 0); } return(false); } else if (value2 == null) { if (value1 is TextDecorationCollection) { TextDecorationCollection decorations1 = (TextDecorationCollection)value1; return(decorations1.Count == 0); } else if (value1 is TextEffectCollection) { TextEffectCollection effects1 = (TextEffectCollection)value1; return(effects1.Count == 0); } return(false); } // Must be of exactly the same types (really ?) // Should we ever return true for different types? if (value1.GetType() != value2.GetType()) { return(false); } // Special cases for known types: TextDecorations, FontFamily, Brush if (value1 is TextDecorationCollection) { TextDecorationCollection decorations1 = (TextDecorationCollection)value1; TextDecorationCollection decorations2 = (TextDecorationCollection)value2; return(decorations1.ValueEquals(decorations2)); } else if (value1 is FontFamily) { FontFamily fontFamily1 = (FontFamily)value1; FontFamily fontFamily2 = (FontFamily)value2; return(fontFamily1.Equals(fontFamily2)); } else if (value1 is Brush) { return(AreBrushesEqual((Brush)value1, (Brush)value2)); } else { string string1 = value1.ToString(); string string2 = value2.ToString(); return(string1 == string2); } }
public void SetTextEffects(TextEffectCollection value) { //TODO: VisualLineElementTextRunProperties.SetTextEffects() throw new NotImplementedException(); }
/// <summary> /// Sets the <see cref="TextEffects"/>. /// </summary> public void SetTextEffects(TextEffectCollection value) { textEffects = value; }