Gorgon
Show / Hide Table of Contents

Class SharpDXRectExtensions

Extension methods for the SharpDX rectangle and rectanglef types.

Inheritance
object
SharpDXRectExtensions
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Graphics
Assembly: Gorgon.Core.dll
Syntax
public static class SharpDXRectExtensions

Methods

| Edit this page View Source

Ceiling(RectangleF)

Function to set the rectangle coordinates to the nearest integer values that are higher than or equal to the original values.

Declaration
public static RectangleF Ceiling(this RectangleF rect)
Parameters
Type Name Description
RectangleF rect

The rectangle to floor.

Returns
Type Description
RectangleF

The truncated rectangle.

| Edit this page View Source

Contains(Rectangle, Point)

Function to determine if a point is contained within a rectangle.

Declaration
public static bool Contains(this Rectangle rect, Point point)
Parameters
Type Name Description
Rectangle rect

The rectangle to evaluate.

Point point

The point to evaluate.

Returns
Type Description
bool

true if the point lies within the rectangle, false if not.

| Edit this page View Source

Contains(RectangleF, RectangleF)

Determines whether this rectangle entirely contains a specified rectangle.

Declaration
public static bool Contains(this RectangleF rect, RectangleF value)
Parameters
Type Name Description
RectangleF rect

The source rectangle to compare.

RectangleF value

The rectangle to evaluate.

Returns
Type Description
bool

true if the rectangle is contained within the other rectangle, or false if not.

| Edit this page View Source

Equals(in Rectangle, in Rectangle)

Function to compare rectangles for equality using a read only reference.

Declaration
public static bool Equals(this in Rectangle thisRect, in Rectangle other)
Parameters
Type Name Description
Rectangle thisRect

The rectangle being compared.

Rectangle other

The other view being compared.

Returns
Type Description
bool

true if the two instances are equal, false if not.

| Edit this page View Source

Equals(in RectangleF, in RectangleF)

Function to compare rectangles for equality using a read only reference.

Declaration
public static bool Equals(this in RectangleF thisRect, in RectangleF other)
Parameters
Type Name Description
RectangleF thisRect

The rectangle being compared.

RectangleF other

The other view being compared.

Returns
Type Description
bool

true if the two instances are equal, false if not.

| Edit this page View Source

Equals(in ViewportF, in ViewportF)

Function to compare viewports for equality using a read only reference.

Declaration
public static bool Equals(this in ViewportF thisView, in ViewportF other)
Parameters
Type Name Description
ViewportF thisView

The view being compared.

ViewportF other

The other view being compared.

Returns
Type Description
bool

true if the two instances are equal, false if not.

| Edit this page View Source

Floor(RectangleF)

Function to set the rectangle coordinates to the nearest integer values that are lower than or equal to the original values.

Declaration
public static RectangleF Floor(this RectangleF rect)
Parameters
Type Name Description
RectangleF rect

The rectangle to floor.

Returns
Type Description
RectangleF

The truncated rectangle.

| Edit this page View Source

ToRectangle(RectangleF)

Function to convert a floating point rectangle to an integer rectangle/

Declaration
public static Rectangle ToRectangle(this RectangleF rect)
Parameters
Type Name Description
RectangleF rect

The rectangle to convert.

Returns
Type Description
Rectangle

The converted rectangle.

Remarks

This method converts the coordinates to integer values without applying rounding.

| Edit this page View Source

ToRectangleF(Rectangle)

Function to convert an integer rectangle to a floating point rectangle/

Declaration
public static RectangleF ToRectangleF(this Rectangle rect)
Parameters
Type Name Description
Rectangle rect

The rectangle to convert.

Returns
Type Description
RectangleF

The converted rectangle.

| Edit this page View Source

Truncate(RectangleF)

Function to truncate the rectangle coordinates to the whole number portion of their values.

Declaration
public static RectangleF Truncate(this RectangleF rect)
Parameters
Type Name Description
RectangleF rect

The rectangle to truncate.

Returns
Type Description
RectangleF

The truncated rectangle.

Remarks

This method converts the coordinates to integer values without applying rounding.

  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author