RelativeRectangle

RelativeRectangle class

Relative rectangle The formula between relative component to absolute value is: Scale (Reference Width) + offset So if we want it to represent an absolute value, leave all scale fields zero, and use offset fields instead.

Methods

constructor

NameDescription
constructor()

Result:


constructor_overload

NameDescription
constructor_overload(left, top, width, height)Construct a RelativeRectangle

Parameters:

NameTypeDescription
lefNumbernull
toNumbernull
widtNumbernull
heighNumbernull

Result:


getScaleX

NameDescription
getScaleX()Relative coordinate X

Result:


setScaleX

NameDescription
setScaleX(value)Relative coordinate X

Result:


getScaleY

NameDescription
getScaleY()Relative coordinate Y

Result:


setScaleY

NameDescription
setScaleY(value)Relative coordinate Y

Result:


getScaleWidth

NameDescription
getScaleWidth()Relative width

Result:


setScaleWidth

NameDescription
setScaleWidth(value)Relative width

Result:


getScaleHeight

NameDescription
getScaleHeight()Relative height

Result:


setScaleHeight

NameDescription
setScaleHeight(value)Relative height

Result:


getOffsetX

NameDescription
getOffsetX()Gets or sets the offset for coordinate X

Result:


setOffsetX

NameDescription
setOffsetX(value)Gets or sets the offset for coordinate X

Result:


getOffsetY

NameDescription
getOffsetY()Gets or sets the offset for coordinate Y

Result:


setOffsetY

NameDescription
setOffsetY(value)Gets or sets the offset for coordinate Y

Result:


getOffsetWidth

NameDescription
getOffsetWidth()Gets or sets the offset for width

Result:


setOffsetWidth

NameDescription
setOffsetWidth(value)Gets or sets the offset for width

Result:


getOffsetHeight

NameDescription
getOffsetHeight()Gets or sets the offset for height

Result:


setOffsetHeight

NameDescription
setOffsetHeight(value)Gets or sets the offset for height

Result:


toAbsolute

NameDescription
toAbsolute(left, top, width, height)Convert the relative rectangle to absolute rectangle

Parameters:

NameTypeDescription
leftNumberLeft of the rectangle
topNumberTop of the rectangle
widthNumberWidth of the rectangle
heightNumberHeight of the rectangle

Result: Rect


fromScale

NameDescription
fromScale(scaleX, scaleY, scaleWidth, scaleHeight)Construct a RelativeRectangle with all offset fields zero and scale fields from given parameters.

Parameters:

NameTypeDescription
scaleNumbernull
scaleNumbernull
scaleWidtNumbernull
scaleHeighNumbernull

Result: RelativeRectangle


toString

NameDescription
toString()Converts the value of this instance to a java.lang.String.

Result: RelativeRectangle