示例#1
0
        private static void SetSelectionRectangle(Rectangle rectangle, TextBoxSelectionBox textBoxSelectionBox, GUIColor color)
        {
            if (rectangle.Width >= 1 && rectangle.Height >= 1)
            {
                textBoxSelectionBox.CurrentTextureName = textBoxSelectionBox.Manager.ImageCompositor.CreateRectangleTexture(textBoxSelectionBox.Name, (int)rectangle.Width, (int)rectangle.Height, 0, GUIColor.White(), GUIColor.White());
                var size  = textBoxSelectionBox.Manager.ImageCompositor.ReadSizeTexture(textBoxSelectionBox.CurrentTextureName);
                var count = (int)size.X * (int)size.Y;

                var colorArray = new GUIColor[count];
                for (var i = 0; i < count; i++)
                {
                    colorArray[i] = color;
                }

                var map = new ColorMap(colorArray, (int)size.X, (int)size.Y);

                textBoxSelectionBox.Manager.ImageCompositor.UpdateTexture(textBoxSelectionBox.CurrentTextureName, map);

                textBoxSelectionBox.ConfigActive = true;
            }
        }
示例#2
0
        private static void SetSelectionRectangle(Rectangle rectangle, TextBoxSelectionBox textBoxSelectionBox, GUIColor color)
        {
            if (rectangle.Width >= 1 && rectangle.Height >= 1)
            {
                textBoxSelectionBox.CurrentTextureName = textBoxSelectionBox.Manager.ImageCompositor.CreateRectangleTexture(textBoxSelectionBox.Name, (int)rectangle.Width, (int)rectangle.Height, 0, GUIColor.White(), GUIColor.White());
                var size = textBoxSelectionBox.Manager.ImageCompositor.ReadSizeTexture(textBoxSelectionBox.CurrentTextureName);
                var count = (int)size.X * (int)size.Y;

                var colorArray = new GUIColor[count];
                for (var i = 0; i < count; i++)
                {
                    colorArray[i] = color;
                }

                var map = new ColorMap(colorArray, (int)size.X, (int)size.Y);

                textBoxSelectionBox.Manager.ImageCompositor.UpdateTexture(textBoxSelectionBox.CurrentTextureName, map);

                textBoxSelectionBox.ConfigActive = true;
            }
        }