unsafe void SetTexture(Texture texture, Color4 color, float opacity)
        {
            SetTextureInner(texture.ResourceView);

            var buffer = new Brush.BrushBuffer()
            {
                Type = 4, Opacity = opacity
            };

            buffer.GradientColors[0] = color.R;
            buffer.GradientColors[1] = color.G;
            buffer.GradientColors[2] = color.B;
            buffer.GradientColors[3] = color.A;
            deviceContext.UpdateSubresource(brushBuffer, 0, null, (IntPtr)(&buffer), 0, 0);
            deviceContext.PixelShader.SetConstantBuffer(1, brushBuffer);
        }
        unsafe void SetTexture(Texture texture, Color4 color, float opacity)
        {
            SetTextureInner(texture.ResourceView);

            var buffer = new Brush.BrushBuffer() { Type = 4, Opacity = opacity};
            buffer.GradientColors[0] = color.R;
            buffer.GradientColors[1] = color.G;
            buffer.GradientColors[2] = color.B;
            buffer.GradientColors[3] = color.A;
            deviceContext.UpdateSubresource(brushBuffer, 0, null, (IntPtr)(&buffer), 0, 0);
            deviceContext.PixelShader.SetConstantBuffer(1, brushBuffer);
        }
 unsafe void SetBrushBuffer(Brush.BrushBuffer buffer)
 {
     deviceContext.UpdateSubresource(brushBuffer, 0, null, (IntPtr)(&buffer), 0, 0);
     deviceContext.PixelShader.SetConstantBuffer(1, brushBuffer);
 }