Renamed Rectangle to Rect and RectangleF to RectF

This commit is contained in:
Javier Suárez Ruiz 2022-02-18 10:34:22 +01:00
Родитель c15cc9cf97
Коммит 1724f57574
85 изменённых файлов: 448 добавлений и 405 удалений

Просмотреть файл

@ -64,7 +64,7 @@ namespace GraphicsTester.Scenarios
// Do nothing by default
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
Draw(canvas);
}

Просмотреть файл

@ -110,7 +110,7 @@ namespace GraphicsTester.Scenarios
{
canvas.StrokeColor = Colors.Blue;
canvas.StrokeSize = 1;
RectangleF rect = new RectangleF(275, 400, 100, 100);
RectF rect = new RectF(275, 400, 100, 100);
canvas.DrawRoundedRectangle(rect, xRadius: 20, yRadius: 40);
}
@ -120,7 +120,7 @@ namespace GraphicsTester.Scenarios
canvas.StrokeSize = .5f;
canvas.StrokeColor = Colors.Magenta;
RectangleF rect = new RectangleF(50, 740, circleRadius * 4, circleRadius * 4);
RectF rect = new RectF(50, 740, circleRadius * 4, circleRadius * 4);
canvas.DrawRoundedRectangle(rect, xRadius: circleRadius, yRadius: circleRadius);
PointF[] circleCenters =

Просмотреть файл

@ -63,7 +63,7 @@ namespace GraphicsTester.Scenarios
private void FillRoundedWithDifferentXYRadius(ICanvas canvas)
{
RectangleF rect = new RectangleF(275, 400, 100, 100);
RectF rect = new RectF(275, 400, 100, 100);
canvas.FillRoundedRectangle(rect, xRadius: 20, yRadius: 40);
}
}

Просмотреть файл

@ -22,7 +22,7 @@ namespace GraphicsTester.Scenarios
if (image != null)
{
canvas.SetFillPaint(image.AsPaint(), RectangleF.Zero);
canvas.SetFillPaint(image.AsPaint(), RectF.Zero);
canvas.FillRectangle(50, 50, 500, 500);
}
}

Просмотреть файл

@ -25,7 +25,7 @@ namespace GraphicsTester.Scenarios
pattern = AddPictureAsPattern(picture.Picture, 12, 12);
}
canvas.SetFillPaint(pattern.AsPaint(), RectangleF.Zero);
canvas.SetFillPaint(pattern.AsPaint(), RectF.Zero);
canvas.FillRectangle(50, 50, 500, 500);
canvas.RestoreState();

Просмотреть файл

@ -21,14 +21,14 @@ namespace GraphicsTester.Scenarios
radialGradientPaint.Center = new Point(0.5, 0.5);
radialGradientPaint.Radius = 0.5;
var ellipseRect1 = new RectangleF(100, 100, 200, 200);
var ellipseRect1 = new RectF(100, 100, 200, 200);
canvas.SetFillPaint(radialGradientPaint, ellipseRect1);
canvas.FillEllipse(ellipseRect1);
radialGradientPaint.Center = new Point(0.6, 0.7);
radialGradientPaint.Radius = 0.5;
var ellipseRect2 = new RectangleF(100, 400, 200, 200);
var ellipseRect2 = new RectF(100, 400, 200, 200);
canvas.SetFillPaint(radialGradientPaint, ellipseRect2);
canvas.FillEllipse(ellipseRect2);

Просмотреть файл

@ -167,14 +167,14 @@ namespace GraphicsTester.Scenarios
linearGradientPaint.StartPoint = new Point(0.1, 0.1);
linearGradientPaint.EndPoint = new Point(0.9, 0.9);
var linearRectangleRectangle = new RectangleF(50, 700, 100, 50);
var linearRectangleRectangle = new RectF(50, 700, 100, 50);
canvas.SetFillPaint(linearGradientPaint, linearRectangleRectangle);
canvas.FillRectangle(linearRectangleRectangle);
linearGradientPaint.StartPoint = new Point(0.1, 0.1);
linearGradientPaint.EndPoint = new Point(0.9, 0.9);
var linearEllipseRectangle = new RectangleF(200, 700, 100, 50);
var linearEllipseRectangle = new RectF(200, 700, 100, 50);
canvas.SetFillPaint(linearGradientPaint, linearEllipseRectangle);
canvas.FillEllipse(linearEllipseRectangle);
@ -182,7 +182,7 @@ namespace GraphicsTester.Scenarios
linearGradientPaint.StartPoint = new Point(0.1, 0.1);
linearGradientPaint.EndPoint = new Point(0.9, 0.9);
var linearRoundedRectangleRectangle = new RectangleF(350, 700, 100, 50);
var linearRoundedRectangleRectangle = new RectF(350, 700, 100, 50);
canvas.SetFillPaint(linearGradientPaint, linearRoundedRectangleRectangle);
canvas.FillRoundedRectangle(linearRoundedRectangleRectangle, 25);
@ -195,7 +195,7 @@ namespace GraphicsTester.Scenarios
linearGradientPaint.StartPoint = new Point(0.1, 0.1);
linearGradientPaint.EndPoint = new Point(0.9, 0.9);
var linearPathRectangle = new RectangleF(500, 700, 200, 50);
var linearPathRectangle = new RectF(500, 700, 200, 50);
canvas.SetFillPaint(linearGradientPaint, linearPathRectangle);
canvas.FillPath(path);
@ -212,14 +212,14 @@ namespace GraphicsTester.Scenarios
radialGradientPaint.Center = new Point(0.5, 0.5);
radialGradientPaint.Radius = 0.5;
var radialRectangleRectangle = new RectangleF(50, 800, 100, 50);
var radialRectangleRectangle = new RectF(50, 800, 100, 50);
canvas.SetFillPaint(radialGradientPaint, radialRectangleRectangle);
canvas.FillRectangle(radialRectangleRectangle);
radialGradientPaint.Center = new Point(0.5, 0.5);
radialGradientPaint.Radius = 0.5;
var radialEllipseRectangle = new RectangleF(200, 800, 100, 50);
var radialEllipseRectangle = new RectF(200, 800, 100, 50);
canvas.SetFillPaint(radialGradientPaint, radialEllipseRectangle);
canvas.FillEllipse(radialEllipseRectangle);
@ -227,7 +227,7 @@ namespace GraphicsTester.Scenarios
radialGradientPaint.Center = new Point(0.5, 0.5);
radialGradientPaint.Radius = 0.5;
var radialRoundedRectangleRectangle = new RectangleF(350, 800, 100, 50);
var radialRoundedRectangleRectangle = new RectF(350, 800, 100, 50);
canvas.SetFillPaint(radialGradientPaint, radialRoundedRectangleRectangle);
canvas.FillRoundedRectangle(radialRoundedRectangleRectangle, 25);
@ -240,7 +240,7 @@ namespace GraphicsTester.Scenarios
radialGradientPaint.Center = new Point(0.5, 0.5);
radialGradientPaint.Radius = 0.5;
var radialPathRectangle = new RectangleF(550, 800, 200, 50);
var radialPathRectangle = new RectF(550, 800, 200, 50);
canvas.SetFillPaint(radialGradientPaint, radialPathRectangle);
canvas.FillPath(path);

Просмотреть файл

@ -47,7 +47,7 @@ namespace GraphicsTester.Xaml
{
using (canvas.CreateSession())
{
drawable.Draw(canvas, new RectangleF(0, 0, (float) Canvas.Width, (float) Canvas.Height));
drawable.Draw(canvas, new RectF(0, 0, (float) Canvas.Width, (float) Canvas.Height));
}
}
}

Просмотреть файл

@ -9,7 +9,7 @@ namespace Microsoft.Maui.Graphics.Blazor
public class BlazorCanvas : AbstractCanvas<BlazorCanvasState>
{
private readonly float[] _matrix = new float[6];
private RectangleF _bounds;
private RectF _bounds;
private CanvasRenderingContext2D _context;
public BlazorCanvas() : base(CreateNewState, CreateStateCopy)
@ -47,7 +47,7 @@ namespace Microsoft.Maui.Graphics.Blazor
public void ClearRect(float x1, float y1, float width, float height)
{
_context.ClearRect(x1, y1, width, height);
_bounds = new RectangleF(x1, y1, width, height);
_bounds = new RectF(x1, y1, width, height);
}
protected override float PlatformStrokeSize { set => CurrentState.LineWidth = value; }
@ -201,7 +201,7 @@ namespace Microsoft.Maui.Graphics.Blazor
_context.GlobalAlpha = alpha;
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint is SolidPaint solidPaint)
{
@ -352,7 +352,7 @@ namespace Microsoft.Maui.Graphics.Blazor
{
var finalCornerRadius = cornerRadius;
var rect = new RectangleF(x, y, width, height);
var rect = new RectF(x, y, width, height);
if (finalCornerRadius > rect.Width)
{

Просмотреть файл

@ -18,7 +18,7 @@ namespace Microsoft.Maui.Graphics.Blazor
private bool _fillDirty = true;
private Color _fillColor = Colors.White;
private Paint _fillPaint = null;
private RectangleF _fillRectangle;
private RectF _fillRectangle;
private bool _textDirty = true;
private Color _textColor = Colors.Black;
@ -261,7 +261,7 @@ namespace Microsoft.Maui.Graphics.Blazor
_textDirty = true;
}
internal void SetFillPaint(Paint paint, RectangleF rectangle)
internal void SetFillPaint(Paint paint, RectF rectangle)
{
_fillColor = null;
_fillPaint = paint;

Просмотреть файл

@ -484,7 +484,7 @@ namespace Microsoft.Maui.Graphics.GDI
{
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint == null)
{

Просмотреть файл

@ -39,7 +39,7 @@ namespace Microsoft.Maui.Graphics.GDI
set => _backgroundColor = value;
}
public void Draw(System.Drawing.Graphics graphics, RectangleF dirtyRect)
public void Draw(System.Drawing.Graphics graphics, RectF dirtyRect)
{
try
{

Просмотреть файл

@ -7,19 +7,19 @@ namespace Microsoft.Maui.Graphics.GDI
{
public static class GDIGraphicsExtensions
{
public static Drawing.RectangleF AsRectangleF(this RectangleF target)
public static Drawing.RectangleF AsRectangleF(this RectF target)
{
return new Drawing.RectangleF(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
}
public static RectangleF AsRectangleF(this Drawing.RectangleF target)
public static RectF AsRectangleF(this Drawing.RectangleF target)
{
return new RectangleF(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
return new RectF(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
}
public static RectangleF AsRectangleF(this global::System.Drawing.Rectangle target)
public static RectF AsRectangleF(this global::System.Drawing.Rectangle target)
{
return new RectangleF(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
return new RectF(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
}
public static Drawing.SizeF AsSizeF(this SizeF target)

Просмотреть файл

@ -12,7 +12,7 @@ namespace Microsoft.Maui.Graphics.GDI
IDrawable Drawable { get; set; }
void Draw(System.Drawing.Graphics graphics, RectangleF dirtyRect);
void Draw(System.Drawing.Graphics graphics, RectF dirtyRect);
void SizeChanged(int width, int height);

Просмотреть файл

@ -5,7 +5,7 @@ namespace Microsoft.Maui.Graphics.GDI
{
public partial class GDIGraphicsView : UserControl
{
private readonly RectangleF dirtyRect = new RectangleF();
private readonly RectF dirtyRect = new RectF();
private GDIGraphicsRenderer renderer;
private IDrawable drawable;
@ -31,7 +31,7 @@ namespace Microsoft.Maui.Graphics.GDI
protected override void OnPaint(PaintEventArgs e)
{
// Extend render area by 1px to prevent rendering artifacts at the edges
RectangleF rect = new RectangleF(
RectF rect = new RectF(
x: e.ClipRectangle.X - 1,
y: e.ClipRectangle.Y - 1,
width: e.ClipRectangle.Width + 2,

Просмотреть файл

@ -111,7 +111,7 @@ namespace Microsoft.Maui.Graphics.GDI
return Task.Factory.StartNew(() => Save(stream, format, quality));
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, Math.Abs(dirtyRect.Width), Math.Abs(dirtyRect.Height));
}
@ -120,7 +120,7 @@ namespace Microsoft.Maui.Graphics.GDI
{
using var context = new GDIBitmapExportContext(width, height, scale);
context.Canvas.Scale(scale, scale);
Draw(context.Canvas, new RectangleF(0, 0, (float)width / scale, (float)height / scale));
Draw(context.Canvas, new RectF(0, 0, (float)width / scale, (float)height / scale));
return context.Image;
}

Просмотреть файл

@ -4,16 +4,16 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
public static class GraphicsExtensions {
public static Rectangle ToRectangle(this Gdk.Rectangle it)
=> new Rectangle(it.X, it.Y, it.Width, it.Height);
public static Rect ToRectangle(this Gdk.Rectangle it)
=> new Rect(it.X, it.Y, it.Width, it.Height);
public static RectangleF ToRectangleF(this Gdk.Rectangle it)
=> new RectangleF(it.X, it.Y, it.Width, it.Height);
public static RectF ToRectangleF(this Gdk.Rectangle it)
=> new RectF(it.X, it.Y, it.Width, it.Height);
public static Gdk.Rectangle ToNative(this Rectangle it)
public static Gdk.Rectangle ToNative(this Rect it)
=> new Gdk.Rectangle((int) it.X, (int) it.Y, (int) it.Width, (int) it.Height);
public static Gdk.Rectangle ToNative(this RectangleF it)
public static Gdk.Rectangle ToNative(this RectF it)
=> new Gdk.Rectangle((int) it.X, (int) it.Y, (int) it.Width, (int) it.Height);
public static Point ToPoint(this Gdk.Point it)

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
// https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-The-GdkPixbuf-Structure.html
public Gdk.Pixbuf? NativeImage => _pixbuf;
public void Draw(ICanvas canvas, RectangleF dirtyRect) {
public void Draw(ICanvas canvas, RectF dirtyRect) {
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, (float) Math.Round(dirtyRect.Width), (float) Math.Round(dirtyRect.Height));
}
@ -56,7 +56,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
{
using var context = new GtkBitmapExportContext(width, height, scale);
context.Canvas.Scale(scale, scale);
Draw(context.Canvas, new RectangleF(0, 0, (float)width / scale, (float)height / scale));
Draw(context.Canvas, new RectF(0, 0, (float)width / scale, (float)height / scale));
return context.Image;
}

Просмотреть файл

@ -63,7 +63,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
return pattern;
}
public static Cairo.Pattern? GetCairoPattern(this LinearGradientPaint? it, RectangleF rectangle, float scaleFactor) {
public static Cairo.Pattern? GetCairoPattern(this LinearGradientPaint? it, RectF rectangle, float scaleFactor) {
if (it == null)
return null;
@ -83,7 +83,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
return pattern;
}
public static Cairo.Pattern? GetCairoPattern(this RadialGradientPaint? it, RectangleF rectangle, float scaleFactor) {
public static Cairo.Pattern? GetCairoPattern(this RadialGradientPaint? it, RectF rectangle, float scaleFactor) {
if (it == null)
return null;

Просмотреть файл

@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
public partial class PlatformCanvas {
public void DrawFillPaint(Cairo.Context? context, Paint? paint, RectangleF rectangle) {
public void DrawFillPaint(Cairo.Context? context, Paint? paint, RectF rectangle) {
if (paint == null || context == null)
return;

Просмотреть файл

@ -219,7 +219,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk
CurrentState.Shadow = (offset, blur, color);
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
CurrentState.FillPaint = (paint, rectangle);
}

Просмотреть файл

@ -66,7 +66,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk {
public (SizeF offset, float blur, Color color) Shadow { get; set; }
public (Paint paint, RectangleF rectangle) FillPaint { get; set; }
public (Paint paint, RectF rectangle) FillPaint { get; set; }
public override void Dispose() {

Просмотреть файл

@ -3,7 +3,7 @@ namespace Microsoft.Maui.Graphics.Platform.Gtk
public class GtkGraphicsView : global::Gtk.EventBox
{
private IDrawable? _drawable;
private RectangleF _dirtyRect;
private RectF _dirtyRect;
private Color? _backgroundColor;
public GtkGraphicsView()

Просмотреть файл

@ -50,7 +50,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
private Vector2 _point1;
private Vector2 _point2;
private float _radius;
private RectangleF _fillRectangle;
private RectF _fillRectangle;
private Size2F _size;
private global::SharpDX.RectangleF _rect;
private RenderTarget _renderTarget;
@ -797,7 +797,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
set { }
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint == null)
{

Просмотреть файл

@ -23,7 +23,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
private Vector2 _linearGradientEndPoint;
private Vector2 _radialGradientCenterPoint;
private float _radialGradientRadius;
private RectangleF _fillRectangle;
private RectF _fillRectangle;
private GradientStopCollection _gradientStopCollection;
private RectangleGeometry _layerBounds;
private PathGeometry _layerMask;
@ -559,7 +559,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
_linearGradientEndPoint = endPoint;
}
public void SetRadialGradient(Paint aPaint, Vector2 center, float radius, RectangleF rectangle)
public void SetRadialGradient(Paint aPaint, Vector2 center, float radius, RectF rectangle)
{
ReleaseFillBrush();
_fillBrushValid = false;

Просмотреть файл

@ -98,7 +98,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
return Task.Factory.StartNew(() => Save(stream, format, quality));
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, Math.Abs(dirtyRect.Width), Math.Abs(dirtyRect.Height));
}
@ -107,7 +107,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
{
using var context = new DXBitmapExportContext(width, height, scale);
context.Canvas.Scale(scale, scale);
Draw(context.Canvas, new RectangleF(0, 0, (float)width / scale, (float)height / scale));
Draw(context.Canvas, new RectF(0, 0, (float)width / scale, (float)height / scale));
return context.Image;
}

Просмотреть файл

@ -23,7 +23,7 @@
<Compile Include="$(MSBuildThisFileDirectory)FontExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Matrix3x2Extensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PathGeometryExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RectangleFExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RectFExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RenderTargetExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TextBrush.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WicBitmapExtensions.cs" />

Просмотреть файл

@ -2,13 +2,13 @@ using SharpDX.Mathematics.Interop;
namespace Microsoft.Maui.Graphics.SharpDX
{
public static class RectangleFExtensions
public static class RectFExtensions
{
public static RectangleF AsRectangleF(this RawRectangleF target)
public static RectF AsRectangleF(this RawRectangleF target)
{
var width = target.Right - target.Left;
var height = target.Bottom - target.Top;
return new RectangleF(target.Left, target.Top, width, height);
return new RectF(target.Left, target.Top, width, height);
}
}
}

Просмотреть файл

@ -50,7 +50,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
RenderTransform = null;
canvas.RenderTarget = context;
var scale = canvas.DisplayScale;
var bounds = new RectangleF(0, 0, (float) ActualWidth * scale, (float) ActualHeight * scale);
var bounds = new RectF(0, 0, (float) ActualWidth * scale, (float) ActualHeight * scale);
if (backgroundColor != null)
{

Просмотреть файл

@ -74,7 +74,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
public SurfaceImageSource ImageSource => _surfaceImageSource;
/// <inveritdoc />
protected override Rect CurrentControlBounds => new Rect(0, 0, _pixelWidth, _pixelHeight);
protected override Windows.Foundation.Rect CurrentControlBounds => new Windows.Foundation.Rect(0, 0, _pixelWidth, _pixelHeight);
/// <summary>
/// Gets the relative position to use to draw on the surface.
@ -175,7 +175,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
backBuffer = viewData.BackBuffer;
renderTargetView = viewData.RenderTargetView;
depthStencilView = viewData.DepthStencilView;
RenderTargetBounds = new Rect(viewData.Viewport.X, viewData.Viewport.Y, viewData.Viewport.Width,
RenderTargetBounds = new Windows.Foundation.Rect(viewData.Viewport.X, viewData.Viewport.Y, viewData.Viewport.Width,
viewData.Viewport.Height);
bitmapTarget = viewData.BitmapTarget;

Просмотреть файл

@ -73,7 +73,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
/// <summary>
/// Gets the bounds of the control linked to this render target
/// </summary>
public Rect RenderTargetBounds { get; protected set; }
public Windows.Foundation.Rect RenderTargetBounds { get; protected set; }
/// <summary>
/// Gets the size in pixels of the Direct3D RenderTarget
@ -83,13 +83,13 @@ namespace Microsoft.Maui.Graphics.SharpDX
/// <summary>
/// Gets the bounds of the control linked to this render target
/// </summary>
public Rect ControlBounds { get; protected set; }
public Windows.Foundation.Rect ControlBounds { get; protected set; }
/// <summary>
/// Gets the current bounds of the control linked to this render target
/// </summary>
protected abstract Rect CurrentControlBounds { get; }
protected abstract Windows.Foundation.Rect CurrentControlBounds { get; }
/// <summary>
/// Event fired when size of the underlying control is changed
@ -119,7 +119,7 @@ namespace Microsoft.Maui.Graphics.SharpDX
/// </summary>
public virtual void UpdateForSizeChange()
{
Rect newBounds = CurrentControlBounds;
Windows.Foundation.Rect newBounds = CurrentControlBounds;
if (newBounds.Width != ControlBounds.Width ||
newBounds.Height != ControlBounds.Height)

Просмотреть файл

@ -12,7 +12,7 @@ namespace Microsoft.Maui.Graphics.SharpDX.WindowsForms
IDrawable Drawable { get; set; }
void Draw(RectangleF dirtyRect);
void Draw(RectF dirtyRect);
void SizeChanged(int width, int height);

Просмотреть файл

@ -74,7 +74,7 @@ namespace Microsoft.Maui.Graphics.SharpDX.WindowsForms
set => _backgroundColor = value;
}
public void Draw(RectangleF dirtyRect)
public void Draw(RectF dirtyRect)
{
try
{

Просмотреть файл

@ -65,7 +65,7 @@ namespace Microsoft.Maui.Graphics.SharpDX.WindowsForms
if (_drawable == null) return;
var clipRect = e.ClipRectangle;
_renderer.Draw(new RectangleF(clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height));
_renderer.Draw(new RectF(clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height));
}
protected override void OnResize(EventArgs e)

Просмотреть файл

@ -42,7 +42,7 @@ namespace Microsoft.Maui.Graphics.Skia
public void Draw(
SKCanvas skiaCanvas,
RectangleF dirtyRect)
RectF dirtyRect)
{
_canvas.Canvas = skiaCanvas;

Просмотреть файл

@ -6,7 +6,7 @@ namespace Microsoft.Maui.Graphics.Skia
{
public class GtkSkiaGraphicsView : SKDrawingArea
{
private RectangleF _dirtyRect;
private RectF _dirtyRect;
private IDrawable _drawable;
private ISkiaGraphicsRenderer _renderer;

Просмотреть файл

@ -9,7 +9,7 @@ namespace Microsoft.Maui.Graphics.Skia
ICanvas Canvas { get; }
IDrawable Drawable { get; set; }
Color BackgroundColor { get; set; }
void Draw(SKCanvas canvas, RectangleF dirtyRect);
void Draw(SKCanvas canvas, RectF dirtyRect);
void SizeChanged(int width, int height);
void Detached();
void Invalidate();

Просмотреть файл

@ -9,7 +9,7 @@ namespace Microsoft.Maui.Graphics.Skia
ICanvas Canvas { get; }
IDrawable Drawable { get; set; }
Color BackgroundColor { get; set; }
void Draw(SKCanvas canvas, RectangleF dirtyRect);
void Draw(SKCanvas canvas, RectF dirtyRect);
void SizeChanged(int width, int height);
void Detached();
void Invalidate();

Просмотреть файл

@ -42,7 +42,7 @@ namespace Microsoft.Maui.Graphics.Skia
public void Draw(
SKCanvas skiaCanvas,
RectangleF dirtyRect)
RectF dirtyRect)
{
_canvas.Canvas = skiaCanvas;

Просмотреть файл

@ -6,7 +6,7 @@ namespace Microsoft.Maui.Graphics.Skia
{
public class WDSkiaGraphicsView : SKElement
{
private RectangleF _dirtyRect;
private RectF _dirtyRect;
private IDrawable _drawable;
private ISkiaGraphicsRenderer _renderer;

Просмотреть файл

@ -61,14 +61,14 @@ namespace Microsoft.Maui.Graphics.Skia
return new Color(r, g, b, a);
}
public static SKRect AsSKRect(this RectangleF target)
public static SKRect AsSKRect(this RectF target)
{
return new SKRect(target.Left, target.Top, target.Right, target.Bottom);
}
public static RectangleF AsRectangleF(this SKRect target)
public static RectF AsRectangleF(this SKRect target)
{
return new RectangleF(target.Left, target.Top, Math.Abs(target.Right - target.Left), Math.Abs(target.Bottom - target.Top));
return new RectF(target.Left, target.Top, Math.Abs(target.Right - target.Left), Math.Abs(target.Bottom - target.Top));
}
public static SKPoint ToSKPoint(this PointF target)

Просмотреть файл

@ -221,7 +221,7 @@ namespace Microsoft.Maui.Graphics.Skia
CurrentState.SetStrokeDashPattern(pattern, strokeSize);
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint == null)
paint = Colors.White.AsPaint();
@ -656,7 +656,7 @@ namespace Microsoft.Maui.Graphics.Skia
if (string.IsNullOrEmpty(value))
return;
var rect = new RectangleF(x, y, width, height);
var rect = new RectF(x, y, width, height);
var attributes = new StandardTextAttributes()
{

Просмотреть файл

@ -140,7 +140,7 @@ namespace Microsoft.Maui.Graphics.Skia
previousValue?.Dispose();
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, (float)Math.Round(dirtyRect.Width), (float)Math.Round(dirtyRect.Height));
}

Просмотреть файл

@ -7,7 +7,7 @@ namespace Microsoft.Maui.Graphics.Skia
public class SkiaTextLayout : IDisposable
{
private readonly LayoutLine _callback;
private readonly RectangleF _rect;
private readonly RectF _rect;
private readonly ITextAttributes _textAttributes;
private readonly string _value;
private readonly TextFlow _textFlow;
@ -20,7 +20,7 @@ namespace Microsoft.Maui.Graphics.Skia
public SkiaTextLayout(
string value,
RectangleF rect,
RectF rect,
ITextAttributes textAttributes,
LayoutLine callback,
TextFlow textFlow = TextFlow.ClipBounds,

Просмотреть файл

@ -45,7 +45,7 @@ namespace Microsoft.Maui.Graphics.Skia.Views
_scalingCanvas.ResetState();
_scalingCanvas.Scale(_scale, _scale);
_drawable.Draw(_scalingCanvas, new RectangleF(0,0,_width / _scale, _height / _scale));
_drawable.Draw(_scalingCanvas, new RectF(0,0,_width / _scale, _height / _scale));
}
protected override void OnSizeChanged(int width, int height, int oldWidth, int oldHeight)

Просмотреть файл

@ -38,7 +38,7 @@ namespace Microsoft.Maui.Graphics.Skia.Views
skiaCanvas.Clear();
_canvas.Canvas = skiaCanvas;
_drawable.Draw(_scalingCanvas, new RectangleF(0, 0, GetSurfaceSize().Width, GetSurfaceSize().Height));
_drawable.Draw(_scalingCanvas, new RectF(0, 0, GetSurfaceSize().Width, GetSurfaceSize().Height));
}
}
}

Просмотреть файл

@ -6,7 +6,7 @@ using Microsoft.Graphics.Canvas.Text;
using Microsoft.Maui.Graphics.Text;
using System;
using System.Numerics;
using Windows.Foundation;
using WRect = Windows.Foundation.Rect;
#if NETFX_CORE
using WColors = global::Windows.UI.Colors;
#else
@ -29,7 +29,14 @@ namespace Microsoft.Maui.Graphics.Win2D
private Vector2 _linearGradientEndPoint;
private Vector2 _radialGradientCenter;
private float _radialGradientRadius;
/* Unmerged change from project 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop'
Before:
private Rect _rect;
After:
private global::Windows.Foundation.Rect _rect;
*/
private WRect _rect;
private global::Windows.Foundation.Size _size;
private bool _bitmapPatternFills;
@ -351,7 +358,7 @@ namespace Microsoft.Maui.Graphics.Win2D
CurrentState.SetShadow(offset, blur, color);
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint == null)
{
@ -418,7 +425,14 @@ namespace Microsoft.Maui.Graphics.Win2D
{
ExtendX = CanvasEdgeBehavior.Wrap,
ExtendY = CanvasEdgeBehavior.Wrap,
/* Unmerged change from project 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop'
Before:
SourceRectangle = new Rect(
After:
SourceRectangle = new global::Windows.Foundation.Rect(
*/
SourceRectangle = new WRect(
(pattern.Width - pattern.StepX) / 2,
(pattern.Height - pattern.StepY) / 2,
pattern.StepX,
@ -499,7 +513,14 @@ namespace Microsoft.Maui.Graphics.Win2D
if (image is W2DImage platformImage)
{
SetRect(x, y, width, height);
/* Unmerged change from project 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop'
Before:
Draw(s => s.DrawImage(platformImage.PlatformImage, _rect, Rect.Empty, CurrentState.Alpha, CanvasImageInterpolation.Linear));
After:
Draw(s => s.DrawImage(platformImage.PlatformImage, _rect, global::Windows.Foundation.Rect.Empty, CurrentState.Alpha, CanvasImageInterpolation.Linear));
*/
Draw(s => s.DrawImage(platformImage.PlatformImage, _rect, WRect.Empty, CurrentState.Alpha, CanvasImageInterpolation.Linear));
}
}

Просмотреть файл

@ -3,7 +3,7 @@ using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.Geometry;
using System;
using System.Numerics;
using Windows.Foundation;
using WRect = Windows.Foundation.Rect;
#if NETFX_CORE
using WColors = global::Windows.UI.Colors;
#else
@ -456,7 +456,14 @@ namespace Microsoft.Maui.Graphics.Win2D
if (_layerMask != null)
throw new Exception("Only one clip operation currently supported.");
/* Unmerged change from project 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop'
Before:
var layerRect = new Rect(0, 0, _owner.CanvasSize.Width, _owner.CanvasSize.Height);
After:
var layerRect = new global::Windows.Foundation.Rect(0, 0, _owner.CanvasSize.Width, _owner.CanvasSize.Height);
*/
var layerRect = new WRect(0, 0, _owner.CanvasSize.Width, _owner.CanvasSize.Height);
_layerBounds = CanvasGeometry.CreateRectangle(_owner.Session, layerRect);
var clipGeometry = path.AsPath(_owner.Session, windingMode == WindingMode.NonZero ? CanvasFilledRegionDetermination.Winding : CanvasFilledRegionDetermination.Alternate);
@ -478,10 +485,24 @@ namespace Microsoft.Maui.Graphics.Win2D
if (_layerMask != null)
throw new Exception("Only one subtraction currently supported.");
/* Unmerged change from project 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop'
Before:
var layerRect = new Rect(0, 0, _owner.CanvasSize.Width, _owner.CanvasSize.Height);
After:
var layerRect = new global::Windows.Foundation.Rect(0, 0, _owner.CanvasSize.Width, _owner.CanvasSize.Height);
*/
var layerRect = new WRect(0, 0, _owner.CanvasSize.Width, _owner.CanvasSize.Height);
_layerBounds = CanvasGeometry.CreateRectangle(_owner.Session, layerRect);
/* Unmerged change from project 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop'
Before:
var boundsToSubtract = new Rect(x, y, width, height);
After:
var boundsToSubtract = new global::Windows.Foundation.Rect(x, y, width, height);
*/
var boundsToSubtract = new WRect(x, y, width, height);
_layerClipBounds = CanvasGeometry.CreateRectangle(_owner.Session, boundsToSubtract);
_layerMask = _layerBounds.CombineWith(_layerClipBounds, Matrix3x2.Identity, CanvasGeometryCombine.Exclude);

Просмотреть файл

@ -15,7 +15,7 @@ namespace Microsoft.Maui.Graphics.Win2D
private readonly W2DCanvas _canvas;
private IDrawable _drawable;
private RectangleF _dirty;
private RectF _dirty;
//private bool _resizeDrawable = true;
public W2DGraphicsView()

Просмотреть файл

@ -96,7 +96,7 @@ namespace Microsoft.Maui.Graphics.Win2D
}
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, Math.Abs(dirtyRect.Width), Math.Abs(dirtyRect.Height));
}

Просмотреть файл

@ -464,7 +464,7 @@ namespace Microsoft.Maui.Graphics.Xaml
{
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint is SolidPaint solidPaint)
FillColor = solidPaint.Color;

Просмотреть файл

@ -10,7 +10,7 @@ namespace Microsoft.Maui.Graphics.Xaml
private Color _strokeColor = Colors.Black;
private Color _fillColor = Colors.White;
private Paint _fillPaint;
private RectangleF _fillRectangle;
private RectF _fillRectangle;
private Color _fontColor = Colors.Black;
private float _alpha = 1;
private DoubleCollection _dashArray;
@ -402,7 +402,7 @@ namespace Microsoft.Maui.Graphics.Xaml
return group;
}
internal void SetFillPaint(Paint paint, RectangleF rectangle)
internal void SetFillPaint(Paint paint, RectF rectangle)
{
_fillColor = null;
_fillPaint = paint;

Просмотреть файл

@ -492,7 +492,7 @@ namespace Microsoft.Maui.Graphics.Xaml
}
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint is SolidPaint solidPaint)
FillColor = solidPaint.Color;

Просмотреть файл

@ -13,7 +13,7 @@ namespace Microsoft.Maui.Graphics.Xaml
private Color _fontColor = Colors.Black;
private Color _fillColor = Colors.White;
private Paint _fillPaint;
private RectangleF _fillRectangle;
private RectF _fillRectangle;
private float _alpha = 1;
private DoubleCollection _dashArray;
@ -437,7 +437,7 @@ namespace Microsoft.Maui.Graphics.Xaml
return group;
}
internal void SetFillPaint(Paint paint, RectangleF rectangle)
internal void SetFillPaint(Paint paint, RectF rectangle)
{
_fillColor = null;
_fillPaint = paint;

Просмотреть файл

@ -219,7 +219,7 @@ namespace Microsoft.Maui.Graphics
}
public abstract void SetShadow(SizeF offset, float blur, Color color);
public abstract void SetFillPaint(Paint paint, RectangleF rectangle);
public abstract void SetFillPaint(Paint paint, RectF rectangle);
public abstract void DrawImage(IImage image, float x, float y, float width, float height);

Просмотреть файл

@ -3,16 +3,16 @@ using Android.Graphics;
namespace Microsoft.Maui.Graphics
{
public partial struct RectangleF
public partial struct RectF
{
public static implicit operator Rect(RectangleF rect) => new Rect((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
public static implicit operator RectF(RectangleF rect) => new RectF(rect.X, rect.Y, rect.Width, rect.Height);
public static implicit operator global::Android.Graphics.Rect(RectF rect) => new global::Android.Graphics.Rect((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
public static implicit operator global::Android.Graphics.RectF(RectF rect) => new global::Android.Graphics.RectF(rect.X, rect.Y, rect.Width, rect.Height);
}
public partial struct Rectangle
public partial struct Rect
{
public static implicit operator Rect(Rectangle rect) => new Rect((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
public static implicit operator RectF(Rectangle rect) => new RectF((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
public static implicit operator global::Android.Graphics.Rect(Rect rect) => new global::Android.Graphics.Rect((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
public static implicit operator global::Android.Graphics.RectF(Rect rect) => new global::Android.Graphics.RectF((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public partial struct PointF

Просмотреть файл

@ -41,24 +41,24 @@ namespace Microsoft.Maui.Graphics.Platform
return new Color(r, g, b, a);
}
public static RectF AsRectF(this RectangleF target)
public static global::Android.Graphics.RectF AsRectF(this RectF target)
{
return new RectF(target.Left, target.Top, target.Right, target.Bottom);
return new global::Android.Graphics.RectF(target.Left, target.Top, target.Right, target.Bottom);
}
public static RectangleF AsRectangleF(this RectF target)
public static RectF AsRectangleF(this global::Android.Graphics.RectF target)
{
return new RectangleF(target.Left, target.Top, Math.Abs(target.Width()), Math.Abs(target.Height()));
return new RectF(target.Left, target.Top, Math.Abs(target.Width()), Math.Abs(target.Height()));
}
public static Rectangle AsRectangle(this RectF target)
public static Rect AsRectangle(this global::Android.Graphics.RectF target)
{
return new Rectangle(target.Left, target.Top, Math.Abs(target.Width()), Math.Abs(target.Height()));
return new Rect(target.Left, target.Top, Math.Abs(target.Width()), Math.Abs(target.Height()));
}
public static RectF AsRectF(this Rect target)
public static global::Android.Graphics.RectF AsRectF(this global::Android.Graphics.Rect target)
{
return new RectF(target);
return new global::Android.Graphics.RectF(target);
}
public static global::Android.Graphics.PointF ToPointF(this PointF target)
@ -143,7 +143,7 @@ namespace Microsoft.Maui.Graphics.Platform
endAngle += 360;
}
var rect = new RectF(offsetX + topLeft.X * scaleX, offsetY + topLeft.Y * scaleY, offsetX + bottomRight.X * scaleX, offsetY + bottomRight.Y * scaleY);
var rect = new global::Android.Graphics.RectF(offsetX + topLeft.X * scaleX, offsetY + topLeft.Y * scaleY, offsetX + bottomRight.X * scaleX, offsetY + bottomRight.Y * scaleY);
var sweep = Geometry.GetSweep(startAngle, endAngle, clockwise);
startAngle *= -1;
@ -225,7 +225,7 @@ namespace Microsoft.Maui.Graphics.Platform
endAngle += 360;
}
var rect = new RectF(topLeft.X * ppu, topLeft.Y * ppu, bottomRight.X * ppu, bottomRight.Y * ppu);
var rect = new global::Android.Graphics.RectF(topLeft.X * ppu, topLeft.Y * ppu, bottomRight.X * ppu, bottomRight.Y * ppu);
var sweep = Geometry.GetSweep(startAngle, endAngle, clockwise);
startAngle *= -1;
@ -303,7 +303,7 @@ namespace Microsoft.Maui.Graphics.Platform
endAngle += 360;
}
var rect = new RectF(topLeft.X * ppu, topLeft.Y * ppu, bottomRight.X * ppu, bottomRight.Y * ppu);
var rect = new global::Android.Graphics.RectF(topLeft.X * ppu, topLeft.Y * ppu, bottomRight.X * ppu, bottomRight.Y * ppu);
var sweep = Geometry.GetSweep(startAngle, endAngle, clockwise);
startAngle *= -1;

Просмотреть файл

@ -204,7 +204,7 @@ namespace Microsoft.Maui.Graphics.Platform
CurrentState.SetStrokeDashPattern(patter, linewidth);
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
if (paint == null)
paint = Colors.White.AsPaint();
@ -391,7 +391,7 @@ namespace Microsoft.Maui.Graphics.Platform
float sweep = Geometry.GetSweep(startAngle, endAngle, clockwise);
var rect = new RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
var rect = new global::Android.Graphics.RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
startAngle *= -1;
if (!clockwise)
@ -435,7 +435,7 @@ namespace Microsoft.Maui.Graphics.Platform
}
var sweep = Geometry.GetSweep(startAngle, endAngle, clockwise);
var rect = new RectF(x, y, x + width, y + height);
var rect = new global::Android.Graphics.RectF(x, y, x + width, y + height);
startAngle *= -1;
if (!clockwise)
@ -489,7 +489,7 @@ namespace Microsoft.Maui.Graphics.Platform
var rectHeight = height;
var radius = aCornerRadius;
var rect = new RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
var rect = new global::Android.Graphics.RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
_canvas.DrawRoundRect(rect, radius, radius, CurrentState.StrokePaintWithAlpha);
rect.Dispose();
}
@ -502,7 +502,7 @@ namespace Microsoft.Maui.Graphics.Platform
var rectHeight = height;
var radius = aCornerRadius;
var rect = new RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
var rect = new global::Android.Graphics.RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
_canvas.DrawRoundRect(rect, radius, radius, CurrentState.FillPaintWithAlpha);
rect.Dispose();
}
@ -517,7 +517,7 @@ namespace Microsoft.Maui.Graphics.Platform
var rectWidth = width;
var rectHeight = height;
var rect = new RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
var rect = new global::Android.Graphics.RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
_canvas.DrawOval(rect, CurrentState.StrokePaintWithAlpha);
rect.Dispose();
}
@ -532,7 +532,7 @@ namespace Microsoft.Maui.Graphics.Platform
var rectWidth = width;
var rectHeight = height;
var rect = new RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
var rect = new global::Android.Graphics.RectF(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
_canvas.DrawOval(rect, CurrentState.FillPaintWithAlpha);
rect.Dispose();
}
@ -759,7 +759,7 @@ namespace Microsoft.Maui.Graphics.Platform
_canvas.Save();
//canvas.Scale (scaleX, scaleY);
var srcRect = new Rect(0, 0, bitmap.Width, bitmap.Height);
var srcRect = new global::Android.Graphics.Rect(0, 0, bitmap.Width, bitmap.Height);
x *= scaleX;
y *= scaleY;
@ -771,7 +771,7 @@ namespace Microsoft.Maui.Graphics.Platform
var rx2 = Math.Max(x, x + width);
var ry2 = Math.Max(y, y + height);
var destRect = new RectF(rx1, ry1, rx2, ry2);
var destRect = new global::Android.Graphics.RectF(rx1, ry1, rx2, ry2);
var paint = CurrentState.GetImagePaint(1, 1);
_canvas.DrawBitmap(bitmap, srcRect, destRect, paint);
paint?.Dispose();

Просмотреть файл

@ -55,7 +55,7 @@ namespace Microsoft.Maui.Graphics.Platform
{
if (_drawable == null) return;
var dirtyRect = new RectangleF(0, 0, _width, _height);
var dirtyRect = new RectF(0, 0, _width, _height);
_canvas.Canvas = androidCanvas;
if (_backgroundColor != null)

Просмотреть файл

@ -121,7 +121,7 @@ namespace Microsoft.Maui.Graphics.Platform
disp?.Dispose();
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, (float) Math.Round(dirtyRect.Width), (float) Math.Round(dirtyRect.Height));
}

Просмотреть файл

@ -7,32 +7,32 @@ namespace Microsoft.Maui.Graphics
target.DrawLine(point1.X, point1.Y, point2.X, point2.Y);
}
public static void DrawRectangle(this ICanvas target, Rectangle rect)
public static void DrawRectangle(this ICanvas target, Rect rect)
{
target.DrawRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public static void DrawRectangle(this ICanvas target, RectangleF rect)
public static void DrawRectangle(this ICanvas target, RectF rect)
{
target.DrawRectangle(rect.X, rect.Y, rect.Width, rect.Height);
}
public static void FillRectangle(this ICanvas target, Rectangle rect)
public static void FillRectangle(this ICanvas target, Rect rect)
{
target.FillRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public static void FillRectangle(this ICanvas target, RectangleF rect)
public static void FillRectangle(this ICanvas target, RectF rect)
{
target.FillRectangle(rect.X, rect.Y, rect.Width, rect.Height);
}
public static void DrawRoundedRectangle(this ICanvas target, Rectangle rect, double cornerRadius)
public static void DrawRoundedRectangle(this ICanvas target, Rect rect, double cornerRadius)
{
target.DrawRoundedRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, (float)cornerRadius);
}
public static void DrawRoundedRectangle(this ICanvas target, RectangleF rect, float cornerRadius)
public static void DrawRoundedRectangle(this ICanvas target, RectF rect, float cornerRadius)
{
target.DrawRoundedRectangle(rect.X, rect.Y, rect.Width, rect.Height, cornerRadius);
}
@ -44,33 +44,33 @@ namespace Microsoft.Maui.Graphics
target.DrawPath(path);
}
public static void DrawRoundedRectangle(this ICanvas target, Rectangle rect, double topLeftCornerRadius, double topRightCornerRadius, double bottomLeftCornerRadius, double bottomRightCornerRadius)
public static void DrawRoundedRectangle(this ICanvas target, Rect rect, double topLeftCornerRadius, double topRightCornerRadius, double bottomLeftCornerRadius, double bottomRightCornerRadius)
{
var path = new PathF();
path.AppendRoundedRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, (float)topLeftCornerRadius, (float)topRightCornerRadius, (float)bottomLeftCornerRadius, (float)bottomRightCornerRadius);
target.DrawPath(path);
}
public static void DrawRoundedRectangle(this ICanvas target, RectangleF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius)
public static void DrawRoundedRectangle(this ICanvas target, RectF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius)
{
var path = new PathF();
path.AppendRoundedRectangle(rect, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius);
target.DrawPath(path);
}
public static void DrawRoundedRectangle(this ICanvas target, RectangleF rect, float xRadius, float yRadius)
public static void DrawRoundedRectangle(this ICanvas target, RectF rect, float xRadius, float yRadius)
{
var path = new PathF();
path.AppendRoundedRectangle(rect, xRadius, yRadius);
target.DrawPath(path);
}
public static void FillRoundedRectangle(this ICanvas target, Rectangle rect, double cornerRadius)
public static void FillRoundedRectangle(this ICanvas target, Rect rect, double cornerRadius)
{
target.FillRoundedRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, (float)cornerRadius);
}
public static void FillRoundedRectangle(this ICanvas target, RectangleF rect, float cornerRadius)
public static void FillRoundedRectangle(this ICanvas target, RectF rect, float cornerRadius)
{
target.FillRoundedRectangle(rect.X, rect.Y, rect.Width, rect.Height, cornerRadius);
}
@ -82,43 +82,43 @@ namespace Microsoft.Maui.Graphics
target.FillPath(path);
}
public static void FillRoundedRectangle(this ICanvas target, Rectangle rect, double topLeftCornerRadius, double topRightCornerRadius, double bottomLeftCornerRadius, double bottomRightCornerRadius)
public static void FillRoundedRectangle(this ICanvas target, Rect rect, double topLeftCornerRadius, double topRightCornerRadius, double bottomLeftCornerRadius, double bottomRightCornerRadius)
{
var path = new PathF();
path.AppendRoundedRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height, (float)topLeftCornerRadius, (float)topRightCornerRadius, (float)bottomLeftCornerRadius, (float)bottomRightCornerRadius);
target.FillPath(path);
}
public static void FillRoundedRectangle(this ICanvas target, RectangleF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius)
public static void FillRoundedRectangle(this ICanvas target, RectF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius)
{
var path = new PathF();
path.AppendRoundedRectangle(rect, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius);
target.FillPath(path);
}
public static void FillRoundedRectangle(this ICanvas target, RectangleF rect, float xRadius, float yRadius)
public static void FillRoundedRectangle(this ICanvas target, RectF rect, float xRadius, float yRadius)
{
var path = new PathF();
path.AppendRoundedRectangle(rect, xRadius, yRadius);
target.FillPath(path);
}
public static void DrawEllipse(this ICanvas target, Rectangle rect)
public static void DrawEllipse(this ICanvas target, Rect rect)
{
target.DrawEllipse((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public static void DrawEllipse(this ICanvas target, RectangleF rect)
public static void DrawEllipse(this ICanvas target, RectF rect)
{
target.DrawEllipse(rect.X, rect.Y, rect.Width, rect.Height);
}
public static void FillEllipse(this ICanvas target, Rectangle rect)
public static void FillEllipse(this ICanvas target, Rect rect)
{
target.FillEllipse((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public static void FillEllipse(this ICanvas target, RectangleF rect)
public static void FillEllipse(this ICanvas target, RectF rect)
{
target.FillEllipse(rect.X, rect.Y, rect.Width, rect.Height);
}
@ -143,12 +143,12 @@ namespace Microsoft.Maui.Graphics
target.ClipPath(path, windingMode);
}
public static void ClipRectangle(this ICanvas target, Rectangle rect)
public static void ClipRectangle(this ICanvas target, Rect rect)
{
target.ClipRectangle((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public static void ClipRectangle(this ICanvas target, RectangleF rect)
public static void ClipRectangle(this ICanvas target, RectF rect)
{
target.ClipRectangle(rect.X, rect.Y, rect.Width, rect.Height);
}
@ -156,7 +156,7 @@ namespace Microsoft.Maui.Graphics
public static void DrawString(
this ICanvas target,
string value,
Rectangle bounds,
Rect bounds,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
TextFlow textFlow = TextFlow.ClipBounds,
@ -168,7 +168,7 @@ namespace Microsoft.Maui.Graphics
public static void DrawString(
this ICanvas target,
string value,
RectangleF bounds,
RectF bounds,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
TextFlow textFlow = TextFlow.ClipBounds,
@ -247,7 +247,7 @@ namespace Microsoft.Maui.Graphics
/// <param name="clockwise">The direction to draw the arc</param>
public static void FillArc(this ICanvas canvas, float x, float y, float width, float height, float startAngle, float endAngle, Paint paint, bool clockwise)
{
var rectangle = new RectangleF(x, y, width, height);
var rectangle = new RectF(x, y, width, height);
canvas.SetFillPaint(paint, rectangle);
canvas.FillArc(x, y, width, height, startAngle, endAngle, clockwise);
}
@ -262,7 +262,7 @@ namespace Microsoft.Maui.Graphics
/// <param name="endAngle">The end angle</param>
/// <param name="clockwise">The direction to draw the arc</param>
/// <param name="closed">If the arc is closed or not</param>
public static void DrawArc(this ICanvas canvas, RectangleF bounds, float startAngle, float endAngle, bool clockwise, bool closed)
public static void DrawArc(this ICanvas canvas, RectF bounds, float startAngle, float endAngle, bool clockwise, bool closed)
{
canvas.DrawArc(bounds.X, bounds.Y, bounds.Width, bounds.Height, startAngle, endAngle, clockwise, closed);
}
@ -277,7 +277,7 @@ namespace Microsoft.Maui.Graphics
/// <param name="endAngle">The end angle</param>
/// <param name="clockwise">The direction to draw the arc</param>
/// <param name="closed">If the arc is closed or not</param>
public static void DrawArc(this ICanvas canvas, Rectangle bounds, float startAngle, float endAngle, bool clockwise, bool closed)
public static void DrawArc(this ICanvas canvas, Rect bounds, float startAngle, float endAngle, bool clockwise, bool closed)
{
canvas.DrawArc((float)bounds.X, (float)bounds.Y, (float)bounds.Width, (float)bounds.Height, startAngle, endAngle, clockwise, closed);
}
@ -292,7 +292,7 @@ namespace Microsoft.Maui.Graphics
/// <param name="startAngle">The start angle</param>
/// <param name="endAngle">The end angle</param>
/// <param name="clockwise">The direction to draw the arc</param>
public static void FillArc(this ICanvas canvas, RectangleF bounds, float startAngle, float endAngle, bool clockwise)
public static void FillArc(this ICanvas canvas, RectF bounds, float startAngle, float endAngle, bool clockwise)
{
canvas.FillArc(bounds.X, bounds.Y, bounds.Width, bounds.Height, startAngle, endAngle, clockwise);
}
@ -306,7 +306,7 @@ namespace Microsoft.Maui.Graphics
/// <param name="startAngle">The start angle</param>
/// <param name="endAngle">The end angle</param>
/// <param name="clockwise">The direction to draw the arc</param>
public static void FillArc(this ICanvas canvas, Rectangle bounds, float startAngle, float endAngle, bool clockwise)
public static void FillArc(this ICanvas canvas, Rect bounds, float startAngle, float endAngle, bool clockwise)
{
canvas.FillArc((float)bounds.X, (float)bounds.Y, (float)bounds.Width, (float)bounds.Height, startAngle, endAngle, clockwise);
}
@ -356,7 +356,7 @@ namespace Microsoft.Maui.Graphics
if (pattern != null)
{
var paint = pattern.AsPaint(foregroundColor);
target.SetFillPaint(paint, RectangleF.Zero);
target.SetFillPaint(paint, RectF.Zero);
}
else
{
@ -365,32 +365,32 @@ namespace Microsoft.Maui.Graphics
}
}
public static void SubtractFromClip(this ICanvas target, Rectangle rect)
public static void SubtractFromClip(this ICanvas target, Rect rect)
{
target.SubtractFromClip((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
}
public static void SubtractFromClip(this ICanvas target, RectangleF rect)
public static void SubtractFromClip(this ICanvas target, RectF rect)
{
target.SubtractFromClip(rect.X, rect.Y, rect.Width, rect.Height);
}
public static void SetFillPaint(this ICanvas target, Paint paint, Point point1, Point point2)
{
target.SetFillPaint(paint, new RectangleF((float)point1.X, (float)point1.Y, (float)point2.X, (float)point2.Y));
target.SetFillPaint(paint, new RectF((float)point1.X, (float)point1.Y, (float)point2.X, (float)point2.Y));
}
public static void SetFillPaint(this ICanvas target, Paint paint, PointF point1, PointF point2)
{
target.SetFillPaint(paint, new RectangleF(point1.X, point1.Y, point2.X, point2.Y));
target.SetFillPaint(paint, new RectF(point1.X, point1.Y, point2.X, point2.Y));
}
public static void SetFillPaint(this ICanvas target, Paint paint, Rectangle rectangle)
public static void SetFillPaint(this ICanvas target, Paint paint, Rect rectangle)
{
target.SetFillPaint(paint, rectangle);
}
public static void SetFillPaint(this ICanvas target, Paint paint, RectangleF rectangle)
public static void SetFillPaint(this ICanvas target, Paint paint, RectF rectangle)
{
target.SetFillPaint(paint, rectangle);
}

Просмотреть файл

@ -5,7 +5,7 @@ using Microsoft.Maui.Graphics;
namespace Microsoft.Maui.Graphics.Converters
{
public class RectangleTypeConverter : TypeConverter
public class RectFTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
=> sourceType == typeof(string);
@ -15,15 +15,15 @@ namespace Microsoft.Maui.Graphics.Converters
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (Rectangle.TryParse(value?.ToString(), out var r))
if (RectF.TryParse(value?.ToString(), out var r))
return r;
throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Rectangle)));
throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(RectF)));
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (!(value is Rectangle r))
if (!(value is RectF r))
throw new NotSupportedException();
return $"{r.X.ToString(CultureInfo.InvariantCulture)}, {r.Y.ToString(CultureInfo.InvariantCulture)}, {r.Width.ToString(CultureInfo.InvariantCulture)}, {r.Height.ToString(CultureInfo.InvariantCulture)}";
}

Просмотреть файл

@ -5,7 +5,7 @@ using Microsoft.Maui.Graphics;
namespace Microsoft.Maui.Graphics.Converters
{
public class RectangleFTypeConverter : TypeConverter
public class RectTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
=> sourceType == typeof(string);
@ -15,15 +15,15 @@ namespace Microsoft.Maui.Graphics.Converters
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (RectangleF.TryParse(value?.ToString(), out var r))
if (Rect.TryParse(value?.ToString(), out var r))
return r;
throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(RectangleF)));
throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Rect)));
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (!(value is RectangleF r))
if (!(value is Rect r))
throw new NotSupportedException();
return $"{r.X.ToString(CultureInfo.InvariantCulture)}, {r.Y.ToString(CultureInfo.InvariantCulture)}, {r.Width.ToString(CultureInfo.InvariantCulture)}, {r.Height.ToString(CultureInfo.InvariantCulture)}";
}

Просмотреть файл

@ -88,7 +88,7 @@ namespace Microsoft.Maui.Graphics
public void SetShadow(SizeF offset, float blur, Color color);
public void SetFillPaint(Paint paint, RectangleF rectangle);
public void SetFillPaint(Paint paint, RectF rectangle);
public void DrawImage(IImage image, float x, float y, float width, float height);

Просмотреть файл

@ -2,6 +2,6 @@ namespace Microsoft.Maui.Graphics
{
public interface IDrawable
{
void Draw(ICanvas canvas, RectangleF dirtyRect);
void Draw(ICanvas canvas, RectF dirtyRect);
}
}

Просмотреть файл

@ -66,7 +66,7 @@ namespace Microsoft.Maui.Graphics
var paint = image.AsPaint();
if (paint != null)
{
canvas.SetFillPaint(paint, RectangleF.Zero);
canvas.SetFillPaint(paint, RectF.Zero);
}
else
{

Просмотреть файл

@ -30,7 +30,7 @@ namespace Microsoft.Maui.Graphics.Platform
set => _graphicsView = value;
}
public void Draw(CGContext coreGraphics, RectangleF dirtyRect)
public void Draw(CGContext coreGraphics, RectF dirtyRect)
{
_canvas.Context = coreGraphics;

Просмотреть файл

@ -8,7 +8,7 @@ namespace Microsoft.Maui.Graphics.Platform
PlatformGraphicsView GraphicsView { set; }
ICanvas Canvas { get; }
IDrawable Drawable { get; set; }
void Draw(CGContext nativeCanvas, RectangleF dirtyRect);
void Draw(CGContext nativeCanvas, RectF dirtyRect);
void SizeChanged(float width, float height);
void Detached();
void Invalidate();

Просмотреть файл

@ -152,7 +152,7 @@ namespace Microsoft.Maui.Graphics.Platform
}
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, (float)Math.Round(dirtyRect.Width), (float)Math.Round(dirtyRect.Height));
}

Просмотреть файл

@ -2,14 +2,14 @@ using System;
using CoreGraphics;
namespace Microsoft.Maui.Graphics
{
public partial struct RectangleF
public partial struct RectF
{
public static implicit operator CGRect(RectangleF rect) => new CGRect(rect.X,rect.Y,rect.Width,rect.Height);
public static implicit operator CGRect(RectF rect) => new CGRect(rect.X,rect.Y,rect.Width,rect.Height);
}
public partial struct Rectangle
public partial struct Rect
{
public static implicit operator CGRect(Rectangle rect) => new CGRect(rect.X, rect.Y, rect.Width, rect.Height);
public static implicit operator CGRect(Rect rect) => new CGRect(rect.X, rect.Y, rect.Width, rect.Height);
}
public partial struct Size

Просмотреть файл

@ -7,28 +7,28 @@ namespace Microsoft.Maui.Graphics.Platform
{
public static class GraphicsExtensions
{
public static CGRect AsCGRect(this RectangleF target)
public static CGRect AsCGRect(this RectF target)
{
return new CGRect(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
}
public static CGRect AsCGRect(this Rectangle target)
public static CGRect AsCGRect(this Rect target)
{
return new CGRect(target.Left, target.Top, Math.Abs(target.Width), Math.Abs(target.Height));
}
public static RectangleF AsRectangleF(this CGRect target)
public static RectF AsRectangleF(this CGRect target)
{
return new RectangleF(
return new RectF(
(float) target.Left,
(float) target.Top,
(float) Math.Abs(target.Width),
(float) Math.Abs(target.Height));
}
public static Rectangle AsRectangle(this CGRect target)
public static Rect AsRectangle(this CGRect target)
{
return new Rectangle(
return new Rect(
target.Left,
target.Top,
Math.Abs(target.Width),

Просмотреть файл

@ -34,7 +34,7 @@ namespace Microsoft.Maui.Graphics.Platform
private IImage _fillImage;
private RectangleF _gradientRectangle = RectangleF.Zero;
private RectF _gradientRectangle = RectF.Zero;
private Paint _paint;
// A local instance of a rectangle to avoid lots of object creation.
@ -303,7 +303,7 @@ namespace Microsoft.Maui.Graphics.Platform
}
}
public override void SetFillPaint(Paint paint, RectangleF rectangle)
public override void SetFillPaint(Paint paint, RectF rectangle)
{
_gradientRectangle = rectangle;

Просмотреть файл

@ -17,7 +17,7 @@ namespace Microsoft.Maui.Graphics.Platform
}
var path = new CGPath();
path.AddRect(new RectangleF(0, 0, 512, 512));
path.AddRect(new RectF(0, 0, 512, 512));
path.CloseSubpath();
var attributedString = new NSMutableAttributedString(value);
@ -66,7 +66,7 @@ namespace Microsoft.Maui.Graphics.Platform
return textBounds.Size;
}
internal static RectangleF GetTextSize(CTFramesetter frameSetter, CGPath path)
internal static RectF GetTextSize(CTFramesetter frameSetter, CGPath path)
{
var frame = frameSetter.GetFrame(new NSRange(0, 0), path, null);
@ -77,10 +77,10 @@ namespace Microsoft.Maui.Graphics.Platform
return textSize;
}
return new RectangleF(0, 0, 0, 0);
return new RectF(0, 0, 0, 0);
}
internal static RectangleF GetTextSize(CTFrame frame)
internal static RectF GetTextSize(CTFrame frame)
{
var minY = float.MaxValue;
var maxY = float.MinValue;
@ -106,7 +106,7 @@ namespace Microsoft.Maui.Graphics.Platform
lines[i].Dispose();
}
return new RectangleF(0f, minY, width, Math.Max(0, maxY - minY));
return new RectF(0f, minY, width, Math.Max(0, maxY - minY));
}
}
}

Просмотреть файл

@ -17,7 +17,7 @@ namespace Microsoft.Maui.Graphics
private readonly List<bool> _subPathsClosed;
private object _platformPath;
private RectangleF? _cachedBounds;
private RectF? _cachedBounds;
private PathF(List<PointF> points, List<float> arcSizes, List<bool> arcClockwise, List<PathOperation> operations, int subPathCount)
{
@ -1022,7 +1022,7 @@ namespace Microsoft.Maui.Graphics
return new PathF(points, arcSizes, arcClockwise, operations, _subPathCount);
}
public void AppendEllipse(RectangleF rect)
public void AppendEllipse(RectF rect)
{
AppendEllipse(rect.X, rect.Y, rect.Width, rect.Height);
}
@ -1070,7 +1070,7 @@ namespace Microsoft.Maui.Graphics
Close();
}
public void AppendRectangle(RectangleF rect, bool includeLast = false)
public void AppendRectangle(RectF rect, bool includeLast = false)
{
AppendRectangle(rect.X, rect.Y, rect.Width, rect.Height, includeLast);
}
@ -1095,7 +1095,7 @@ namespace Microsoft.Maui.Graphics
Close();
}
public void AppendRoundedRectangle(RectangleF rect, float cornerRadius, bool includeLast = false)
public void AppendRoundedRectangle(RectF rect, float cornerRadius, bool includeLast = false)
{
AppendRoundedRectangle(rect.X, rect.Y, rect.Width, rect.Height, cornerRadius, includeLast);
}
@ -1129,12 +1129,12 @@ namespace Microsoft.Maui.Graphics
Close();
}
public void AppendRoundedRectangle(RectangleF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius, bool includeLast = false)
public void AppendRoundedRectangle(RectF rect, float topLeftCornerRadius, float topRightCornerRadius, float bottomLeftCornerRadius, float bottomRightCornerRadius, bool includeLast = false)
{
AppendRoundedRectangle(rect.X, rect.Y, rect.Width, rect.Height, topLeftCornerRadius, topRightCornerRadius, bottomLeftCornerRadius, bottomRightCornerRadius, includeLast);
}
public void AppendRoundedRectangle(RectangleF rect, float xCornerRadius, float yCornerRadius)
public void AppendRoundedRectangle(RectF rect, float xCornerRadius, float yCornerRadius)
{
xCornerRadius = Math.Min(xCornerRadius, rect.Width / 2);
yCornerRadius = Math.Min(yCornerRadius, rect.Height / 2);
@ -1383,12 +1383,12 @@ namespace Microsoft.Maui.Graphics
return true;
}
public RectangleF Bounds
public RectF Bounds
{
get
{
if (_cachedBounds != null)
return (RectangleF)_cachedBounds;
return (RectF)_cachedBounds;
#if IOS || MACCATALYST || __IOS__
@ -1402,14 +1402,14 @@ namespace Microsoft.Maui.Graphics
_cachedBounds = GetBoundsByFlattening();
#endif
return (RectangleF)_cachedBounds;
return (RectF)_cachedBounds;
}
}
public RectangleF GetBoundsByFlattening(float flatness = 0.001f)
public RectF GetBoundsByFlattening(float flatness = 0.001f)
{
if (_cachedBounds != null)
return (RectangleF)_cachedBounds;
return (RectF)_cachedBounds;
var path = GetFlattenedPath(flatness, true);
@ -1436,8 +1436,8 @@ namespace Microsoft.Maui.Graphics
}
}
_cachedBounds = new RectangleF(l, t, r - l, b - t);
return (RectangleF)_cachedBounds;
_cachedBounds = new RectF(l, t, r - l, b - t);
return (RectF)_cachedBounds;
}
public PathF GetFlattenedPath(float flatness = .001f, bool includeSubPaths = false)

Просмотреть файл

@ -253,7 +253,7 @@ namespace Microsoft.Maui.Graphics
_commands.Add(canvas => canvas.SetFillPaint(paint, point1, point2));
}
public void SetFillPaint(Paint paint, RectangleF rectangle)
public void SetFillPaint(Paint paint, RectF rectangle)
{
_commands.Add(canvas => canvas.SetFillPaint(paint, rectangle));
}

Просмотреть файл

@ -2,10 +2,10 @@ namespace Microsoft.Maui.Graphics
{
public static class PictureExtensions
{
public static RectangleF GetBounds(this IPicture target)
public static RectF GetBounds(this IPicture target)
{
if (target == null) return default;
return new RectangleF(target.X, target.Y, target.Width, target.Height);
return new RectF(target.X, target.Y, target.Width, target.Height);
}
}
}

Просмотреть файл

@ -153,7 +153,7 @@ namespace Microsoft.Maui.Graphics.Platform
stream.Dispose();
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
throw new PlatformNotSupportedException();
}

Просмотреть файл

@ -6,8 +6,8 @@ using System.Globalization;
namespace Microsoft.Maui.Graphics
{
[DebuggerDisplay("X={X}, Y={Y}, Width={Width}, Height={Height}")]
[TypeConverter(typeof(Converters.RectangleTypeConverter))]
public partial struct Rectangle
[TypeConverter(typeof(Converters.RectTypeConverter))]
public partial struct Rect
{
public double X { get; set; }
@ -17,7 +17,7 @@ namespace Microsoft.Maui.Graphics
public double Height { get; set; }
public static Rectangle Zero = new Rectangle();
public static Rect Zero = new Rect();
public override string ToString()
{
@ -25,7 +25,7 @@ namespace Microsoft.Maui.Graphics
}
// constructors
public Rectangle(double x, double y, double width, double height) : this()
public Rect(double x, double y, double width, double height) : this()
{
X = x;
Y = y;
@ -33,16 +33,16 @@ namespace Microsoft.Maui.Graphics
Height = height;
}
public Rectangle(Point loc, Size sz) : this(loc.X, loc.Y, sz.Width, sz.Height)
public Rect(Point loc, Size sz) : this(loc.X, loc.Y, sz.Width, sz.Height)
{
}
public static Rectangle FromLTRB(double left, double top, double right, double bottom)
public static Rect FromLTRB(double left, double top, double right, double bottom)
{
return new Rectangle(left, top, right - left, bottom - top);
return new Rect(left, top, right - left, bottom - top);
}
public bool Equals(Rectangle other)
public bool Equals(Rect other)
{
return X.Equals(other.X) && Y.Equals(other.Y) && Width.Equals(other.Width) && Height.Equals(other.Height);
}
@ -51,7 +51,7 @@ namespace Microsoft.Maui.Graphics
{
if (ReferenceEquals(null, obj))
return false;
return obj is Rectangle && Equals((Rectangle)obj);
return obj is Rect && Equals((Rect)obj);
}
public override int GetHashCode()
@ -66,18 +66,18 @@ namespace Microsoft.Maui.Graphics
}
}
public static bool operator ==(Rectangle r1, Rectangle r2)
public static bool operator ==(Rect r1, Rect r2)
{
return (r1.Location == r2.Location) && (r1.Size == r2.Size);
}
public static bool operator !=(Rectangle r1, Rectangle r2)
public static bool operator !=(Rect r1, Rect r2)
{
return !(r1 == r2);
}
// Hit Testing / Intersection / Union
public bool Contains(Rectangle rect)
public bool Contains(Rect rect)
{
return X <= rect.X && Right >= rect.Right && Y <= rect.Y && Bottom >= rect.Bottom;
}
@ -92,27 +92,27 @@ namespace Microsoft.Maui.Graphics
return (x >= Left) && (x < Right) && (y >= Top) && (y < Bottom);
}
public bool IntersectsWith(Rectangle r)
public bool IntersectsWith(Rect r)
{
return !((Left >= r.Right) || (Right <= r.Left) || (Top >= r.Bottom) || (Bottom <= r.Top));
}
public Rectangle Union(Rectangle r)
public Rect Union(Rect r)
{
return Union(this, r);
}
public static Rectangle Union(Rectangle r1, Rectangle r2)
public static Rect Union(Rect r1, Rect r2)
{
return FromLTRB(Math.Min(r1.Left, r2.Left), Math.Min(r1.Top, r2.Top), Math.Max(r1.Right, r2.Right), Math.Max(r1.Bottom, r2.Bottom));
}
public Rectangle Intersect(Rectangle r)
public Rect Intersect(Rect r)
{
return Intersect(this, r);
}
public static Rectangle Intersect(Rectangle r1, Rectangle r2)
public static Rect Intersect(Rect r1, Rect r2)
{
double x = Math.Max(r1.X, r2.X);
double y = Math.Max(r1.Y, r2.Y);
@ -123,7 +123,7 @@ namespace Microsoft.Maui.Graphics
{
return Zero;
}
return new Rectangle(x, y, width, height);
return new Rect(x, y, width, height);
}
// Position/Size
@ -176,14 +176,14 @@ namespace Microsoft.Maui.Graphics
public Point Center => new Point(X + Width / 2, Y + Height / 2);
// Inflate and Offset
public Rectangle Inflate(Size sz)
public Rect Inflate(Size sz)
{
return Inflate(sz.Width, sz.Height);
}
public Rectangle Inflate(double width, double height)
public Rect Inflate(double width, double height)
{
Rectangle r = this;
Rect r = this;
r.X -= width;
r.Y -= height;
r.Width += width * 2;
@ -191,22 +191,22 @@ namespace Microsoft.Maui.Graphics
return r;
}
public Rectangle Offset(double dx, double dy)
public Rect Offset(double dx, double dy)
{
Rectangle r = this;
Rect r = this;
r.X += dx;
r.Y += dy;
return r;
}
public Rectangle Offset(Point dr)
public Rect Offset(Point dr)
{
return Offset(dr.X, dr.Y);
}
public Rectangle Round()
public Rect Round()
{
return new Rectangle(Math.Round(X), Math.Round(Y), Math.Round(Width), Math.Round(Height));
return new Rect(Math.Round(X), Math.Round(Y), Math.Round(Width), Math.Round(Height));
}
public void Deconstruct(out double x, out double y, out double width, out double height)
@ -216,9 +216,10 @@ namespace Microsoft.Maui.Graphics
width = Width;
height = Height;
}
public static implicit operator RectangleF(Rectangle rect) => new RectangleF((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
public static bool TryParse(string value, out Rectangle rectangle)
public static implicit operator RectF(Rect rect) => new RectF((float)rect.X, (float)rect.Y, (float)rect.Width, (float)rect.Height);
public static bool TryParse(string value, out Rect rectangle)
{
if (!string.IsNullOrEmpty(value))
{
@ -229,7 +230,7 @@ namespace Microsoft.Maui.Graphics
&& double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out double w)
&& double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out double h))
{
rectangle = new Rectangle(x, y, w, h);
rectangle = new Rect(x, y, w, h);
return true;
}
}

Просмотреть файл

@ -6,8 +6,8 @@ using System.Globalization;
namespace Microsoft.Maui.Graphics
{
[DebuggerDisplay("X={X}, Y={Y}, Width={Width}, Height={Height}")]
[TypeConverter(typeof(Converters.RectangleFTypeConverter))]
public partial struct RectangleF
[TypeConverter(typeof(Converters.RectFTypeConverter))]
public partial struct RectF
{
public float X { get; set; }
@ -17,7 +17,7 @@ namespace Microsoft.Maui.Graphics
public float Height { get; set; }
public static RectangleF Zero = new RectangleF();
public static RectF Zero = new RectF();
public override string ToString()
{
@ -26,7 +26,7 @@ namespace Microsoft.Maui.Graphics
}
// constructors
public RectangleF(float x, float y, float width, float height) : this()
public RectF(float x, float y, float width, float height) : this()
{
X = x;
Y = y;
@ -34,16 +34,16 @@ namespace Microsoft.Maui.Graphics
Height = height;
}
public RectangleF(PointF loc, SizeF sz) : this(loc.X, loc.Y, sz.Width, sz.Height)
public RectF(PointF loc, SizeF sz) : this(loc.X, loc.Y, sz.Width, sz.Height)
{
}
public static RectangleF FromLTRB(float left, float top, float right, float bottom)
public static RectF FromLTRB(float left, float top, float right, float bottom)
{
return new RectangleF(left, top, right - left, bottom - top);
return new RectF(left, top, right - left, bottom - top);
}
public bool Equals(RectangleF other)
public bool Equals(RectF other)
{
return X.Equals(other.X) && Y.Equals(other.Y) && Width.Equals(other.Width) && Height.Equals(other.Height);
}
@ -52,7 +52,7 @@ namespace Microsoft.Maui.Graphics
{
if (ReferenceEquals(null, obj))
return false;
return obj is RectangleF && Equals((RectangleF)obj);
return obj is RectF && Equals((RectF)obj);
}
public override int GetHashCode()
@ -67,18 +67,18 @@ namespace Microsoft.Maui.Graphics
}
}
public static bool operator ==(RectangleF r1, RectangleF r2)
public static bool operator ==(RectF r1, RectF r2)
{
return (r1.Location == r2.Location) && (r1.Size == r2.Size);
}
public static bool operator !=(RectangleF r1, RectangleF r2)
public static bool operator !=(RectF r1, RectF r2)
{
return !(r1 == r2);
}
// Hit Testing / Intersection / Union
public bool Contains(RectangleF rect)
public bool Contains(RectF rect)
{
return X <= rect.X && Right >= rect.Right && Y <= rect.Y && Bottom >= rect.Bottom;
}
@ -93,27 +93,27 @@ namespace Microsoft.Maui.Graphics
return (x >= Left) && (x < Right) && (y >= Top) && (y < Bottom);
}
public bool IntersectsWith(RectangleF r)
public bool IntersectsWith(RectF r)
{
return !((Left >= r.Right) || (Right <= r.Left) || (Top >= r.Bottom) || (Bottom <= r.Top));
}
public RectangleF Union(RectangleF r)
public RectF Union(RectF r)
{
return Union(this, r);
}
public static RectangleF Union(RectangleF r1, RectangleF r2)
public static RectF Union(RectF r1, RectF r2)
{
return FromLTRB(Math.Min(r1.Left, r2.Left), Math.Min(r1.Top, r2.Top), Math.Max(r1.Right, r2.Right), Math.Max(r1.Bottom, r2.Bottom));
}
public RectangleF Intersect(RectangleF r)
public RectF Intersect(RectF r)
{
return Intersect(this, r);
}
public static RectangleF Intersect(RectangleF r1, RectangleF r2)
public static RectF Intersect(RectF r1, RectF r2)
{
float x = Math.Max(r1.X, r2.X);
float y = Math.Max(r1.Y, r2.Y);
@ -124,7 +124,7 @@ namespace Microsoft.Maui.Graphics
{
return Zero;
}
return new RectangleF(x, y, width, height);
return new RectF(x, y, width, height);
}
// Position/Size
@ -177,14 +177,14 @@ namespace Microsoft.Maui.Graphics
public PointF Center => new PointF(X + Width / 2, Y + Height / 2);
// Inflate and Offset
public RectangleF Inflate(SizeF sz)
public RectF Inflate(SizeF sz)
{
return Inflate(sz.Width, sz.Height);
}
public RectangleF Inflate(float width, float height)
public RectF Inflate(float width, float height)
{
RectangleF r = this;
RectF r = this;
r.X -= width;
r.Y -= height;
r.Width += width * 2;
@ -192,22 +192,22 @@ namespace Microsoft.Maui.Graphics
return r;
}
public RectangleF Offset(float dx, float dy)
public RectF Offset(float dx, float dy)
{
RectangleF r = this;
RectF r = this;
r.X += dx;
r.Y += dy;
return r;
}
public RectangleF Offset(PointF dr)
public RectF Offset(PointF dr)
{
return Offset(dr.X, dr.Y);
}
public RectangleF Round()
public RectF Round()
{
return new RectangleF((float)Math.Round(X), (float)Math.Round(Y), (float)Math.Round(Width), (float)Math.Round(Height));
return new RectF((float)Math.Round(X), (float)Math.Round(Y), (float)Math.Round(Width), (float)Math.Round(Height));
}
public void Deconstruct(out float x, out float y, out float width, out float height)
@ -218,9 +218,9 @@ namespace Microsoft.Maui.Graphics
height = Height;
}
public static implicit operator Rectangle(RectangleF rect) => new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
public static implicit operator Rect(RectF rect) => new Rect(rect.X, rect.Y, rect.Width, rect.Height);
public static bool TryParse(string value, out RectangleF rectangleF)
public static bool TryParse(string value, out RectF rectangleF)
{
if (!string.IsNullOrEmpty(value))
{
@ -231,7 +231,7 @@ namespace Microsoft.Maui.Graphics
&& float.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out float w)
&& float.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out float h))
{
rectangleF = new RectangleF(x, y, w, h);
rectangleF = new RectF(x, y, w, h);
return true;
}
}

Просмотреть файл

@ -201,9 +201,9 @@ namespace Microsoft.Maui.Graphics
_canvas.Rotate(degrees, x * _scaleX, y * _scaleY);
}
public void SetFillPaint(Paint paint, RectangleF rectangle)
public void SetFillPaint(Paint paint, RectF rectangle)
{
_canvas.SetFillPaint(paint, new RectangleF(rectangle.X * _scaleX, rectangle.Y * _scaleY, rectangle.Width * _scaleX, rectangle.Height * _scaleY));
_canvas.SetFillPaint(paint, new RectF(rectangle.X * _scaleX, rectangle.Y * _scaleY, rectangle.Width * _scaleX, rectangle.Height * _scaleY));
}
public void Rotate(float degrees)

Просмотреть файл

@ -29,7 +29,7 @@ namespace Microsoft.Maui.Graphics.Platform
set => _graphicsView = value;
}
public void Draw(CGContext coreGraphics, RectangleF dirtyRect)
public void Draw(CGContext coreGraphics, RectF dirtyRect)
{
_canvas.Context = coreGraphics;
@ -69,7 +69,7 @@ namespace Microsoft.Maui.Graphics.Platform
public void Invalidate(float x, float y, float w, float h)
{
_graphicsView?.SetNeedsDisplayInRect(new RectangleF(x, y, w, h));
_graphicsView?.SetNeedsDisplayInRect(new RectF(x, y, w, h));
}
}
}

Просмотреть файл

@ -8,7 +8,7 @@ namespace Microsoft.Maui.Graphics.Platform
PlatformGraphicsView GraphicsView { set; }
ICanvas Canvas { get; }
IDrawable Drawable { get; set; }
void Draw(CGContext coreGraphics, RectangleF dirtyRect);
void Draw(CGContext coreGraphics, RectF dirtyRect);
void SizeChanged(float width, float height);
void Detached();
void Invalidate();

Просмотреть файл

@ -129,7 +129,7 @@ namespace Microsoft.Maui.Graphics.Platform
disp?.Dispose();
}
public void Draw(ICanvas canvas, RectangleF dirtyRect)
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.DrawImage(this, dirtyRect.Left, dirtyRect.Top, (float)Math.Round(dirtyRect.Width), (float)Math.Round(dirtyRect.Height));
}

Просмотреть файл

@ -0,0 +1,134 @@
using Microsoft.Maui.Graphics.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.Maui.Graphics.Tests
{
public class RectTypeConverterTests
{
[Theory]
[MemberData(nameof(RectangleConvertData))]
public void ConvertsRectangleFromString(string from, bool expectedSuccess, Rect expectedResult)
{
var ok = from.TryConvertFrom<RectTypeConverter, Rect>(out var p);
Assert.Equal(expectedSuccess, ok);
if (expectedSuccess)
Assert.Equal(expectedResult, p);
}
[Theory]
[MemberData(nameof(RectangleFConvertData))]
public void ConvertsRectangleFFromString(string from, bool expectedSuccess, RectF expectedResult)
{
var ok = from.TryConvertFrom<RectFTypeConverter, RectF>(out var p);
Assert.Equal(expectedSuccess, ok);
if (expectedSuccess)
Assert.Equal(expectedResult, p);
}
// 0, 0
public static IEnumerable<object[]> RectangleConvertData()
=> new List<object[]>
{
new object[] { "1,2,3,4", true, new Rect(1, 2, 3, 4) },
new object[] { "1.1,2.0,3,4.4", true, new Rect(1.1, 2, 3, 4.4) },
new object[] { "0,0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "1,2, 0, 0", true, new Rect(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new Rect(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new Rect(1, 2, 0, 0) },
new object[] { "0.0,0.0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "1.1,2.1, 0, 0", true, new Rect(1.1, 2.1, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new Rect(1.1, 2.1, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new Rect(1.1, 2.1, 0, 0) },
new object[] { "0,-0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "-0, 0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "-0, -0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "-1,2, 0, 0", true, new Rect(-1, 2, 0, 0) },
new object[] { "1, -2, 0, 0", true, new Rect(1, -2, 0, 0) },
new object[] { "-1, -2, 0, 0", true, new Rect(-1, -2, 0, 0) },
new object[] { "-0.0,0.0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "0.0, -0.0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "-0.0, -0.0, 0, 0", true, new Rect(0, 0, 0, 0) },
new object[] { "-1.1,2.1, 0, 0", true, new Rect(-1.1, 2.1, 0, 0) },
new object[] { "1.1, -2.1, 0, 0", true, new Rect(1.1, -2.1, 0, 0) },
new object[] { "-1.1, -2.1, 0, 0", true, new Rect(-1.1, -2.1, 0, 0) },
new object[] { ".1,0, 0, 0", true, new Rect(0.1, 0, 0, 0) },
new object[] { "-.1, 1, 0, 0", true, new Rect(-0.1, 1, 0, 0) },
new object[] { "1, 1, 0, 0", true, new Rect(1, 1, 0, 0) },
new object[] { "0", false, new Rect(0, 0, 0, 0) },
new object[] { ",1, 0, 0", false, new Rect(0, 1, 0, 0) },
new object[] { "1,, 0, 0", false, new Rect(1, 0, 0, 0) },
new object[] { "", false, new Rect(0, 0, 0, 0) },
};
public static IEnumerable<object[]> RectangleFConvertData()
=> new List<object[]>
{
new object[] { "1,2,3,4", true, new RectF(1, 2, 3, 4) },
new object[] { "1.1,2.0,3,4.4", true, new RectF(1.1f, 2, 3, 4.4f) },
new object[] { "0,0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "1,2, 0, 0", true, new RectF(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new RectF(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new RectF(1, 2, 0, 0) },
new object[] { "0.0,0.0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "1.1,2.1, 0, 0", true, new RectF(1.1f, 2.1f, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new RectF(1.1f, 2.1f, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new RectF(1.1f, 2.1f, 0, 0) },
new object[] { "0,-0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "-0, 0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "-0, -0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "-1,2, 0, 0", true, new RectF(-1, 2, 0, 0) },
new object[] { "1, -2, 0, 0", true, new RectF(1, -2, 0, 0) },
new object[] { "-1, -2, 0, 0", true, new RectF(-1, -2, 0, 0) },
new object[] { "-0.0,0.0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "0.0, -0.0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "-0.0, -0.0, 0, 0", true, new RectF(0, 0, 0, 0) },
new object[] { "-1.1,2.1, 0, 0", true, new RectF(-1.1f, 2.1f, 0, 0) },
new object[] { "1.1, -2.1, 0, 0", true, new RectF(1.1f, -2.1f, 0, 0) },
new object[] { "-1.1, -2.1, 0, 0", true, new RectF(-1.1f, -2.1f, 0, 0) },
new object[] { ".1,0, 0, 0", true, new RectF(0.1f, 0, 0, 0) },
new object[] { "-.1, 1, 0, 0", true, new RectF(-0.1f, 1, 0, 0) },
new object[] { "1, 1, 0, 0", true, new RectF(1, 1, 0, 0) },
new object[] { "0", false, new RectF(0, 0, 0, 0) },
new object[] { ",1, 0, 0", false, new RectF(0, 1, 0, 0) },
new object[] { "1,, 0, 0", false, new RectF(1, 0, 0, 0) },
new object[] { "", false, new RectF(0, 0, 0, 0) },
};
}
}

Просмотреть файл

@ -1,134 +0,0 @@
using Microsoft.Maui.Graphics.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.Maui.Graphics.Tests
{
public class RectangleTypeConverterTests
{
[Theory]
[MemberData(nameof(RectangleConvertData))]
public void ConvertsRectangleFromString(string from, bool expectedSuccess, Rectangle expectedResult)
{
var ok = from.TryConvertFrom<RectangleTypeConverter, Rectangle>(out var p);
Assert.Equal(expectedSuccess, ok);
if (expectedSuccess)
Assert.Equal(expectedResult, p);
}
[Theory]
[MemberData(nameof(RectangleFConvertData))]
public void ConvertsRectangleFFromString(string from, bool expectedSuccess, RectangleF expectedResult)
{
var ok = from.TryConvertFrom<RectangleFTypeConverter, RectangleF>(out var p);
Assert.Equal(expectedSuccess, ok);
if (expectedSuccess)
Assert.Equal(expectedResult, p);
}
// 0, 0
public static IEnumerable<object[]> RectangleConvertData()
=> new List<object[]>
{
new object[] { "1,2,3,4", true, new Rectangle(1, 2, 3, 4) },
new object[] { "1.1,2.0,3,4.4", true, new Rectangle(1.1, 2, 3, 4.4) },
new object[] { "0,0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "1,2, 0, 0", true, new Rectangle(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new Rectangle(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new Rectangle(1, 2, 0, 0) },
new object[] { "0.0,0.0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "1.1,2.1, 0, 0", true, new Rectangle(1.1, 2.1, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new Rectangle(1.1, 2.1, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new Rectangle(1.1, 2.1, 0, 0) },
new object[] { "0,-0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "-0, 0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "-0, -0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "-1,2, 0, 0", true, new Rectangle(-1, 2, 0, 0) },
new object[] { "1, -2, 0, 0", true, new Rectangle(1, -2, 0, 0) },
new object[] { "-1, -2, 0, 0", true, new Rectangle(-1, -2, 0, 0) },
new object[] { "-0.0,0.0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "0.0, -0.0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "-0.0, -0.0, 0, 0", true, new Rectangle(0, 0, 0, 0) },
new object[] { "-1.1,2.1, 0, 0", true, new Rectangle(-1.1, 2.1, 0, 0) },
new object[] { "1.1, -2.1, 0, 0", true, new Rectangle(1.1, -2.1, 0, 0) },
new object[] { "-1.1, -2.1, 0, 0", true, new Rectangle(-1.1, -2.1, 0, 0) },
new object[] { ".1,0, 0, 0", true, new Rectangle(0.1, 0, 0, 0) },
new object[] { "-.1, 1, 0, 0", true, new Rectangle(-0.1, 1, 0, 0) },
new object[] { "1, 1, 0, 0", true, new Rectangle(1, 1, 0, 0) },
new object[] { "0", false, new Rectangle(0, 0, 0, 0) },
new object[] { ",1, 0, 0", false, new Rectangle(0, 1, 0, 0) },
new object[] { "1,, 0, 0", false, new Rectangle(1, 0, 0, 0) },
new object[] { "", false, new Rectangle(0, 0, 0, 0) },
};
public static IEnumerable<object[]> RectangleFConvertData()
=> new List<object[]>
{
new object[] { "1,2,3,4", true, new RectangleF(1, 2, 3, 4) },
new object[] { "1.1,2.0,3,4.4", true, new RectangleF(1.1f, 2, 3, 4.4f) },
new object[] { "0,0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "0, 0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "1,2, 0, 0", true, new RectangleF(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new RectangleF(1, 2, 0, 0) },
new object[] { "1, 2, 0, 0", true, new RectangleF(1, 2, 0, 0) },
new object[] { "0.0,0.0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "0.0, 0.0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "1.1,2.1, 0, 0", true, new RectangleF(1.1f, 2.1f, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new RectangleF(1.1f, 2.1f, 0, 0) },
new object[] { "1.1, 2.1, 0, 0", true, new RectangleF(1.1f, 2.1f, 0, 0) },
new object[] { "0,-0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "-0, 0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "-0, -0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "-1,2, 0, 0", true, new RectangleF(-1, 2, 0, 0) },
new object[] { "1, -2, 0, 0", true, new RectangleF(1, -2, 0, 0) },
new object[] { "-1, -2, 0, 0", true, new RectangleF(-1, -2, 0, 0) },
new object[] { "-0.0,0.0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "0.0, -0.0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "-0.0, -0.0, 0, 0", true, new RectangleF(0, 0, 0, 0) },
new object[] { "-1.1,2.1, 0, 0", true, new RectangleF(-1.1f, 2.1f, 0, 0) },
new object[] { "1.1, -2.1, 0, 0", true, new RectangleF(1.1f, -2.1f, 0, 0) },
new object[] { "-1.1, -2.1, 0, 0", true, new RectangleF(-1.1f, -2.1f, 0, 0) },
new object[] { ".1,0, 0, 0", true, new RectangleF(0.1f, 0, 0, 0) },
new object[] { "-.1, 1, 0, 0", true, new RectangleF(-0.1f, 1, 0, 0) },
new object[] { "1, 1, 0, 0", true, new RectangleF(1, 1, 0, 0) },
new object[] { "0", false, new RectangleF(0, 0, 0, 0) },
new object[] { ",1, 0, 0", false, new RectangleF(0, 1, 0, 0) },
new object[] { "1,, 0, 0", false, new RectangleF(1, 0, 0, 0) },
new object[] { "", false, new RectangleF(0, 0, 0, 0) },
};
}
}