diff --git a/src/Consolonia.Core/Drawing/ConsoleBrush.cs b/src/Consolonia.Core/Drawing/ConsoleBrush.cs
index d19e4f2..a2d3bc8 100644
--- a/src/Consolonia.Core/Drawing/ConsoleBrush.cs
+++ b/src/Consolonia.Core/Drawing/ConsoleBrush.cs
@@ -100,66 +100,68 @@ public static ConsoleBrush FromPosition(IBrush brush, int x, int y, int width, i
switch (brush)
{
case ILinearGradientBrush gradientBrush:
- {
- if (width <= 0)
- width = 1;
- if (height <= 0)
- height = 1;
- // Calculate the relative position within the gradient
- double horizontalRelativePosition = (double)x / width;
- double verticalRelativePosition = (double)y / height;
-
- // Interpolate horizontal and vertical colors
- Color horizontalColor = InterpolateColor(gradientBrush, horizontalRelativePosition);
- Color verticalColor = InterpolateColor(gradientBrush, verticalRelativePosition);
-
- // Average the two colors to get the final color
- Color color = BlendColors(horizontalColor, verticalColor);
- return new ConsoleBrush(color);
- }
+ {
+ if (width <= 0)
+ width = 1;
+ if (height <= 0)
+ height = 1;
+ // Calculate the relative position within the gradient
+ double horizontalRelativePosition = (double)x / width;
+ double verticalRelativePosition = (double)y / height;
+
+ // Interpolate horizontal and vertical colors
+ Color horizontalColor = InterpolateColor(gradientBrush, horizontalRelativePosition);
+ Color verticalColor = InterpolateColor(gradientBrush, verticalRelativePosition);
+
+ // Average the two colors to get the final color
+ Color color = BlendColors(horizontalColor, verticalColor);
+ return new ConsoleBrush(color);
+ }
case IRadialGradientBrush radialBrush:
- {
- // Calculate the normalized center coordinates
- double centerX = radialBrush.Center.Point.X * width;
- double centerY = radialBrush.Center.Point.Y * height;
-
- // Calculate the distance from the center
- double dx = x - centerX;
- double dy = y - centerY;
-
- // Calculate the distance based on separate X and Y radii
- double distanceX = dx / (width * radialBrush.RadiusX.Scalar);
- double distanceY = dy / (height * radialBrush.RadiusY.Scalar);
- double distance = Math.Sqrt(distanceX * distanceX + distanceY * distanceY);
-
- // Normalize the distance
- double normalizedDistance = distance / Math.Sqrt(radialBrush.RadiusX.Scalar * radialBrush.RadiusX.Scalar + radialBrush.RadiusY.Scalar * radialBrush.RadiusY.Scalar);
-
- // Clamp the normalized distance to [0, 1]
- normalizedDistance = Math.Min(Math.Max(normalizedDistance, 0), 1);
-
- // Interpolate the color based on the normalized distance
- Color color = InterpolateColor(radialBrush, normalizedDistance);
- return new ConsoleBrush(color);
- }
+ {
+ // Calculate the normalized center coordinates
+ double centerX = radialBrush.Center.Point.X * width;
+ double centerY = radialBrush.Center.Point.Y * height;
+
+ // Calculate the distance from the center
+ double dx = x - centerX;
+ double dy = y - centerY;
+
+ // Calculate the distance based on separate X and Y radii
+ double distanceX = dx / (width * radialBrush.RadiusX.Scalar);
+ double distanceY = dy / (height * radialBrush.RadiusY.Scalar);
+ double distance = Math.Sqrt(distanceX * distanceX + distanceY * distanceY);
+
+ // Normalize the distance
+ double normalizedDistance = distance /
+ Math.Sqrt(radialBrush.RadiusX.Scalar * radialBrush.RadiusX.Scalar +
+ radialBrush.RadiusY.Scalar * radialBrush.RadiusY.Scalar);
+
+ // Clamp the normalized distance to [0, 1]
+ normalizedDistance = Math.Min(Math.Max(normalizedDistance, 0), 1);
+
+ // Interpolate the color based on the normalized distance
+ Color color = InterpolateColor(radialBrush, normalizedDistance);
+ return new ConsoleBrush(color);
+ }
case IConicGradientBrush conicBrush:
- {
- if (width <= 0)
- width = 1;
- if (height <= 0)
- height = 1;
- // Calculate the relative position within the gradient
- double horizontalRelativePosition = (double)x / width;
- double verticalRelativePosition = (double)y / height;
-
- // Interpolate horizontal and vertical colors
- Color horizontalColor = InterpolateColor(conicBrush, horizontalRelativePosition);
- Color verticalColor = InterpolateColor(conicBrush, verticalRelativePosition);
-
- // Average the two colors to get the final color
- Color color = BlendColors(horizontalColor, verticalColor);
- return new ConsoleBrush(color);
- }
+ {
+ if (width <= 0)
+ width = 1;
+ if (height <= 0)
+ height = 1;
+ // Calculate the relative position within the gradient
+ double horizontalRelativePosition = (double)x / width;
+ double verticalRelativePosition = (double)y / height;
+
+ // Interpolate horizontal and vertical colors
+ Color horizontalColor = InterpolateColor(conicBrush, horizontalRelativePosition);
+ Color verticalColor = InterpolateColor(conicBrush, verticalRelativePosition);
+
+ // Average the two colors to get the final color
+ Color color = BlendColors(horizontalColor, verticalColor);
+ return new ConsoleBrush(color);
+ }
default:
return FromBrush(brush);
diff --git a/src/Consolonia.Core/Drawing/DrawingContextImpl.cs b/src/Consolonia.Core/Drawing/DrawingContextImpl.cs
index 6f614aa..1aeeb02 100644
--- a/src/Consolonia.Core/Drawing/DrawingContextImpl.cs
+++ b/src/Consolonia.Core/Drawing/DrawingContextImpl.cs
@@ -43,6 +43,8 @@ public DrawingContextImpl(ConsoleWindow consoleWindow, PixelBuffer pixelBuffer)
private Rect CurrentClip => _clipStack.Peek();
+ public RenderOptions RenderOptions { get; set; }
+
public void Dispose()
{
}
@@ -291,14 +293,27 @@ public object GetFeature(Type t)
throw new NotImplementedException();
}
- public RenderOptions RenderOptions { get; set; }
-
public Matrix Transform
{
get => _transform;
set => _transform = value * _postTransform;
}
+ public void DrawRegion(IBrush brush, IPen pen, IPlatformRenderInterfaceRegion region)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void PushLayer(Rect bounds)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void PopLayer()
+ {
+ throw new NotImplementedException();
+ }
+
///
/// Draw a straight horizontal line or vertical line
///
@@ -780,20 +795,5 @@ private static double GetColorBrightness(SKColor color)
{
return 0.299 * color.Red + 0.587 * color.Green + 0.114 * color.Blue + color.Alpha;
}
-
- public void DrawRegion(IBrush brush, IPen pen, IPlatformRenderInterfaceRegion region)
- {
- throw new NotImplementedException();
- }
-
- public void PushLayer(Rect bounds)
- {
- throw new NotImplementedException();
- }
-
- public void PopLayer()
- {
- throw new NotImplementedException();
- }
}
}
\ No newline at end of file
diff --git a/src/Consolonia.Core/Drawing/Line.cs b/src/Consolonia.Core/Drawing/Line.cs
index cddaa8c..8a27356 100644
--- a/src/Consolonia.Core/Drawing/Line.cs
+++ b/src/Consolonia.Core/Drawing/Line.cs
@@ -92,6 +92,11 @@ public bool TryGetSegment(double startDistance, double stopDistance, bool startO
public IGeometryImpl SourceGeometry { get; }
public Matrix Transform { get; }
+ public IGeometryImpl GetWidenedGeometry(IPen pen)
+ {
+ throw new NotImplementedException();
+ }
+
public static Line CreateMyLine(Point p1, Point p2)
{
(double x, double y) = p2 - p1;
@@ -105,10 +110,5 @@ public static Line CreateMyLine(Point p1, Point p2)
// ReSharper disable once PatternIsRedundant todo: fix
return x is 0 or 0d ? new Line(p1, true, (int)y) : new Line(p1, false, (int)x);
}
-
- public IGeometryImpl GetWidenedGeometry(IPen pen)
- {
- throw new NotImplementedException();
- }
}
}
\ No newline at end of file
diff --git a/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs b/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs
index 2fe12f5..8aedc71 100644
--- a/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs
+++ b/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs
@@ -252,11 +252,16 @@ public object TryGetFeature(Type featureType)
if (featureType == typeof(ITextInputMethodImpl)) return null;
Debug.WriteLine($"Someone asked for {featureType.Name}");
-
+
// this is a TRY function, so we return null if we don't support it.
return null;
}
+ public void GetWindowsZOrder(Span windows, Span zOrder)
+ {
+ throw new NotImplementedException();
+ }
+
private void ConsoleOnMouseEvent(RawPointerEventType type, Point point, Vector? wheelDelta,
RawInputModifiers modifiers)
{
@@ -374,10 +379,5 @@ await Dispatcher.UIThread.InvokeAsync(() =>
}, DispatcherPriority.Input);
}
}
-
- public void GetWindowsZOrder(Span windows, Span zOrder)
- {
- throw new NotImplementedException();
- }
}
}
\ No newline at end of file
diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs
index dffbbf8..8999b1a 100644
--- a/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs
+++ b/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs
@@ -31,6 +31,11 @@ public ITrayIconImpl CreateTrayIcon()
throw new NotImplementedException();
}
+ public ITopLevelImpl CreateEmbeddableTopLevel()
+ {
+ throw new NotImplementedException();
+ }
+
public void Initialize()
{
NotSupported += InternalIgnore;
@@ -80,11 +85,6 @@ notSupportedRequest.Information[1] is null &&
break;
}
}
-
- public ITopLevelImpl CreateEmbeddableTopLevel()
- {
- throw new NotImplementedException();
- }
}
public class ConsoloniaPlatformSettings : DefaultPlatformSettings
diff --git a/src/Consolonia.Core/Text/FontManagerImpl.cs b/src/Consolonia.Core/Text/FontManagerImpl.cs
index c400451..a77de5c 100644
--- a/src/Consolonia.Core/Text/FontManagerImpl.cs
+++ b/src/Consolonia.Core/Text/FontManagerImpl.cs
@@ -41,19 +41,20 @@ public bool TryCreateGlyphTypeface(string familyName, FontStyle style, FontWeigh
return true;
}
- public bool TryCreateGlyphTypeface(Stream stream, out IGlyphTypeface glyphTypeface)
+ public bool TryCreateGlyphTypeface(Stream stream, FontSimulations fontSimulations,
+ [NotNullWhen(true)] out IGlyphTypeface glyphTypeface)
{
throw new NotImplementedException();
}
- public static string GetTheOnlyFontFamilyName()
+ public bool TryCreateGlyphTypeface(Stream stream, out IGlyphTypeface glyphTypeface)
{
- return "ConsoleDefault(F7D6533C-AC9D-4C4A-884F-7719A9B5DC0C)";
+ throw new NotImplementedException();
}
- public bool TryCreateGlyphTypeface(Stream stream, FontSimulations fontSimulations, [NotNullWhen(true)] out IGlyphTypeface glyphTypeface)
+ public static string GetTheOnlyFontFamilyName()
{
- throw new NotImplementedException();
+ return "ConsoleDefault(F7D6533C-AC9D-4C4A-884F-7719A9B5DC0C)";
}
}
}
\ No newline at end of file