From efa870dac2fdad4dd736b16e79b3c8e4e33b6055 Mon Sep 17 00:00:00 2001 From: Matthew S. Wilson Date: Mon, 04 Jul 2005 19:19:34 +0000 Subject: use the new tiff2ps interfaces 2005-07-04 Matthew S. Wilson * 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. --- (limited to 'tiff/tiff-document.c') 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 #include -#include #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 -- cgit v0.9.1