chmatrix, bldmatrix, cpmatrix - change, build, and copy HCRST matrix


#include <mpict_p.h>

chmatrix (par, pic)
struct picpar *par;
PICT pic;

bldmatrix (par, matrix)
struct picpar *par;
MATRIX * matrix;

cpmatrix (matrix, pic)
MATRIX * matrix;
PICT pic;


chmatrix changes the rotation, scale, and translation parameters of an existing top picture by modifying the internal transformation matrix associated with that picture. All previously specified transformation values are changed.

The argument par points to a structure (also described in mkpar(3u) that includes:

struct picpar{
  char  pp_flags;       /* flags indicating which parameters are set */
  int   pp_x;           /* x position */
  int   pp_y;           /* y position */
  int   pp_intcol;      /* intensity  */
  float pp_xscale;      /* x scale factor */
  float pp_yscale;      /* y scale factor */
  float pp_xsctr;       /* x center for scaling */
  float pp_ysctr;       /* y center for scaling */
  int   pp_xlclip;      /* lower x clip */
  int   pp_ylclip;      /* lower y clip */
  int   pp_xuclip;      /* upper x clip */
  int   pp_yuclip;      /* upper y clip */
  int   pp_xtran;       /* x translation */
  int   pp_ytran;       /* y translation */
  int   pp_rot;         /* rotation angle (degrees) */
  float pp_xrctr;       /* x center for rotation */
  float pp_yctr;        /* y center for rotation */
The pp_flags field contains flags that identify the HCRST parameters that are specified in the other fields. These are:

scale parameters

rotate parameters

translation parameters

The P_SCALE flag indicates that scaling parameters are provided. pp_xscale and pp_yscale specify the x and y scale factors. pp_xsctr and pp_ysctc specify the absolute screen coordinate about which the scaling is centered. If P_SCALE flag is not set, the picture is not scaled.

The P_ROTATE flag indicates that rotation parameters are provided. pp_rot specifies a rotation angle in degrees. pp_xrctr and pp_yctr specifies the absolute screen coordinate about which the scaling is centered. If P_ROTATE flag is not set, the picture is not rotated.

The P_TRAN flag indicates that horizontal and vertical translation parameters, pp_xtran and pp_ytran are provided. If P_TRAN flag is not set, the picture is not translated.

pic specifies the top picture to be changed.

bldtmatrix is used to build and return a transformation matrix that will be copied into a top picture at a later time by cptmatrix. par specifies the scale, rotation, and translation parameters as above. matrix is a pointer to a type MATRIX array of NMATRIXELT (currently 6) elements. The matrix is provided by the calling routine. bldmatrix fills this matrix with new transformation values. cptmatrix copies matrix to top picture pic at a later time.




chmatrix and cptmatrix will fail, printing an appropriate error message and returning -1 for any of the following reasons: