DEFINITION MODULE GPITRANSFORMS;

(************************************************************************
  OS/2 2.0 interface for Presentation Manager
           GPI Transform and Transform Conversion.

  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, POINTL, RECTL;
FROM   GPIDEF  IMPORT FIXED;

CONST (* co-ordinates space for GpiConvert *)
  CVTC_WORLD                   = 1;
  CVTC_MODEL                   = 2;
  CVTC_DEFAULTPAGE             = 3;
  CVTC_PAGE                    = 4;
  CVTC_DEVICE                  = 5;

CONST (* type of transformation for GpiSetSegmentTransformMatrix *)
  TRANSFORM_REPLACE            = 0;
  TRANSFORM_ADD                = 1;
  TRANSFORM_PREEMPT            = 2;

TYPE (* transform matrix *)
  MATRIXLF                     = RECORD  (* matlf *)
    CASE                         : TYPEPREFIX OF
    | TRUE                       :
      fxM11                      : FIXED;
      fxM12                      : FIXED;
      lM13                       : LONGINT;
      fxM21                      : FIXED;
      fxM22                      : FIXED;
      lM23                       : LONGINT;
      lM31                       : LONGINT;
      lM32                       : LONGINT;
      lM33                       : LONGINT;
    | FALSE                      :
      M11                        : FIXED;
      M12                        : FIXED;
      M13                        : LONGINT;
      M21                        : FIXED;
      M22                        : FIXED;
      M23                        : LONGINT;
      M31                        : LONGINT;
      M32                        : LONGINT;
      M33                        : LONGINT;
    END;                         END;
  PMATRIXLF                    = POINTER TO MATRIXLF;

(*** transform and transform conversion functions *)

PROCEDURE GpiQuerySegmentTransformMatrix
( PresSpaceHandle              : HPS;
  SegId                        : LONGINT;
  Count                        : LONGINT;
  VAR Matrix                   : ARRAY OF MATRIXLF
)                              : BOOLEAN;

PROCEDURE GpiSetSegmentTransformMatrix
( PresSpaceHandle              : HPS;
  SegId                        : LONGINT;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT
)                              : BOOLEAN;

PROCEDURE GpiConvert
( PresSpaceHandle              : HPS;
  Src                          : LONGINT;
  Targ                         : LONGINT;
  Count                        : LONGINT;
  VAR Points                   : ARRAY OF POINTL
)                              : BOOLEAN;

PROCEDURE GpiConvertWithMatrix
( PresSpaceHandle              : HPS;
  PointsCount                  : LONGINT;
  VAR Points                   : ARRAY OF POINTL;
  MatrixCount                  : LONGINT;
  VAR Matrix                   : MATRIXLF
)                              : BOOLEAN;

PROCEDURE GpiQueryModelTransformMatrix
( PresSpaceHandle              : HPS;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF
)                              : BOOLEAN;

PROCEDURE GpiSetModelTransformMatrix
( PresSpaceHandle              : HPS;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT
)                              : BOOLEAN;

PROCEDURE GpiCallSegmentMatrix
( PresSpaceHandle              : HPS;
  Segment                      : LONGINT;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT
)                              : LONGINT;

PROCEDURE GpiQueryDefaultViewMatrix
( PresSpaceHandle              : HPS;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF
)                              : BOOLEAN;

PROCEDURE GpiSetDefaultViewMatrix
( PresSpaceHandle              : HPS;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT
)                              : BOOLEAN;

PROCEDURE GpiQueryPageViewport
( PresSpaceHandle              : HPS;
  VAR Viewport                 : RECTL
)                              : BOOLEAN;

PROCEDURE GpiSetPageViewport
( PresSpaceHandle              : HPS;
  VAR Viewport                 : RECTL
)                              : BOOLEAN;

PROCEDURE GpiQueryViewingTransformMatrix
( PresSpaceHandle              : HPS;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF
)                              : BOOLEAN;

PROCEDURE GpiSetViewingTransformMatrix
( PresSpaceHandle              : HPS;
  Count                        : LONGINT;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT
)                              : BOOLEAN;


(*** transform helper routines *)

PROCEDURE GpiTranslate
( PresSpaceHandle              : HPS;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT;
  VAR TranslationPoint         : POINTL
)                              : BOOLEAN;

PROCEDURE GpiScale
( PresSpaceHandle              : HPS;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT;
  VAR ScaleFactors             : ARRAY OF FIXED;
  VAR CenterPoint              : POINTL
)                              : BOOLEAN;

PROCEDURE GpiRotate
( PresSpaceHandle              : HPS;
  VAR Matrix                   : MATRIXLF;
  Options                      : LONGINT;
  Angle                        : FIXED;
  VAR CenterPoint              : POINTL
)                              : BOOLEAN;

(*** general clipping functions *)

PROCEDURE GpiSetGraphicsField
( PresSpaceHandle              : HPS;
  VAR Field                    : RECTL
)                              : BOOLEAN;

PROCEDURE GpiQueryGraphicsField
( PresSpaceHandle              : HPS;
  VAR Field                    : RECTL
)                              : BOOLEAN;

PROCEDURE GpiSetViewingLimits
( PresSpaceHandle              : HPS;
  VAR Limits                   : RECTL
)                              : BOOLEAN;

PROCEDURE GpiQueryViewingLimits
( PresSpaceHandle              : HPS;
  VAR Limits                   : RECTL
)                              : BOOLEAN;

END GPITRANSFORMS.
