Pango.Matrix

Entities

Record Types

Subprograms

Description

A structure specifying a transformation between user-space coordinates and device coordinates. The transformation is given by

x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;

Concat

procedure Concat (Self : Pango_Matrix; New_Matrix : Pango_Matrix)

Changes the transformation represented by Matrix to be the transformation given by first applying transformation given by New_Matrix then applying the original transformation. Since: gtk+ 1.6

Parameters
Self
New_Matrix

a Pango.Matrix.Pango_Matrix

Copy

function Copy (Self : Pango_Matrix) return Pango_Matrix

Copies a Pango.Matrix.Pango_Matrix. Since: gtk+ 1.6

Parameters
Self
Return Value

the newly allocated Pango.Matrix.Pango_Matrix, which should be freed with Pango.Matrix.Free, or null if Matrix was null.

Free

procedure Free (Self : Pango_Matrix)

Free a Pango.Matrix.Pango_Matrix created with Pango.Matrix.Copy. Since: gtk+ 1.6

Parameters
Self

From_Object_Free

function From_Object_Free (B : access Pango_Matrix) return Pango_Matrix

A structure specifying a transformation between user-space coordinates and device coordinates. The transformation is given by

x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0;
y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;
Parameters
B
Return Value

Get_Font_Scale_Factor

function Get_Font_Scale_Factor (Self : Pango_Matrix) return Gdouble

Returns the scale factor of a matrix on the height of the font. That is, the scale factor in the direction perpendicular to the vector that the X coordinate is mapped to. If the scale in the X coordinate is needed as well, use Pango.Matrix.Get_Font_Scale_Factors. Since: gtk+ 1.12

Parameters
Self
Return Value

the scale factor of Matrix on the height of the font, or 1.0 if Matrix is null.

Get_Font_Scale_Factors

procedure Get_Font_Scale_Factors
   (Self   : Pango_Matrix;
    Xscale : out Gdouble;
    Yscale : out Gdouble)

Calculates the scale factor of a matrix on the width and height of the font. That is, Xscale is the scale factor in the direction of the X coordinate, and Yscale is the scale factor in the direction perpendicular to the vector that the X coordinate is mapped to. Note that output numbers will always be non-negative. Since: gtk+ 1.38

Parameters
Self
Xscale

output scale factor in the x direction, or null

Yscale

output scale factor perpendicular to the x direction, or null

Get_Type

function Get_Type return Glib.GType
Return Value

Pango_Matrix

type Pango_Matrix is record
   Xx : Gdouble;
   Xy : Gdouble;
   Yx : Gdouble;
   Yy : Gdouble;
   X0 : Gdouble;
   Y0 : Gdouble;
end record;
Record fields
Xx
Xy
Yx
Yy
X0
Y0

Rotate

procedure Rotate (Self : in out Pango_Matrix; Degrees : Gdouble)

Changes the transformation represented by Matrix to be the transformation given by first rotating by Degrees degrees counter-clockwise then applying the original transformation. Since: gtk+ 1.6

Parameters
Self
Degrees

degrees to rotate counter-clockwise

Scale

procedure Scale
   (Self    : in out Pango_Matrix;
    Scale_X : Gdouble;
    Scale_Y : Gdouble)

Changes the transformation represented by Matrix to be the transformation given by first scaling by Sx in the X direction and Sy in the Y direction then applying the original transformation. Since: gtk+ 1.6

Parameters
Self
Scale_X

amount to scale by in X direction

Scale_Y

amount to scale by in Y direction

Transform_Distance

procedure Transform_Distance
   (Self : Pango_Matrix;
    Dx   : in out Gdouble;
    Dy   : in out Gdouble)

Transforms the distance vector (Dx,Dy) by Matrix. This is similar to Pango.Matrix.Transform_Point except that the translation components of the transformation are ignored. The calculation of the returned vector is as follows:

dx2 = dx1 * xx + dy1 * xy;
dy2 = dx1 * yx + dy1 * yy;

Affine transformations are position invariant, so the same vector always transforms to the same vector. If (X1,Y1) transforms to (X2,Y2) then (X1+Dx1,Y1+Dy1) will transform to (X1+Dx2,Y1+Dy2) for all values of X1 and X2. Since: gtk+ 1.16

Parameters
Self
Dx

in/out X component of a distance vector

Dy

in/out Y component of a distance vector

Transform_Pixel_Rectangle

procedure Transform_Pixel_Rectangle
   (Self : Pango_Matrix;
    Rect : in out Pango_Rectangle)

First transforms the Rect using Matrix, then calculates the bounding box of the transformed rectangle. The rectangle should be in device units (pixels). This function is useful for example when you want to draw a rotated Pangolayout to an image buffer, and want to know how large the image should be and how much you should shift the layout when rendering. For better accuracy, you should use Pango.Matrix.Transform_Rectangle on original rectangle in Pango units and convert to pixels afterward using pango_extents_to_pixels's first argument. Since: gtk+ 1.16

Parameters
Self
Rect

in/out bounding box in device units, or null

Transform_Point

procedure Transform_Point
   (Self : Pango_Matrix;
    X    : in out Gdouble;
    Y    : in out Gdouble)

Transforms the point (X, Y) by Matrix. Since: gtk+ 1.16

Parameters
Self
X

in/out X position

Y

in/out Y position

Transform_Rectangle

procedure Transform_Rectangle
   (Self : Pango_Matrix;
    Rect : in out Pango_Rectangle)

First transforms Rect using Matrix, then calculates the bounding box of the transformed rectangle. The rectangle should be in Pango units. This function is useful for example when you want to draw a rotated Pangolayout to an image buffer, and want to know how large the image should be and how much you should shift the layout when rendering. If you have a rectangle in device units (pixels), use Pango.Matrix.Transform_Pixel_Rectangle. If you have the rectangle in Pango units and want to convert to transformed pixel bounding box, it is more accurate to transform it first (using this function) and pass the result to pango_extents_to_pixels, first argument, for an inclusive rounded rectangle. However, there are valid reasons that you may want to convert to pixels first and then transform, for example when the transformed coordinates may overflow in Pango units (large matrix translation for example). Since: gtk+ 1.16

Parameters
Self
Rect

in/out bounding box in Pango units, or null

Translate

procedure Translate
   (Self : in out Pango_Matrix;
    Tx   : Gdouble;
    Ty   : Gdouble)

Changes the transformation represented by Matrix to be the transformation given by first translating by (Tx, Ty) then applying the original transformation. Since: gtk+ 1.6

Parameters
Self
Tx

amount to translate in the X direction

Ty

amount to translate in the Y direction