]> git.saurik.com Git - wxWidgets.git/blame - src/tiff/libtiff/tif_codec.c
Support Unicode module names in wxDynamicLibrary::MSWGetModuleHandle().
[wxWidgets.git] / src / tiff / libtiff / tif_codec.c
CommitLineData
8414a40c
VZ
1/* $Id$ */
2
3/*
4 * Copyright (c) 1988-1997 Sam Leffler
5 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and
8 * its documentation for any purpose is hereby granted without fee, provided
9 * that (i) the above copyright notices and this permission notice appear in
10 * all copies of the software and related documentation, and (ii) the names of
11 * Sam Leffler and Silicon Graphics may not be used in any advertising or
12 * publicity relating to the software without the specific, prior written
13 * permission of Sam Leffler and Silicon Graphics.
14 *
15 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 * OF THIS SOFTWARE.
25 */
26
27/*
28 * TIFF Library
29 *
30 * Builtin Compression Scheme Configuration Support.
31 */
32#include "tiffiop.h"
33
80ed523f 34static int NotConfigured(TIFF*, int);
8414a40c 35
80ed523f
VZ
36#ifndef LZW_SUPPORT
37#define TIFFInitLZW NotConfigured
8414a40c 38#endif
80ed523f
VZ
39#ifndef PACKBITS_SUPPORT
40#define TIFFInitPackBits NotConfigured
8414a40c 41#endif
80ed523f
VZ
42#ifndef THUNDER_SUPPORT
43#define TIFFInitThunderScan NotConfigured
8414a40c 44#endif
80ed523f
VZ
45#ifndef NEXT_SUPPORT
46#define TIFFInitNeXT NotConfigured
8414a40c 47#endif
80ed523f
VZ
48#ifndef JPEG_SUPPORT
49#define TIFFInitJPEG NotConfigured
8414a40c 50#endif
80ed523f
VZ
51#ifndef OJPEG_SUPPORT
52#define TIFFInitOJPEG NotConfigured
8414a40c 53#endif
80ed523f
VZ
54#ifndef CCITT_SUPPORT
55#define TIFFInitCCITTRLE NotConfigured
56#define TIFFInitCCITTRLEW NotConfigured
57#define TIFFInitCCITTFax3 NotConfigured
58#define TIFFInitCCITTFax4 NotConfigured
8414a40c
VZ
59#endif
60#ifndef JBIG_SUPPORT
80ed523f 61#define TIFFInitJBIG NotConfigured
8414a40c 62#endif
80ed523f
VZ
63#ifndef ZIP_SUPPORT
64#define TIFFInitZIP NotConfigured
8414a40c 65#endif
80ed523f
VZ
66#ifndef PIXARLOG_SUPPORT
67#define TIFFInitPixarLog NotConfigured
8414a40c
VZ
68#endif
69#ifndef LOGLUV_SUPPORT
80ed523f
VZ
70#define TIFFInitSGILog NotConfigured
71#endif
72#ifndef LZMA_SUPPORT
73#define TIFFInitLZMA NotConfigured
8414a40c
VZ
74#endif
75
76/*
77 * Compression schemes statically built into the library.
78 */
79#ifdef VMS
80const TIFFCodec _TIFFBuiltinCODECS[] = {
81#else
82TIFFCodec _TIFFBuiltinCODECS[] = {
83#endif
84 { "None", COMPRESSION_NONE, TIFFInitDumpMode },
85 { "LZW", COMPRESSION_LZW, TIFFInitLZW },
86 { "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits },
87 { "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan },
88 { "NeXT", COMPRESSION_NEXT, TIFFInitNeXT },
89 { "JPEG", COMPRESSION_JPEG, TIFFInitJPEG },
90 { "Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG },
91 { "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
92 { "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
93 { "CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
94 { "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 },
95 { "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG },
96 { "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP },
97 { "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP },
98 { "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog },
99 { "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog },
100 { "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog },
80ed523f 101 { "LZMA", COMPRESSION_LZMA, TIFFInitLZMA },
8414a40c
VZ
102 { NULL, 0, NULL }
103};
104
105static int
106_notConfigured(TIFF* tif)
107{
108 const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
80ed523f
VZ
109 char compression_code[20];
110
111 sprintf( compression_code, "%d", tif->tif_dir.td_compression );
8414a40c 112 TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
80ed523f
VZ
113 "%s compression support is not configured",
114 c ? c->name : compression_code );
8414a40c
VZ
115 return (0);
116}
117
118static int
119NotConfigured(TIFF* tif, int scheme)
120{
80ed523f
VZ
121 (void) scheme;
122
123 tif->tif_fixuptags = _notConfigured;
124 tif->tif_decodestatus = FALSE;
125 tif->tif_setupdecode = _notConfigured;
126 tif->tif_encodestatus = FALSE;
127 tif->tif_setupencode = _notConfigured;
128 return (1);
8414a40c
VZ
129}
130
131/************************************************************************/
132/* TIFFIsCODECConfigured() */
133/************************************************************************/
134
135/**
136 * Check whether we have working codec for the specific coding scheme.
80ed523f 137 *
8414a40c
VZ
138 * @return returns 1 if the codec is configured and working. Otherwise
139 * 0 will be returned.
140 */
141
142int
143TIFFIsCODECConfigured(uint16 scheme)
144{
145 const TIFFCodec* codec = TIFFFindCODEC(scheme);
146
147 if(codec == NULL) {
80ed523f
VZ
148 return 0;
149 }
150 if(codec->init == NULL) {
151 return 0;
152 }
8414a40c 153 if(codec->init != NotConfigured){
80ed523f
VZ
154 return 1;
155 }
8414a40c
VZ
156 return 0;
157}
158
80ed523f
VZ
159/*
160 * Local Variables:
161 * mode: c
162 * c-basic-offset: 8
163 * fill-column: 78
164 * End:
165 */