render.h 4.37 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1
2
/* See LICENSE file for license and copyright information */

Moritz Lipp's avatar
Moritz Lipp committed
3
4
5
#ifndef RENDER_H
#define RENDER_H

Moritz Lipp's avatar
Moritz Lipp committed
6
#include <stdbool.h>
Moritz Lipp's avatar
Moritz Lipp committed
7
#include <stdlib.h>
Sebastian Ramacher's avatar
Sebastian Ramacher committed
8
9
#include <glib-object.h>
#include <gdk/gdk.h>
10
#include <girara/types.h>
11
#include "types.h"
Moritz Lipp's avatar
Moritz Lipp committed
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
typedef struct zathura_renderer_class_s ZathuraRendererClass;

struct zathura_renderer_s
{
  GObject parent;
};

struct zathura_renderer_class_s
{
  GObjectClass parent_class;
};

#define ZATHURA_TYPE_RENDERER \
  (zathura_renderer_get_type())
#define ZATHURA_RENDERER(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), ZATHURA_TYPE_RENDERER, ZathuraRenderer))
#define ZATHURA_RENDERER_CLASS(obj) \
  (G_TYPE_CHECK_CLASS_CAST((obj), ZATHURA_TYPE_RENDERER, ZathuraRendererClass))
#define ZATHURA_IS_RENDERER(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZATHURA_TYPE_RENDERER))
#define ZATHURA_IS_RENDERER_CLASS(obj) \
  (G_TYPE_CHECK_CLASS_TYPE((obj), ZATHURA_TYPE_RENDERER))
#define ZATHURA_RENDERER_GET_CLASS \
  (G_TYPE_INSTANCE_GET_CLASS((obj), ZATHURA_TYPE_RENDERER, ZathuraRendererClass))
Moritz Lipp's avatar
Moritz Lipp committed
37

Moritz Lipp's avatar
Moritz Lipp committed
38
/**
39
40
41
42
43
44
45
46
47
 * Returns the type of the renderer.
 * @return the type
 */
GType zathura_renderer_get_type(void);
/**
 * Create a page view widget.
 * @param zathura the zathura instance
 * @param page the page to be displayed
 * @return a page view widget
Moritz Lipp's avatar
Moritz Lipp committed
48
 */
49
50
51
52
53
54
55
56
ZathuraRenderer* zathura_renderer_new(zathura_t* zathura);

bool zathura_renderer_recolor_enabled(ZathuraRenderer* renderer);
void zathura_renderer_enable_recolor(ZathuraRenderer* renderer, bool enable);
bool zathura_renderer_recolor_hue_enabled(ZathuraRenderer* renderer);
void zathura_renderer_enable_recolor_hue(ZathuraRenderer* renderer,
    bool enable);
void zathura_renderer_set_recolor_colors(ZathuraRenderer* renderer,
57
58
59
60
    const GdkColor* light, const GdkColor* dark);
void zathura_renderer_set_recolor_colors_str(ZathuraRenderer* renderer,
    const char* light, const char* dark);
void zathura_renderer_get_recolor_colors(ZathuraRenderer* renderer,
61
62
63
    GdkColor* light, GdkColor* dark);

void zathura_renderer_stop(ZathuraRenderer* renderer);
Moritz Lipp's avatar
Moritz Lipp committed
64
65

/**
66
67
 * Lock the render thread. This is useful if you want to render on your own (e.g
 * for printing).
Moritz Lipp's avatar
Moritz Lipp committed
68
 *
69
 * @param render_thread The render thread object.
Moritz Lipp's avatar
Moritz Lipp committed
70
 */
71
void zathura_renderer_lock(ZathuraRenderer* renderer);
Moritz Lipp's avatar
Moritz Lipp committed
72
73

/**
74
 * Unlock the render thread.
Moritz Lipp's avatar
Moritz Lipp committed
75
 *
76
 * @param render_thread The render thread object.
Moritz Lipp's avatar
Moritz Lipp committed
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
void zathura_renderer_unlock(ZathuraRenderer* renderer);



typedef struct zathura_render_request_s ZathuraRenderRequest;
typedef struct zathura_render_request_class_s ZathuraRenderRequestClass;

struct zathura_render_request_s
{
  GObject parent;
};

struct zathura_render_request_class_s
{
  GObjectClass parent_class;
};

#define ZATHURA_TYPE_RENDER_REQUEST \
  (zathura_render_request_get_type())
#define ZATHURA_RENDER_REQUEST(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), ZATHURA_TYPE_RENDER_REQUEST, \
                              ZathuraRenderRequest))
#define ZATHURA_RENDER_REQUEST_CLASS(obj) \
  (G_TYPE_CHECK_CLASS_CAST((obj), ZATHURA_TYPE_RENDER_REQUEST, \
                           ZathuraRenderRequestClass))
#define ZATHURA_IS_RENDER_REQUEST(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZATHURA_TYPE_RENDER_REQUEST))
#define ZATHURA_IS_RENDER_REQUEST_CLASS(obj) \
  (G_TYPE_CHECK_CLASS_TYPE((obj), ZATHURA_TYPE_RENDER_REQUEST))
#define ZATHURA_RENDER_REQUEST_GET_CLASS \
  (G_TYPE_INSTANCE_GET_CLASS((obj), ZATHURA_TYPE_RENDER_REQUEST, \
                             ZathuraRenderRequestClass))
Moritz Lipp's avatar
Moritz Lipp committed
110

111
/**
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
 * Returns the type of the renderer.
 * @return the type
 */
GType zathura_page_render_info_get_type(void);
/**
 * Create a page view widget.
 * @param zathura the zathura instance
 * @param page the page to be displayed
 * @return a page view widget
 */
ZathuraRenderRequest* zathura_render_request_new(ZathuraRenderer* renderer,
    zathura_page_t* page);

/**
 * This function is used to add a page to the render thread list
 * that should be rendered.
Moritz Lipp's avatar
Moritz Lipp committed
128
 *
129
 * @param request request object of the page that should be renderer
130
 */
131
void zathura_render_request(ZathuraRenderRequest* request);
132

133
/**
134
 * Abort an existing render request.
135
 *
136
 * @param reqeust request that should be aborted
137
 */
138
139
void zathura_render_request_abort(ZathuraRenderRequest* request);

140
141

/**
142
143
144
 * This function is used to unmark all pages as not rendered. This should
 * be used if all pages should be rendered again (e.g.: the zoom level or the
 * colors have changed)
145
 *
146
 * @param zathura Zathura object
147
 */
148
void render_all(zathura_t* zathura);
149

Moritz Lipp's avatar
Moritz Lipp committed
150
#endif // RENDER_H