File: SkXmp.h

package info (click to toggle)
webkit2gtk 2.51.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 455,340 kB
  • sloc: cpp: 3,865,253; javascript: 197,710; ansic: 165,177; python: 49,241; asm: 21,868; ruby: 18,095; perl: 16,926; xml: 4,623; sh: 2,409; yacc: 2,356; java: 2,019; lex: 1,330; pascal: 372; makefile: 210
file content (62 lines) | stat: -rw-r--r-- 2,367 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright 2023 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkXmp_DEFINED
#define SkXmp_DEFINED

#include "include/core/SkRefCnt.h"
#include "include/private/base/SkAPI.h"

class SkData;
struct SkGainmapInfo;

#include <cstddef>
#include <memory>

/*
 * An interface to extract information from XMP metadata.
 */
class SK_API SkXmp {
public:
    SkXmp() = default;
    virtual ~SkXmp() = default;
    // Make noncopyable
    SkXmp(const SkXmp&) = delete;
    SkXmp& operator= (const SkXmp&) = delete;

    // Create from XMP data.
    static std::unique_ptr<SkXmp> Make(sk_sp<SkData> xmpData);
    // Create from standard XMP + extended XMP data, see XMP Specification Part 3: Storage in files,
    // Section 1.1.3.1: Extended XMP in JPEG
    static std::unique_ptr<SkXmp> Make(sk_sp<SkData> xmpStandard, sk_sp<SkData> xmpExtended);

    // Extract HDRGM gainmap parameters.
    // TODO(b/338342146): Remove this once all callers are removed.
    bool getGainmapInfoHDRGM(SkGainmapInfo* info) const { return getGainmapInfoAdobe(info); }

    // Extract gainmap parameters from http://ns.adobe.com/hdr-gain-map/1.0/.
    virtual bool getGainmapInfoAdobe(SkGainmapInfo* info) const = 0;

    // If the image specifies http://ns.apple.com/pixeldatainfo/1.0/ AuxiliaryImageType of
    // urn:com:apple:photo:2020:aux:hdrgainmap, and includes a http://ns.apple.com/HDRGainMap/1.0/
    // HDRGainMapVersion, then populate |info| with gainmap parameters that will approximate the
    // math specified at [0] and return true.
    // [0] https://developer.apple.com/documentation/appkit/images_and_pdf/
    //     applying_apple_hdr_effect_to_your_photos
    virtual bool getGainmapInfoApple(float exifHdrHeadroom, SkGainmapInfo* info) const = 0;

    // If this includes GContainer metadata and the GContainer contains an item with semantic
    // GainMap and Mime of image/jpeg, then return true, and populate |offset| and |size| with
    // that item's offset (from the end of the primary JPEG image's EndOfImage), and the size of
    // the gainmap.
    virtual bool getContainerGainmapLocation(size_t* offset, size_t* size) const = 0;

    // Return the GUID of an Extended XMP if present, or null otherwise.
    virtual const char* getExtendedXmpGuid() const = 0;
};

#endif