PixelRect Struct
Definition
Represents a rectangle in device pixels.
public struct PixelRect
Constructors
| Name | Description |
|---|---|
| PixelRect (4 overloads) | Initializes a new instance of the Avalonia.PixelRect structure. |
PixelRect overloads
PixelRect Constructor
Initializes a new instance of the Avalonia.PixelRect structure.
public PixelRect(Avalonia.PixelPoint topLeft, Avalonia.PixelPoint bottomRight)
Parameters
topLeft Avalonia.PixelPoint
The top left position of the rectangle.
bottomRight Avalonia.PixelPoint
The bottom right position of the rectangle.
PixelRect Constructor
Initializes a new instance of the Avalonia.PixelRect structure.
public PixelRect(Avalonia.PixelPoint position, Avalonia.PixelSize size)
Parameters
position Avalonia.PixelPoint
The position of the rectangle.
size Avalonia.PixelSize
The size of the rectangle.
PixelRect Constructor
Initializes a new instance of the Avalonia.PixelRect structure.
public PixelRect(Avalonia.PixelSize size)
Parameters
size Avalonia.PixelSize
The size of the rectangle.
PixelRect Constructor
Initializes a new instance of the Avalonia.PixelRect structure.
public PixelRect(int x, int y, int width, int height)
Parameters
x int
The X position.
y int
The Y position.
width int
The width.
height int
The height.
Methods
| Name | Description |
|---|---|
| CenterRect | Centers another rectangle in this rectangle. |
| Contains (2 overloads) | Determines whether a point in the bounds of the rectangle. |
| ContainsExclusive | Determines whether a point is in the bounds of the rectangle, exclusive of the rectangle's bottom/right edge. |
| Equals (2 overloads) | Returns a boolean indicating whether the rect is equal to the other given rect. |
| FromRect (2 overloads) | Converts a Avalonia.Rect to device pixels using the specified scaling factor. |
| FromRectWithDpi (2 overloads) | Converts a Avalonia.Rect to device pixels using the specified dots per inch (DPI). |
| GetHashCode | Returns the hash code for this instance. |
| Intersect | Gets the intersection of two rectangles. |
| Intersects | Determines whether a rectangle intersects with this rectangle. |
| Parse | Parses a Avalonia.PixelRect string. |
| ToRect (2 overloads) | Converts the Avalonia.PixelRect to a device-independent Avalonia.Rect using the specified scaling factor. |
| ToRectWithDpi (2 overloads) | Converts the Avalonia.PixelRect to a device-independent Avalonia.Rect using the specified dots per inch (DPI). |
| ToString | Returns the string representation of the rectangle. |
| Translate | Translates the rectangle by an offset. |
| Union | Gets the union of two rectangles. |
| WithHeight | Returns a new Avalonia.PixelRect with the specified height. |
| WithWidth | Returns a new Avalonia.PixelRect with the specified width. |
| WithX | Returns a new Avalonia.PixelRect with the specified X position. |
| WithY | Returns a new Avalonia.PixelRect with the specified Y position. |
CenterRect Method
Centers another rectangle in this rectangle.
public Avalonia.PixelRect CenterRect(Avalonia.PixelRect rect)
Parameters
rect Avalonia.PixelRect
The rectangle to center.
Returns
The centered rectangle.
Contains overloads
Contains Method
Determines whether a point in the bounds of the rectangle.
public bool Contains(Avalonia.PixelPoint p)
Parameters
The point.
Returns
bool
true if the point is in the bounds of the rectangle; otherwise false.
Contains Method
Determines whether the rectangle fully contains another rectangle.
public bool Contains(Avalonia.PixelRect r)
Parameters
The rectangle.
Returns
bool
true if the rectangle is fully contained; otherwise false.
ContainsExclusive Method
Determines whether a point is in the bounds of the rectangle, exclusive of the rectangle's bottom/right edge.
public bool ContainsExclusive(Avalonia.PixelPoint p)
Parameters
The point.
Returns
bool
true if the point is in the bounds of the rectangle; otherwise false.
Equals overloads
Equals Method
Returns a boolean indicating whether the rect is equal to the other given rect.
public bool Equals(Avalonia.PixelRect other)
Parameters
other Avalonia.PixelRect
The other rect to test equality against.
Returns
bool
True if this rect is equal to other; False otherwise.
Equals Method
Returns a boolean indicating whether the given object is equal to this rectangle.
public bool Equals(object obj)
Parameters
obj object
The object to compare against.
Returns
bool
True if the object is equal to this rectangle; false otherwise.
FromRect overloads
FromRect Method
Converts a Avalonia.Rect to device pixels using the specified scaling factor.
public Avalonia.PixelRect FromRect(Avalonia.Rect rect, Avalonia.Vector scale)
Parameters
rect Avalonia.Rect
The rect.
scale Avalonia.Vector
The scaling factor.
Returns
The device-independent point.
FromRect Method
Converts a Avalonia.Rect to device pixels using the specified scaling factor.
public Avalonia.PixelRect FromRect(Avalonia.Rect rect, double scale)
Parameters
rect Avalonia.Rect
The rect.
scale double
The scaling factor.
Returns
The device-independent rect.
FromRectWithDpi overloads
FromRectWithDpi Method
Converts a Avalonia.Rect to device pixels using the specified dots per inch (DPI).
public Avalonia.PixelRect FromRectWithDpi(Avalonia.Rect rect, Avalonia.Vector dpi)
Parameters
rect Avalonia.Rect
The rect.
dpi Avalonia.Vector
The dots per inch of the device.
Returns
The device-independent point.
FromRectWithDpi Method
Converts a Avalonia.Rect to device pixels using the specified dots per inch (DPI).
public Avalonia.PixelRect FromRectWithDpi(Avalonia.Rect rect, double dpi)
Parameters
rect Avalonia.Rect
The rect.
dpi double
The dots per inch of the device.
Returns
The device-independent point.
GetHashCode Method
Returns the hash code for this instance.
public int GetHashCode()
Returns
int
The hash code.
Intersect Method
Gets the intersection of two rectangles.
public Avalonia.PixelRect Intersect(Avalonia.PixelRect rect)
Parameters
rect Avalonia.PixelRect
The other rectangle.
Returns
The intersection.
Intersects Method
Determines whether a rectangle intersects with this rectangle.
public bool Intersects(Avalonia.PixelRect rect)
Parameters
rect Avalonia.PixelRect
The other rectangle.
Returns
bool
True if the specified rectangle intersects with this one; otherwise false.
Parse Method
Parses a Avalonia.PixelRect string.
public Avalonia.PixelRect Parse(string s)
Parameters
s string
The string.
Returns
The parsed Avalonia.PixelRect.
ToRect overloads
ToRect Method
Converts the Avalonia.PixelRect to a device-independent Avalonia.Rect using the specified scaling factor.
public Avalonia.Rect ToRect(Avalonia.Vector scale)
Parameters
scale Avalonia.Vector
The scaling factor.
Returns
The device-independent rect.
ToRect Method
Converts the Avalonia.PixelRect to a device-independent Avalonia.Rect using the specified scaling factor.
public Avalonia.Rect ToRect(double scale)
Parameters
scale double
The scaling factor.
Returns
The device-independent rect.
ToRectWithDpi overloads
ToRectWithDpi Method
Converts the Avalonia.PixelRect to a device-independent Avalonia.Rect using the specified dots per inch (DPI).
public Avalonia.Rect ToRectWithDpi(Avalonia.Vector dpi)
Parameters
dpi Avalonia.Vector
The dots per inch of the device.
Returns
The device-independent rect.
ToRectWithDpi Method
Converts the Avalonia.PixelRect to a device-independent Avalonia.Rect using the specified dots per inch (DPI).
public Avalonia.Rect ToRectWithDpi(double dpi)
Parameters
dpi double
The dots per inch of the device.
Returns
The device-independent rect.
ToString Method
Returns the string representation of the rectangle.
public string ToString()
Returns
string
The string representation of the rectangle.
Translate Method
Translates the rectangle by an offset.
public Avalonia.PixelRect Translate(Avalonia.PixelVector offset)
Parameters
offset Avalonia.PixelVector
The offset.
Returns
The translated rectangle.
Union Method
Gets the union of two rectangles.
public Avalonia.PixelRect Union(Avalonia.PixelRect rect)
Parameters
rect Avalonia.PixelRect
The other rectangle.
Returns
The union.
WithHeight Method
Returns a new Avalonia.PixelRect with the specified height.
public Avalonia.PixelRect WithHeight(int height)
Parameters
height int
The height.
Returns
The new Avalonia.PixelRect.
WithWidth Method
Returns a new Avalonia.PixelRect with the specified width.
public Avalonia.PixelRect WithWidth(int width)
Parameters
width int
The width.
Returns
The new Avalonia.PixelRect.
WithX Method
Returns a new Avalonia.PixelRect with the specified X position.
public Avalonia.PixelRect WithX(int x)
Parameters
x int
The x position.
Returns
The new Avalonia.PixelRect.
WithY Method
Returns a new Avalonia.PixelRect with the specified Y position.
public Avalonia.PixelRect WithY(int y)
Parameters
y int
The y position.
Returns
The new Avalonia.PixelRect.
Properties
| Name | Description |
|---|---|
| Bottom | Gets the bottom position of the rectangle. |
| BottomLeft | Gets the bottom left point of the rectangle. |
| BottomRight | Gets the bottom right point of the rectangle. |
| Center | Gets the center point of the rectangle. |
| Height | Gets the height. |
| Position | Gets the position of the rectangle. |
| Right | Gets the right position of the rectangle. |
| Size | Gets the size of the rectangle. |
| TopLeft | Gets the top left point of the rectangle. |
| TopRight | Gets the top right point of the rectangle. |
| Width | Gets the width. |
| X | Gets the X position. |
| Y | Gets the Y position. |
Bottom Property
Gets the bottom position of the rectangle.
public int Bottom { get; set; }
BottomLeft Property
Gets the bottom left point of the rectangle.
public Avalonia.PixelPoint BottomLeft { get; set; }
BottomRight Property
Gets the bottom right point of the rectangle.
public Avalonia.PixelPoint BottomRight { get; set; }
Center Property
Gets the center point of the rectangle.
public Avalonia.PixelPoint Center { get; set; }
Height Property
Gets the height.
public int Height { get; set; }
Position Property
Gets the position of the rectangle.
public Avalonia.PixelPoint Position { get; set; }
Right Property
Gets the right position of the rectangle.
public int Right { get; set; }
Size Property
Gets the size of the rectangle.
public Avalonia.PixelSize Size { get; set; }
TopLeft Property
Gets the top left point of the rectangle.
public Avalonia.PixelPoint TopLeft { get; set; }
TopRight Property
Gets the top right point of the rectangle.
public Avalonia.PixelPoint TopRight { get; set; }
Width Property
Gets the width.
public int Width { get; set; }
X Property
Gets the X position.
public int X { get; set; }
Y Property
Gets the Y position.
public int Y { get; set; }