Home | History | Annotate | Download | only in libtiff

Lines Matching defs:tif

86 	TIFF *tif;
119 tif = (TIFF *)_TIFFmalloc((tmsize_t)(sizeof (TIFF) + strlen(name) + 1));
120 if (tif == NULL) {
124 _TIFFmemset(tif, 0, sizeof (*tif));
125 tif->tif_name = (char *)tif + sizeof (TIFF);
126 strcpy(tif->tif_name, name);
127 tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
128 tif->tif_curdir = (uint16) -1; /* non-existent directory */
129 tif->tif_curoff = 0;
130 tif->tif_curstrip = (uint32) -1; /* invalid strip */
131 tif->tif_row = (uint32) -1; /* read/write pre-increment */
132 tif->tif_clientdata = clientdata;
138 tif->tif_readproc = readproc;
139 tif->tif_writeproc = writeproc;
140 tif->tif_seekproc = seekproc;
141 tif->tif_closeproc = closeproc;
142 tif->tif_sizeproc = sizeproc;
144 tif->tif_mapproc = mapproc;
146 tif->tif_mapproc = _tiffDummyMapProc;
148 tif->tif_unmapproc = unmapproc;
150 tif->tif_unmapproc = _tiffDummyUnmapProc;
151 _TIFFSetDefaultCompressionState(tif); /* setup default state */
157 tif->tif_flags = FILLORDER_MSB2LSB;
159 tif->tif_flags |= TIFF_MAPPED;
163 tif->tif_flags |= STRIPCHOP_DEFAULT;
223 tif->tif_flags |= TIFF_SWAB;
229 tif->tif_flags |= TIFF_SWAB;
233 tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
237 tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
241 tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
246 tif->tif_flags |= TIFF_MAPPED;
250 tif->tif_flags &= ~TIFF_MAPPED;
254 tif->tif_flags |= TIFF_STRIPCHOP;
258 tif->tif_flags &= ~TIFF_STRIPCHOP;
261 tif->tif_flags |= TIFF_HEADERONLY;
265 tif->tif_flags |= TIFF_BIGTIFF;
272 !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeaderClassic))) {
273 if (tif->tif_mode == O_RDONLY) {
274 TIFFErrorExt(tif->tif_clientdata, name,
282 tif->tif_header.common.tiff_magic = (tif->tif_flags & TIFF_SWAB)
285 tif->tif_header.common.tiff_magic = (tif->tif_flags & TIFF_SWAB)
288 if (!(tif->tif_flags&TIFF_BIGTIFF))
290 tif->tif_header.common.tiff_version = TIFF_VERSION_CLASSIC;
291 tif->tif_header.classic.tiff_diroff = 0;
292 if (tif->tif_flags & TIFF_SWAB)
293 TIFFSwabShort(&tif->tif_header.common.tiff_version);
294 tif->tif_header_size = sizeof(TIFFHeaderClassic);
298 tif->tif_header.common.tiff_version = TIFF_VERSION_BIG;
299 tif->tif_header.big.tiff_offsetsize = 8;
300 tif->tif_header.big.tiff_unused = 0;
301 tif->tif_header.big.tiff_diroff = 0;
302 if (tif->tif_flags & TIFF_SWAB)
304 TIFFSwabShort(&tif->tif_header.common.tiff_version);
305 TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
307 tif->tif_header_size = sizeof (TIFFHeaderBig);
316 TIFFSeekFile( tif, 0, SEEK_SET );
317 if (!WriteOK(tif, &tif->tif_header, (tmsize_t)(tif->tif_header_size))) {
318 TIFFErrorExt(tif->tif_clientdata, name,
325 if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN) {
327 tif->tif_flags |= TIFF_SWAB;
331 tif->tif_flags |= TIFF_SWAB;
337 if (!TIFFDefaultDirectory(tif))
339 tif->tif_diroff = 0;
340 tif->tif_dirlist = NULL;
341 tif->tif_dirlistsize = 0;
342 tif->tif_dirnumber = 0;
343 return (tif);
348 if (tif->tif_header.common.tiff_magic != TIFF_BIGENDIAN &&
349 tif->tif_header.common.tiff_magic != TIFF_LITTLEENDIAN
353 tif->tif_header.common.tiff_magic != MDI_BIGENDIAN
355 tif->tif_header.common.tiff_magic != MDI_LITTLEENDIAN
358 TIFFErrorExt(tif->tif_clientdata, name,
362 TIFFErrorExt(tif->tif_clientdata, name,
365 tif->tif_header.common.tiff_magic,
366 tif->tif_header.common.tiff_magic);
369 if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN) {
371 tif->tif_flags |= TIFF_SWAB;
375 tif->tif_flags |= TIFF_SWAB;
378 if (tif->tif_flags & TIFF_SWAB)
379 TIFFSwabShort(&tif->tif_header.common.tiff_version);
380 if ((tif->tif_header.common.tiff_version != TIFF_VERSION_CLASSIC)&&
381 (tif->tif_header.common.tiff_version != TIFF_VERSION_BIG)) {
382 TIFFErrorExt(tif->tif_clientdata, name,
384 tif->tif_header.common.tiff_version,
385 tif->tif_header.common.tiff_version);
388 if (tif->tif_header.common.tiff_version == TIFF_VERSION_CLASSIC)
390 if (tif->tif_flags & TIFF_SWAB)
391 TIFFSwabLong(&tif->tif_header.classic.tiff_diroff);
392 tif->tif_header_size = sizeof(TIFFHeaderClassic);
396 if (!ReadOK(tif, ((uint8*)(&tif->tif_header) + sizeof(TIFFHeaderClassic)), (sizeof(TIFFHeaderBig)-sizeof(TIFFHeaderClassic))))
398 TIFFErrorExt(tif->tif_clientdata, name,
402 if (tif->tif_flags & TIFF_SWAB)
404 TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
405 TIFFSwabLong8(&tif->tif_header.big.tiff_diroff);
407 if (tif->tif_header.big.tiff_offsetsize != 8)
409 TIFFErrorExt(tif->tif_clientdata, name,
411 tif->tif_header.big.tiff_offsetsize,
412 tif->tif_header.big.tiff_offsetsize);
415 if (tif->tif_header.big.tiff_unused != 0)
417 TIFFErrorExt(tif->tif_clientdata, name,
419 tif->tif_header.big.tiff_unused,
420 tif->tif_header.big.tiff_unused);
423 tif->tif_header_size = sizeof(TIFFHeaderBig);
424 tif->tif_flags |= TIFF_BIGTIFF;
426 tif->tif_flags |= TIFF_MYBUFFER;
427 tif->tif_rawcp = tif->tif_rawdata = 0;
428 tif->tif_rawdatasize = 0;
429 tif->tif_rawdataoff = 0;
430 tif->tif_rawdataloaded = 0;
434 if (!(tif->tif_flags&TIFF_BIGTIFF))
435 tif->tif_nextdiroff = tif->tif_header.classic.tiff_diroff;
437 tif->tif_nextdiroff = tif->tif_header.big.tiff_diroff;
443 if (tif->tif_flags & TIFF_MAPPED)
446 if (TIFFMapFileContents(tif,(void**)(&tif->tif_base),&n))
448 tif->tif_size=(tmsize_t)n;
449 assert((toff_t)tif->tif_size==n);
452 tif->tif_flags &= ~TIFF_MAPPED;
460 if (tif->tif_flags & TIFF_HEADERONLY)
461 return (tif);
466 if (TIFFReadDirectory(tif)) {
467 tif->tif_rawcc = (tmsize_t)-1;
468 tif->tif_flags |= TIFF_BUFFERSETUP;
469 return (tif);
478 if (!TIFFDefaultDirectory(tif))
480 return (tif);
483 tif->tif_mode = O_RDONLY; /* XXX avoid flush */
484 TIFFCleanup(tif);
497 TIFFFileName(TIFF* tif)
499 return (tif->tif_name);
506 TIFFSetFileName(TIFF* tif, const char *name)
508 const char* old_name = tif->tif_name;
509 tif->tif_name = (char *)name;
517 TIFFFileno(TIFF* tif)
519 return (tif->tif_fd);
526 TIFFSetFileno(TIFF* tif, int fd)
528 int old_fd = tif->tif_fd;
529 tif->tif_fd = fd;
537 TIFFClientdata(TIFF* tif)
539 return (tif->tif_clientdata);
546 TIFFSetClientdata(TIFF* tif, thandle_t newvalue)
548 thandle_t m = tif->tif_clientdata;
549 tif->tif_clientdata = newvalue;
557 TIFFGetMode(TIFF* tif)
559 return (tif->tif_mode);
566 TIFFSetMode(TIFF* tif, int mode)
568 int old_mode = tif->tif_mode;
569 tif->tif_mode = mode;
578 TIFFIsTiled(TIFF* tif)
580 return (isTiled(tif));
587 TIFFCurrentRow(TIFF* tif)
589 return (tif->tif_row);
596 TIFFCurrentDirectory(TIFF* tif)
598 return (tif->tif_curdir);
605 TIFFCurrentStrip(TIFF* tif)
607 return (tif->tif_curstrip);
614 TIFFCurrentTile(TIFF* tif)
616 tif->tif_curtile);
623 TIFFIsByteSwapped(TIFF* tif)
625 return ((tif->tif_flags & TIFF_SWAB) != 0);
632 TIFFIsUpSampled(TIFF* tif)
634 return (isUpSampled(tif));
641 TIFFIsMSB2LSB(TIFF* tif)
643 return (isFillOrder(tif, FILLORDER_MSB2LSB));
650 TIFFIsBigEndian(TIFF* tif)
652 return (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN);
659 TIFFGetReadProc(TIFF* tif)
661 return (tif->tif_readproc);
668 TIFFGetWriteProc(TIFF* tif)
670 return (tif->tif_writeproc);
677 TIFFGetSeekProc(TIFF* tif)
679 return (tif->tif_seekproc);
686 TIFFGetCloseProc(TIFF* tif)
688 return (tif->tif_closeproc);
695 TIFFGetSizeProc(TIFF* tif)
697 return (tif->tif_sizeproc);
704 TIFFGetMapFileProc(TIFF* tif)
706 return (tif->tif_mapproc);
713 TIFFGetUnmapFileProc(TIFF* tif)
715 return (tif->tif_unmapproc);