home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / pdflib / pdflib-4.0.1.sit / pdflib-4.0.1 / tiff / tif_dumpmode.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-04  |  2.3 KB  |  83 lines  |  [TEXT/CWIE]

  1. /*
  2.  * Copyright (c) 1988-1997 Sam Leffler
  3.  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  4.  *
  5.  * Permission to use, copy, modify, distribute, and sell this software and 
  6.  * its documentation for any purpose is hereby granted without fee, provided
  7.  * that (i) the above copyright notices and this permission notice appear in
  8.  * all copies of the software and related documentation, and (ii) the names of
  9.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  10.  * publicity relating to the software without the specific, prior written
  11.  * permission of Sam Leffler and Silicon Graphics.
  12.  * 
  13.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  14.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  15.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  16.  * 
  17.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  18.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  19.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  21.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  22.  * OF THIS SOFTWARE.
  23.  */
  24.  
  25. /*
  26.  * TIFF Library.
  27.  *
  28.  * "Null" Compression Algorithm Support.
  29.  */
  30.  
  31. /* $Id: tif_dumpmode.c,v 1.6 2001/03/21 10:41:18 rjs Exp $ */
  32.  
  33. #include "tiffiop.h"
  34.  
  35. /*
  36.  * Decode a hunk of pixels.
  37.  */
  38. static int
  39. DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
  40. {
  41.     (void) s;
  42.     if (tif->tif_rawcc < cc) {
  43.         TIFFError(tif->tif_name,
  44.             "DumpModeDecode: Not enough data for scanline %d",
  45.             tif->tif_row);
  46.         return (0);
  47.     }
  48.     /*
  49.      * Avoid copy if client has setup raw
  50.      * data buffer to avoid extra copy.
  51.      */
  52.     if (tif->tif_rawcp != buf)
  53.         _TIFFmemcpy(buf, tif->tif_rawcp, cc);
  54.     tif->tif_rawcp += cc;
  55.     tif->tif_rawcc -= cc;
  56.     return (1);
  57. }
  58.  
  59. /*
  60.  * Seek forwards nrows in the current strip.
  61.  */
  62. static int
  63. DumpModeSeek(TIFF* tif, uint32 nrows)
  64. {
  65.     tif->tif_rawcp += nrows * tif->tif_scanlinesize;
  66.     tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
  67.     return (1);
  68. }
  69.  
  70. /*
  71.  * Initialize dump mode.
  72.  */
  73. int
  74. TIFFInitDumpMode(TIFF* tif, int scheme)
  75. {
  76.     (void) scheme;
  77.     tif->tif_decoderow = DumpModeDecode;
  78.     tif->tif_decodestrip = DumpModeDecode;
  79.     tif->tif_decodetile = DumpModeDecode;
  80.     tif->tif_seek = DumpModeSeek;
  81.     return (1);
  82. }
  83.