Package ch.bailu.gtk.pango
Class Matrix
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.pango.Matrix
- All Implemented Interfaces:
PointerInterface
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;
```
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;
```
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
x translationstatic final String
1st component of the transformation matrixstatic final String
2nd component of the transformation matrixstatic final String
y translationstatic final String
3rd component of the transformation matrixstatic final String
4th component of the transformation matrix -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Changes the transformation represented by @matrix to be the
transformation given by first applying transformation
given by @new_matrix then applying the original transformation.copy()
Copies a `PangoMatrix`.void
free()
Free a `PangoMatrix`.static ClassHandler
double
x translationdouble
1st component of the transformation matrixdouble
2nd component of the transformation matrixdouble
y translationdouble
3rd component of the transformation matrixdouble
4th component of the transformation matrixdouble
Returns the scale factor of a matrix on the height of the font.static int
static long
static TypeSystem.TypeSize
double
Gets the slant ratio of a matrix.static long
static TypeSystem.TypeSize
void
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.void
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.void
setFieldX0
(double x0) x translationvoid
setFieldXx
(double xx) 1st component of the transformation matrixvoid
setFieldXy
(double xy) 2nd component of the transformation matrixvoid
setFieldY0
(double y0) y translationvoid
setFieldYx
(double yx) 3rd component of the transformation matrixvoid
setFieldYy
(double yy) 4th component of the transformation matrixvoid
First transforms the @rect using @matrix, then calculates the bounding box
of the transformed rectangle.void
transformRectangle
(Rectangle rect) First transforms @rect using @matrix, then calculates the bounding box
of the transformed rectangle.void
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.Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
XX
1st component of the transformation matrix- See Also:
-
XY
2nd component of the transformation matrix- See Also:
-
YX
3rd component of the transformation matrix- See Also:
-
YY
4th component of the transformation matrix- See Also:
-
X0
x translation- See Also:
-
Y0
y translation- See Also:
-
-
Constructor Details
-
Matrix
-
Matrix
public Matrix()
-
-
Method Details
-
getClassHandler
-
setFieldXx
public void setFieldXx(double xx) 1st component of the transformation matrix -
getFieldXx
public double getFieldXx()1st component of the transformation matrix -
setFieldXy
public void setFieldXy(double xy) 2nd component of the transformation matrix -
getFieldXy
public double getFieldXy()2nd component of the transformation matrix -
setFieldYx
public void setFieldYx(double yx) 3rd component of the transformation matrix -
getFieldYx
public double getFieldYx()3rd component of the transformation matrix -
setFieldYy
public void setFieldYy(double yy) 4th component of the transformation matrix -
getFieldYy
public double getFieldYy()4th component of the transformation matrix -
setFieldX0
public void setFieldX0(double x0) x translation -
getFieldX0
public double getFieldX0()x translation -
setFieldY0
public void setFieldY0(double y0) y translation -
getFieldY0
public double getFieldY0()y translation -
concat
Changes the transformation represented by @matrix to be the
transformation given by first applying transformation
given by @new_matrix then applying the original transformation.- Parameters:
new_matrix
- a `PangoMatrix`
-
copy
Copies a `PangoMatrix`.- Returns:
- the newly allocated `PangoMatrix`
-
free
public void free()Free a `PangoMatrix`. -
getFontScaleFactor
public double getFontScaleFactor()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].- Returns:
- the scale factor of @matrix on the height of the font, or 1.0 if @matrix is %NULL.
-
getSlantRatio
public double getSlantRatio()Gets the slant ratio of a matrix.
For a simple shear matrix in the form:
1 λ
0 1
this is simply λ.- Returns:
- the slant ratio of @matrix
-
rotate
public void 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.- Parameters:
degrees
- degrees to rotate counter-clockwise
-
scale
public void 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.- Parameters:
scale_x
- amount to scale by in X directionscale_y
- amount to scale by in Y direction
-
transformPixelRectangle
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.- Parameters:
rect
- in/out bounding box in device units
-
transformRectangle
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).- Parameters:
rect
- in/out bounding box in Pango units
-
translate
public void 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.- Parameters:
tx
- amount to translate in the X directionty
- amount to translate in the Y direction
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-