ConvertColor() public static method

Converts the Color.
public static ConvertColor ( Color value ) : SlimDX.Color4
value System.Drawing.Color The Color.
return SlimDX.Color4
示例#1
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;
 }
示例#2
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.Direct2DFactory);

            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();

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

            geometry.Dispose();
        }
示例#3
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)
 {
     _renderTarget.FillRectangle(new SolidColorBrush(_renderTarget, DirectXHelper.ConvertColor(color)),
                                 DirectXHelper.ConvertRectangle(rectangle));
 }
示例#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)
 {
     _renderTarget.FillEllipse(new SolidColorBrush(_renderTarget, DirectXHelper.ConvertColor(color)),
                               DirectXHelper.ConvertEllipse(ellipse));
 }
示例#5
0
 /// <summary>
 /// Begins the draw operation.
 /// </summary>
 public void Begin()
 {
     _renderTarget.BeginDraw();
     _renderTarget.Transform = Matrix3x2.Identity;
     _renderTarget.Clear(DirectXHelper.ConvertColor(_graphicsDevice.ClearColor));
 }