| 1 | /* Pango |
| 2 | * pango-matrix.h: Matrix manipulation routines |
| 3 | * |
| 4 | * Copyright (C) 2002, 2006 Red Hat Software |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Library General Public |
| 17 | * License along with this library; if not, write to the |
| 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __PANGO_MATRIX_H__ |
| 23 | #define __PANGO_MATRIX_H__ |
| 24 | |
| 25 | #include <glib.h> |
| 26 | #include <glib-object.h> |
| 27 | |
| 28 | G_BEGIN_DECLS |
| 29 | |
| 30 | typedef struct _PangoMatrix PangoMatrix; |
| 31 | |
| 32 | /** |
| 33 | * PangoMatrix: |
| 34 | * @xx: 1st component of the transformation matrix |
| 35 | * @xy: 2nd component of the transformation matrix |
| 36 | * @yx: 3rd component of the transformation matrix |
| 37 | * @yy: 4th component of the transformation matrix |
| 38 | * @x0: x translation |
| 39 | * @y0: y translation |
| 40 | * |
| 41 | * A structure specifying a transformation between user-space |
| 42 | * coordinates and device coordinates. The transformation |
| 43 | * is given by |
| 44 | * |
| 45 | * <programlisting> |
| 46 | * x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0; |
| 47 | * y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0; |
| 48 | * </programlisting> |
| 49 | * |
| 50 | * Since: 1.6 |
| 51 | **/ |
| 52 | struct _PangoMatrix |
| 53 | { |
| 54 | double xx; |
| 55 | double xy; |
| 56 | double yx; |
| 57 | double yy; |
| 58 | double x0; |
| 59 | double y0; |
| 60 | }; |
| 61 | |
| 62 | /** |
| 63 | * PANGO_TYPE_MATRIX: |
| 64 | * |
| 65 | * The GObject type for #PangoMatrix |
| 66 | **/ |
| 67 | #define PANGO_TYPE_MATRIX (pango_matrix_get_type ()) |
| 68 | |
| 69 | /** |
| 70 | * PANGO_MATRIX_INIT: |
| 71 | * |
| 72 | * Constant that can be used to initialize a PangoMatrix to |
| 73 | * the identity transform. |
| 74 | * |
| 75 | * <informalexample><programlisting> |
| 76 | * PangoMatrix matrix = PANGO_MATRIX_INIT; |
| 77 | * pango_matrix_rotate (&matrix, 45.); |
| 78 | * </programlisting></informalexample> |
| 79 | * |
| 80 | * Since: 1.6 |
| 81 | **/ |
| 82 | #define PANGO_MATRIX_INIT { 1., 0., 0., 1., 0., 0. } |
| 83 | |
| 84 | /* for PangoRectangle */ |
| 85 | #include <pango/pango-types.h> |
| 86 | |
| 87 | PANGO_AVAILABLE_IN_1_6 |
| 88 | GType pango_matrix_get_type (void) G_GNUC_CONST; |
| 89 | |
| 90 | PANGO_AVAILABLE_IN_1_6 |
| 91 | PangoMatrix *pango_matrix_copy (const PangoMatrix *matrix); |
| 92 | PANGO_AVAILABLE_IN_1_6 |
| 93 | void pango_matrix_free (PangoMatrix *matrix); |
| 94 | |
| 95 | PANGO_AVAILABLE_IN_1_6 |
| 96 | void pango_matrix_translate (PangoMatrix *matrix, |
| 97 | double tx, |
| 98 | double ty); |
| 99 | PANGO_AVAILABLE_IN_1_6 |
| 100 | void pango_matrix_scale (PangoMatrix *matrix, |
| 101 | double scale_x, |
| 102 | double scale_y); |
| 103 | PANGO_AVAILABLE_IN_1_6 |
| 104 | void pango_matrix_rotate (PangoMatrix *matrix, |
| 105 | double degrees); |
| 106 | PANGO_AVAILABLE_IN_1_6 |
| 107 | void pango_matrix_concat (PangoMatrix *matrix, |
| 108 | const PangoMatrix *new_matrix); |
| 109 | PANGO_AVAILABLE_IN_1_16 |
| 110 | void pango_matrix_transform_point (const PangoMatrix *matrix, |
| 111 | double *x, |
| 112 | double *y); |
| 113 | PANGO_AVAILABLE_IN_1_16 |
| 114 | void pango_matrix_transform_distance (const PangoMatrix *matrix, |
| 115 | double *dx, |
| 116 | double *dy); |
| 117 | PANGO_AVAILABLE_IN_1_16 |
| 118 | void pango_matrix_transform_rectangle (const PangoMatrix *matrix, |
| 119 | PangoRectangle *rect); |
| 120 | PANGO_AVAILABLE_IN_1_16 |
| 121 | void pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix, |
| 122 | PangoRectangle *rect); |
| 123 | PANGO_AVAILABLE_IN_1_12 |
| 124 | double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix) G_GNUC_PURE; |
| 125 | PANGO_AVAILABLE_IN_1_38 |
| 126 | void pango_matrix_get_font_scale_factors (const PangoMatrix *matrix, |
| 127 | double *xscale, double *yscale); |
| 128 | |
| 129 | |
| 130 | G_END_DECLS |
| 131 | |
| 132 | #endif /* __PANGO_MATRIX_H__ */ |
| 133 | |