跳轉到主要內容
影像中的矩形區域。

建構函式

ConstructorDescription
Rect Rect( XCoordinate left, YCoordinate top, XCoordinate right, YCoordinate bottom )從影像上的座標建立一個 Rect 型別的值。矩形的邊界透過參數傳入:left 為左邊界,top 為上邊界,right 為右邊界,bottom 為下邊界。

運算子

OperatorDescription
Or合併兩個 Rectangle。結果是能同時包含這兩個 Rectangle 的最小 Rectangle。
And取兩個 Rectangle 的交集。結果是同時位於這兩個 Rectangle 之內的最大 Rectangle。

方法

MethodDescription
XCoordinate Left()傳回矩形的左邊界。唯讀屬性。
YCoordinate top()傳回矩形的上邊界。唯讀屬性。
XCoordinate Right()傳回矩形的右邊界。唯讀屬性。
YCoordinate Bottom()傳回矩形的下邊界。唯讀屬性。
Distance Width()傳回矩形的寬度。唯讀屬性。
Distance Height()傳回矩形的高度。唯讀屬性。
Area Area()傳回矩形的面積。唯讀屬性。
Void Left( XCoordinate x )設定矩形的左邊界。
Void top( YCoordinate y )設定矩形的上邊界。
Void Right( XCoordinate x )設定矩形的右邊界。
Void Bottom( YCoordinate y )設定矩形的下邊界。
XCoordinate XCenter()矩形中心點的 X 座標。
YCoordinate YCenter()矩形中心點的 Y 座標。
Void Inflate( Distance xDist, Distance yDist )將矩形向左和向右各擴展 xDist,並向上和向下各擴展 yDist。
XCoordinate GetX( Real ratio )計算位於矩形內、介於 Left 與 Right 座標之間的 X 座標,為 Left + Width * ratio。
YCoordinate GetY( Real ratio )計算位於矩形內、介於 Top 與 Bottom 座標之間的 Y 座標,為 Top + Height * ratio。
Rect GetInflated( Distance xDist, Distance yDist )傳回「已擴展」的矩形。每個頂點皆依擴展圖形的方向分別平移 xDist 與 yDist(例如左上頂點向上且向左移動)。矩形本身保持不變。
Logic IsEmpty()檢查矩形是否對應於影像上的非空區域,即 Left < Right 且 Top < Bottom 的區域。