File: pango-renderer.h

package info (click to toggle)
pango1.0 1.42.4-8~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,564 kB
  • sloc: ansic: 42,694; sh: 4,360; makefile: 1,075; python: 305; perl: 56; cpp: 20
file content (287 lines) | stat: -rw-r--r-- 9,419 bytes parent folder | download | duplicates (2)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/* Pango
 * pango-renderer.h: Base class for rendering
 *
 * Copyright (C) 2004, Red Hat, Inc.
 *
 * 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 __PANGO_RENDERER_H_
#define __PANGO_RENDERER_H_

#include <pango/pango-layout.h>

G_BEGIN_DECLS

#define PANGO_TYPE_RENDERER            (pango_renderer_get_type())
#define PANGO_RENDERER(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_RENDERER, PangoRenderer))
#define PANGO_IS_RENDERER(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_RENDERER))
#define PANGO_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_RENDERER, PangoRendererClass))
#define PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_RENDERER))
#define PANGO_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_RENDERER, PangoRendererClass))

typedef struct _PangoRenderer        PangoRenderer;
typedef struct _PangoRendererClass   PangoRendererClass;
typedef struct _PangoRendererPrivate PangoRendererPrivate;

/**
 * PangoRenderPart:
 * @PANGO_RENDER_PART_FOREGROUND: the text itself
 * @PANGO_RENDER_PART_BACKGROUND: the area behind the text
 * @PANGO_RENDER_PART_UNDERLINE: underlines
 * @PANGO_RENDER_PART_STRIKETHROUGH: strikethrough lines
 *
 * #PangoRenderPart defines different items to render for such
 * purposes as setting colors.
 *
 * Since: 1.8
 **/
/* When extending, note N_RENDER_PARTS #define in pango-renderer.c */
typedef enum
{
  PANGO_RENDER_PART_FOREGROUND,
  PANGO_RENDER_PART_BACKGROUND,
  PANGO_RENDER_PART_UNDERLINE,
  PANGO_RENDER_PART_STRIKETHROUGH
} PangoRenderPart;

/**
 * PangoRenderer:
 * @matrix: (nullable): the current transformation matrix for
 *    the Renderer; may be %NULL, which should be treated the
 *    same as the identity matrix.
 *
 * #PangoRenderer is a base class for objects that are used to
 * render Pango objects such as #PangoGlyphString and
 * #PangoLayout.
 *
 * Since: 1.8
 **/
struct _PangoRenderer
{
  /*< private >*/
  GObject parent_instance;

  PangoUnderline underline;
  gboolean strikethrough;
  int active_count;

  /*< public >*/
  PangoMatrix *matrix;		/* May be NULL */

  /*< private >*/
  PangoRendererPrivate *priv;
};

/**
 * PangoRendererClass:
 * @draw_glyphs: draws a #PangoGlyphString
 * @draw_rectangle: draws a rectangle
 * @draw_error_underline: draws a squiggly line that approximately
 * covers the given rectangle in the style of an underline used to
 * indicate a spelling error.
 * @draw_shape: draw content for a glyph shaped with #PangoAttrShape.
 *   @x, @y are the coordinates of the left edge of the baseline,
 *   in user coordinates.
 * @draw_trapezoid: draws a trapezoidal filled area
 * @draw_glyph: draws a single glyph
 * @part_changed: do renderer specific processing when rendering
 *  attributes change
 * @begin: Do renderer-specific initialization before drawing
 * @end: Do renderer-specific cleanup after drawing
 * @prepare_run: updates the renderer for a new run
 * @draw_glyph_item: draws a #PangoGlyphItem
 *
 * Class structure for #PangoRenderer.
 *
 * Since: 1.8
 **/
struct _PangoRendererClass
{
  /*< private >*/
  GObjectClass parent_class;

  /* vtable - not signals */
  /*< public >*/

  /* All of the following have default implementations
   * and take as coordinates user coordinates in Pango units
   */
  void (*draw_glyphs) (PangoRenderer     *renderer,
		       PangoFont         *font,
		       PangoGlyphString  *glyphs,
		       int                x,
		       int                y);
  void (*draw_rectangle) (PangoRenderer     *renderer,
			  PangoRenderPart    part,
			  int                x,
			  int                y,
			  int                width,
			  int                height);
  void (*draw_error_underline) (PangoRenderer     *renderer,
				int                x,
				int                y,
				int                width,
				int                height);

  /* Nothing is drawn for shaped glyphs unless this is implemented */
  void (*draw_shape) (PangoRenderer  *renderer,
		      PangoAttrShape *attr,
		      int             x,
		      int             y);

  /* These two must be implemented and take coordinates in
   * device space as doubles.
   */
  void (*draw_trapezoid) (PangoRenderer  *renderer,
			  PangoRenderPart part,
			  double          y1_,
			  double          x11,
			  double          x21,
			  double          y2,
			  double          x12,
			  double          x22);
  void (*draw_glyph) (PangoRenderer *renderer,
		      PangoFont     *font,
		      PangoGlyph     glyph,
		      double         x,
		      double         y);

  /* Notification of change in rendering attributes
   */
  void (*part_changed) (PangoRenderer   *renderer,
			PangoRenderPart  part);

  /* Paired around drawing operations
   */
  void (*begin) (PangoRenderer *renderer);
  void (*end)   (PangoRenderer *renderer);

  /* Hooks into the details of layout rendering
   */
  void (*prepare_run) (PangoRenderer  *renderer,
		       PangoLayoutRun *run);

  /* All of the following have default implementations
   * and take as coordinates user coordinates in Pango units
   */
  void (*draw_glyph_item) (PangoRenderer     *renderer,
			   const char        *text,
			   PangoGlyphItem    *glyph_item,
			   int                x,
			   int                y);

  /*< private >*/

  /* Padding for future expansion */
  void (*_pango_reserved2) (void);
  void (*_pango_reserved3) (void);
  void (*_pango_reserved4) (void);
};

PANGO_AVAILABLE_IN_1_8
GType pango_renderer_get_type    (void) G_GNUC_CONST;

PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_layout          (PangoRenderer    *renderer,
					  PangoLayout      *layout,
					  int               x,
					  int               y);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_layout_line     (PangoRenderer    *renderer,
					  PangoLayoutLine  *line,
					  int               x,
					  int               y);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_glyphs          (PangoRenderer    *renderer,
					  PangoFont        *font,
					  PangoGlyphString *glyphs,
					  int               x,
					  int               y);
PANGO_AVAILABLE_IN_1_22
void pango_renderer_draw_glyph_item      (PangoRenderer    *renderer,
					  const char       *text,
					  PangoGlyphItem   *glyph_item,
					  int               x,
					  int               y);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_rectangle       (PangoRenderer    *renderer,
					  PangoRenderPart   part,
					  int               x,
					  int               y,
					  int               width,
					  int               height);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_error_underline (PangoRenderer    *renderer,
					  int               x,
					  int               y,
					  int               width,
					  int               height);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_trapezoid       (PangoRenderer    *renderer,
					  PangoRenderPart   part,
					  double            y1_,
					  double            x11,
					  double            x21,
					  double            y2,
					  double            x12,
					  double            x22);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_draw_glyph           (PangoRenderer    *renderer,
					  PangoFont        *font,
					  PangoGlyph        glyph,
					  double            x,
					  double            y);

PANGO_AVAILABLE_IN_1_8
void pango_renderer_activate             (PangoRenderer    *renderer);
PANGO_AVAILABLE_IN_1_8
void pango_renderer_deactivate           (PangoRenderer    *renderer);

PANGO_AVAILABLE_IN_1_8
void        pango_renderer_part_changed (PangoRenderer   *renderer,
					 PangoRenderPart  part);

PANGO_AVAILABLE_IN_1_8
void        pango_renderer_set_color (PangoRenderer    *renderer,
				      PangoRenderPart   part,
				      const PangoColor *color);
PANGO_AVAILABLE_IN_1_8
PangoColor *pango_renderer_get_color (PangoRenderer    *renderer,
				      PangoRenderPart   part);

PANGO_AVAILABLE_IN_1_38
void        pango_renderer_set_alpha (PangoRenderer    *renderer,
				      PangoRenderPart   part,
				      guint16           alpha);
PANGO_AVAILABLE_IN_1_38
guint16     pango_renderer_get_alpha (PangoRenderer    *renderer,
				      PangoRenderPart   part);

PANGO_AVAILABLE_IN_1_8
void                        pango_renderer_set_matrix (PangoRenderer     *renderer,
						       const PangoMatrix *matrix);
PANGO_AVAILABLE_IN_1_8
const PangoMatrix          *pango_renderer_get_matrix (PangoRenderer     *renderer);

PANGO_AVAILABLE_IN_1_20
PangoLayout     *pango_renderer_get_layout      (PangoRenderer     *renderer);
PANGO_AVAILABLE_IN_1_20
PangoLayoutLine *pango_renderer_get_layout_line (PangoRenderer     *renderer);

G_END_DECLS

#endif /* __PANGO_RENDERER_H_ */