summaryrefslogtreecommitdiff
path: root/pango/pangoxft-render.h
blob: 2d12df052abfea2ecceb9e1c8576e4c17e44e3dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* Pango
 * pangoxft-render.h: Rendering routines for the Xft library
 *
 * Copyright (C) 2004 Red Hat Software
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __PANGOXFT_RENDER_H__
#define __PANGOXFT_RENDER_H__

#include <pango/pango-renderer.h>

G_BEGIN_DECLS

#define _XFT_NO_COMPAT
#define _XFTCOMPAT_H_
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#if defined(XftVersion) && XftVersion >= 20000
#else
#error "must have Xft version 2 or newer"
#endif

typedef struct _PangoXftRenderer        PangoXftRenderer;
typedef struct _PangoXftRendererClass   PangoXftRendererClass;
typedef struct _PangoXftRendererPrivate PangoXftRendererPrivate;

#define PANGO_TYPE_XFT_RENDERER            (pango_xft_renderer_get_type())
#define PANGO_XFT_RENDERER(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_RENDERER, PangoXftRenderer))
#define PANGO_IS_XFT_RENDERER(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_XFT_RENDERER))
#define PANGO_XFT_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass))
#define PANGO_IS_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_XFT_RENDERER))
#define PANGO_XFT_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass))

/**
 * PangoXftRenderer
 *
 * #PangoXftRenderer is a subclass of #PangoRenderer used for rendering
 * with Pango's Xft backend. It can be used directly, or it can be
 * further subclassed to modify exactly how drawing of individual
 * elements occurs.
 *
 * Since: 1.8
 */
struct _PangoXftRenderer
{
  /*< private >*/	
  PangoRenderer parent_instance;

  Display *display;
  int screen;
  XftDraw *draw;

  PangoXftRendererPrivate *priv;
};

/**
 * PangoXftRendererClass
 * @composite_trapezoids: draw the specified trapezoids using
 *   the current color and other attributes for @part
 * @composite_glyphs: draw the specified glyphs using
 *   the current foreground color and other foreground
 *   attributes 
 *
 * The class structure for #PangoXftRenderer
 *
 * Since: 1.8
 */
struct _PangoXftRendererClass
{
  /*< private >*/	
  PangoRendererClass parent_class;

  /*< public >*/
  void (*composite_trapezoids) (PangoXftRenderer *xftrenderer,
				PangoRenderPart   part,
				XTrapezoid       *trapezoids,
				int               n_trapezoids);
  void (*composite_glyphs)     (PangoXftRenderer *xftrenderer,
				XftFont          *xft_font,
				XftGlyphSpec     *glyphs,
				int               n_glyphs);
};

GType pango_xft_renderer_get_type    (void);

PangoRenderer *pango_xft_renderer_new                 (Display          *display,
						       int               screen);
void           pango_xft_renderer_set_draw            (PangoXftRenderer *xftrenderer,
						       XftDraw          *draw);
void           pango_xft_renderer_set_default_color   (PangoXftRenderer *xftrenderer,
						       PangoColor       *default_color);

void pango_xft_render             (XftDraw          *draw,
				   XftColor         *color,
				   PangoFont        *font,
				   PangoGlyphString *glyphs,
				   gint              x,
				   gint              y);
void pango_xft_picture_render     (Display          *display,
				   Picture           src_picture,
				   Picture           dest_picture,
				   PangoFont        *font,
				   PangoGlyphString *glyphs,
				   gint              x,
				   gint              y);
void pango_xft_render_transformed (XftDraw          *draw,
				   XftColor         *color,
				   PangoMatrix      *matrix,
				   PangoFont        *font,
				   PangoGlyphString *glyphs,
				   int               x,
				   int               y);
void pango_xft_render_layout_line (XftDraw          *draw,
				   XftColor         *color,
				   PangoLayoutLine  *line,
				   int               x,
				   int               y);
void pango_xft_render_layout      (XftDraw          *draw,
				   XftColor         *color,
				   PangoLayout      *layout,
				   int               x,
				   int               y);

G_END_DECLS

#endif /* __PANGOXFT_RENDER_H__ */