home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1988 by Sam Leffler.
- * All rights reserved.
- *
- * This file is provided for unrestricted use provided that this
- * legend is included on all tape media and as a part of the
- * software program in whole or part. Users may copy, modify or
- * distribute this file at will.
- */
-
- /*
- Compression Scheme Configuration Support.
- */
-
- #define NSCHEMES (sizeof (CompressionSchemes) / sizeof (CompressionSchemes[0]))
-
- #include "tiffio.h"
-
- extern void TIFFInitDumpMode(TIFF *);
- extern void TIFFInitLZW(TIFF *);
- extern void TIFFInitPackBits(TIFF *);
- extern void TIFFInitCCITTRLE(TIFF *);
- extern void TIFFInitCCITTRLEW(TIFF *);
- extern void TIFFInitCCITTFax3(TIFF *);
- extern void TIFFInitCCITTFax4(TIFF *);
-
- static struct cscheme
- {
- unsigned scheme;
- void (*init)(TIFF *);
- } CompressionSchemes[] =
- {
- { COMPRESSION_NONE, TIFFInitDumpMode },
- { COMPRESSION_LZW, TIFFInitLZW },
- { COMPRESSION_PACKBITS, TIFFInitPackBits },
- { COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
- { COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
- { COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
- { COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 }
- };
-
-
- CompletionCode TIFFSetCompressionScheme(TIFF *tif, unsigned scheme)
- {
- register struct cscheme *c;
-
- for (c = CompressionSchemes; c < &CompressionSchemes[NSCHEMES]; c++)
- if (c->scheme == scheme)
- {
- tif->tif_stripdecode = NULL;
- tif->tif_stripencode = NULL;
- tif->tif_encodestrip = NULL;
- tif->tif_seek = NULL;
- tif->tif_cleanup = NULL;
- /* install compression/expansion scheme */
- (*c->init)(tif);
- return(TRUE);
- }
- TIFFError(tif->tif_name, "Unknown data compression algorithm %u",
- scheme);
- return (FALSE);
- }