Struct tiff_encoder::Ifd[][src]

pub struct Ifd { /* fields omitted */ }

A structure that holds both an IFD and all the values pointed at by its entries.

In a TIFF file, an IFD may point to another IFD with its last 4 bytes. To abstract the user of this crate from the position of each structure in the file, this link between Ifds is represented by an IfdChain. Because any IFD could technically point to a next one, in most functions that one would expect to input an Ifd, its parameters actually ask for an IfdChain.

One can easily create an IfdChain of a single Ifd calling the method single() on that Ifd.

Methods

impl Ifd
[src]

Creates a new empty Ifd.

Note that an empty IFD is prohibited by the TIFF specification. As such, it is not possible to directly use the resulting Ifd alone in the creation of a TIFF file.

However, one can chain this function with methods such as with_entry(FieldTag, FieldValues) in order to build a valid Ifd.

Returns the same Ifd, but adding the given pair of Tag and Values.

Because it returns Self, it is possible to chain this method.

Examples

Creating a TiffFile with some arbitrary entries.

Note that the order in which entries are added is irrelevant. Internally, the Ifd will automatically arrange them by ascending order of tags, as specified by the TIFF specification.

use tiff_encoder::*;
use tiff_encoder::tiff_type::*;
 
let ifd = Ifd::new()
    .with_entry(0x0000, BYTE::single(0))
    .with_entry(0x00FF, LONG::single(500))
    .with_entry(0xA01F, SHORT::values(vec![50, 2, 0, 3]))
    .with_entry(0x0005, ASCII::from_str("Hello TIFF!"))
    .with_entry(0x0100, UNDEFINED::values(vec![0x42, 0x42, 0x42, 0x42]));

Panics

In order to protect the user of this crate, trying to add a value to an already existing entry with this method is considered a mistake and will panic.

Other functions that insert members to the Ifd will have an "Entries" section, where they'll specify which entries are inserted.

Returns the same Ifd, but adding the given subifds.

Because it returns Self, it is possible to chain this method.

Entries

Using this method will automatically insert the entry 0x014A (tag::SubIFDs).

Panics

If the inserted entries already exist, this function will panic.

Returns an IfdChain containing solely this Ifd.

In other words, it marks this Ifd as the single element of its chain.

Auto Trait Implementations

impl !Send for Ifd

impl !Sync for Ifd