1/* viewer-render.c: Common code for rendering in viewers
2 *
3 * Copyright (C) 1999, 2004 Red Hat Software
4 * Copyright (C) 2001 Sun Microsystems
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#ifndef VIEWER_RENDER_H
22#define VIEWER_RENDER_H
23
24#include <pango/pango-layout.h>
25
26#include "viewer.h"
27
28typedef enum {
29 HINT_DEFAULT,
30 HINT_NONE,
31 HINT_AUTO,
32 HINT_SLIGHT,
33 HINT_MEDIUM,
34 HINT_FULL
35} HintMode;
36
37typedef enum {
38 SUBPIXEL_DEFAULT,
39 SUBPIXEL_RGB,
40 SUBPIXEL_BGR,
41 SUBPIXEL_VRGB,
42 SUBPIXEL_VBGR
43} SubpixelOrder;
44
45typedef enum {
46 ANTIALIAS_DEFAULT,
47 ANTIALIAS_NONE,
48 ANTIALIAS_GRAY,
49 ANTIALIAS_SUBPIXEL
50} Antialias;
51
52typedef enum {
53 HINT_METRICS_DEFAULT,
54 HINT_METRICS_ON,
55 HINT_METRICS_OFF
56} HintMetrics;
57
58typedef void (*RenderCallback) (PangoLayout *layout,
59 int x,
60 int y,
61 gpointer cb_context,
62 gpointer cb_data);
63typedef void (*TransformCallback) (PangoContext *context,
64 PangoMatrix *transform,
65 gpointer cb_context,
66 gpointer cb_data);
67
68void fail (const char *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN;
69
70void parse_options (int argc,
71 char *argv[]);
72void do_output (PangoContext *context,
73 RenderCallback render_cb,
74 TransformCallback transform_cb,
75 gpointer cb_context,
76 gpointer cb_data,
77 int *width,
78 int *height);
79void finalize (void);
80gchar *get_options_string (void);
81
82extern const char *prog_name;
83
84/* handled by viewer-render.c */
85extern const char *opt_font;
86extern gboolean opt_header;
87extern int opt_margin;
88extern int opt_markup;
89extern gboolean opt_rtl;
90extern double opt_rotate;
91extern gboolean opt_auto_dir;
92extern const char *opt_text;
93extern gboolean opt_waterfall;
94extern int opt_width;
95extern int opt_indent;
96extern PangoEllipsizeMode opt_ellipsize;
97
98/* handled by viewer-main.c */
99extern gboolean opt_display;
100extern const char *opt_output;
101extern int opt_runs;
102extern const PangoViewer *opt_viewer;
103
104/* handled by backend-specific code */
105extern int opt_dpi;
106extern HintMode opt_hinting;
107extern SubpixelOrder opt_subpixel_order;
108extern Antialias opt_antialias;
109extern HintMetrics opt_hint_metrics;
110extern gboolean opt_subpixel_positions;
111extern PangoColor opt_fg_color;
112extern guint16 opt_fg_alpha;
113extern gboolean opt_bg_set;
114extern PangoColor opt_bg_color;
115extern guint16 opt_bg_alpha;
116
117#endif /* VIEWER_RENDER_H */
118

source code of gtk/subprojects/pango/utils/viewer-render.h