更新
This commit is contained in:
29
WPFDark/Internals/RenderHelper.cs
Normal file
29
WPFDark/Internals/RenderHelper.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
using WPFDark.Internals;
|
||||
|
||||
namespace WPFDark.Internals
|
||||
{
|
||||
internal static class RenderHelper
|
||||
{
|
||||
internal static void DrawPointCursor(this Visual visual, in LayoutRounder rounder, DrawingContext dc, in ImmutableVec2_double pos, bool isEnabled, bool isReadOnly)
|
||||
{
|
||||
var pointIn = Caches.GetPen(ByteColor.White, rounder.RoundLayoutValue(PointCursorRadius - 2));
|
||||
var pointInIsReadOnly = Caches.GetPen(ByteColor.Gray, rounder.RoundLayoutValue(PointCursorRadius - 2));
|
||||
var pointOut = Caches.GetPen(ByteColor.Black, rounder.RoundLayoutValue(PointCursorRadius));
|
||||
|
||||
var s = rounder.RoundLayoutValue(1);
|
||||
|
||||
var ob = pointOut;
|
||||
var ib = isEnabled == false || isReadOnly ? pointInIsReadOnly : pointIn;
|
||||
|
||||
var p = new Point(pos.X, pos.Y);
|
||||
|
||||
dc.DrawEllipse(ob.Brush, ob, p, s, s);
|
||||
dc.DrawEllipse(ib.Brush, ib, p, s, s);
|
||||
}
|
||||
|
||||
private const double PointCursorRadius = 6;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user