Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Avoid duplicate types between Maui and Maui Graphics #233

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,448 changes: 43 additions & 20,405 deletions samples/GraphicsTester.Android/Resources/Resource.designer.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion samples/GraphicsTester.Portable/Scenarios/DimensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override void Draw(ICanvas canvas)

canvas.FontColor = Colors.Black;
canvas.FontSize = 16f;
canvas.DrawString($"{Width}x{Height}", Width / 2, 50, HorizontalAlignment.Center);
canvas.DrawString($"{Width}x{Height}", Width / 2, 50, TextAlignment.Center);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ public override void Draw(ICanvas canvas)
canvas.FontSize = 12f;

canvas.Translate(0, 10);
canvas.DrawString("Arial - Left", 100, 10, HorizontalAlignment.Left);
canvas.DrawString("Arial - Left", 100, 10, TextAlignment.Start);
canvas.FillCircle(100, 10, 2);

canvas.Translate(0, 30);
canvas.DrawString("Arial - Center", 100, 10, HorizontalAlignment.Center);
canvas.DrawString("Arial - Center", 100, 10, TextAlignment.Center);
canvas.FillCircle(100, 10, 2);

canvas.Translate(0, 30);
canvas.DrawString("Arial - Right", 100, 10, HorizontalAlignment.Right);
canvas.DrawString("Arial - Right", 100, 10, TextAlignment.End);
canvas.FillCircle(100, 10, 2);

canvas.SetToSystemFont();

canvas.Translate(0, 30);
canvas.DrawString("System - Left", 100, 10, HorizontalAlignment.Left);
canvas.DrawString("System - Left", 100, 10, TextAlignment.Start);
canvas.FillCircle(100, 10, 2);

canvas.Translate(0, 30);
canvas.DrawString("System - Center", 100, 10, HorizontalAlignment.Center);
canvas.DrawString("System - Center", 100, 10, TextAlignment.Center);
canvas.FillCircle(100, 10, 2);

canvas.Translate(0, 30);
canvas.DrawString("System - Right", 100, 10, HorizontalAlignment.Right);
canvas.DrawString("System - Right", 100, 10, TextAlignment.End);
canvas.FillCircle(100, 10, 2);

canvas.RestoreState();
Expand Down
8 changes: 4 additions & 4 deletions samples/GraphicsTester.Portable/Scenarios/DrawLines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ private static void DrawLinesWithLineCaps(ICanvas canvas)
canvas.StrokeColor = Colors.Black;
canvas.StrokeSize = 20;
canvas.StrokeDashPattern = null;
canvas.StrokeLineCap = LineCap.Butt;
canvas.StrokeLineCap = PenLineCap.Flat;
canvas.DrawLine(50, 250, 200, 250);
canvas.StrokeLineCap = LineCap.Round;
canvas.StrokeLineCap = PenLineCap.Round;
canvas.DrawLine(50, 300, 200, 300);
canvas.StrokeLineCap = LineCap.Square;
canvas.StrokeLineCap = PenLineCap.Square;
canvas.DrawLine(50, 350, 200, 350);

canvas.StrokeColor = Colors.Blue;
canvas.StrokeSize = 1;
canvas.StrokeLineCap = LineCap.Butt;
canvas.StrokeLineCap = PenLineCap.Flat;
canvas.DrawLine(50, 250, 200, 250);
canvas.DrawLine(50, 300, 200, 300);
canvas.DrawLine(50, 350, 200, 350);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public override void Draw(ICanvas canvas)

canvas.DrawRectangle(dx, dy, 190, 140);

var horizontalAlignment = (HorizontalAlignment) x;
var verticalAlignment = (VerticalAlignment) y;
var horizontalAlignment = (TextAlignment) x;
var verticalAlignment = (TextAlignment) y;

canvas.DrawString(textLong, dx, dy, 190, 140, horizontalAlignment, verticalAlignment);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public override void Draw(ICanvas canvas)

canvas.DrawRectangle(dx, dy, 190, 140);

var verticalAlignment = (VerticalAlignment) y;
var verticalAlignment = (TextAlignment) y;

canvas.DrawString(
longText,
dx,
dy,
190,
140,
HorizontalAlignment.Left,
TextAlignment.Start,
verticalAlignment,
TextFlow.OverflowBounds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public override void Draw(ICanvas canvas)

canvas.DrawRectangle(dx, dy, 190, 140);

var verticalAlignment = (VerticalAlignment) y;
var verticalAlignment = (TextAlignment) y;

canvas.DrawString(
longText,
dx,
dy,
190,
140,
HorizontalAlignment.Left,
TextAlignment.Start,
verticalAlignment,
TextFlow.ClipBounds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public override void Draw(ICanvas canvas)

canvas.DrawRectangle(dx, dy, 190, 140);

var horizontalAlignment = (HorizontalAlignment) x;
var verticalAlignment = (VerticalAlignment) y;
var horizontalAlignment = (TextAlignment) x;
var verticalAlignment = (TextAlignment) y;

canvas.DrawString(textShort, dx, dy, 190, 140, horizontalAlignment, verticalAlignment);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public override void Draw(ICanvas canvas)

canvas.DrawRectangle(dx, dy, 190, 140);

var horizontalAlignment = (HorizontalAlignment) x;
var verticalAlignment = (VerticalAlignment) y;
var horizontalAlignment = (TextAlignment) x;
var verticalAlignment = (TextAlignment) y;

canvas.DrawString(textShort, dx, dy, 190, 140, horizontalAlignment, verticalAlignment);
}
Expand Down
14 changes: 7 additions & 7 deletions samples/GraphicsTester.Portable/Scenarios/DrawTextAtPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ public override void Draw(ICanvas canvas)
canvas.FontSize = 12f;

canvas.DrawLine(50, 50, 250, 50);
canvas.DrawString("Red - Align Left", 50, 50, HorizontalAlignment.Left);
canvas.DrawString("Red - Align Start", 50, 50, TextAlignment.Start);

canvas.DrawLine(50, 100, 250, 100);
canvas.DrawString("Red - Align Center", 150, 100, HorizontalAlignment.Center);
canvas.DrawString("Red - Align Center", 150, 100, TextAlignment.Center);

canvas.DrawLine(50, 150, 250, 150);
canvas.DrawString("Red - Align Right", 250, 150, HorizontalAlignment.Right);
canvas.DrawString("Red - Align End", 250, 150, TextAlignment.End);

canvas.SaveState();
canvas.SetShadow(CanvasDefaults.DefaultShadowOffset, CanvasDefaults.DefaultShadowBlur, CanvasDefaults.DefaultShadowColor);
canvas.DrawString("Red - Shadowed", 50, 200, HorizontalAlignment.Left);
canvas.DrawString("Red - Shadowed", 50, 200, TextAlignment.Start);
canvas.RestoreState();

var blurrableCanvas = canvas as IBlurrableCanvas;
if (blurrableCanvas != null)
{
canvas.SaveState();
blurrableCanvas.SetBlur(CanvasDefaults.DefaultShadowBlur);
canvas.DrawString("Red - Shadowed", 50, 250, HorizontalAlignment.Left);
canvas.DrawString("Red - Shadowed", 50, 250, TextAlignment.Start);
canvas.RestoreState();
}

canvas.SaveState();
canvas.SetToBoldSystemFont();
canvas.DrawString("Bold System Font", 50, 350, HorizontalAlignment.Left);
canvas.DrawString("Bold System Font", 50, 350, TextAlignment.Start);
canvas.SetToSystemFont();
canvas.DrawString("System Font", 50, 400, HorizontalAlignment.Left);
canvas.DrawString("System Font", 50, 400, TextAlignment.Start);
canvas.RestoreState();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ public override void Draw(ICanvas canvas)
canvas.FontSize = 12f;

canvas.DrawLine(50, 50, 250, 50);
canvas.DrawString("Red - Align Left", 50, 50, HorizontalAlignment.Left);
canvas.DrawString("Red - Align Start", 50, 50, TextAlignment.Start);

canvas.DrawLine(50, 100, 250, 100);
canvas.DrawString("Red - Align Center", 150, 100, HorizontalAlignment.Center);
canvas.DrawString("Red - Align Center", 150, 100, TextAlignment.Center);

canvas.DrawLine(50, 150, 250, 150);
canvas.DrawString("Red - Align Right", 250, 150, HorizontalAlignment.Right);
canvas.DrawString("Red - Align End", 250, 150, TextAlignment.End);

canvas.SaveState();
canvas.SetShadow(CanvasDefaults.DefaultShadowOffset, CanvasDefaults.DefaultShadowBlur, CanvasDefaults.DefaultShadowColor);
canvas.DrawString("Red - Shadowed", 50, 200, HorizontalAlignment.Left);
canvas.DrawString("Red - Shadowed", 50, 200, TextAlignment.Start);
canvas.RestoreState();

var blurrableCanvas = canvas as IBlurrableCanvas;
if (blurrableCanvas != null)
{
canvas.SaveState();
blurrableCanvas.SetBlur(CanvasDefaults.DefaultShadowBlur);
canvas.DrawString("Red - Shadowed", 50, 250, HorizontalAlignment.Left);
canvas.DrawString("Red - Shadowed", 50, 250, TextAlignment.Start);
canvas.RestoreState();
}

canvas.SaveState();
canvas.SetToBoldSystemFont();
canvas.DrawString("Bold System Font", 50, 350, HorizontalAlignment.Left);
canvas.DrawString("Bold System Font", 50, 350, TextAlignment.Start);
canvas.SetToSystemFont();
canvas.DrawString("System Font", 50, 400, HorizontalAlignment.Left);
canvas.DrawString("System Font", 50, 400, TextAlignment.Start);
canvas.RestoreState();

canvas.RestoreState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ public override void Draw(ICanvas canvas)
var rectHeight = 20;
canvas.Translate(0, 10);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 1", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Really Short 1", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 2", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Really Short 2", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 3", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Really Short 3", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 4", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Really Short 4", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

canvas.RestoreState();
Expand All @@ -50,25 +50,25 @@ public override void Draw(ICanvas canvas)
rectHeight = 20;
canvas.Translate(0, 10);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 1", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Really Short 1", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 2", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Really Short 2", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 3", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Really Short 3", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 4", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Really Short 4", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

canvas.RestoreState();
Expand All @@ -79,25 +79,25 @@ public override void Draw(ICanvas canvas)
rectHeight = 20;
canvas.Translate(0, 10);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 1", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Really Short 1", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 2", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Really Short 2", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 3", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Really Short 3", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Really Short 4", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Really Short 4", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

canvas.RestoreState();
Expand All @@ -109,25 +109,25 @@ public override void Draw(ICanvas canvas)
rectHeight = 20;
canvas.Translate(0, 10);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 1", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Sys Font R 1", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 2", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Sys Font R 2", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 3", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Sys Font R 3", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 4", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Center);
canvas.DrawString("Sys Font R 4", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Center);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

canvas.RestoreState();
Expand All @@ -139,25 +139,25 @@ public override void Draw(ICanvas canvas)
rectHeight = 20;
canvas.Translate(0, 10);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 1", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Sys Font R 1", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 2", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Sys Font R 2", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 3", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Sys Font R 3", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 4", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Top);
canvas.DrawString("Sys Font R 4", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.Start);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

canvas.RestoreState();
Expand All @@ -169,25 +169,25 @@ public override void Draw(ICanvas canvas)
rectHeight = 20;
canvas.Translate(0, 10);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 1", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Sys Font R 1", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 2", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Sys Font R 2", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 3", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Sys Font R 3", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

rectHeight -= 2;
canvas.Translate(0, 30);
canvas.DrawRectangle(10, 0, 100, rectHeight);
canvas.DrawString("Sys Font R 4", 10, 0, 100, rectHeight, HorizontalAlignment.Center, VerticalAlignment.Bottom);
canvas.DrawString("Sys Font R 4", 10, 0, 100, rectHeight, TextAlignment.Center, TextAlignment.End);
canvas.DrawLine(10, rectHeight / 2, 100, rectHeight / 2);

canvas.RestoreState();
Expand Down
Loading