Each function described above is in the same format and for all you have to do with them is passing a Storage instance and an Image instance. The code below illustrates it:
AutoPtr<DiskStorageWithRollback> storage = DiskStorageWithRollback::create("test.tif"); exportAsTIFF(storage, image); // assume that image points to an Image instance. storage->commit();
NULL), exportAsXXX function uses the metadata obtained from the Image instance, otherwise exportAsXXX function uses the metadata specified by it instead of the metadata obtained from the Image instance. For information about Metadata handling, see Metadata Handling.
The code below illustrate how to modify the metadata before calling exportAsXXX function:
AutoPtr<DataStore> metadata = image->getMetadata(); // We can modify the metadata! TIFF6::set(metadata, "Artist", "Leonardo da Vinci"); TIFF6::set(metadata, "Software", "My mighty image program"); AutoPtr<DiskStorageWithRollback> storage = DiskStorageWithRollback::create("test.bmp", accessWrite); exportAsVFZ(storage, image, metadata); storage->commit();
AutoPtr<HttpManager> httpMan = HttpManager::create("My Export Test/1.0"); String padsAddr = "pads.somewhere.org:12222"; AutoPtr<CredentialProvider> credProv = CredentialProvider::createFromStrings("username", "password"); AutoPtr<DiskStorageWithRollback> storage = DiskStorageWithRollback::create("test.pfz", accessWrite); exportAsPFZ(storage, image, padsAddr, credProv, httpMan); storage->commit();
SimpleArray< AutoPtr<Image> > pages; SimpleArray< AutoPtr<DataStore> > metadata; pages.push_back(firstPage); pages.push_back(secondPage); pages.push_back(thirdPage); exportAsMultiPageTIFF(storage, pages, metadata);