Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PangoMatrixLayout

[12:14] static extends: object

Generated struct layout helper for GIR record Matrix.

Methods

  • layout ()

    Returns the Panama struct layout for Matrix.

class: PangoMatrix

[35:7] extends: object

A PangoMatrix specifies a transformation between user-space 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; ```

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • PangoMatrix (Handle = null)

    Creates a new Matrix by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • concat (object new_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.
    • @p new_matrix is a PangoMatrix.
    • @r None.
  • copy ()

    Copies a PangoMatrix.

    • @r the newly allocated PangoMatrix.
  • free ()

    Free a PangoMatrix.

    • @r None.
  • get_font_scale_factor ()

    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 [method@Pango.Matrix.get_font_scale_factors].

    • @r the scale factor of @matrix on the height of the font, or 1.0 if
    • @matrix is %NULL..
  • get_font_scale_factors ()

    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.

    • @p xscale is output scale factor in the x direction.
    • @p yscale is output scale factor perpendicular to the x direction.
    • @r None.
  • get_slant_ratio ()

    Gets the slant ratio of a matrix. For a simple shear matrix in the form: 1 λ 0 1 this is simply λ.

    • @r the slant ratio of @matrix.
  • rotate (double degrees)

    Changes the transformation represented by @matrix to be the transformation given by first rotating by @degrees degrees counter-clockwise then applying the original transformation.

    • @p degrees is degrees to rotate counter-clockwise.
    • @r None.
  • scale (double scale_x, double scale_y)

    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.

    • @p scale_x is amount to scale by in X direction.
    • @p scale_y is amount to scale by in Y direction.
    • @r None.
  • transform_distance (int dx, int dy)

    Transforms the distance vector (@dx,@dy) by @matrix. This is similar to [method@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.

    • @p dx is in/out X component of a distance vector.
    • @p dy is in/out Y component of a distance vector.
    • @r None.
  • transform_pixel_rectangle ()

    First transforms the @rect using @matrix, then calculates the bounding box of the transformed rectangle. 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 [method@Pango.Matrix.transform_rectangle] on original rectangle in Pango units and convert to pixels afterward using [func@extents_to_pixels]'s first argument.

    • @p rect is in/out bounding box in device units.
    • @r None.
  • transform_point (int x, int y)

    Transforms the point (@x, @y) by @matrix.

    • @p x is in/out X position.
    • @p y is in/out Y position.
    • @r None.
  • transform_rectangle ()

    First transforms @rect using @matrix, then calculates the bounding box of the transformed rectangle. 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 [method@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).

    • @p rect is in/out bounding box in Pango units.
    • @r None.
  • translate (double tx, double ty)

    Changes the transformation represented by @matrix to be the transformation given by first translating by (@tx, @ty) then applying the original transformation.

    • @p tx is amount to translate in the X direction.
    • @p ty is amount to translate in the Y direction.
    • @r None.