diff options
author | Matthew S. Wilson <msw@rpath.com> | 2005-07-04 19:19:34 (GMT) |
---|---|---|
committer | Matt Wilson <msw@src.gnome.org> | 2005-07-04 19:19:34 (GMT) |
commit | efa870dac2fdad4dd736b16e79b3c8e4e33b6055 (patch) | |
tree | 2c4ae202daf2cbeb6c9eb9e473bc79b9ae2bfe52 /tiff/tiff-document.c | |
parent | ec348ae2051c72cd31cb69035cfb64182fcd89d5 (diff) |
use the new tiff2ps interfaces
2005-07-04 Matthew S. Wilson <msw@rpath.com>
* tiff/tiff-document.c (tiff_document_ps_export_begin)
(tiff_document_ps_export_do_page, tiff_document_ps_export_end):
use the new tiff2ps interfaces
* tiff/tiff2ps.h (tiff2ps_context_new, tiff2ps_process_page)
(tiff2ps_context_finalize): implement new interfaces for tiff2ps
* tiff/tiff2ps.c: refactor tiff2ps code to use a context
structure instead of global variables. Remove use of static
variables in functions.
Diffstat (limited to 'tiff/tiff-document.c')
-rw-r--r-- | tiff/tiff-document.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/tiff/tiff-document.c b/tiff/tiff-document.c index 137833b..36847aa 100644 --- a/tiff/tiff-document.c +++ b/tiff/tiff-document.c @@ -22,7 +22,6 @@ #include <stdio.h> #include <glib.h> -#include <glib/gstdio.h> #include "tiffio.h" #include "tiff2ps.h" @@ -43,8 +42,7 @@ struct _TiffDocument TIFF *tiff; gint n_pages; EvOrientation orientation; - FILE *ps_export_file; - gint ps_export_pages; + TIFF2PSContext *ps_export_ctx; }; typedef struct _TiffDocumentClass TiffDocumentClass; @@ -417,10 +415,7 @@ tiff_document_ps_export_begin (EvPSExporter *exporter, const char *filename, { TiffDocument *document = TIFF_DOCUMENT (exporter); - document->ps_export_file = g_fopen (filename, "w"); - if (document->ps_export_file == NULL) - return; - document->ps_export_pages = 0; + document->ps_export_ctx = tiff2ps_context_new(filename); } static void @@ -428,14 +423,12 @@ tiff_document_ps_export_do_page (EvPSExporter *exporter, int page) { TiffDocument *document = TIFF_DOCUMENT (exporter); - if (document->ps_export_file == NULL) + if (document->ps_export_ctx == NULL) return; if (TIFFSetDirectory (document->tiff, page) != 1) return; - TIFF2PS (document->ps_export_file, - document->tiff, - 0, 0, 0, 0, 0, - &document->ps_export_pages); + tiff2ps_process_page (document->ps_export_ctx, document->tiff, + 0, 0, 0, 0, 0); } static void @@ -443,12 +436,9 @@ tiff_document_ps_export_end (EvPSExporter *exporter) { TiffDocument *document = TIFF_DOCUMENT (exporter); - if (document->ps_export_file == NULL) + if (document->ps_export_ctx == NULL) return; - if (document->ps_export_pages) - TIFFPSTail (document->ps_export_file, - document->ps_export_pages); - fclose (document->ps_export_file); + tiff2ps_context_finalize(document->ps_export_ctx); } static void |