Debian Codegraph @

converter/other/jpeg2000/libjasper_compat.h

raw
1 /* Here's some stuff to create backward compatibility with older Jasper
2 libraries. Unfortunately, new versions of the Jasper library are not
3 backward compatible with old applications.
4
5 This also makes the programs compatible with both distributed Jasper
6 libraries and the Netpbm fork of Jasper distributed with Netpbm.
7 */
8 /* The color space thing got more complex between Version 1.600 and
9 1.701. For example, it now allows for multiple kinds of RGB, whereas
10 in 1.600 RGB meant SRGB. As part of that change, names changed
11 from "colorspace" to "clrspc".
12 */
13 #include "jasper/jasper.h"
14 #include "jasper/jas_image.h"
15
16 #if defined(jas_image_setcolorspace)
17 /* Old style color space */
18 #define jas_image_setclrspc jas_image_setcolorspace
19 #define JAS_CLRSPC_GENRGB JAS_IMAGE_CS_RGB
20 #define JAS_CLRSPC_GENGRAY JAS_IMAGE_CS_GRAY
21 #define JAS_CLRSPC_UNKNOWN JAS_IMAGE_CS_UNKNOWN
22
23 #define jas_clrspc_fam(clrspc) (clrspc)
24 #define jas_image_clrspc jas_image_colorspace
25
26 #define JAS_CLRSPC_FAM_RGB JAS_IMAGE_CS_RGB
27 #define JAS_CLRSPC_FAM_GRAY JAS_IMAGE_CS_GRAY
28 #define JAS_CLRSPC_FAM_UNKNOWN JAS_IMAGE_CS_UNKNOWN
29
30 #endif
31
32
33 #ifndef JAS_HAVE_PMJAS_IMAGE_DECODE
34
35 /* The Netpbm version of jas_image_decode (pmjas_image_decode) returns a
36 description of the problem when it fails and does not molest Standard
37 Error. Real libjasper just indicates that it failed, after writing some
38 explanation (but not as much as the Netpbm version returns) to Standard
39 Error.
40 */
41 void
42 pmjas_image_decode(jas_stream_t * const in,
43 int const fmtArg,
44 const char * const optstr,
45 jas_image_t ** const imagePP,
46 const char ** const errorP) {
47
48 jas_image_t * const jasperP = jas_image_decode(in, fmtArg, optstr);
49
50 if (jasperP) {
51 *imagePP = jasperP;
52 *errorP = NULL;
53 } else {
54 pm_asprintf(errorP, "Failed. Details may have been written to "
55 "Standard Error");
56 }
57 }
58
59 #endif