ConvertColor() public static method

Converts a Color into DxColor.
public static ConvertColor ( SharpDX.Color color ) : SharpDX.Color
color SharpDX.Color The Color.
return SharpDX.Color
Beispiel #1
0
 /// <summary>
 /// Begins the draw operation.
 /// </summary>
 public void Begin()
 {
     _swapChainDesc.ModeDescription.Scaling = _graphicsDevice.BackBuffer.Scaling
         ? DisplayModeScaling.Stretched
         : DisplayModeScaling.Centered;
     DirectXHelper.RenderTarget.BeginDraw();
     DirectXHelper.RenderTarget.Transform = Matrix3x2.Identity;
     DirectXHelper.RenderTarget.Clear(DirectXHelper.ConvertColor(_graphicsDevice.ClearColor));
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new DirectXPen class.
 /// </summary>
 /// <param name="color">The Color.</param>
 /// <param name="width">The Width.</param>
 public DirectXPen(Color color, float width)
 {
     _colorBrush = new SolidColorBrush(DirectXHelper.RenderTarget, DirectXHelper.ConvertColor(color));
     Width       = width;
 }
Beispiel #3
0
        /// <summary>
        /// Fills a Polygon.
        /// </summary>
        /// <param name="color">The Color.</param>
        /// <param name="polygon">The Polygon.</param>
        public void FillPolygon(Color color, Polygon polygon)
        {
            var geometry = new PathGeometry(DirectXHelper.D2DFactory);

            using (GeometrySink sink = geometry.Open())
            {
                sink.BeginFigure(DirectXHelper.ConvertVector(polygon.Points[0]), FigureBegin.Filled);

                for (int i = 1; i < polygon.Points.Length; i++)
                {
                    sink.AddLine(DirectXHelper.ConvertVector(polygon.Points[i]));
                }

                sink.EndFigure(FigureEnd.Closed);
                sink.Close();

                DirectXHelper.RenderTarget.FillGeometry(geometry,
                                                        new SolidColorBrush(DirectXHelper.RenderTarget, DirectXHelper.ConvertColor(color)));
            }

            geometry.Dispose();
        }
Beispiel #4
0
 /// <summary>
 /// Fills a Ellipse.
 /// </summary>
 /// <param name="color">The Color.</param>
 /// <param name="ellipse">The Ellipse.</param>
 public void FillEllipse(Color color, Ellipse ellipse)
 {
     DirectXHelper.RenderTarget.FillEllipse(DirectXHelper.ConvertEllipse(ellipse),
                                            new SolidColorBrush(DirectXHelper.RenderTarget, DirectXHelper.ConvertColor(color)));
 }
Beispiel #5
0
 /// <summary>
 /// Fills a Rectangle.
 /// </summary>
 /// <param name="color">The Color.</param>
 /// <param name="rectangle">The Rectangle.</param>
 public void FillRectangle(Color color, Rectangle rectangle)
 {
     DirectXHelper.RenderTarget.FillRectangle(DirectXHelper.ConvertRectangle(rectangle),
                                              new SolidColorBrush(DirectXHelper.RenderTarget, DirectXHelper.ConvertColor(color)));
 }