private void _その他パネルを描画する(DeviceContext dc)
        {
            グラフィックデバイス.Instance.D2DBatchDraw(dc, () => {
                dc.PrimitiveBlend = PrimitiveBlend.SourceOver;

                using (var ソートタブ上色 = new SolidColorBrush(dc, new Color4(0xFF121212)))
                    using (var ソートタブ下色 = new SolidColorBrush(dc, new Color4(0xFF1f1f1f)))
                    {
                        // 曲リストソートタブ
                        dc.FillRectangle(new RectangleF(927f, 50f, 993f, 138f), ソートタブ上色);
                        dc.FillRectangle(new RectangleF(927f, 142f, 993f, 46f), ソートタブ下色);
                    }

                // インフォメーションバー
                dc.FillRectangle(new RectangleF(0f, 0f, 1920f, 50f), this._黒);
                dc.DrawLine(new Vector2(0f, 50f), new Vector2(1920f, 50f), this._白, strokeWidth: 1f);

                // ボトムバー
                dc.FillRectangle(new RectangleF(0f, 1080f - 43f, 1920f, 1080f), this._黒);

                // プレビュー領域
                dc.FillRectangle(new RectangleF(0f, 52f, 927f, 476f), this._黒透過);
                dc.DrawRectangle(new RectangleF(0f, 52f, 927f, 476f), this._灰透過, strokeWidth: 1f);
                dc.DrawLine(new Vector2(1f, 442f), new Vector2(925f, 442f), this._灰透過, strokeWidth: 1f);
            });
        }
        private void Render()
        {
            context.Clear(null);

            Matrix3x2 worldToFormTransform = GetWorldToFormTransform();

            foreach (var bone in bones)
            {
                var transform  = bone.GetChainedTransform(inputs) * worldToFormTransform;
                var formCenter = Matrix3x2.TransformPoint(transform, bone.Center);
                var formEnd    = Matrix3x2.TransformPoint(transform, bone.End);

                context.DrawEllipse(new Ellipse(formCenter, 5, 5), whiteBrush, 2);
                context.DrawLine(formCenter, formEnd, whiteBrush, 2);
            }

            var formTarget = Matrix3x2.TransformPoint(worldToFormTransform, target);

            float crossSize = 5;

            context.DrawLine(
                formTarget + crossSize * new Vector2(-1, -1),
                formTarget + crossSize * new Vector2(+1, +1),
                redBrush, 2);
            context.DrawLine(
                formTarget + crossSize * new Vector2(-1, +1),
                formTarget + crossSize * new Vector2(+1, -1),
                redBrush, 2);
        }
Beispiel #3
0
        internal void DrawCrosshair()
        {
            var MidWidth  = Program.Renderer.Resolution.Width / 2;
            var MidHeight = Program.Renderer.Resolution.Height / 2;

            Context2D.DrawLine(new SharpDX.Mathematics.Interop.RawVector2(MidWidth, MidHeight - 10), new SharpDX.Mathematics.Interop.RawVector2(MidWidth, MidHeight + 10), Brush);
            Context2D.DrawLine(new SharpDX.Mathematics.Interop.RawVector2(MidWidth - 10, MidHeight), new SharpDX.Mathematics.Interop.RawVector2(MidWidth + 10, MidHeight), Brush);
        }
        private void _小節線拍線を描画する(DeviceContext dc, double 現在の演奏時刻sec)
        {
            // 小節線・拍線 と チップ は描画階層(奥行き)が異なるので、別々のメソッドに分ける。

            DXResources.Instance.D2DBatchDraw(dc, () => {
                dc.PrimitiveBlend = PrimitiveBlend.SourceOver;

                this._描画範囲内のすべてのチップに対して(現在の演奏時刻sec, (chip, index, ヒット判定バーと描画との時間sec, ヒット判定バーと発声との時間sec, ヒット判定バーとの距離dpx) => {
                    if (chip.チップ種別 == チップ種別.小節線)
                    {
                        float 位置dpx = (float)(ヒット判定位置Ydpx + ヒット判定バーとの距離dpx - 1f);       // -1f は小節線の厚みの半分。

                        // 小節線
                        if (App進行描画.ユーザ管理.ログオン中のユーザ.演奏中に小節線と拍線を表示する)
                        {
                            float x = 441f;
                            float w = 780f;
                            dc.DrawLine(new Vector2(x, 位置dpx + 0f), new Vector2(x + w, 位置dpx + 0f), this._小節線色);
                            dc.DrawLine(new Vector2(x, 位置dpx + 1f), new Vector2(x + w, 位置dpx + 1f), this._小節線影色);
                        }

                        // 小節番号
                        if (App進行描画.ユーザ管理.ログオン中のユーザ.演奏中に小節番号を表示する)
                        {
                            float 右位置dpx = 441f + 780f - 24f;                                                     // -24f は適当なマージン。
                            this._数字フォント中グレー48x64.描画する(dc, 右位置dpx, 位置dpx - 84f, chip.小節番号.ToString(), 右揃え: true); // -84f は適当なマージン。
                        }
                    }
                    else if (chip.チップ種別 == チップ種別.拍線)
                    {
                        // 拍線
                        if (App進行描画.ユーザ管理.ログオン中のユーザ.演奏中に小節線と拍線を表示する)
                        {
                            float 位置dpx = (float)(ヒット判定位置Ydpx + ヒット判定バーとの距離dpx - 1f);       // -1f は拍線の厚みの半分。
                            dc.DrawLine(new Vector2(441f, 位置dpx), new Vector2(441f + 780f, 位置dpx), this._拍線色, strokeWidth: 1f);
                        }
                    }
                });
            });
        }
 /// <summary>
 /// Draws a line.
 /// </summary>
 /// <param name="pen">The stroke pen.</param>
 /// <param name="p1">The first point of the line.</param>
 /// <param name="p2">The second point of the line.</param>
 public void DrawLine(IPen pen, Point p1, Point p2)
 {
     if (pen != null)
     {
         using (var d2dBrush = CreateBrush(pen.Brush, new Rect(p1, p2).Normalize()))
             using (var d2dStroke = pen.ToDirect2DStrokeStyle(_deviceContext))
             {
                 if (d2dBrush.PlatformBrush != null)
                 {
                     _deviceContext.DrawLine(
                         p1.ToSharpDX(),
                         p2.ToSharpDX(),
                         d2dBrush.PlatformBrush,
                         (float)pen.Thickness,
                         d2dStroke);
                 }
             }
     }
 }
Beispiel #6
0
        private async Task Render()
        {
            DeviceContext renderTarget = _deviceContext;

            renderTarget.BeginDraw();

            renderTarget.Clear(Color.FromKnown(Colors.Black, 1f));


            for (int index = 0; index < PointCount; ++index)
            {
                for (int n = 0; n < NeighborCount; ++n)
                {
                    renderTarget.DrawLine(_brush1, (NeighborCount - n) / (float)(10 * NeighborCount), _points[index], _points[_neighbors[index, n]]);
                }
                renderTarget.DrawEllipse(_brush, 0.5f, new Ellipse(_points[index], 1.5f, 1.5f));
            }

            string text = "Press <Esc> to exit...";

            using (TextFormat textFormat = _directWriteFactory.CreateTextFormat("Segoe UI", 13, FontWeight.Normal))
                using (TextLayout textLayout = _directWriteFactory.CreateTextLayout(text, textFormat, float.MaxValue, float.MaxValue))
                    using (SolidColorBrush textBrush = renderTarget.CreateSolidColorBrush(Color.FromKnown(Colors.White, 1)))
                    {
                        renderTarget.DrawText(
                            text,
                            textFormat,
                            new RectF(10, 10, ClientRectangle.Width, ClientRectangle.Height),
                            textBrush,
                            DrawTextOptions.None,
                            MeasuringMode.Natural
                            );
                    }

            renderTarget.EndDraw();

            _swapChain.Present(1, 0);

            await MovePoints();
        }
Beispiel #7
0
        private void Render()
        {
            DeviceContext renderTarget = _deviceContext;

            renderTarget.BeginDraw();

            renderTarget.Clear(Color.FromKnown(Colors.Black, 1f));

            for (double re = 0.5; re <= 2; re += 0.1d)
            {
                for (double im = -2; im <= 2; im += 0.1d)
                {
                    Complex s  = new Complex(re, im);
                    Complex z  = AdvancedComplexMath.RiemannZeta(s);
                    PointF  rs = TranslateToScreen(s.Real, s.Imaginary);
                    PointF  rz = TranslateToScreen(z.Real, z.Imaginary);
                    renderTarget.DrawLine(_brush1, 1, rs, rz);
                }
            }

            renderTarget.EndDraw();

            _swapChain.Present(1, 0);
        }
Beispiel #8
0
 internal override void DoWork(DeviceContext context)
 {
     context.DrawLine(Point0, Point1, Brush, StrokeWidth, StrokeStyle);
 }