Archived
Compare commits
6
Commits
06c19bf10a
...
8305c5b3d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8305c5b3d6 | ||
|
|
0d285b4ccc | ||
|
|
26e52b98e4 | ||
|
|
087b7f2f4e | ||
|
|
3a898c428f | ||
|
|
b76ba2b6ea |
+34
-1
@@ -2,7 +2,9 @@
|
||||
using RDTKEditor.Models;
|
||||
using RhythmBase.Events;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.Desktop;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -15,6 +17,7 @@ namespace RDTKEditor
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private SKSizeI _vsScale = new(1600,900);
|
||||
private readonly RDTKView viewModel = new();
|
||||
public MainWindow()
|
||||
{
|
||||
@@ -239,7 +242,7 @@ namespace RDTKEditor
|
||||
};
|
||||
timelineCanvas.Children.Add(rectangle);
|
||||
}
|
||||
private void mainUI_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
|
||||
/*private void mainUI_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
var sfc = e.Surface;
|
||||
var cvs = sfc.Canvas;
|
||||
@@ -248,6 +251,36 @@ namespace RDTKEditor
|
||||
{
|
||||
Color = SKColors.Red,
|
||||
});
|
||||
}*/
|
||||
|
||||
private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
var sfc = e.Surface;
|
||||
var cvs = sfc.Canvas;
|
||||
var info = e.Info;
|
||||
cvs.Clear(SKColors.Black);
|
||||
SKPoint scale = new(info.Width / _vsScale.Width, info.Height / _vsScale.Height);
|
||||
cvs.Save();
|
||||
cvs.Scale(scale);
|
||||
Draw(cvs);
|
||||
cvs.Restore();
|
||||
}
|
||||
private void Draw(SKCanvas canvas)
|
||||
{
|
||||
// 以 1600x900 为基准绘制
|
||||
|
||||
canvas.DrawLine(0, 0, _vsScale.Width, _vsScale.Height, new SKPaint
|
||||
{
|
||||
Color = SKColors.Red,
|
||||
StrokeWidth = 3,
|
||||
IsStroke = true,
|
||||
});
|
||||
canvas.DrawLine(0, _vsScale.Height, _vsScale.Width, 0, new SKPaint
|
||||
{
|
||||
Color = SKColors.White,
|
||||
StrokeWidth = 3,
|
||||
IsStroke = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
public class MainViewModel : INotifyPropertyChanged
|
||||
|
||||
@@ -145,3 +145,4 @@ namespace RDTKEditor.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user