home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / grfx_snd / tifflib / source / tif_cmpr.c < prev    next >
C/C++ Source or Header  |  1993-01-13  |  2KB  |  75 lines

  1. #pragma warn -use
  2. static char     *sccsid = "@(#)TIFF/tif_compress.c 1.15, Copyright (c) Sam Leffler, Dieter Linde, "__DATE__;
  3. #pragma warn .use
  4. /*
  5.  * Copyright (c) 1988, 1990 by Sam Leffler, Oct 8 1990
  6.  * All rights reserved.
  7.  *
  8.  * This file is provided for unrestricted use provided that this legend is included on all tape media and as a part of the
  9.  * software program in whole or part.  Users may copy, modify or distribute this file at will.
  10.  *
  11.  * TIFF Library
  12.  *
  13.  * Compression Scheme Configuration Support.
  14.  */
  15. #include "tiffio.h"
  16.  
  17. static  struct    cscheme {
  18.            u_short    scheme;
  19.         int     (*init)(TIFF *);
  20. } CompressionSchemes[] = {
  21.         { COMPRESSION_NONE, TIFFInitDumpMode },
  22.         { COMPRESSION_LZW, TIFFInitLZW },
  23.         { COMPRESSION_PACKBITS, TIFFInitPackBits },
  24.  
  25. #ifdef     PICIO_SUPPORT
  26.         { COMPRESSION_PICIO, TIFFInitPicio },
  27. #endif    /* PICIO_SUPPORT */
  28.  
  29. #ifdef     THUNDER_SUPPORT
  30.         { COMPRESSION_THUNDERSCAN, TIFFInitThunderScan },
  31. #endif    /* THUNDER_SUPPORT */
  32.  
  33. #ifdef     NEXT_SUPPORT
  34.         { COMPRESSION_NEXT, TIFFInitNeXT },
  35. #endif    /* NEXT_SUPPORT */
  36.  
  37. #ifdef     SGI_SUPPORT
  38.         { COMPRESSION_SGIRLE, TIFFInitSGI },
  39. #endif    /* SGI_SUPPORT */
  40.  
  41.         { COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
  42.         { COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
  43.         { COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
  44.         { COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 },
  45. };
  46.  
  47. #define NSCHEMES    (sizeof(CompressionSchemes) / sizeof(CompressionSchemes[0]))
  48.  
  49. /****************************************************************************
  50.  *
  51.  */
  52. int
  53. TIFFSetCompressionScheme(
  54.     TIFF     *tif,
  55.     u_short    scheme
  56.     )
  57. {
  58.         register struct cscheme    *c;
  59.  
  60.         for (c = CompressionSchemes; c < &CompressionSchemes[NSCHEMES]; c++)
  61.                 if (c->scheme == scheme) {
  62.                         tif->tif_stripdecode = NULL;
  63.                         tif->tif_stripencode = NULL;
  64.                         tif->tif_encodestrip = NULL;
  65.                         tif->tif_close = NULL;
  66.                         tif->tif_seek = NULL;
  67.                         tif->tif_cleanup = NULL;
  68.                         tif->tif_flags &= ~TIFF_NOBITREV;
  69.                         tif->tif_options = 0;
  70.                         return((*c->init)(tif));
  71.                 }
  72.         TIFFError("TIFFSetCompressionScheme", "unknown data compression algorithm %u", tif->tif_name, scheme);
  73.         return(0);
  74. }
  75.