Background and motivation
I propose to add a unary minus operator to the Point, PointF, Size and SizeF structs. It is to improve readability during drawing operations.
API Proposal
namespace System.Drawing;
public struct Point
{
public static Point operator -(Point value) { return new Point(-value.X, -value.Y); }
}
public struct PointF
{
public static PointF operator -(PointF value) { return new PointF(-value.X, -value.Y); }
}
public struct Size
{
public static Size operator -(Size value) { return new Size(-value.Width, -value.Height); }
}
public struct SizeF
{
public static SizeF operator -(SizeF value) { return new SizeF(-value.Width, -value.Height); }
}
API Usage
// Translate
graphics.TranslateTransform(
pntLocation
);
// Reverse translate
graphics.TranslateTransform(
-pntLocation
);
Alternative Designs
No response
Risks
No response
Will this feature affect UI controls?
No impact on UI controls.
Background and motivation
I propose to add a unary minus operator to the Point, PointF, Size and SizeF structs. It is to improve readability during drawing operations.
API Proposal
API Usage
Alternative Designs
No response
Risks
No response
Will this feature affect UI controls?
No impact on UI controls.