📄 readme
字号:
NOTE: Sept/2004 The following described approach to managing tag extensions has beenmostly superceeded since libtiff 3.6.0. The described approach requiresinternal knowledge of the libtiff API and tends to be very fragile in the face of libtiff upgrades. Please read over the html/addingtags.html in preference to the belowdescribed approach.==================================Client module for adding to LIBTIFF tagset------------------------------------------- Author: Niles Ritter In the past, users of the "libtiff" package had to modify thesource code of the library if they required additional private tagsor codes not recognized by libtiff. Thus, whenevera new revision of libtiff came out the client would have toperform modifications to six or seven different files to re-installtheir tags.The latest versions of libtiff now provide client software new routines, giving them the opportunity to install private extensions at runtime,rather than compile-time. This means that the client may encapsulateall of their private tags into a separate module, which need onlybe recompiled when new versions of libtiff are released; no manualediting of files is required.How it works------------The mechanism for overriding the tag access has been enabled witha single new routine, which has the following calling sequence: TIFFExtendProc old_extender; old_extender = TIFFSetTagExtender(tag_extender);which must be called prior to opening or creating TIFF files.This routine sets a static pointer to the user-specified function<tag_extender>, which in turn is called by TIFFDefaultDirectory(),just after the usual TIFFSetField() and TIFFGetField() methodsare defined, and just before the compression tag is set. It alsoreturns a pointer to the previously-defined value of the tag-extender,so that multiple clients may be installed.The TIFFExtendProc method that you define should be used to overridethe TIFF file's "vsetfield" and "vgetfield" methods, so that youcan trap your new, private tags, and install their values intoa private directory structure. For your convienience, a new pointerhas also been added to the "TIFF" file structure: tidata_t tif_clientdir; /* client TIFF directory */into which you may install whatever private directory structures you like.You should also override the tag-printing method from within your"vsetfield" method, to permit the symbolic printing of your new tags.Example Client Code:--------------------An example module has been provided as a template for installingyour own tags into a client tag extender. The module is called"xtif_dir.c", and defines all of the interface routines, tag fieldaccess, tag printing, etc. for most purpose. To see how the client module operates, there are three "fake"tags currently installed. If you use the existing makefile you canbuild them with: make all -f Makefile.gcc !or Makefile.mpw maketif listtif This will build two example programs called "maketif" and "listtif" and then run them. These programs do nothing more than create a smallfile called "newtif.tif", install the fake tags, and then list them outusing TIFFPrintDirectory().Installing Private Tags-----------------------To use this module for installing your own tags, edit each of the files xtif_dir.c xtiffio.h xtiffiop.h and search for the string "XXX". At these locations the commentswill direct you how to install your own tag values, define theirtypes, etc. Three examples tags are currently installed, demonstratinghow to implement multi-valued tags, single-valued tags, and ASCII tags.The examples are not valid, registered tags, so you must replace them withyour own.To test the routines, also edit the test programs "maketif.c" and"listtif.c" and replace the portions of the code that set theprivate tag values and list them.Once you have edited these files, you may build the client modulewith the Makefile provided, and run the test programs.To use these files in your own code, the "xtif_dir.c" module definesreplacement routines for the standard "TIFFOpen()" "TIFFFdOpen",and "TIFFClose()" routines, called XTIFFOpen, XTIFFFdOpen and XTIFFClose.You must use these routines in order to have the extended tag handlersinstalled. Once installed, the standard TIFFGetField() and TIFFSetFieldroutines may be used as before.Adding Extended Tags to "tools"-------------------------------To create an extended-tag savvy "tiffinfo" program or other utility, you maysimply recompile and link the tools to your "libxtiff" library, adding -DTIFFOpen=XTIFFOpen -DTIFFClose=XTIFFClose -DTIFFFdOpen=XTIFFFdOpento the compile statement.Bugs, Comments Etc:------------------ Send all reports and suggestions to ndr@tazboy.jpl.nasa.gov (Niles Ritter).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -