Ejemplo n.º 1
0
        /// <summary>Create brush for console color.</summary>
        /// <remarks>Most named values are very different from createSolidBrush, the console colors are from CGA.
        /// For example, parsing "Green" string will get you #008000, ConsoleColor.Green returns #00FF00.</remarks>
        /// <seealso href="https://en.wikipedia.org/wiki/Color_Graphics_Adapter#With_an_RGBI_monitor" />
        /// <seealso href="https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color?view=netcore-2.1" />
        public static iBrush createSolidBrush(this iDrawDevice device, ConsoleColor color)
        {
            if (device is DrawDevice vrmac)
            {
                return(new SolidColorBrush(color));
            }

            if (null == consoleColors)
            {
                consoleColors = PredefinedPaletteEntries.readPalette();
            }
            Vector4 vals = consoleColors[(int)color];

            return(device.createSolidColorBrush(vals));
        }
Ejemplo n.º 2
0
 /// <summary>Create solid color brush from premultiplied RGBA values</summary>
 public static iSolidColorBrush createSolidBrush(this iDrawDevice device, Vector4 color)
 {
     return(device.createSolidColorBrush(ref color));
 }
Ejemplo n.º 3
0
        /// <summary>Create solid color brush from color string like "blue" or "#ffccff44"</summary>
        public static iSolidColorBrush createSolidBrush(this iDrawDevice device, string colorString)
        {
            Vector4 color = Color.parseNonPremultiplied(colorString);

            return(device.createSolidColorBrush(ref color));
        }
Ejemplo n.º 4
0
 /// <summary>Parse string to color, and create a new solid color brush of that color.</summary>
 public static iBrush createSolidBrush(this iDrawDevice device, string colorString)
 {
     return(device.createSolidColorBrush(device.parseBrushColor(colorString)));
 }