Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Gui.RectArea Class Reference

Immutable rectangular area. More...

Inheritance diagram for Dragengine.Gui.RectArea:

Public Member Functions

Constructors
RectArea new ()
 Create rectangular area with all coordinates set to 0.
RectArea new (int x1, int y1, int x2, int y2)
 Create rectangular area with initial coordinates.
RectArea new (RectArea rect)
 Create copy of rectangular area.
RectArea new (Point position, Point size)
 Create recangular area from a point and size.
Management
int getX1 ()
 X1-Coordinate.
int getY1 ()
 Y1-Coordinate.
int getX2 ()
 X2-Coordinate.
int getY2 ()
 Y2-Coordinate.
RectArea orientate ()
 Orientate rectangular area placing (x1,y1) top-left and (x2,y2) bottom-right.
Point getPosition ()
 Position.
Point getSize ()
 Size.
int getWidth ()
 Width.
int getHeight ()
 Height.
Point getTopLeft ()
 Top-left corner (x1, y1).
Point getTopRight ()
 Top-right corner (x2, y1).
Point getBottomLeft ()
 Bottom-left corner (x1, y2).
Point getBottomRight ()
 Bottom-right corner (x2, y2).
RectArea move (int x, int y)
 Rectangular area moved by offset.
RectArea move (Point distance)
 Rectangular area moved by offset.
RectArea grow (int x, int y)
 Rectangular area grown by size at bottom right.
RectArea grow (Point size)
 Rectangular area grown by size at bottom right.
RectArea growInverse (int x, int y)
 Rectangular area grown by size at top left.
RectArea growInverse (Point size)
 Rectangular area grown by size at top left.
RectArea include (RectArea rect)
 Rectangular area grown to include another rectangular area.
RectArea intersect (RectArea rect)
 Rectangular area set to the intersection area between two rectangular areas.
Point clamp (Point point)
 Point clamped to rectangular area.
bool isZeroWidth ()
 Width is 0 (x1=x2).
bool isZeroHeight ()
 Height is 0 (y1=y2).
bool isZeroSize ()
 Size is 0 (x1=x2, y1=y2).
bool isZeroWidthOrHeight ()
 Width or height is 0 (x1=x2 or y1=y2).
bool isInside (int x, int y)
 Point is inside rectangular area.
bool isInsideX (int x)
 Point is inside rectangular area along X axis.
bool isInsideY (int y)
 Point is inside rectangular area along Y axis.
bool isOverlapping (RectArea rect)
 Rectangular areas overlap.
bool isOverlappingX (RectArea rect)
 Rectangular areas overlap in X direction.
bool isOverlappingY (RectArea rect)
 Rectangular areas overlap in Y direction.
bool isEqual (RectArea rect)
 Rectangular areas is equal to another rectangular area.
String toString ()
 String representation.

Public Attributes

int pX1

File Handling

void writeToFile (FileWriter writer)
 Write rectangular area to file writer.
static RectArea readFromFile (FileReader reader)
 Read rectangular area from file reader.

Detailed Description

Immutable rectangular area.

Coordinate (x2,y2) is exclusive. Hence the rectangular area includes all points except row y2 and column x2.

Member Function Documentation

◆ clamp()

Point Dragengine.Gui.RectArea.clamp ( Point point)

Point clamped to rectangular area.

This excludes the row y2 and column x2 unless the width or height is 0.

References getTopLeft(), and pX1.

Referenced by toString().

◆ getBottomLeft()

Point Dragengine.Gui.RectArea.getBottomLeft ( )

Bottom-left corner (x1, y2).

Version
1.13

Referenced by isZeroSize().

◆ getBottomRight()

Point Dragengine.Gui.RectArea.getBottomRight ( )

Bottom-right corner (x2, y2).

Version
1.13

Referenced by isZeroWidthOrHeight().

◆ getHeight()

int Dragengine.Gui.RectArea.getHeight ( )

Height.

Version
1.13

References getY2().

Referenced by intersect().

◆ getPosition()

Point Dragengine.Gui.RectArea.getPosition ( )

Position.

References getX1(), and pX1.

Referenced by move().

◆ getSize()

Point Dragengine.Gui.RectArea.getSize ( )

Size.

References getY1().

Referenced by grow().

◆ getTopLeft()

Point Dragengine.Gui.RectArea.getTopLeft ( )

Top-left corner (x1, y1).

Version
1.13

References orientate(), and pX1.

Referenced by clamp().

◆ getTopRight()

Point Dragengine.Gui.RectArea.getTopRight ( )

Top-right corner (x2, y1).

Version
1.13

References pX1.

Referenced by isZeroWidth().

◆ getWidth()

int Dragengine.Gui.RectArea.getWidth ( )

Width.

Version
1.13

References getX2().

Referenced by growInverse().

◆ getX1()

int Dragengine.Gui.RectArea.getX1 ( )

X1-Coordinate.

Referenced by getPosition().

◆ getX2()

int Dragengine.Gui.RectArea.getX2 ( )

X2-Coordinate.

References pX1.

Referenced by getWidth().

◆ getY1()

int Dragengine.Gui.RectArea.getY1 ( )

Y1-Coordinate.

References pX1.

Referenced by getSize().

◆ getY2()

int Dragengine.Gui.RectArea.getY2 ( )

Y2-Coordinate.

Referenced by getHeight().

◆ grow() [1/2]

RectArea Dragengine.Gui.RectArea.grow ( int x,
int y )

Rectangular area grown by size at bottom right.

References getSize(), and pX1.

Referenced by isInsideX(), and isInsideY().

◆ grow() [2/2]

RectArea Dragengine.Gui.RectArea.grow ( Point size)

Rectangular area grown by size at bottom right.

◆ growInverse() [1/2]

RectArea Dragengine.Gui.RectArea.growInverse ( int x,
int y )

Rectangular area grown by size at top left.

References getWidth().

Referenced by isInsideY(), and isOverlapping().

◆ growInverse() [2/2]

RectArea Dragengine.Gui.RectArea.growInverse ( Point size)

Rectangular area grown by size at top left.

References pX1.

◆ include()

RectArea Dragengine.Gui.RectArea.include ( RectArea rect)

Rectangular area grown to include another rectangular area.

Referenced by isOverlappingX().

◆ intersect()

RectArea Dragengine.Gui.RectArea.intersect ( RectArea rect)

Rectangular area set to the intersection area between two rectangular areas.

References getHeight().

Referenced by isOverlappingY().

◆ isEqual()

bool Dragengine.Gui.RectArea.isEqual ( RectArea rect)

Rectangular areas is equal to another rectangular area.

Referenced by writeToFile().

◆ isInside()

bool Dragengine.Gui.RectArea.isInside ( int x,
int y )

Point is inside rectangular area.

This excludes the row y2 and column x2. If the width or height is 0 the point is never inside.

References move(), and pX1.

Referenced by writeToFile().

◆ isInsideX()

bool Dragengine.Gui.RectArea.isInsideX ( int x)

Point is inside rectangular area along X axis.

Version
1.29

This excludes the column x2. If the width is 0 the point is never inside.

References grow(), and pX1.

Referenced by writeToFile().

◆ isInsideY()

bool Dragengine.Gui.RectArea.isInsideY ( int y)

Point is inside rectangular area along Y axis.

Version
1.29

This excludes the row y2. If the height is 0 the point is never inside.

References grow(), growInverse(), and pX1.

Referenced by writeToFile().

◆ isOverlapping()

bool Dragengine.Gui.RectArea.isOverlapping ( RectArea rect)

Rectangular areas overlap.

Version
1.29

References growInverse().

Referenced by writeToFile().

◆ isOverlappingX()

bool Dragengine.Gui.RectArea.isOverlappingX ( RectArea rect)

Rectangular areas overlap in X direction.

Version
1.29

References include(), and pX1.

Referenced by writeToFile().

◆ isOverlappingY()

bool Dragengine.Gui.RectArea.isOverlappingY ( RectArea rect)

Rectangular areas overlap in Y direction.

Version
1.29

References intersect(), and pX1.

Referenced by writeToFile().

◆ isZeroHeight()

bool Dragengine.Gui.RectArea.isZeroHeight ( )

Height is 0 (y1=y2).

Version
1.29

Referenced by writeToFile().

◆ isZeroSize()

bool Dragengine.Gui.RectArea.isZeroSize ( )

Size is 0 (x1=x2, y1=y2).

Version
1.29

References getBottomLeft(), and pX1.

Referenced by writeToFile().

◆ isZeroWidth()

bool Dragengine.Gui.RectArea.isZeroWidth ( )

Width is 0 (x1=x2).

Version
1.29

References getTopRight().

Referenced by writeToFile().

◆ isZeroWidthOrHeight()

bool Dragengine.Gui.RectArea.isZeroWidthOrHeight ( )

Width or height is 0 (x1=x2 or y1=y2).

Version
1.29

References getBottomRight().

Referenced by writeToFile().

◆ move() [1/2]

RectArea Dragengine.Gui.RectArea.move ( int x,
int y )

Rectangular area moved by offset.

References getPosition(), and pX1.

Referenced by isInside().

◆ move() [2/2]

RectArea Dragengine.Gui.RectArea.move ( Point distance)

Rectangular area moved by offset.

◆ new() [1/4]

RectArea Dragengine.Gui.RectArea.new ( )

Create rectangular area with all coordinates set to 0.

References new().

Referenced by new(), and new().

◆ new() [2/4]

RectArea Dragengine.Gui.RectArea.new ( int x1,
int y1,
int x2,
int y2 )

Create rectangular area with initial coordinates.

References new(), and pX1.

◆ new() [3/4]

RectArea Dragengine.Gui.RectArea.new ( Point position,
Point size )

Create recangular area from a point and size.

References pX1.

◆ new() [4/4]

RectArea Dragengine.Gui.RectArea.new ( RectArea rect)

Create copy of rectangular area.

◆ orientate()

RectArea Dragengine.Gui.RectArea.orientate ( )

Orientate rectangular area placing (x1,y1) top-left and (x2,y2) bottom-right.

Referenced by getTopLeft().

◆ readFromFile()

RectArea Dragengine.Gui.RectArea.readFromFile ( FileReader reader)
static

Read rectangular area from file reader.

Referenced by writeToFile().

◆ toString()

String Dragengine.Gui.RectArea.toString ( )

String representation.

References clamp(), and pX1.

Referenced by writeToFile().

◆ writeToFile()

void Dragengine.Gui.RectArea.writeToFile ( FileWriter writer)

Member Data Documentation

◆ pX1


The documentation for this class was generated from the following file: