Compare commits

...
6 Commits
Author SHA1 Message Date
OLDREDSTONE 8305c5b3d6 封装预览区域绘制函数 2025-03-26 12:06:43 +08:00
obugs 0d285b4ccc Merge pull request 'master' (#3) from Koquem/RDTKEditor:master into master
Reviewed-on: obugs/RDTKEditor#3
2025-03-26 10:51:43 +08:00
Koquem 26e52b98e4 1 2025-03-26 10:43:54 +08:00
Koquem 087b7f2f4e merge upstream 2025-03-25 16:27:05 +08:00
obugs 3a898c428f Merge pull request '添加对 Core 的直接引用' (#2) from obsmain into master
Reviewed-on: obugs/RDTKEditor#2
2025-03-25 16:17:15 +08:00
Koquem b76ba2b6ea 更新 RDTKView.cs 文件
在 RDTKEditor.Models 命名空间中添加了一行代码。
2025-02-27 12:25:31 +08:00
2 changed files with 35 additions and 1 deletions
+34 -1
View File
@@ -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
+1
View File
@@ -145,3 +145,4 @@ namespace RDTKEditor.Models
}
}
}