shithub: jbig2

Download patch

ref: b109bd22c74be647631cd12077ad105c179afa12
parent: 3893f8c38a5c6a97258cb10807479903a6542033
author: Sebastian Rasmussen <[email protected]>
date: Sat May 26 11:12:54 EDT 2018

jbig2dec: Create jbig2_image_rw.h with image reading/writing declarations.

--- a/jbig2_image.h
+++ b/jbig2_image.h
@@ -23,19 +23,4 @@
 int jbig2_image_get_pixel(Jbig2Image *image, int x, int y);
 void jbig2_image_set_pixel(Jbig2Image *image, int x, int y, bool value);
 
-/* routines for dumping the image data in various formats */
-/* FIXME: should these be in the client instead? */
-
-#include <stdio.h>
-
-int jbig2_image_write_pbm_file(Jbig2Image *image, char *filename);
-int jbig2_image_write_pbm(Jbig2Image *image, FILE *out);
-Jbig2Image *jbig2_image_read_pbm_file(Jbig2Ctx *ctx, char *filename);
-Jbig2Image *jbig2_image_read_pbm(Jbig2Ctx *ctx, FILE *in);
-
-#ifdef HAVE_LIBPNG
-int jbig2_image_write_png_file(Jbig2Image *image, char *filename);
-int jbig2_image_write_png(Jbig2Image *image, FILE *out);
-#endif
-
 #endif /* _JBIG2_IMAGE_H */
--- a/jbig2_image_pbm.c
+++ b/jbig2_image_pbm.c
@@ -28,6 +28,7 @@
 #include "jbig2.h"
 #include "jbig2_priv.h"
 #include "jbig2_image.h"
+#include "jbig2_image_rw.h"
 
 /* take an image structure and write it to a file in pbm format */
 
--- /dev/null
+++ b/jbig2_image_rw.h
@@ -1,0 +1,37 @@
+/* Copyright (C) 2001-2018 Artifex Software, Inc.
+   All Rights Reserved.
+
+   This software is provided AS-IS with no warranty, either express or
+   implied.
+
+   This software is distributed under license and may not be copied,
+   modified or distributed except as expressly authorized under the terms
+   of the license contained in the file LICENSE in this distribution.
+
+   Refer to licensing information at http://www.artifex.com or contact
+   Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
+   CA 94945, U.S.A., +1(415)492-9861, for further information.
+*/
+
+/*
+    jbig2dec
+*/
+
+#ifndef _JBIG2_IMAGE_RW_H
+#define _JBIG2_IMAGE_RW_H
+
+/* routines for dumping the image data in various formats */
+
+#include <stdio.h>
+
+int jbig2_image_write_pbm_file(Jbig2Image *image, char *filename);
+int jbig2_image_write_pbm(Jbig2Image *image, FILE *out);
+Jbig2Image *jbig2_image_read_pbm_file(Jbig2Ctx *ctx, char *filename);
+Jbig2Image *jbig2_image_read_pbm(Jbig2Ctx *ctx, FILE *in);
+
+#ifdef HAVE_LIBPNG
+int jbig2_image_write_png_file(Jbig2Image *image, char *filename);
+int jbig2_image_write_png(Jbig2Image *image, FILE *out);
+#endif
+
+#endif /* _JBIG2_IMAGE_RW_H */
--- a/jbig2dec.c
+++ b/jbig2dec.c
@@ -45,6 +45,7 @@
 #include "jbig2.h"
 #include "jbig2_priv.h"
 #include "jbig2_image.h"
+#include "jbig2_image_rw.h"
 
 typedef enum {
     usage, dump, render
--- a/pbm2png.c
+++ b/pbm2png.c
@@ -33,6 +33,7 @@
 
 #include "jbig2.h"
 #include "jbig2_image.h"
+#include "jbig2_image_rw.h"
 
 int
 main(int argc, char *argv[])