1 /* This file is part of Libspectre. 2 * 3 * Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> 4 * Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org> 5 * 6 * Libspectre is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * Libspectre is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef SPECTRE_PRIVATE_H 22 #define SPECTRE_PRIVATE_H 23 24 #include "spectre-macros.h" 25 #include "spectre-status.h" 26 #include "spectre-document.h" 27 #include "spectre-page.h" 28 #include "spectre-exporter.h" 29 #include "spectre-gs.h" 30 #include "ps.h" 31 32 SPECTRE_BEGIN_DECLS 33 34 struct SpectreRenderContext { 35 double x_scale; 36 double y_scale; 37 SpectreOrientation orientation; 38 double x_dpi; 39 double y_dpi; 40 int width; 41 int height; 42 int text_alpha_bits; 43 int graphic_alpha_bits; 44 int use_platform_fonts; 45 }; 46 47 struct SpectreExporter { 48 struct document *doc; 49 50 /* PDF specific */ 51 SpectreGS *gs; 52 53 /* PS specific */ 54 FILE *from; 55 FILE *to; 56 int n_pages; 57 58 59 SpectreStatus (* begin) (SpectreExporter *exporter, 60 const char *filename); 61 SpectreStatus (* do_page) (SpectreExporter *exporter, 62 unsigned int page_index); 63 SpectreStatus (* end) (SpectreExporter *exporter); 64 }; 65 66 SpectrePage *_spectre_page_new (unsigned int page_index, 67 struct document *doc); 68 struct document *_spectre_document_get_doc (SpectreDocument *document); 69 SpectreExporter *_spectre_exporter_ps_new (struct document *doc); 70 SpectreExporter *_spectre_exporter_pdf_new (struct document *doc); 71 72 /*! Loads the given open file into the document. This function can fail 73 @param document the document where the file will be loaded 74 @param file the file to load 75 @see spectre_document_status 76 */ 77 SPECTRE_PUBLIC 78 void spectre_document_load_from_stream (SpectreDocument *document, 79 FILE *file); 80 81 SPECTRE_END_DECLS 82 83 #endif /* SPECTRE_PRIVATE_H */ 84