Date: Thu, 18 Aug 2022 03:19:03 -0500 (CDT) Message-ID: <450529308.25137.1660810743947@kb> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_25136_561019211.1660810743946" ------=_Part_25136_561019211.1660810743946 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html What do the elements a, b, c, d, h, v mean in a matrix like the = ASFixedMatrix?

# What do the elements a, b, c, d, h, v mean in a matrix like the ASF= ixedMatrix?

As in PostScript, in the Adobe PDF Library the matrix is the pri= mary method used to control where PDF elements are placed on a page, and th= e size (scale) of those elements:

1. a and b are the scale factors in X and Y positions of the movement in x=
2. c and d are scale factors in X and Y positions of the movement in y
3. h and v are absolute displacement in X and Y distances

These values are expressed in the format [a b c d h v]. So the first four numbers of the matrix are scal= e factors, and have no units. The last two describe how the object twill be= moved on the page. These two final values are in the units that were in ef= fect prior to the transformation. That is, if you add scaling, so that the = size of the element is doubled (a =3D 2), the units applying to values h an= d v will also double.

To scale an element evenly, use [Scale 0 0 Scale 0 0].

To move an element to a given point, use [1 0 0 1 Xpos Ypos].

The default unit is 1/72 of an inch, or one point. So [1 0 0 1 72 72] would move an object one inch (72 = points) to the right (h, or horizontal) and one inch (72 points) up (v, or = vertical).

Or, in another example, applying the matrix [2 0 0 1 -10 10] at a current position of [10,10] would take you to [10,20] in the transform= ed system:

Xnew =3D (a * Xold) + (c * Yold) + h and Ynew =3D (b * Xold) + (d * Yold) + v

where: a =3D 2; b =3D 0; c =3D 0; d =3D 1; h =3D -10; v =3D 10; Xold =3D 10= ; Yold =3D 10

thus:

10 =3D (2 * 10) + (0 * 10) + (-10) and 20 =3D (0 * 10) + (1 * 10) + 10

To rotate an image on the page a matrix, use the following algorithm as = a guide:

=20
```     vo=
id PDFMatrixRotate(ASFixedMatrix *M, float Angle)=20
{=20
double Sina, Cosa;=20
double Ma, Mb, Mc, Md;
return;
Ma =3D FixedToFloat (M->a);=20
Mb =3D FixedToFloat (M->b);=20
Mc =3D FixedToFloat (M->c);=20
Md =3D FixedToFloat (M->d);