/// <summary> /// Registers an icon with the command stream. /// </summary> /// <param name="name">The name that identifies the icon.</param> /// <param name="icon">The icon to register.</param> /// <returns>The index of the icon within the command stream's internal registry.</returns> public Int16 RegisterIcon(StringSegment name, TextIconInfo icon) { if (icons == null) { icons = new List <TextIconInfo>(); } if (iconsByName == null) { iconsByName = new Dictionary <StringSegment, Int16>(); } return(RegisterResource(name, icon, icons, iconsByName)); }
/// <summary> /// Registers an icon with the command stream. /// </summary> /// <param name="name">The name of the icon to register.</param> /// <param name="icon">The icon to register under the specified name.</param> /// <returns>The index of the specified icon within the command stream's internal registry.</returns> public Int16 RegisterIcon(StringSegment name, TextIconInfo icon) { return(RegisterResource(name, icon, icons, iconsByName)); }
/// <summary> /// Registers the specified icon with the command stream and returns its resulting index. /// </summary> private Int16 RegisterIconWithCommandStream(TextLayoutCommandStream output, StringSegment name, out TextIconInfo icon) { if (!registeredIcons.TryGetValue(name, out icon)) { throw new InvalidOperationException(UltravioletStrings.UnrecognizedIcon.Format(name)); } return(output.RegisterIcon(name, icon)); }
/// <summary> /// Registers an icon with the command stream. /// </summary> /// <param name="name">The name of the icon to register.</param> /// <param name="icon">The icon to register under the specified name.</param> /// <returns>The index of the specified icon within the command stream's internal registry.</returns> public Int16 RegisterIcon(StringSegment name, TextIconInfo icon) => (resources = resources ?? new TextLayoutCommandStreamResources()).RegisterIcon(name, icon);