Updated OnDrawingContent methods across multiple classes to use non-nullable DrawContext parameters, improving type safety.

Refactored `IDriver` interface:
- Updated `SetScreenSize` to remove `NotSupportedException`.
- Clarified `Refresh` method as internal and updated documentation for `SizeChanged` event.
This commit is contained in:
Tig
2025-12-04 16:53:03 -07:00
parent b061aacf18
commit ce15aa2d0f
6 changed files with 17 additions and 23 deletions

View File

@@ -631,7 +631,7 @@ public class Images : Scenario
public Image<Rgba32> FullResImage;
private Image<Rgba32> _matchSize;
protected override bool OnDrawingContent (DrawContext? context)
protected override bool OnDrawingContent (DrawContext context)
{
if (FullResImage == null)
{
@@ -708,7 +708,7 @@ public class Images : Scenario
return (columns, rows);
}
protected override bool OnDrawingContent (DrawContext? context)
protected override bool OnDrawingContent (DrawContext context)
{
if (_palette == null || _palette.Count == 0)
{

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text;
namespace UICatalog.Scenarios;
@@ -273,7 +270,7 @@ public class DrawingArea : View
public ITool CurrentTool { get; set; } = new DrawLineTool ();
public DrawingArea () { AddLayer (); }
protected override bool OnDrawingContent (DrawContext? context)
protected override bool OnDrawingContent (DrawContext context)
{
foreach (LineCanvas canvas in Layers)
{
@@ -380,7 +377,7 @@ public class AttributeView : View
}
/// <inheritdoc/>
protected override bool OnDrawingContent (DrawContext? context)
protected override bool OnDrawingContent (DrawContext context)
{
Color fg = Value.Foreground;
Color bg = Value.Background;

View File

@@ -322,7 +322,7 @@ public class Snake : Scenario
private SnakeState State { get; }
protected override bool OnDrawingContent (DrawContext? context)
protected override bool OnDrawingContent (DrawContext context)
{
SetAttribute (white);
ClearViewport ();

View File

@@ -109,7 +109,7 @@ internal class GradientsView : View
private const int LABEL_HEIGHT = 1;
private const int GRADIENT_WITH_LABEL_HEIGHT = GRADIENT_HEIGHT + LABEL_HEIGHT + 1; // +1 for spacing
protected override bool OnDrawingContent (DrawContext? context)
protected override bool OnDrawingContent (DrawContext context)
{
DrawTopLineGradient (Viewport);