DEFINITION MODULE GPIREGIONS;

(************************************************************************
  OS/2 2.0 interface for Presentation Manager
           GPI Regions and Clipping with Regions.

  Copyright (c) 1992 by Juergen Neuhoff
*************************************************************************)

(*$XL+       Modula-2 language extensions: '_' allowed for symbol names *)
(*$CDECL+    C-style procedures                                         *)
(*$A         default alignment for record fields                        *)

FROM   OS2DEF  IMPORT TYPEPREFIX, HPS, HRGN, RECTL, PRECTL, POINTL;
FROM   GPIDEF  IMPORT SIZEL;

CONST (* options for GpiCombineRegion *)
  CRGN_OR                       = 1;
  CRGN_COPY                     = 2;
  CRGN_XOR                      = 4;
  CRGN_AND                      = 6;
  CRGN_DIFF                     = 7;

CONST (* usDirection of returned region data for GpiQueryRegionRects *)
  RECTDIR_LFRT_TOPBOT           = 1;
  RECTDIR_RTLF_TOPBOT           = 2;
  RECTDIR_LFRT_BOTTOP           = 3;
  RECTDIR_RTLF_BOTTOP           = 4;

TYPE (* control data for GpiQueryRegionRects *)
  RGNRECT                       = RECORD (* rgnrc *)
    CASE                          : TYPEPREFIX OF
    | TRUE                        :
      ircStart                    : LONGCARD;
      crc                         : LONGCARD;
      crcReturned                 : LONGCARD;
      ulDirection                 : LONGCARD;
    | FALSE                       :
      RecStart                    : LONGCARD;
      RecMaxCount                 : LONGCARD;
      RecReturned                 : LONGCARD;
      Direction                   : LONGCARD;
    END;                          END;
  PRGNRECT                      = POINTER TO RGNRECT;

CONST (* return code to indicate type of region for GpiCombineRegion and others *)
  RGN_ERROR                     = 0;
  RGN_NULL                      = 1;
  RGN_RECT                      = 2;
  RGN_COMPLEX                   = 3;

CONST (* return codes for GpiPtInRegion *)
  PRGN_ERROR                    = 0;
  PRGN_OUTSIDE                  = 1;
  PRGN_INSIDE                   = 2;

CONST (* return codes for GpiRectInRegion *)
  RRGN_ERROR                    = 0;
  RRGN_OUTSIDE                  = 1;
  RRGN_PARTIAL                  = 2;
  RRGN_INSIDE                   = 3;

CONST (* return codes for GpiEqualRegion *)
  EQRGN_ERROR                   = 0;
  EQRGN_NOTEQUAL                = 1;
  EQRGN_EQUAL                   = 2;

CONST (* error return code for GpiSetRegion *)
  HRGN_ERROR                    = HRGN( -1 );


(*** main region functions *)

PROCEDURE GpiCombineRegion
( PresSpaceHandle               : HPS;
  DestRegHandle                 : HRGN;
  Source1RegHandle              : HRGN;
  Source2RegHandle              : HRGN;
  Mode                          : LONGINT
)                               : LONGINT;

PROCEDURE GpiCreateRegion
( PresSpaceHandle               : HPS;
  Count                         : LONGINT;
  VAR Rectangles                : ARRAY OF RECTL
)                               : HRGN;

PROCEDURE GpiDestroyRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN
)                               : BOOLEAN;

PROCEDURE GpiEqualRegion
( PresSpaceHandle               : HPS;
  Src1RegHandle                 : HRGN;
  Src2Reghandle                 : HRGN
)                               : LONGINT;

PROCEDURE GpiOffsetRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  VAR Offset                    : POINTL
)                               : BOOLEAN;

PROCEDURE GpiPaintRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN
)                               : LONGINT;

PROCEDURE GpiFrameRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  VAR Thickness                 : SIZEL
)                               : LONGINT;

PROCEDURE GpiPtInRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  VAR Point                     : POINTL
)                               : LONGINT;

PROCEDURE GpiQueryRegionBox
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  VAR Bound                     : RECTL
)                               : LONGINT;

PROCEDURE GpiQueryRegionRects
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  Bound                         : PRECTL;
  VAR Control                   : RGNRECT;
  VAR Rects                     : ARRAY OF RECTL
)                               : BOOLEAN;

PROCEDURE GpiRectInRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  VAR Rect                      : RECTL
)                               : LONGINT;

PROCEDURE GpiSetRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  Count                         : LONGINT;
  VAR Rectangles                : ARRAY OF RECTL
)                               : BOOLEAN;


(*** clip region functions *)

PROCEDURE GpiSetClipRegion
( PresSpaceHandle               : HPS;
  RegHandle                     : HRGN;
  VAR OldRegHandle              : HRGN
)                               : LONGINT;

PROCEDURE GpiQueryClipRegion
( PresSpaceHandle               : HPS
)                               : HRGN;

PROCEDURE GpiQueryClipBox
( PresSpaceHandle               : HPS;
  VAR Bound                     : RECTL
)                               : LONGINT;

PROCEDURE GpiExcludeClipRectangle
( PresSpaceHandle               : HPS;
  VAR Rectangle                 : RECTL
)                               : LONGINT;

PROCEDURE GpiIntersectClipRectangle
( PresSpaceHandle               : HPS;
  VAR Rectangle                 : RECTL
)                               : LONGINT;

PROCEDURE GpiOffsetClipRegion
( PresSpaceHandle               : HPS;
  VAR Point                     : POINTL
)                               : LONGINT;

END GPIREGIONS.
