예제 #1
0
 /**
  * Factor to convert from yards to meters.
  **********************************************************************/
 static inline double yard() throw() { return 3 * foot(); }
 /**
  * @return the number of meters in a yard.
  **********************************************************************/
 static inline Math::real yard() { return 3 * foot(); }
예제 #3
0
std::string
encode_xmp(const ImageSpec& spec, bool minimal)
{
    std::vector<std::pair<const XMPtag*, std::string>> list;
    gather_xmp_attribs(spec, list);

    std::string xmp;

#if 1
    // This stuff seems to work
    xmp += encode_xmp_category(list, "photoshop", "photoshop:", NULL, NULL,
                               "http://ns.adobe.com/photoshop/1.0/", minimal,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "xmp", "xmp:Rating", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/", minimal,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "xmp", "xmp:CreateDate", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/", false,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "xmp", "xmp:ModifyDate", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/", false,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "xmp", "xmp:MetadataDate", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/", false,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "xmpRights", "xmpRights:UsageTerms", NULL,
                               "xmpRights:UsageTerms",
                               "http://ns.adobe.com/xap/1.0/rights/", minimal,
                               XMP_AltList);
    xmp += encode_xmp_category(list, "xmpRights", "xmpRights:", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/rights/", minimal,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "dc", "dc:subject", NULL, "dc:subject",
                               "http://purl.org/dc/elements/1.1/", minimal,
                               XMP_BagList);
    xmp += encode_xmp_category(list, "Iptc4xmpCore", "Iptc4xmpCore:SubjectCode",
                               NULL, "Iptc4xmpCore:SubjectCode",
                               "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/",
                               false, XMP_BagList);
    xmp += encode_xmp_category(list, "Iptc4xmpCore",
                               "Iptc4xmpCore:", "Iptc4xmpCore:Ci", NULL,
                               "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/",
                               minimal, XMP_attribs);
    xmp += encode_xmp_category(list, "Iptc4xmpCore", "Iptc4xmpCore:Ci", NULL,
                               "Iptc4xmpCore:CreatorContactInfo",
                               "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/",
                               minimal, XMP_attribs);
    xmp += encode_xmp_category(list, "Iptc4xmpCore", "Iptc4xmpCore:Scene", NULL,
                               "Iptc4xmpCore:Scene",
                               "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/",
                               minimal, XMP_BagList);

    xmp += encode_xmp_category(list, "xmpMM", "xmpMM:", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/mm/", minimal,
                               XMP_attribs);
    xmp += encode_xmp_category(list, "GPano", "GPano:", NULL, NULL,
                               "http://ns.google.com/photos/1.0/panorama/",
                               minimal, XMP_attribs);
    xmp += encode_xmp_category(list, "crs", "crs:", NULL, NULL,
                               "http://ns.adobe.com/camera-raw-settings/1.0/",
                               minimal, XMP_attribs);
#endif

    xmp += encode_xmp_category(list, "xmp", "xmp:", NULL, NULL,
                               "http://ns.adobe.com/xap/1.0/", minimal,
                               XMP_nodes);

    xmp += encode_xmp_category(list, "tiff", "tiff:", NULL, NULL,
                               "http://ns.adobe.com/tiff/1.0/", minimal,
                               XMP_attribs);
#if 0
    // Doesn't work yet
    xmp += encode_xmp_category (list, "xapRights", "xapRights:", NULL, NULL,
                                "http://ns.adobe.com/xap/1.0/rights/", minimal, XMP_attribs);
//    xmp += encode_xmp_category (list, "dc", "dc:", NULL, NULL,
//                                "http://purl.org/dc/elements/1.1/", minimal, XMP_attribs);

#endif

    // FIXME exif xmp stRef stVer stJob xmpDM

    if (!xmp.empty()) {
        std::string head(
            "<?xpacket begin=\"\xEF\xBB\xBF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?> "
            "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"Adobe XMP Core 5.5-c002 1.148022, 2012/07/15-18:06:45        \"> <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"> ");
        std::string foot(" </rdf:RDF> </x:xmpmeta> <?xpacket end=\"w\"?>");
        xmp = head + xmp + foot;
    }


#if DEBUG_XMP_WRITE
    std::cerr << "xmp to write = \n---\n" << xmp << "\n---\n";
    std::cerr << "\n\nHere's what I still haven't output:\n";
    for (size_t i = 0; i < list.size(); ++i)
        std::cerr << list[i].first->xmpname << "\n";
#endif

    return xmp;
}