diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-05-28 22:53:24 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-05-28 22:53:24 +0000 |
commit | 31e0850c421fcc777c452121eb5c68fcf2ce3cda (patch) | |
tree | 3ff00cfd6e238df998bcf3c1b95fc059582ab1ce /pango/pango-types.h | |
parent | 3ef5e7edc246615f45accafca5d83739b14ca66b (diff) | |
download | pango-31e0850c421fcc777c452121eb5c68fcf2ce3cda.tar.gz |
Add PangoMatrix type for affine transforms.
Fri May 28 11:39:39 2004 Owen Taylor <otaylor@redhat.com>
* pango/pango-types.h pango/pango-utils.c: Add PangoMatrix
type for affine transforms.
* configure.in pango.pc.in pango/Makefile.am: Add a -lm
dependency for PangoMatrix operations.
* pango/pango-context.[ch]: Add pango_context_set/get_matrix().
* pango/pangoft2-render.c pango/pangoft2-private.h: Add
code for drawing antialiased transformed rectangles and
squiggly error underlines.
* pango/pangoft2.[ch]: Add pango_ft2_render_transformed(),
pango_ft2_render_layout_subpixel(),
pango_ft2_render_layout_line_subpixel(), implement transformed
rendering.
* pango/pangofc-font.c: Pass any transformation matrix on to
fontconfig when creating the pattern for a PangoFcFont.
Diffstat (limited to 'pango/pango-types.h')
-rw-r--r-- | pango/pango-types.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/pango/pango-types.h b/pango/pango-types.h index 6f515ead..55283fbd 100644 --- a/pango/pango-types.h +++ b/pango/pango-types.h @@ -33,6 +33,8 @@ typedef struct _PangoEngineLang PangoEngineLang; typedef struct _PangoEngineShape PangoEngineShape; typedef struct _PangoFont PangoFont; + +typedef struct _PangoMatrix PangoMatrix; typedef struct _PangoRectangle PangoRectangle; /* Dummy typedef - internally it's a 'const char *' */ @@ -53,6 +55,61 @@ struct _PangoRectangle int height; }; +/** + * PangoMatrix: + * @xx: 1st component of the transformation matrix + * @xy: 2nd component of the transformation matrix + * @yx: 3rd component of the transformation matrix + * @yy: 4th component of the transformation matrix + * @x0: x translation + * @y0: y translation + * + * A structure specifying a transformation between user-space + * coordinates and device coordinates. The transformation + * is given by + * + * <programlisting> + * x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0; + * y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0; + * </programlisting> + **/ +struct _PangoMatrix +{ + double xx; + double xy; + double yx; + double yy; + double x0; + double y0; +}; + +/** + * PANGO_MATRIX_INIT + * + * Constant that can be used to initialize a PangoMatrix to + * the identity transform. + * + * <informalexample><programlisting> + * PangoMatrix matrix = PANGO_MATRIX_INIT; + * pango_matrix_rotate (&matrix, 45.); + * </programlisting></informalexample> + **/ +#define PANGO_MATRIX_INIT { 1., 0., 0., 1., 0., 0. }; + +PangoMatrix *pango_matrix_copy (PangoMatrix *matrix); +void pango_matrix_free (PangoMatrix *matrix); + +void pango_matrix_translate (PangoMatrix *matrix, + double tx, + double ty); +void pango_matrix_scale (PangoMatrix *matrix, + double scale_x, + double scale_y); +void pango_matrix_rotate (PangoMatrix *matrix, + double degrees); +void pango_matrix_concat (PangoMatrix *matrix, + PangoMatrix *new); + #define PANGO_SCALE 1024 #define PANGO_PIXELS(d) (((d) >= 0) ? \ ((d) + PANGO_SCALE / 2) / PANGO_SCALE : \ |