public override void Draw(DrawData dd) { if (StartPoint.X < dd.LFT) { return; } if (StartPoint.X > dd.RIT) { return; } // draw measure dd.target.FillRectangle(Rectangle, resources.LoopRangeBrush); }
public override void DrawHilites(DrawData dd) { var rect = new RectangleF(EndPoint.X - 7, EndPoint.Y - 7, 6, 6); dd.target.FillRectangle(rect, resources.Step_RedBrush); dd.target.DrawRectangle(rect, resources.Step_GhostWhiteBrush); rect = new RectangleF(EndPoint.X - 8, EndPoint.Y - 8, 8, 8); dd.target.DrawRectangle(rect, resources.Step_BlackBrush); rect = new RectangleF(StartPoint.X, StartPoint.Y, 6, 6); dd.target.FillRectangle(rect, resources.Step_GreenBrush); dd.target.DrawRectangle(rect, resources.Step_GhostWhiteBrush); rect = new RectangleF(StartPoint.X - 1, StartPoint.Y - 1, 8, 8); dd.target.DrawRectangle(rect, resources.Step_BlackBrush); }
public override void DrawSelect(DrawData dd, bool primary) { Rectangle rect = Rectangle; if (rect.Left > dd.RIT) { return; } if (rect.Right < dd.LFT) { return; } dd.target.DrawRectangle(rect, primary ? resources.Selected_PrimaryBrush : resources.Selected_SecondaryBrush); }
public override void DrawHilites(DrawData dd) { Rectangle rect = Rectangle; if (rect.Left > dd.RIT) { return; } if (rect.Right < dd.LFT) { return; } dd.target.DrawRectangle(rect, resources.HiliteBrush); }
public override void Draw(DrawData dd) { Rectangle rect = Rectangle; if (rect.Left > dd.RIT) { return; } if (rect.Right < dd.LFT) { return; } //PointF[] wrk = new[] { StartPoint }; //dd.Transform.TransformPoints(wrk); dd.target.DrawText(text, resources.Lyric_TextFormat, rect, resources.Lyric_FontBrush); }
private void draw(DrawData dd, Brush brush) { //var savTrans = dd.target.Transform; //dd.target.Transform = Matrix3x2.Identity; //dd.target.DrawLine(new Vector2(StartPoint.X, dd.Height + 1), new Vector2(StartPoint.X, dd.Height + Global.Slider_Height - 2), brush); //dd.target.Transform = savTrans; if (StartPoint.X < dd.LFT) { return; } if (StartPoint.X > dd.RIT) { return; } dd.target.DrawLine(StartPoint, EndPoint, brush); }
public override void Draw(DrawData dd) { // save transform and install identity var savTrans = dd.target.Transform; dd.target.Transform = Matrix3x2.Identity; // draw slider and thumb int ht = Global.Slider_Height; int top = dd.Height; var scale = (float)dd.Width / dd.Song.TrackPx; var pt = ((float)dd.LFT) * scale; var pt1 = ((float)dd.RIT) * scale; dd.target.FillRectangle(new RectangleF(pt, top + 2, pt1 - pt, ht - 4), resources.SliderThumb_ThumbFillBrush); dd.target.DrawRectangle(new RectangleF(pt, top + 2, pt1 - pt, ht - 4), resources.SliderThumb_ThumbBrush); // restore transform dd.target.Transform = savTrans; }
public virtual void DrawHilites(DrawData dd) { }
public override void Draw(DrawData dd) { dd.target.FillRectangle(Rectangle, resources.Step_GoldenrodBrush); }
public override void Draw(DrawData dd) { }
public override void DrawHilites(DrawData dd) { draw(dd, resources.HiliteBrush); }
public override void DrawSelect(DrawData dd, bool primary) { draw(dd, resources.Selected_PrimaryBrush); }
public override void Draw(DrawData dd) { // draw wave data byte[] wavedata = dd.Song.WaveformData; if (wavedata != null) { #if (MARKERS) Markers.WriteFlag("Wave"); #endif int fnd = -1; for (int ndx = dd.LFT / Global.pxpersec; ndx < (dd.RIT + Global.pxpersec - 1) / Global.pxpersec; ndx++) { if (resources.Wave_Bmps[ndx] == null) { fnd = ndx; break; } } if (fnd == -1) { for (int ndx = 0; ndx < resources.Wave_Bmps.Length; ndx++) { if (resources.Wave_Bmps[ndx] == null) { fnd = ndx; break; } } } if (fnd != -1) { var ht = Global.Wave_Height; var half = ht >> 1; using (var renderT = new SharpDX.Direct2D1.BitmapRenderTarget(dd.target, CompatibleRenderTargetOptions.None, new Size2F(Global.pxpersec, ht), null, new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied))) { renderT.BeginDraw(); renderT.Clear(SharpDX.Color.Black); using (var path = new PathGeometry(Global.Instance.factory2D1)) { var sink = path.Open(); sink.BeginFigure(new Vector2(Global.pxpersec, half + 1), FigureBegin.Hollow); sink.AddLine(new Vector2(0, half + 1)); for (int ndx = 0, src = fnd * 2 * Global.pxpersec; ndx < Global.pxpersec && src < wavedata.Length; ndx++, src += 2) { sink.AddLine(new Vector2(ndx, half + 1 + wavedata[src])); } sink.EndFigure(FigureEnd.Open); sink.Close(); renderT.DrawGeometry(path, resources.Wave_RedBrush); } using (var path = new PathGeometry(Global.Instance.factory2D1)) { var sink = path.Open(); sink.BeginFigure(new Vector2(Global.pxpersec, half - 1), FigureBegin.Hollow); sink.AddLine(new Vector2(0, half - 1)); for (int ndx = 0, src = fnd * 2 * Global.pxpersec + 1; ndx < Global.pxpersec && src < wavedata.Length; ndx++, src += 2) { sink.AddLine(new Vector2(ndx, half - 1 - wavedata[src])); } sink.EndFigure(FigureEnd.Open); sink.Close(); renderT.DrawGeometry(path, resources.Wave_GreenBrush); } renderT.EndDraw(); resources.Wave_Bmps[fnd] = renderT.Bitmap; } } for (int ndx = dd.LFT / Global.pxpersec, bgn = ndx * Global.pxpersec; ndx < resources.Wave_Bmps.Length && bgn <= dd.RIT; ndx++, bgn += Global.pxpersec) { var bmp = resources.Wave_Bmps[ndx]; if (bmp == null) { break; } dd.target.DrawBitmap(bmp, new RectangleF(bgn, Global.Wave_Channels, Global.pxpersec, Global.Wave_Height), 1.0f, BitmapInterpolationMode.NearestNeighbor, new RectangleF(0, 0, Global.pxpersec, Global.Wave_Height)); } #if (MARKERS) Markers.WriteFlag("WaveEnd"); #endif } }
public override void Draw(DrawData dd) { draw(dd, resources.LoopEndBrush); }
public void D3DRender(bool updated) { #if (MARKERS) var span = Markers.EnterSpan($"{nameof(RC2)} render"); #endif Song song = Global.Instance.Song; if (resizeNeeded) { resizeNeeded = false; target.Resize(new Size2(Global.Instance.Width, Global.Instance.Height)); if (song != null) { song.DevDepReacquireAll(target); song.ResetPoints(); } } target.BeginDraw(); target.Clear(SharpDX.Color.Black); if (initialized) { if (true) //Global.Instance.Updated) { if (song != null) { if (!song.IsDevDepResourcesAcquired) { VizRes.DevDepAcquireAll(target); song.IsDevDepResourcesAcquired = true; } if (song.PlayerMode == PlayerMode.playing) { if (song.Position < song.TrackPx) { song.Position = Math.Min(song.Position + 2, song.TrackPx - 1); } else { song.Position = 0; song.PlayerMode = PlayerMode.stopped; } } var half = target.PixelSize.Width / 2; if (song.Position < half) { song.LFT = 0; } else if (song.Position > song.TrackPx - half) { song.LFT = song.TrackPx - target.PixelSize.Width; } else { song.LFT = song.Position - half; } song.RIT = song.LFT + target.PixelSize.Width; target.Transform = Matrix3x2.Translation(-song.LFT, 0); bool moving = ((song.LFT != prevLFT) || (song.RIT != prevRIT)); if (moving) { prevLFT = song.LFT; prevRIT = song.RIT; } DrawData dd = new DrawData() { target = target, Song = song, Height = target.PixelSize.Height - Global.Slider_Height, Width = target.PixelSize.Width, LFT = prevLFT, RIT = prevRIT, Offset = song.Position }; if (moving) { foreach (var viz in song.Vizs) { viz.DrawMove(dd); } } foreach (var viz in song.Vizs) { if (viz is Slider || viz is Rule || (viz.StartPoint.X < prevRIT && viz.EndPoint.X > prevLFT)) { viz.Draw(dd); } } foreach (Viz viz in song.Vizs) { if (viz.StartPoint.X < prevRIT && viz.EndPoint.X > prevLFT) { if ((viz.IsSelectable) && (song.Selected.Contains(viz))) { viz.DrawSelect(dd, viz == song.Selected[0]); } } } if ((CurrOver != null) && (CurrOver.HasHilites)) { CurrOver.DrawHilites(dd); } //if (song.Drag.DragMode == DragMode.Active) //{ // target.DrawRectangle(Pens.AliceBlue, Math.Min(dragBegin.X, dragEnd.X), Math.Min(dragBegin.Y, dragEnd.Y), Math.Abs(dragBegin.X - dragEnd.X), Math.Abs(dragBegin.Y - dragEnd.Y)); //} } } } if (mouseOver) { using (var brush = new SolidColorBrush(target, Color.LightGoldenrodYellow)) { target.DrawEllipse(new Ellipse(new Vector2(mousex, mousey), 2, 2), brush); } } //end drawing target.EndDraw(); #if (MARKERS) span.Leave(); #endif fpsCounter.Update(); #if (MARKERS) span = Markers.EnterSpan($"{nameof(RC2)} progress"); #endif string text = $"FPS:{fpsCounter.FPS}:{Global.Instance.RealTime} Updates:{updateds} W/H:{ClientSize.Width}/{ClientSize.Height} MO:{mouseOver}"; tsLbl4Prog.Report(text); string time = string.Empty; if ((song != null) && (prevPosition != (song.Position / (Global.pxpersec / 10)))) { prevPosition = song.Position / (Global.pxpersec / 10); time = $"{(prevPosition / 600):00}:{(prevPosition / 10 % 60):00}.{(prevPosition % 10):0}"; tsppTimeProg.Report(time); } #if (MARKERS) span.Leave(); #endif }
public virtual void DrawSelect(DrawData dd, bool primary) { }
public override void DrawSelect(DrawData dd, bool primary) { dd.target.DrawRectangle(Rectangle, primary ? resources.Selected_PrimaryBrush : resources.Selected_SecondaryBrush); }
public abstract void Draw(DrawData dd);
public virtual void DrawMove(DrawData dd) { }