1 /* 2 * Copyright (C) 2003 Red Hat, Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * 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 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 /* The interfaces in this file are subject to change at any time. */ 20 21 #ifndef vte_vtedraw_h_included 22 #define vte_vtedraw_h_included 23 24 #include <glib.h> 25 #include <gtk/gtk.h> 26 #include <cairo.h> 27 #include "vteunistr.h" 28 #include "vtetypes.hh" 29 30 G_BEGIN_DECLS 31 32 #define VTE_DRAW_OPAQUE (1.0) 33 #define VTE_DRAW_MAX_LENGTH 1024 34 35 #define VTE_DRAW_NORMAL 0 36 #define VTE_DRAW_BOLD 1 37 #define VTE_DRAW_ITALIC 2 38 39 struct _vte_draw; 40 41 /* A request to draw a particular character spanning a given number of columns 42 at the given location. Unlike most APIs, (x,y) specifies the top-left 43 corner of the cell into which the character will be drawn instead of the 44 left end of the baseline. */ 45 struct _vte_draw_text_request { 46 vteunistr c; 47 gshort x, y, columns; 48 }; 49 50 guint _vte_draw_get_style(gboolean bold, gboolean italic); 51 52 /* Create and destroy a draw structure. */ 53 struct _vte_draw *_vte_draw_new(void); 54 void _vte_draw_free(struct _vte_draw *draw); 55 56 void _vte_draw_set_cairo(struct _vte_draw *draw, 57 cairo_t *cr); 58 59 void _vte_draw_clear(struct _vte_draw *draw, 60 gint x, gint y, gint width, gint height, 61 vte::color::rgb const* color, double alpha); 62 63 void _vte_draw_set_text_font(struct _vte_draw *draw, 64 GtkWidget *widget, 65 const PangoFontDescription *fontdesc, 66 double cell_width_scale, double cell_height_scale); 67 void _vte_draw_get_text_metrics(struct _vte_draw *draw, 68 int *cell_width, int *cell_height, 69 int *char_ascent, int *char_descent, 70 GtkBorder *char_spacing); 71 void _vte_draw_get_char_edges (struct _vte_draw *draw, vteunistr c, int columns, guint style, 72 int *left, int *right); 73 gboolean _vte_draw_has_bold (struct _vte_draw *draw, guint style); 74 75 void _vte_draw_text(struct _vte_draw *draw, 76 struct _vte_draw_text_request *requests, gsize n_requests, 77 vte::color::rgb const* color, double alpha, guint style); 78 gboolean _vte_draw_char(struct _vte_draw *draw, 79 struct _vte_draw_text_request *request, 80 vte::color::rgb const* color, double alpha, guint style); 81 gboolean _vte_draw_has_char(struct _vte_draw *draw, vteunistr c, guint style); 82 83 void _vte_draw_fill_rectangle(struct _vte_draw *draw, 84 gint x, gint y, gint width, gint height, 85 vte::color::rgb const* color, double alpha); 86 void _vte_draw_draw_rectangle(struct _vte_draw *draw, 87 gint x, gint y, gint width, gint height, 88 vte::color::rgb const* color, double alpha); 89 90 void _vte_draw_draw_line(struct _vte_draw *draw, 91 gint x, gint y, gint xp, gint yp, 92 int line_width, 93 vte::color::rgb const *color, double alpha); 94 95 double _vte_draw_get_undercurl_height(gint width, double line_width); 96 97 void _vte_draw_draw_undercurl(struct _vte_draw *draw, 98 gint x, double y, 99 double line_width, 100 gint count, 101 vte::color::rgb const *color, double alpha); 102 103 G_END_DECLS 104 105 #endif 106