Upload tizen 2.0 beta source
[external/pango1.0.git] / pango / pangoxft-render.h
1 /* Pango
2  * pangoxft-render.h: Rendering routines for the Xft library
3  *
4  * Copyright (C) 2004 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 __PANGOXFT_RENDER_H__
23 #define __PANGOXFT_RENDER_H__
24
25 #include <pango/pango-renderer.h>
26
27 G_BEGIN_DECLS
28
29 #define _XFT_NO_COMPAT_
30 #include <X11/Xlib.h>
31 #include <X11/Xft/Xft.h>
32 #if defined(XftVersion) && XftVersion >= 20000
33 #else
34 #error "must have Xft version 2 or newer"
35 #endif
36
37 typedef struct _PangoXftRenderer        PangoXftRenderer;
38 typedef struct _PangoXftRendererClass   PangoXftRendererClass;
39 typedef struct _PangoXftRendererPrivate PangoXftRendererPrivate;
40
41 #define PANGO_TYPE_XFT_RENDERER            (pango_xft_renderer_get_type())
42 #define PANGO_XFT_RENDERER(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_RENDERER, PangoXftRenderer))
43 #define PANGO_IS_XFT_RENDERER(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_XFT_RENDERER))
44 #define PANGO_XFT_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass))
45 #define PANGO_IS_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_XFT_RENDERER))
46 #define PANGO_XFT_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass))
47
48 /**
49  * PangoXftRenderer
50  *
51  * #PangoXftRenderer is a subclass of #PangoRenderer used for rendering
52  * with Pango's Xft backend. It can be used directly, or it can be
53  * further subclassed to modify exactly how drawing of individual
54  * elements occurs.
55  *
56  * Since: 1.8
57  */
58 struct _PangoXftRenderer
59 {
60   /*< private >*/
61   PangoRenderer parent_instance;
62
63   Display *display;
64   int screen;
65   XftDraw *draw;
66
67   PangoXftRendererPrivate *priv;
68 };
69
70 /**
71  * PangoXftRendererClass
72  * @composite_trapezoids: draw the specified trapezoids using
73  *   the current color and other attributes for @part
74  * @composite_glyphs: draw the specified glyphs using
75  *   the current foreground color and other foreground
76  *   attributes
77  *
78  * The class structure for #PangoXftRenderer
79  *
80  * Since: 1.8
81  */
82 struct _PangoXftRendererClass
83 {
84   /*< private >*/
85   PangoRendererClass parent_class;
86
87   /*< public >*/
88   void (*composite_trapezoids) (PangoXftRenderer *xftrenderer,
89                                 PangoRenderPart   part,
90                                 XTrapezoid       *trapezoids,
91                                 int               n_trapezoids);
92   void (*composite_glyphs)     (PangoXftRenderer *xftrenderer,
93                                 XftFont          *xft_font,
94                                 XftGlyphSpec     *glyphs,
95                                 int               n_glyphs);
96 };
97
98 GType pango_xft_renderer_get_type    (void) G_GNUC_CONST;
99
100 PangoRenderer *pango_xft_renderer_new                 (Display          *display,
101                                                        int               screen);
102 void           pango_xft_renderer_set_draw            (PangoXftRenderer *xftrenderer,
103                                                        XftDraw          *draw);
104 void           pango_xft_renderer_set_default_color   (PangoXftRenderer *xftrenderer,
105                                                        PangoColor       *default_color);
106
107 void pango_xft_render             (XftDraw          *draw,
108                                    XftColor         *color,
109                                    PangoFont        *font,
110                                    PangoGlyphString *glyphs,
111                                    gint              x,
112                                    gint              y);
113 void pango_xft_picture_render     (Display          *display,
114                                    Picture           src_picture,
115                                    Picture           dest_picture,
116                                    PangoFont        *font,
117                                    PangoGlyphString *glyphs,
118                                    gint              x,
119                                    gint              y);
120 void pango_xft_render_transformed (XftDraw          *draw,
121                                    XftColor         *color,
122                                    PangoMatrix      *matrix,
123                                    PangoFont        *font,
124                                    PangoGlyphString *glyphs,
125                                    int               x,
126                                    int               y);
127 void pango_xft_render_layout_line (XftDraw          *draw,
128                                    XftColor         *color,
129                                    PangoLayoutLine  *line,
130                                    int               x,
131                                    int               y);
132 void pango_xft_render_layout      (XftDraw          *draw,
133                                    XftColor         *color,
134                                    PangoLayout      *layout,
135                                    int               x,
136                                    int               y);
137
138 G_END_DECLS
139
140 #endif /* __PANGOXFT_RENDER_H__ */
141