vtedraw.h 4.41 KB
Newer Older
1 2 3
/*
 * Copyright (C) 2003 Red Hat, Inc.
 *
4 5 6 7
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9 10
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14 15 16
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 18 19 20 21 22 23 24 25 26
 */

/* The interfaces in this file are subject to change at any time. */

#ifndef vte_vtedraw_h_included
#define vte_vtedraw_h_included


#include <glib.h>
#include <gtk/gtk.h>
27
#include <cairo.h>
28
#include "vtebg.h"
29
#include "vte.h"
30
#include "vteunistr.h"
31 32 33

G_BEGIN_DECLS

34 35 36 37 38 39
#define VTE_DRAW_SINGLE_WIDE_CHARACTERS	\
					" !\"#$%&'()*+,-./" \
					"0123456789" \
					":;<=>?@" \
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
					"[\\]^_`" \
40
					"abcdefghijklmnopqrstuvwxyz" \
41 42
					"{|}~" \
					""
43 44 45 46 47 48
#define VTE_DRAW_DOUBLE_WIDE_CHARACTERS 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94,\
					0xac00, 0xac01, 0xac04, 0xac08, 0xac10
/* For Pango, we have to use CJK Ideographs alone. Otherwise, 'width'
   returned by pango_layout would be screwed up for Chinese and Japanese
   fonts without Hangul */
#define VTE_DRAW_DOUBLE_WIDE_IDEOGRAPHS 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94
49
#define VTE_DRAW_OPAQUE 0xff
50
#define VTE_DRAW_MAX_LENGTH 1024
51

52 53 54 55
#define VTE_DRAW_NORMAL 0
#define VTE_DRAW_BOLD   1
#define VTE_DRAW_ITALIC 2

56 57
struct _vte_draw;

58 59 60 61
/* A request to draw a particular character spanning a given number of columns
   at the given location.  Unlike most APIs, (x,y) specifies the top-left
   corner of the cell into which the character will be drawn instead of the
   left end of the baseline. */
62
struct _vte_draw_text_request {
63
	vteunistr c;
64
	gshort x, y, columns;
65 66
};

67 68
guint _vte_draw_get_style(gboolean bold, gboolean italic);

69
/* Create and destroy a draw structure. */
70 71
struct _vte_draw *_vte_draw_new(GtkWidget *widget);
void _vte_draw_free(struct _vte_draw *draw);
72

73 74
cairo_t *_vte_draw_get_context (struct _vte_draw *draw);

75 76
/* Begin and end a drawing operation.  If anything is buffered locally, it is
   flushed to the window system when _end() is called. */
77 78 79 80
void _vte_draw_start(struct _vte_draw *draw);
void _vte_draw_end(struct _vte_draw *draw);

void _vte_draw_set_background_solid(struct _vte_draw *draw,
81 82 83 84
				    double red,
				    double green,
				    double blue,
				    double opacity);
85
void _vte_draw_set_background_image(struct _vte_draw *draw,
Christian Persch's avatar
Christian Persch committed
86
				    VteBgSourceType type,
87 88
				    GdkPixbuf *pixbuf,
				    const char *file,
89
				    const PangoColor *color,
90 91 92 93
				    double saturation);
void _vte_draw_set_background_scroll(struct _vte_draw *draw,
				     gint x, gint y);

94
void _vte_draw_clip(struct _vte_draw *draw, cairo_region_t *region);
95 96 97 98
void _vte_draw_clear(struct _vte_draw *draw,
		     gint x, gint y, gint width, gint height);

void _vte_draw_set_text_font(struct _vte_draw *draw,
99
			     const PangoFontDescription *fontdesc);
100 101 102
void _vte_draw_get_text_metrics(struct _vte_draw *draw,
				gint *width, gint *height, gint *ascent);
int _vte_draw_get_char_width(struct _vte_draw *draw, vteunistr c, int columns,
103 104
			     guint style);
gboolean _vte_draw_has_bold (struct _vte_draw *draw, guint style);
105 106 107

void _vte_draw_text(struct _vte_draw *draw,
		    struct _vte_draw_text_request *requests, gsize n_requests,
108
		    const PangoColor *color, guchar alpha, guint style);
109 110
gboolean _vte_draw_char(struct _vte_draw *draw,
			struct _vte_draw_text_request *request,
111 112
			const PangoColor *color, guchar alpha, guint style);
gboolean _vte_draw_has_char(struct _vte_draw *draw, vteunistr c, guint style);
113 114 115

void _vte_draw_fill_rectangle(struct _vte_draw *draw,
			      gint x, gint y, gint width, gint height,
116
			      const PangoColor *color, guchar alpha);
117 118
void _vte_draw_draw_rectangle(struct _vte_draw *draw,
			      gint x, gint y, gint width, gint height,
119
			      const PangoColor *color, guchar alpha);
120 121 122
void _vte_draw_set_source_color_alpha (struct _vte_draw *draw,
                                       const PangoColor *color,
                                       guchar            alpha);
123

124 125 126
G_END_DECLS

#endif