From d959c42e99e2cf777e5fc0a784d391aac179845d Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Sun, 28 Jul 2024 14:11:23 +0300 Subject: [PATCH] Rename various objects. --- Dashboard.BlurgText/BlurgCommand.cs | 4 +- Dashboard.OpenTK/OpenTKPlatform.cs | 2 +- Dashboard.OpenTK/OpenTKPort.cs | 2 +- Dashboard/Controls/UIBase.cs | 8 +-- Dashboard/DbApplication.cs | 4 +- Dashboard/Geometry.cs | 26 +++++----- Dashboard/ImmediateDraw/DrawEngine.cs | 16 +++--- Dashboard/ImmediateDraw/DrawList.cs | 44 ++++++++-------- Dashboard/ImmediateDraw/Frame.cs | 20 ++++---- Dashboard/ImmediateDraw/Image.cs | 4 +- Dashboard/Media/Font/FontAtlas.cs | 4 +- Dashboard/Media/QFont.cs | 4 +- Dashboard/OpenGL/GL21Driver.cs | 2 +- Dashboard/PAL/Dash.cs | 14 ++---- .../{IDashboardPlatform.cs => IDbPlatform.cs} | 2 +- Dashboard/Style.cs | 14 +++--- Dashboard/Typography/TextLayout.cs | 12 ++--- Dashboard/Typography/Typesetter.cs | 6 +-- .../{DrawQueue.cs => DrawCallQueue.cs} | 14 +++--- .../VertexGenerator/VertexDrawingEngine.cs | 50 +++++++++---------- tests/Dashboard.Demo/Program.cs | 2 +- 21 files changed, 125 insertions(+), 129 deletions(-) rename Dashboard/PAL/{IDashboardPlatform.cs => IDbPlatform.cs} (97%) rename Dashboard/VertexGenerator/{DrawQueue.cs => DrawCallQueue.cs} (84%) diff --git a/Dashboard.BlurgText/BlurgCommand.cs b/Dashboard.BlurgText/BlurgCommand.cs index bc6e7bb..fc315d8 100644 --- a/Dashboard.BlurgText/BlurgCommand.cs +++ b/Dashboard.BlurgText/BlurgCommand.cs @@ -12,13 +12,13 @@ namespace Dashboard.BlurgText { BlurgRect rect = result[i]; - QRectangle pos = new QRectangle() + Rectangle pos = new Rectangle() { Min = origin + new Vector2(rect.X, rect.Y), Size = new Vector2(rect.Width, rect.Height) }; - QRectangle uv = new QRectangle(rect.U1, rect.V1, rect.U0, rect.V0); + Rectangle uv = new Rectangle(rect.U1, rect.V1, rect.U0, rect.V0); list.Image(blurg.Images[(int)rect.UserData], pos, uv); } diff --git a/Dashboard.OpenTK/OpenTKPlatform.cs b/Dashboard.OpenTK/OpenTKPlatform.cs index 25b54e9..faaabfb 100644 --- a/Dashboard.OpenTK/OpenTKPlatform.cs +++ b/Dashboard.OpenTK/OpenTKPlatform.cs @@ -10,7 +10,7 @@ using System.Collections.Generic; namespace Dashboard.OpenTK { - public class OpenTKPlatform : IDashboardPlatform + public class OpenTKPlatform : IDbPlatform { private readonly List _ports = new List(); diff --git a/Dashboard.OpenTK/OpenTKPort.cs b/Dashboard.OpenTK/OpenTKPort.cs index 5e756a4..1b25368 100644 --- a/Dashboard.OpenTK/OpenTKPort.cs +++ b/Dashboard.OpenTK/OpenTKPort.cs @@ -68,7 +68,7 @@ namespace Dashboard.OpenTK public void Paint(DrawList queue) { - QRectangle view = new QRectangle(Size, new Vector2(0, 0)); + Rectangle view = new Rectangle(Size, new Vector2(0, 0)); _vertexEngine.Reset(); _vertexEngine.ProcessCommands(view, queue); diff --git a/Dashboard/Controls/UIBase.cs b/Dashboard/Controls/UIBase.cs index 3f73c1b..2c9901b 100644 --- a/Dashboard/Controls/UIBase.cs +++ b/Dashboard/Controls/UIBase.cs @@ -14,9 +14,9 @@ namespace Dashboard.Controls public UIBase? Parent { get; protected set; } public string? Id { get; set; } - public QRectangle Bounds + public Rectangle Bounds { - get => new QRectangle(Position + Size, Position); + get => new Rectangle(Position + Size, Position); set { Size = value.Size; @@ -38,7 +38,7 @@ namespace Dashboard.Controls } } - public QRectangle AbsoluteBounds + public Rectangle AbsoluteBounds { get { @@ -48,7 +48,7 @@ namespace Dashboard.Controls } else { - return new QRectangle(Bounds.Max + Parent.Position, Bounds.Min + Parent.Position); + return new Rectangle(Bounds.Max + Parent.Position, Bounds.Min + Parent.Position); } } } diff --git a/Dashboard/DbApplication.cs b/Dashboard/DbApplication.cs index ef3e052..4356781 100644 --- a/Dashboard/DbApplication.cs +++ b/Dashboard/DbApplication.cs @@ -17,7 +17,7 @@ namespace Dashboard /// /// The application platform driver. /// - public IDashboardPlatform Platform { get; } + public IDbPlatform Platform { get; } /// /// Title of the application. @@ -46,7 +46,7 @@ namespace Dashboard /// public List MediaLoaders { get; } = new List(); - public DbApplication(IDashboardPlatform platform) + public DbApplication(IDbPlatform platform) { Platform = platform; FontProvider = new FontProvider(this); diff --git a/Dashboard/Geometry.cs b/Dashboard/Geometry.cs index bbc3da6..71bb0db 100644 --- a/Dashboard/Geometry.cs +++ b/Dashboard/Geometry.cs @@ -8,7 +8,7 @@ namespace Dashboard /// A bezier curve segment. /// [DebuggerDisplay("{Start} -- {ControlA} -- {ControlB} -- {End}")] - public struct QBezier + public struct Bezier { /// /// Segment start point. @@ -37,7 +37,7 @@ namespace Dashboard 0.5f * (End - Start).Length + 0.5f * ((ControlA - Start).Length + (ControlB - ControlA).Length + (End - ControlB).Length); - public QBezier(Vector2 start, Vector2 controlA, Vector2 controlB, Vector2 end) + public Bezier(Vector2 start, Vector2 controlA, Vector2 controlB, Vector2 end) { Start = start; ControlA = controlA; @@ -45,7 +45,7 @@ namespace Dashboard End = end; } - public QBezier( + public Bezier( float startX, float startY, float controlAx, @@ -104,7 +104,7 @@ namespace Dashboard /// A line segment. /// [DebuggerDisplay("{Start} -- {End}")] - public struct QLine + public struct Line { /// /// Start point. @@ -116,13 +116,13 @@ namespace Dashboard /// public Vector2 End; - public QLine(Vector2 start, Vector2 end) + public Line(Vector2 start, Vector2 end) { Start = start; End = end; } - public QLine(float startX, float startY, float endX, float endY) + public Line(float startX, float startY, float endX, float endY) { Start.X = startX; Start.Y = startY; @@ -145,7 +145,7 @@ namespace Dashboard /// A rectangle. /// [DebuggerDisplay("({Left}, {Top}, {Right}, {Bottom})")] - public struct QRectangle + public struct Rectangle { /// /// Position maximum point. @@ -187,13 +187,13 @@ namespace Dashboard set => Max = Min + value; } - public QRectangle(Vector2 max, Vector2 min) + public Rectangle(Vector2 max, Vector2 min) { Max = max; Min = min; } - public QRectangle(float r, float b, float l, float t) + public Rectangle(float r, float b, float l, float t) { Max = new Vector2(r, b); Min = new Vector2(l, t); @@ -212,8 +212,8 @@ namespace Dashboard Max += offset; } - public static QRectangle Intersect(in QRectangle a, in QRectangle b) => - new QRectangle( + public static Rectangle Intersect(in Rectangle a, in Rectangle b) => + new Rectangle( Math.Max(a.Right, b.Right), Math.Max(a.Bottom, b.Bottom) , @@ -226,7 +226,7 @@ namespace Dashboard /// /// It is undefined to have an ellipse with non-orthogonal axes. [DebuggerDisplay("{Center} ellipse {AxisA}; {AxisB}")] - public struct QEllipse + public struct Ellipse { /// /// Ellipse center point. @@ -248,7 +248,7 @@ namespace Dashboard /// A triangle. /// [DebuggerDisplay("{A} -- {B} -- {C}")] - public struct QTriangle + public struct Triangle { /// /// First vertex. diff --git a/Dashboard/ImmediateDraw/DrawEngine.cs b/Dashboard/ImmediateDraw/DrawEngine.cs index 9a7b6e4..860c469 100644 --- a/Dashboard/ImmediateDraw/DrawEngine.cs +++ b/Dashboard/ImmediateDraw/DrawEngine.cs @@ -10,14 +10,14 @@ namespace Dashboard.ImmediateDraw private readonly Stack _zStack = new Stack(); public int ZIndex => _zIndex; - private QRectangle _viewport; - private readonly Stack _viewportStack = new Stack(); + private Rectangle _viewport; + private readonly Stack _viewportStack = new Stack(); private readonly Stack _matrixStack = new Stack(); private Command _customCommandBase = Command.CustomCommandBase; private readonly List _customCommands = new List(); - public QRectangle Viewport => _viewport; + public Rectangle Viewport => _viewport; public Matrix4 ActiveTransforms { get; } @@ -35,7 +35,7 @@ namespace Dashboard.ImmediateDraw return id; } - public void ProcessCommands(QRectangle bounds, DrawList queue) + public void ProcessCommands(Rectangle bounds, DrawList queue) { DrawQueue iterator = queue.GetEnumerator(); @@ -74,13 +74,13 @@ namespace Dashboard.ImmediateDraw _viewportStack.Push(_viewport); break; case Command.IntersectViewport: - _viewport = QRectangle.Intersect((QRectangle)iterator.Dequeue(), _viewport); + _viewport = Rectangle.Intersect((Rectangle)iterator.Dequeue(), _viewport); break; case Command.StoreViewport: - _viewport = (QRectangle)iterator.Dequeue(); + _viewport = (Rectangle)iterator.Dequeue(); break; case Command.PopViewport: - _viewport = _viewportStack.TryPop(out QRectangle viewport) ? viewport : bounds; + _viewport = _viewportStack.TryPop(out Rectangle viewport) ? viewport : bounds; break; case Command.PushZ: _zStack.Push(_zIndex); @@ -123,7 +123,7 @@ namespace Dashboard.ImmediateDraw _zIndex = 0; _zStack.Clear(); - _viewport = new QRectangle(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue); + _viewport = new Rectangle(float.MaxValue, float.MinValue, float.MinValue, float.MaxValue); _viewportStack.Clear(); _matrixStack.Clear(); diff --git a/Dashboard/ImmediateDraw/DrawList.cs b/Dashboard/ImmediateDraw/DrawList.cs index d2b2b39..0c45901 100644 --- a/Dashboard/ImmediateDraw/DrawList.cs +++ b/Dashboard/ImmediateDraw/DrawList.cs @@ -49,13 +49,13 @@ namespace Dashboard.ImmediateDraw Enqueue(Command.PushViewport); } - public void IntersectViewport(in QRectangle viewport) + public void IntersectViewport(in Rectangle viewport) { Enqueue(Command.IntersectViewport); Enqueue(viewport); } - public void StoreViewport(in QRectangle viewport) + public void StoreViewport(in Rectangle viewport) { Enqueue(Command.StoreViewport); Enqueue(viewport); @@ -126,21 +126,21 @@ namespace Dashboard.ImmediateDraw Enqueue(Command.PopStyle); } - public void Line(in QLine line) + public void Line(in Line line) { Enqueue(Command.Line); Enqueue(line); } - public void Line(params QLine[] lines) + public void Line(params Line[] lines) { Enqueue(Command.Line); Enqueue((Frame)lines.Length); - foreach (QLine line in lines) + foreach (Line line in lines) Enqueue(line); } - public void Bezier(in QBezier bezier) + public void Bezier(in Bezier bezier) { Frame a, b; Frame.Create(bezier, out a, out b); @@ -150,14 +150,14 @@ namespace Dashboard.ImmediateDraw Enqueue(b); } - public void Bezier(params QBezier[] beziers) + public void Bezier(params Bezier[] beziers) { Frame a, b; Enqueue(Command.Bezier); Enqueue((Frame)beziers.Length); - foreach (QBezier bezier in beziers) + foreach (Bezier bezier in beziers) { Frame.Create(bezier, out a, out b); Enqueue(a); @@ -165,21 +165,21 @@ namespace Dashboard.ImmediateDraw } } - public void Rectangle(in QRectangle rectangle) + public void Rectangle(in Rectangle rectangle) { Enqueue(Command.Rectangle); Enqueue(rectangle); } - public void Rectangle(QRectangle[] rectangles) + public void Rectangle(Rectangle[] rectangles) { Enqueue(Command.Rectangle); Enqueue((Frame)rectangles.Length); - foreach (QRectangle rectangle in rectangles) + foreach (Rectangle rectangle in rectangles) Enqueue(rectangle); } - public void Ellipse(in QEllipse ellipse) + public void Ellipse(in Ellipse ellipse) { Frame a, b; Frame.Create(ellipse, out a, out b); @@ -189,12 +189,12 @@ namespace Dashboard.ImmediateDraw Enqueue(b); } - public void Ellipse(params QEllipse[] ellipses) + public void Ellipse(params Ellipse[] ellipses) { Frame a, b; Enqueue(Command.Ellipse); Enqueue((Frame)ellipses.Length); - foreach (QEllipse ellipse in ellipses) + foreach (Ellipse ellipse in ellipses) { Frame.Create(ellipse, out a, out b); Enqueue(a); @@ -202,7 +202,7 @@ namespace Dashboard.ImmediateDraw } } - public void Triangle(in QTriangle triangle) + public void Triangle(in Triangle triangle) { Enqueue(Command.Triangle); Enqueue(triangle.A); @@ -210,11 +210,11 @@ namespace Dashboard.ImmediateDraw Enqueue(triangle.C); } - public void Triangle(params QTriangle[] triangles) + public void Triangle(params Triangle[] triangles) { Enqueue(Command.Triangle); Enqueue((Frame)triangles.Length); - foreach (QTriangle triangle in triangles) + foreach (Triangle triangle in triangles) { Enqueue(triangle.A); Enqueue(triangle.B); @@ -232,7 +232,7 @@ namespace Dashboard.ImmediateDraw } } - public void Image(QImage texture, in QRectangle rectangle) + public void Image(QImage texture, in Rectangle rectangle) { Enqueue(Command.Image); Enqueue((Frame)(int)ImageCommandFlags.Single); @@ -240,7 +240,7 @@ namespace Dashboard.ImmediateDraw Enqueue(rectangle); } - public void Image(QImage texture, in QRectangle rectangle, in QRectangle uv) + public void Image(QImage texture, in Rectangle rectangle, in Rectangle uv) { Enqueue(Command.Image); Enqueue((Frame)(int)(ImageCommandFlags.Single | ImageCommandFlags.UVs)); @@ -249,7 +249,7 @@ namespace Dashboard.ImmediateDraw Enqueue(uv); } - public void Image(QImage texture, ReadOnlySpan rectangles, bool interleavedUV = false) + public void Image(QImage texture, ReadOnlySpan rectangles, bool interleavedUV = false) { int count = rectangles.Length; ImageCommandFlags flags = ImageCommandFlags.None; @@ -264,13 +264,13 @@ namespace Dashboard.ImmediateDraw Enqueue(new Frame((int)flags, count)); Enqueue(new Frame(texture)); - foreach (QRectangle rectangle in rectangles) + foreach (Rectangle rectangle in rectangles) { Enqueue(rectangle); } } - public void Image(QImage texture, ReadOnlySpan rectangles, ReadOnlySpan uvs) + public void Image(QImage texture, ReadOnlySpan rectangles, ReadOnlySpan uvs) { int count = Math.Min(rectangles.Length, uvs.Length); Enqueue(Command.Image); diff --git a/Dashboard/ImmediateDraw/Frame.cs b/Dashboard/ImmediateDraw/Frame.cs index ce736d0..def3fd1 100644 --- a/Dashboard/ImmediateDraw/Frame.cs +++ b/Dashboard/ImmediateDraw/Frame.cs @@ -312,29 +312,29 @@ namespace Dashboard.ImmediateDraw } } - public static explicit operator QRectangle(in Frame frame) + public static explicit operator Rectangle(in Frame frame) { switch (frame.Type) { default: throw new InvalidCastException(); case FrameType.IVec4: - return new QRectangle(frame._i1, frame._i2, frame._i3, frame._i4); + return new Rectangle(frame._i1, frame._i2, frame._i3, frame._i4); case FrameType.Vec4: - return new QRectangle(frame._f1, frame._f2, frame._f3, frame._f4); + return new Rectangle(frame._f1, frame._f2, frame._f3, frame._f4); } } - public static explicit operator QLine(in Frame frame) + public static explicit operator Line(in Frame frame) { switch (frame.Type) { default: throw new InvalidCastException(); case FrameType.IVec4: - return new QLine(frame._i1, frame._i2, frame._i3, frame._i4); + return new Line(frame._i1, frame._i2, frame._i3, frame._i4); case FrameType.Vec4: - return new QLine(frame._f1, frame._f2, frame._f3, frame._f4); + return new Line(frame._f1, frame._f2, frame._f3, frame._f4); } } #endregion @@ -344,16 +344,16 @@ namespace Dashboard.ImmediateDraw public static implicit operator Frame(Command cmd) => new Frame(cmd); public static implicit operator Frame(in Vector2 vector) => new Frame(vector.X, vector.Y); public static implicit operator Frame(in Color4 color) => new Frame(color.R, color.G, color.B, color.A); - public static implicit operator Frame(in QRectangle rect) => new Frame(rect.Max.X, rect.Max.Y, rect.Min.X, rect.Min.Y); - public static implicit operator Frame(in QLine line) => new Frame(line.Start.X, line.Start.Y, line.End.X, line.Start.Y); + public static implicit operator Frame(in Rectangle rect) => new Frame(rect.Max.X, rect.Max.Y, rect.Min.X, rect.Min.Y); + public static implicit operator Frame(in Line line) => new Frame(line.Start.X, line.Start.Y, line.End.X, line.Start.Y); - public static void Create(in QBezier bezier, out Frame a, out Frame b) + public static void Create(in Bezier bezier, out Frame a, out Frame b) { a = new Frame(bezier.Start.X, bezier.Start.Y, bezier.End.X, bezier.End.Y); b = new Frame(bezier.ControlA.X, bezier.ControlA.Y, bezier.ControlB.X, bezier.ControlB.Y); } - public static void Create(in QEllipse ellipse, out Frame a, out Frame b) + public static void Create(in Ellipse ellipse, out Frame a, out Frame b) { a = new Frame(ellipse.Center.X, ellipse.Center.Y); b = new Frame(ellipse.AxisA.X, ellipse.AxisA.Y, ellipse.AxisB.X, ellipse.AxisB.Y); diff --git a/Dashboard/ImmediateDraw/Image.cs b/Dashboard/ImmediateDraw/Image.cs index 8d07269..50df761 100644 --- a/Dashboard/ImmediateDraw/Image.cs +++ b/Dashboard/ImmediateDraw/Image.cs @@ -11,8 +11,8 @@ namespace Dashboard.ImmediateDraw public struct Image3DCall { - public QRectangle Rectangle; - public QRectangle UVs; + public Rectangle Rectangle; + public Rectangle UVs; public int Layer; } } \ No newline at end of file diff --git a/Dashboard/Media/Font/FontAtlas.cs b/Dashboard/Media/Font/FontAtlas.cs index 17c4b20..a159782 100644 --- a/Dashboard/Media/Font/FontAtlas.cs +++ b/Dashboard/Media/Font/FontAtlas.cs @@ -9,7 +9,7 @@ namespace Dashboard.Media.Font { public int Codepoint; public QImage Image; - public QRectangle UVs; + public Rectangle UVs; } public class FontAtlas @@ -136,7 +136,7 @@ namespace Dashboard.Media.Font Vector2 size = new Vector2((float)src.Width/Image.Width, (float)src.Height/Image.Height); prototype.Image = Image; - prototype.UVs = new QRectangle(min + size, min); + prototype.UVs = new Rectangle(min + size, min); AdvanceColumn(src.Width, src.Height); } diff --git a/Dashboard/Media/QFont.cs b/Dashboard/Media/QFont.cs index ef67cd9..7087bcf 100644 --- a/Dashboard/Media/QFont.cs +++ b/Dashboard/Media/QFont.cs @@ -104,9 +104,9 @@ namespace Dashboard.Media public readonly int CodePoint; public readonly QImage? Image; public readonly QGlyphMetrics Metrics; - public readonly QRectangle UVs; + public readonly Rectangle UVs; - public FontGlyph(int codepoint, QImage? image, in QGlyphMetrics metrics, in QRectangle uvs) + public FontGlyph(int codepoint, QImage? image, in QGlyphMetrics metrics, in Rectangle uvs) { CodePoint = codepoint; Image = image; diff --git a/Dashboard/OpenGL/GL21Driver.cs b/Dashboard/OpenGL/GL21Driver.cs index 001f7ad..713d28d 100644 --- a/Dashboard/OpenGL/GL21Driver.cs +++ b/Dashboard/OpenGL/GL21Driver.cs @@ -87,7 +87,7 @@ namespace Dashboard.OpenGL if (!IsInit) throw new InvalidOperationException("Initialize the driver first."); } - public void Draw(DrawCallQueue queue, in QRectangle view) + public void Draw(DrawCallQueue queue, in Rectangle view) { AssertInit(); diff --git a/Dashboard/PAL/Dash.cs b/Dashboard/PAL/Dash.cs index 6df5a58..9411919 100644 --- a/Dashboard/PAL/Dash.cs +++ b/Dashboard/PAL/Dash.cs @@ -1,11 +1,7 @@ -using OpenTK.Mathematics; -using Dashboard.ImmediateDraw; +using Dashboard.ImmediateDraw; using Dashboard.Controls; +using OpenTK.Mathematics; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Dashboard.PAL { @@ -15,7 +11,7 @@ namespace Dashboard.PAL public class Dash { private readonly IDashHandle handle; - private readonly IDashboardPlatform platform; + private readonly IDbPlatform platform; public string Title { @@ -51,7 +47,7 @@ namespace Dashboard.PAL } } - public Dash(IDashboardPlatform platform) + public Dash(IDbPlatform platform) { this.platform = platform; handle = platform.CreatePort(); @@ -79,7 +75,7 @@ namespace Dashboard.PAL list ??= new DrawList(); list.Clear(); - UIElement.Bounds = new QRectangle(Size, new Vector2(0,0)); + UIElement.Bounds = new Rectangle(Size, new Vector2(0,0)); UIElement.Paint(list); platform.PortPaint(handle, list); } diff --git a/Dashboard/PAL/IDashboardPlatform.cs b/Dashboard/PAL/IDbPlatform.cs similarity index 97% rename from Dashboard/PAL/IDashboardPlatform.cs rename to Dashboard/PAL/IDbPlatform.cs index 117f44d..9a8a561 100644 --- a/Dashboard/PAL/IDashboardPlatform.cs +++ b/Dashboard/PAL/IDbPlatform.cs @@ -15,7 +15,7 @@ namespace Dashboard.PAL /// /// The primary primary platform abstraction interface for dashboard hosts. /// - public interface IDashboardPlatform : IDisposable + public interface IDbPlatform : IDisposable { /// /// The title of the application. diff --git a/Dashboard/Style.cs b/Dashboard/Style.cs index a88fbc0..d040f8f 100644 --- a/Dashboard/Style.cs +++ b/Dashboard/Style.cs @@ -209,7 +209,7 @@ namespace Dashboard /// /// A line stipple pattern. /// - public struct QuikStipplePattern + public struct StipplePattern { /// /// The stipple pitch value. @@ -221,19 +221,19 @@ namespace Dashboard /// public float DutyCycle; - public QuikStipplePattern(float pitch, float dutyCycle) + public StipplePattern(float pitch, float dutyCycle) { Pitch = pitch; DutyCycle = dutyCycle; } - public static QuikStipplePattern None => new QuikStipplePattern(0.0f, 1.0f); + public static StipplePattern None => new StipplePattern(0.0f, 1.0f); } /// /// Stroke style for lines and borders. /// - public class QuikStrokeStyle + public class StrokeStyle { /// /// Stroke color. @@ -250,11 +250,11 @@ namespace Dashboard // /// // public QuikStipplePattern StipplePattern { get; set; } - public QuikStrokeStyle() + public StrokeStyle() { } - public QuikStrokeStyle(Color4 color, float width /*, QuikStipplePattern pattern*/) + public StrokeStyle(Color4 color, float width /*, QuikStipplePattern pattern*/) { Color = color; Width = width; @@ -269,7 +269,7 @@ namespace Dashboard /// /// Fill style for rectangles and the like. /// - public class QuikFillStyle + public class FillStyle { public Color4 Color { get; set; } } diff --git a/Dashboard/Typography/TextLayout.cs b/Dashboard/Typography/TextLayout.cs index ec1d535..b8eef58 100644 --- a/Dashboard/Typography/TextLayout.cs +++ b/Dashboard/Typography/TextLayout.cs @@ -227,7 +227,7 @@ namespace Dashboard.Typography pen.Y -= PostSpace; - group.BoundingBox = new QRectangle(width, pen.Y, 0, 0); + group.BoundingBox = new Rectangle(width, pen.Y, 0, 0); group.Translate(-pen); } @@ -355,14 +355,14 @@ namespace Dashboard.Typography { public int Character; public QImage Texture; - public QRectangle Position; - public QRectangle UV; + public Rectangle Position; + public Rectangle UV; public TypesetCharacter( int chr, QImage texture, - in QRectangle position, - in QRectangle uv) + in Rectangle position, + in Rectangle uv) { Character = chr; Texture = texture; @@ -376,7 +376,7 @@ namespace Dashboard.Typography private int _count = 0; private TypesetCharacter[] _array = Array.Empty(); - public QRectangle BoundingBox; + public Rectangle BoundingBox; public int Count => _count; diff --git a/Dashboard/Typography/Typesetter.cs b/Dashboard/Typography/Typesetter.cs index 007f8ca..f6b862c 100644 --- a/Dashboard/Typography/Typesetter.cs +++ b/Dashboard/Typography/Typesetter.cs @@ -148,11 +148,11 @@ namespace Dashboard.Typography { info = new FontDrawInfo(); info.Image = image; - info.rectangles = new List(); + info.rectangles = new List(); drawInfo[image] = info; } - QRectangle dest = new QRectangle( + Rectangle dest = new Rectangle( pen + new Vector2(metrics.HorizontalBearing.X + metrics.Size.X, metrics.Size.Y - metrics.HorizontalBearing.Y), pen + new Vector2(metrics.HorizontalBearing.X, -metrics.HorizontalBearing.Y)); @@ -176,7 +176,7 @@ namespace Dashboard.Typography private struct FontDrawInfo { public QImage Image; - public List rectangles; + public List rectangles; } } } diff --git a/Dashboard/VertexGenerator/DrawQueue.cs b/Dashboard/VertexGenerator/DrawCallQueue.cs similarity index 84% rename from Dashboard/VertexGenerator/DrawQueue.cs rename to Dashboard/VertexGenerator/DrawCallQueue.cs index d73f13c..6cbb319 100644 --- a/Dashboard/VertexGenerator/DrawQueue.cs +++ b/Dashboard/VertexGenerator/DrawCallQueue.cs @@ -13,7 +13,7 @@ namespace Dashboard.VertexGenerator private readonly List _drawCalls = new List(); private int _start; private int _baseOffset; - private QRectangle _bounds; + private Rectangle _bounds; private QImage? _texture; public int ZDepth { get; private set; } @@ -33,7 +33,7 @@ namespace Dashboard.VertexGenerator } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void StartDrawCall(in QRectangle bounds, QImage? texture, int baseOffset) + public void StartDrawCall(in Rectangle bounds, QImage? texture, int baseOffset) { _start = ElementCount; _texture = texture; @@ -42,13 +42,13 @@ namespace Dashboard.VertexGenerator } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void StartDrawCall(in QRectangle bounds) => StartDrawCall(bounds, null, _vertices.Count); + public void StartDrawCall(in Rectangle bounds) => StartDrawCall(bounds, null, _vertices.Count); [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void StartDrawCall(in QRectangle bounds, int baseOffset) => StartDrawCall(bounds, null, baseOffset); + public void StartDrawCall(in Rectangle bounds, int baseOffset) => StartDrawCall(bounds, null, baseOffset); [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void StartDrawCall(in QRectangle bounds, QImage texture) => StartDrawCall(bounds, texture, _vertices.Count); + public void StartDrawCall(in Rectangle bounds, QImage texture) => StartDrawCall(bounds, texture, _vertices.Count); [MethodImpl(MethodImplOptions.AggressiveInlining)] public void AddVertex(in DbVertex vertex) @@ -99,10 +99,10 @@ namespace Dashboard.VertexGenerator { public int Start { get; } public int Count { get; } - public QRectangle Bounds { get; } + public Rectangle Bounds { get; } public QImage? Texture { get; } - public DrawCall(int start, int count, in QRectangle bounds, QImage? texture) + public DrawCall(int start, int count, in Rectangle bounds, QImage? texture) { Start = start; Count = count; diff --git a/Dashboard/VertexGenerator/VertexDrawingEngine.cs b/Dashboard/VertexGenerator/VertexDrawingEngine.cs index 46eaa4a..50419f2 100644 --- a/Dashboard/VertexGenerator/VertexDrawingEngine.cs +++ b/Dashboard/VertexGenerator/VertexDrawingEngine.cs @@ -66,7 +66,7 @@ namespace Dashboard.VertexGenerator return (int) Math.Ceiling(arc * radius * CurveGranularity); } - private readonly List LineList = new List(); + private readonly List LineList = new List(); private void LineProc(DrawQueue queue) { Frame frame = queue.Dequeue(); @@ -79,12 +79,12 @@ namespace Dashboard.VertexGenerator for (int i = 0; i < count; i++) { frame = queue.Dequeue(); - LineList.Add((QLine)frame); + LineList.Add((Line)frame); } } else { - LineList.Add((QLine)frame); + LineList.Add((Line)frame); } float width = Style.StrokeWidth ?? 1; @@ -93,7 +93,7 @@ namespace Dashboard.VertexGenerator LineInfo prevBase, nextBase = default; for (int i = 0; i < LineList.Count; i++) { - QLine line = LineList[i]; + Line line = LineList[i]; // A line segment needs a start cap if it is the first segment in // the list, or the last end point is not the current start point. bool isStart = (i == 0 || line.Start != LineList[i - 1].End); @@ -124,7 +124,7 @@ namespace Dashboard.VertexGenerator DrawQueue.EndDrawCall(); } - private LineInfo GenerateLineSegment(in QLine line) + private LineInfo GenerateLineSegment(in Line line) { DbVertex vertex = StrokeVertex; DbVertex a, b, c, d; @@ -291,7 +291,7 @@ namespace Dashboard.VertexGenerator } } - private readonly List BezierList = new List(); + private readonly List BezierList = new List(); private void BezierProc(DrawQueue queue) { Frame a = queue.Dequeue(); @@ -308,7 +308,7 @@ namespace Dashboard.VertexGenerator b = queue.Dequeue(); BezierList.Add( - new QBezier( + new Bezier( new Vector2(a.GetF(0), a.GetF(1)), new Vector2(b.GetF(0), b.GetF(1)), new Vector2(b.GetF(2), b.GetF(3)), @@ -322,7 +322,7 @@ namespace Dashboard.VertexGenerator b = queue.Dequeue(); BezierList.Add( - new QBezier( + new Bezier( new Vector2(a.GetF(0), a.GetF(1)), new Vector2(b.GetF(0), b.GetF(1)), new Vector2(b.GetF(2), b.GetF(3)), @@ -337,7 +337,7 @@ namespace Dashboard.VertexGenerator LineInfo prevBase, nextBase = default; for (int i = 0; i < LineList.Count; i++) { - QBezier bezier = BezierList[i]; + Bezier bezier = BezierList[i]; // A line segment needs a start cap if it is the first segment in // the list, or the last end point is not the current start point. bool isStart = (i == 0 || bezier.Start != BezierList[i - 1].End); @@ -368,7 +368,7 @@ namespace Dashboard.VertexGenerator DrawQueue.EndDrawCall(); } - private LineInfo GenerateBezierSegment(in QBezier bezier) + private LineInfo GenerateBezierSegment(in Bezier bezier) { Vector2 startTangent = bezier.GetBezierTangent(0); Vector2 endTangent = bezier.GetBezierTangent(1); @@ -408,7 +408,7 @@ namespace Dashboard.VertexGenerator return new LineInfo(vbase, 0, 1, index - 2, index - 1); } - private readonly List RectangleList = new List(); + private readonly List RectangleList = new List(); private void RectangleProc(DrawQueue queue) { Frame frame = queue.Dequeue(); @@ -419,12 +419,12 @@ namespace Dashboard.VertexGenerator for (int i = 0; i < count; i++) { frame = queue.Dequeue(); - RectangleList.Add((QRectangle)frame); + RectangleList.Add((Rectangle)frame); } } else { - RectangleList.Add((QRectangle)frame); + RectangleList.Add((Rectangle)frame); } float stroke = Style.StrokeWidth ?? 1.0f; @@ -432,8 +432,8 @@ namespace Dashboard.VertexGenerator DrawQueue.StartDrawCall(Viewport); for (int i = 0; i < RectangleList.Count; i++) { - QRectangle outer = RectangleList[i]; - QRectangle inner = new QRectangle( + Rectangle outer = RectangleList[i]; + Rectangle inner = new Rectangle( outer.Right - stroke, outer.Bottom - stroke, outer.Left + stroke, outer.Top + stroke); @@ -457,7 +457,7 @@ namespace Dashboard.VertexGenerator DrawQueue.EndDrawCall(); } - private void GenerateRectangleBase(in QRectangle rectangle, float radius) + private void GenerateRectangleBase(in Rectangle rectangle, float radius) { /* +--j-------i--+ @@ -599,7 +599,7 @@ namespace Dashboard.VertexGenerator DrawQueue.AddElement(1); DrawQueue.AddElement(previous); DrawQueue.AddElement(6); } - private void GenerateRectangleStripStraight(in QRectangle rectangle) + private void GenerateRectangleStripStraight(in Rectangle rectangle) { /* h---------g @@ -649,7 +649,7 @@ namespace Dashboard.VertexGenerator DrawQueue.AddElement(4); DrawQueue.AddElement(3); DrawQueue.AddElement(7); // SWW } - private void GenerateRectangleStripNarrow(in QRectangle rectangle, float radius) + private void GenerateRectangleStripNarrow(in Rectangle rectangle, float radius) { /* v-j---i-u @@ -843,7 +843,7 @@ namespace Dashboard.VertexGenerator DrawQueue.AddElement(16); DrawQueue.AddElement(previous); DrawQueue.AddElement(17); } - private void GenerateRectangleStripWide(in QRectangle rectangle, float radius) + private void GenerateRectangleStripWide(in Rectangle rectangle, float radius) { /* l---k @@ -1035,16 +1035,16 @@ namespace Dashboard.VertexGenerator for (int i = 0; i < count; i++) { - QRectangle rect = (QRectangle)queue.Dequeue(); - QRectangle uvs; + Rectangle rect = (Rectangle)queue.Dequeue(); + Rectangle uvs; if (uv) { - uvs = (QRectangle)queue.Dequeue(); + uvs = (Rectangle)queue.Dequeue(); } else { - uvs = new QRectangle(1, 1, 0, 0); + uvs = new Rectangle(1, 1, 0, 0); } DrawQueue.RestoreOffset(); @@ -1079,8 +1079,8 @@ namespace Dashboard.VertexGenerator for (int i = 0; i < count; i++) { - QRectangle rect = (QRectangle)queue.Dequeue(); - QRectangle uvs = (QRectangle)queue.Dequeue(); + Rectangle rect = (Rectangle)queue.Dequeue(); + Rectangle uvs = (Rectangle)queue.Dequeue(); int layer = (int)queue.Dequeue(); DrawQueue.RestoreOffset(); diff --git a/tests/Dashboard.Demo/Program.cs b/tests/Dashboard.Demo/Program.cs index 538900e..e35f45a 100644 --- a/tests/Dashboard.Demo/Program.cs +++ b/tests/Dashboard.Demo/Program.cs @@ -43,7 +43,7 @@ namespace Dashboard.Demo } cmd.PutBlurgText(dblurg, result!, new Vector2(300, 300)); - cmd.Rectangle(new QRectangle(16, 16, 0, 0)); + cmd.Rectangle(new Rectangle(16, 16, 0, 0)); // Label.Paint(cmd); } }