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.
- */
-
- /*
- "Null" Compression Algorithm Support.
- */
-
- #include <mem.h>
- #include "tiffio.h"
-
-
- /*
- Encode a scanline of pixels.
- */
- static
- CompletionCode DumpModeEncode(TIFF *tif, char *pp, long cc)
- {
- if (tif->tif_rawcc + cc > tif->tif_rawdatasize)
- if (!TIFFFlushData(tif))
- return (-1);
- memcpy(tif->tif_rawcp, pp, (unsigned) cc);
- tif->tif_rawcp += (unsigned) cc;
- tif->tif_rawcc += cc;
- return (TRUE);
- }
-
- /*
- Seek forwards nrows in the current strip.
- */
- static
- CompletionCode DumpModeSeek(TIFF *tif, long nrows)
- {
- tif->tif_rawcp += (unsigned)(nrows * tif->tif_scanlinesize);
- tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
- return(TRUE);
- }
-
- /*
- Decode a scanline of pixels.
- */
- static
- CompletionCode DumpModeDecode(TIFF *tif, char *buf, long cc)
- {
- if (tif->tif_rawcc < cc)
- {
- TIFFError(tif->tif_name,"DumpModeDecode: Not enough data for scanline %d",
- tif->tif_row);
- return (FALSE);
- }
- memcpy(buf,tif->tif_rawcp, (unsigned) cc);
- DumpModeSeek(tif, 1);
- return(TRUE);
- }
-
-
- /*
- Initialize dump mode.
- */
-
- void TIFFInitDumpMode(TIFF *tif)
- {
- tif->tif_decoderow = DumpModeDecode;
- tif->tif_encoderow = DumpModeEncode;
- tif->tif_seek = DumpModeSeek;
- }