Skip to content

Latest commit

 

History

History
73 lines (46 loc) · 2.61 KB

Area.md

File metadata and controls

73 lines (46 loc) · 2.61 KB

Class lwtk.Area

A list of rectangle coordinates forming an area.

Contents

Inheritance

Constructor

  • Area()

    Creates an empty area object.

Methods

  • Area:addRect(x, y, w, h)

    Adds the rectangle coordinates to the area.

  • Area:clear()

    Clears all rectangle coordinates. After this the area does not contain any rectangle, i.e. area.count == 0.

  • Area:getRect(i)

    Obtain coordinates of the i-th rectangle from the area.

    • i - index of the rectangle, 1 <= i <= area.count

    Returns x, y, w, h rectangle coordinates

  • Area:intersects(x, y, w, h)

    Returns true if the given rectangle coordinates intersect the area.

  • Area:intersectsBorder(x, y, w, h, borderWidth)

  • Area:isWithin(x, y, w, h)

    Returns true if the given rectangle coordinates are within the area.

  • Area:iteration()

    Iterate through all rectangle coordinates.

    Returns an iterator function, self and 0, so that the construction

        for i, x, y, w, h in area:iteration() do ... end

    will iterate over all rectangle indices and coordinates.

Inherited Methods