Flutter Engine
The Flutter Engine
SkExif.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkExif_DEFINED
9#define SkExif_DEFINED
10
13
14#include <cstdint>
15#include <optional>
16
17class SkData;
18
19namespace SkExif {
20
21// Tag values that are parsed by Parse and stored in Metadata.
22static constexpr uint16_t kOriginTag = 0x112;
23static constexpr uint16_t kResolutionUnitTag = 0x0128;
24static constexpr uint16_t kXResolutionTag = 0x011a;
25static constexpr uint16_t kYResolutionTag = 0x011b;
26static constexpr uint16_t kPixelXDimensionTag = 0xa002;
27static constexpr uint16_t kPixelYDimensionTag = 0xa003;
28
29struct Metadata {
30 // The image orientation.
31 std::optional<SkEncodedOrigin> fOrigin;
32
33 // The HDR headroom property.
34 // https://developer.apple.com/documentation/appkit/images_and_pdf/applying_apple_hdr_effect_to_your_photos
35 std::optional<float> fHdrHeadroom;
36
37 // Resolution.
38 std::optional<uint16_t> fResolutionUnit;
39 std::optional<float> fXResolution;
40 std::optional<float> fYResolution;
41
42 // Size in pixels.
43 std::optional<uint32_t> fPixelXDimension;
44 std::optional<uint32_t> fPixelYDimension;
45};
46
47/*
48 * Parse the metadata specified in |data| and write them to |metadata|. Stop only at an
49 * unrecoverable error (allow truncated input).
50 */
51void SK_API Parse(Metadata& metadata, const SkData* data);
52
53} // namespace SkExif
54
55#endif
#define SK_API
Definition: SkAPI.h:35
Definition: SkData.h:25
Definition: SkExif.h:19
static constexpr uint16_t kResolutionUnitTag
Definition: SkExif.h:23
static constexpr uint16_t kPixelXDimensionTag
Definition: SkExif.h:26
static constexpr uint16_t kPixelYDimensionTag
Definition: SkExif.h:27
static constexpr uint16_t kOriginTag
Definition: SkExif.h:22
static constexpr uint16_t kXResolutionTag
Definition: SkExif.h:24
void SK_API Parse(Metadata &metadata, const SkData *data)
Definition: SkExif.cpp:182
static constexpr uint16_t kYResolutionTag
Definition: SkExif.h:25
std::optional< uint32_t > fPixelYDimension
Definition: SkExif.h:44
std::optional< uint32_t > fPixelXDimension
Definition: SkExif.h:43
std::optional< float > fHdrHeadroom
Definition: SkExif.h:35
std::optional< SkEncodedOrigin > fOrigin
Definition: SkExif.h:31
std::optional< float > fYResolution
Definition: SkExif.h:40
std::optional< uint16_t > fResolutionUnit
Definition: SkExif.h:38
std::optional< float > fXResolution
Definition: SkExif.h:39
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63