/// <summary>
        /// Paints a triangle onto the screen.
        /// </summary>
        /// <param name="device"></param>
        /// <param name="region"></param>
        /// <param name="buffer"></param>
        /// <param name="fillColor"></param>
        public static void PaintColoredTriangle(Device device, Rectangle rectangle, VertexBuffer buffer, Color fillColor)
        {
            GraphicsBuffer <TransformedColored> data = buffer.Lock <TransformedColored>(0, 3, LockFlags.None);

            buffer.Unlock();
            data[0] = new TransformedColored(rectangle.X, rectangle.Y, .5f, 0, fillColor);
            data[1] = new TransformedColored(rectangle.Right, rectangle.Y, .5f, 0, fillColor);
            data[2] = new TransformedColored((rectangle.X + rectangle.Right) / 2, rectangle.Bottom, .5f, 0, fillColor);
            device.RenderState.ZBufferWriteEnable = false;
            device.RenderState.AlphaBlendEnable   = true;
            device.RenderState.CullMode           = Cull.None;
            device.VertexFormat = TransformedColored.Format;
            device.SetStreamSource(0, buffer, 0);
            device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 1);
        }
        /// <summary>
        /// Paints a the specified rectangle with the colors specified.
        /// </summary>
        /// <param name="device"></param>
        /// <param name="rectangle"></param>
        /// <param name="buffer"></param>
        /// <param name="color1"></param>
        /// <param name="color2"></param>
        /// <param name="gradientDirection"></param>
        public static void PaintColoredRectangle(Device device, Rectangle rectangle, VertexBuffer buffer, Color color1, Color color2, GradientDirection gradientDirection)
        {
            GraphicsBuffer <TransformedColored> data = buffer.Lock <TransformedColored>(0, 4, LockFlags.None);
            int topLeftColor     = color1.ToArgb();
            int topRightColor    = gradientDirection == GradientDirection.Horizontal ? color2.ToArgb() : color1.ToArgb();
            int bottomLeftColor  = gradientDirection == GradientDirection.Horizontal ? color1.ToArgb() : color2.ToArgb();
            int bottomRightColor = color2.ToArgb();

            data[0] = new TransformedColored(rectangle.X, rectangle.Y, .5f, 0, topLeftColor);
            data[1] = new TransformedColored(rectangle.Right, rectangle.Y, .5f, 0, topRightColor);
            data[2] = new TransformedColored(rectangle.X, rectangle.Bottom, .5f, 0, bottomLeftColor);
            data[3] = new TransformedColored(rectangle.Right, rectangle.Bottom, .5f, 0, bottomRightColor);
            buffer.Unlock();
            device.RenderState.ZBufferWriteEnable = false;
            device.RenderState.AlphaBlendEnable   = false;
            device.RenderState.CullMode           = Cull.None;
            device.VertexFormat = TransformedColored.Format;
            device.SetStreamSource(0, buffer, 0);
            device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
        }