1 /* Dia -- an diagram creation/manipulation program 2 * Copyright (C) 1998 Alexander Larsson 3 * 4 * diacairo.c -- Cairo based export plugin for dia 5 * Copyright (C) 2004, 2007 Hans Breuer, <Hans@Breuer.Org> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 */ 21 22 #include <cairo.h> 23 #include "diarenderer.h" 24 25 /* 26 #define DEBUG_CAIRO 27 */ 28 #ifdef DEBUG_CAIRO 29 # define DIAG_NOTE(action) action 30 # define DIAG_STATE(cr) { if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) g_print ("%s:%d, %s\n", __FILE__, __LINE__, cairo_status_to_string (cairo_status(cr))); } 31 #else 32 # define DIAG_NOTE(action) 33 # define DIAG_STATE(cr) 34 #endif 35 36 /* --- the renderer base class --- */ 37 G_BEGIN_DECLS 38 39 #define DIA_TYPE_CAIRO_RENDERER (dia_cairo_renderer_get_type ()) 40 #define DIA_CAIRO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIA_TYPE_CAIRO_RENDERER, DiaCairoRenderer)) 41 #define DIA_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIA_TYPE_CAIRO_RENDERER, DiaCairoRendererClass)) 42 #define DIA_IS_CAIRO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIA_TYPE_CAIRO_RENDERER)) 43 #define DIA_CAIRO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIA_CAIRO_TYPE_RENDERER, DiaCairoRendererClass)) 44 45 GType dia_cairo_renderer_get_type (void) G_GNUC_CONST; 46 47 typedef struct _DiaCairoRenderer DiaCairoRenderer; 48 typedef struct _DiaCairoRendererClass DiaCairoRendererClass; 49 50 struct _DiaCairoRenderer 51 { 52 DiaRenderer parent_instance; 53 54 cairo_t *cr; /**< if NULL it gest created from the surface */ 55 cairo_surface_t *surface; /**< can be NULL to use the provived cr */ 56 57 double dash_length; 58 LineStyle line_style; 59 DiagramData *dia; 60 61 real scale; 62 gboolean with_alpha; 63 gboolean skip_show_page; /**< when using for print avoid the internal show_page */ 64 65 /** caching the font description from set_font */ 66 PangoLayout *layout; 67 }; 68 69 struct _DiaCairoRendererClass 70 { 71 DiaRendererClass parent_class; 72 }; 73 74 /* FIXME: need to think about proper registration */ 75 GType dia_cairo_interactive_renderer_get_type (void) G_GNUC_CONST; 76 77 G_END_DECLS 78 79