aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/narrative_render_cairo.h
blob: 635cfede42460a33aad1f557a39d3d0ed8f4f7cc (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
/*
 * narrative_render_cairo.h
 *
 * Copyright © 2013-2019 Thomas White <taw@bitwiz.org.uk>
 *
 * This file is part of Colloquium.
 *
 * Colloquium is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef NARRATIVE_RENDER_CAIRO_H
#define NARRATIVE_RENDER_CAIRO_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "narrative.h"
#include "imagestore.h"

struct edit_pos
{
	int para;    /* Paragraph number (corresponding to narrative items) */
	int pos;     /* Byte position within paragraph (yes, really)  */
	int trail;   /* 1 = end of character, 0 = before */
};

extern int narrative_wrap_range(Narrative *n, Stylesheet *stylesheet,
                                PangoLanguage *lang, PangoContext *pc, double w,
                                ImageStore *is, int min, int max,
                                struct edit_pos sel_start, struct edit_pos sel_end);

extern double narrative_get_height(Narrative *n);

extern double narrative_item_get_height(Narrative *n, int i);

extern int narrative_render_item_cairo(Narrative*n, cairo_t *cr, int i);

extern int narrative_render_cairo(Narrative *n, cairo_t *cr,
                                  Stylesheet *stylesheet);

extern int index_with_removal(int *chars_removed, int n_chars_removed, int idx);

extern int index_before_removal(int *chars_removed, int n_chars_removed, int idx);

#endif	/* NARRATIVE_RENDER_CAIRO_H */