/// <summary> /// Registers the glyph shader with the specified name. /// </summary> /// <param name="name">The name of the glyph shader to register.</param> /// <param name="shader">The glyph shader to register.</param> public void RegisterGlyphShader(String name, GlyphShader shader) { Contract.RequireNotEmpty(name, "name"); Contract.Require(shader, "shader"); registeredGlyphShaders.Add(name, shader); }
/// <summary> /// Registers the glyph shader with the specified name. /// </summary> /// <param name="name">The name of the glyph shader to register.</param> /// <param name="shader">The glyph shader to register.</param> public void RegisterGlyphShader(String name, GlyphShader shader) { Contract.RequireNotEmpty(name, nameof(name)); Contract.Require(shader, nameof(shader)); registeredGlyphShaders.Add(name, shader); }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutToken"/> structure. /// </summary> /// <param name="text">The token's text.</param> /// <param name="bounds">The token's bounds relative to its layout region.</param> /// <param name="fontFace">The token's font face.</param> /// <param name="icon">The token's icon.</param> /// <param name="glyphShader">The token's glyph shader.</param> /// <param name="color">The token's color.</param> internal TextLayoutToken(StringSegment text, Rectangle bounds, SpriteFontFace fontFace, TextIconInfo? icon, GlyphShader glyphShader, Color? color) { this.text = text; this.bounds = bounds; this.fontFace = fontFace; this.icon = icon; this.glyphShader = glyphShader; this.color = color; }
/// <summary> /// Registers a glyph shader with the command stream. /// </summary> /// <param name="name">The name that identifies the glyph shader.</param> /// <param name="glyphShader">The glyph shader to register.</param> /// <returns>The index of the glyph shader within the command stream's internal registry.</returns> public Int16 RegisterGlyphShader(StringSegment name, GlyphShader glyphShader) { Contract.Require(glyphShader, nameof(glyphShader)); if (glyphShaders == null) { glyphShaders = new List <GlyphShader>(); } if (glyphShadersByName == null) { glyphShadersByName = new Dictionary <StringSegment, Int16>(); } return(RegisterResource(name, glyphShader, glyphShaders, glyphShadersByName)); }
/// <summary> /// Registers a glyph shader with the command stream. /// </summary> /// <param name="name">The name of the glyph shader to register.</param> /// <param name="glyphShader">The glyph shader to register under the specified name.</param> /// <returns>The index of the specified glyph shader within the command stream's internal registry.</returns> public Int16 RegisterGlyphShader(StringSegment name, GlyphShader glyphShader) { Contract.Require(glyphShader, nameof(glyphShader)); return(RegisterResource(name, glyphShader, glyphShaders, glyphShadersByName)); }
/// <summary> /// Registers the specified glyph shader with the command stream and returns its resulting index. /// </summary> private Int16 RegisterGlyphShaderWithCommandStream(TextLayoutCommandStream output, StringSegment name, out GlyphShader glyphShader) { if (!registeredGlyphShaders.TryGetValue(name, out glyphShader)) { throw new InvalidOperationException(UltravioletStrings.UnrecognizedGlyphShader.Format(name)); } return(output.RegisterGlyphShader(name, glyphShader)); }
/// <summary> /// Registers a glyph shader with the command stream. /// </summary> /// <param name="name">The name of the glyph shader to register.</param> /// <param name="glyphShader">The glyph shader to register under the specified name.</param> /// <returns>The index of the specified glyph shader within the command stream's internal registry.</returns> public Int16 RegisterGlyphShader(StringSegment name, GlyphShader glyphShader) => (resources = resources ?? new TextLayoutCommandStreamResources()).RegisterGlyphShader(name, glyphShader);
/// <summary> /// Registers the specified glyph shader with the command stream and returns its resulting index. /// </summary> private Int16 RegisterGlyphShaderWithCommandStream(TextLayoutCommandStream output, StringSegment name, out GlyphShader glyphShader) { if (!registeredGlyphShaders.TryGetValue(name, out glyphShader)) throw new InvalidOperationException(UltravioletStrings.UnrecognizedGlyphShader.Format(name)); return output.RegisterGlyphShader(name, glyphShader); }
public void PushGlyphShader(GlyphShader glyphShader) { PushScopedStack(GlyphShaderStack, glyphShader); }
/// <summary> /// Initializes a new instance of the <see cref="TextLayoutToken"/> structure. /// </summary> /// <param name="text">The token's text.</param> /// <param name="bounds">The token's bounds relative to its layout region.</param> /// <param name="fontFace">The token's font face.</param> /// <param name="icon">The token's icon.</param> /// <param name="glyphShader">The token's glyph shader.</param> /// <param name="color">The token's color.</param> internal TextLayoutToken(StringSegment text, Rectangle bounds, UltravioletFontFace fontFace, TextIconInfo?icon, GlyphShader glyphShader, Color?color) { this.text = text; this.bounds = bounds; this.fontFace = fontFace; this.icon = icon; this.glyphShader = glyphShader; this.color = color; }