Package Name: java.awt.polygon

Return to: Package List


with java.lang; use java.lang;
with java.awt.Rectangle; use java.awt.Rectangle;

package java.awt.Polygon is
    type Coord_Array is array(Positive range <>) of Integer;

    type Coord_Array_Ptr is access Coord_Array(1..20);  -- TBD uncon
    type Polygon_Obj is new Object with record
        npoints : Integer;
        xpoints : Coord_Array_Ptr;
        ypoints : Coord_Array_Ptr;
    end record;

    type Polygon_Ptr is access all Polygon_Obj'Class;
    procedure init_Polygon(Obj : access Polygon_Obj'Class);

    function new_Polygon(Obj : Polygon_Ptr := null) return Polygon_Ptr;
    function new_Polygon(
        xpoints : Coord_Array;
        ypoints : Coord_Array;
        npoints : Integer;
        Obj : Polygon_Ptr := null)

      return Polygon_Ptr;
    procedure addPoint(Obj : access Polygon_Obj;
        x : Integer;

        y : Integer);

    function getBoundingBox(Obj : access Polygon_Obj) return Rectangle_Ptr;
    function inside(Obj : access Polygon_Obj;
        x : Integer;
        y : Integer)

      return Boolean;
    pragma Import(Java, addPoint);
    pragma Import(Java, inside);

    pragma Import(Java, getBoundingBox);
    pragma Import(Java_Constructor, init_Polygon);

    pragma Import(Java_Constructor, new_Polygon);
end java.awt.Polygon;