ngageoint / tiff-java

Tagged Image File Format Java Library
https://ngageoint.github.io/tiff-java
MIT License
72 stars 34 forks source link

rename FieldType to TagType and FieldTagType to TagName #16

Closed Jochen0x90h closed 7 years ago

Jochen0x90h commented 7 years ago

also renames get/setEntryValue to get/setTag. This should not affect existing code, but when access to tags is exposed I think this renaming conforms more to the TIFF documentation such as http://www.fileformat.info/format/tiff/egff.htm#X058-9-TIFF-TB-3

bosborn commented 7 years ago

I prefer the current names and think they more closely match the TIFF 6.0 spec.

Your provided link discusses the TIFF spec, but is not the spec. It also includes this warning:

Note that the TIFF 6.0 specification has replaced the term tag with the term field. Field now refers to the entire 12-byte data record, while the term tag has been redefined to refer only to a field's identifying number. Because so many programmers are familiar with the older definition of the term tag, the authors have chosen to continue using tag, rather than field, in this description of TIFF to avoid confusion.

You can search online for tiff6.pdf to read the TIFF 6.0 spec (published in 1992).

The FileDirectoryEntry is an "IFD Entry” (Image File Directory).

IFD Entry
Each 12-byte IFD entry has the following format:
* Bytes 0-1 The Tag that identifies the field.
* Bytes 2-3 The field Type.
* Bytes 4-7 The number of values, Count of the indicated Type. TIFF 6.0 Specification Final—June 3, 1992 15
* Bytes 8-11 The Value Offset, the file offset (in bytes) of the Value for the field. The Value is expected to begin on a word boundary; the corresponding Value Offset will thus be an even number. This file offset may point anywhere in the file, even after the image data.

FieldTagType is an enumeration of the possible field tag types, each containing a name and tag number. The name is an attribute of the field tag enumeration (.name()), not a TagName itself.

FieldType is an enumeration of the field types for an IFD entry, each defining the type and size. This has little to do with a TagType.

The IFD Entries contain either the value or the offset to the value. Those methods are getting/setting the IFD entry with value as opposed to getting/setting a tag.

Javadoc is regenerated upon release and does not require manual maintenance.