xref: /aosp_15_r20/external/skia/include/private/SkJpegGainmapEncoder.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 SkJpegGainmapEncoder_DEFINED
9 #define SkJpegGainmapEncoder_DEFINED
10 
11 #include "include/encode/SkJpegEncoder.h"
12 
13 class SkPixmap;
14 class SkWStream;
15 struct SkGainmapInfo;
16 
17 class SK_API SkJpegGainmapEncoder {
18 public:
19     /**
20      *  Encode an UltraHDR image to |dst|.
21      *
22      *  The base image is specified by |base|, and |baseOptions| controls the encoding behavior for
23      *  the base image.
24      *
25      *  The gainmap image is specified by |gainmap|, and |gainmapOptions| controls the encoding
26      *  behavior for the gainmap image.
27      *
28      *  The rendering behavior of the gainmap image is provided in |gainmapInfo|.
29      *
30      *  If |baseOptions| or |gainmapOptions| specify XMP metadata, then that metadata will be
31      *  overwritten.
32      *
33      *  Returns true on success.  Returns false on an invalid or unsupported |src|.
34      */
35     static bool EncodeHDRGM(SkWStream* dst,
36                             const SkPixmap& base,
37                             const SkJpegEncoder::Options& baseOptions,
38                             const SkPixmap& gainmap,
39                             const SkJpegEncoder::Options& gainmapOptions,
40                             const SkGainmapInfo& gainmapInfo);
41 
42     /**
43      *  Write a Multi Picture Format containing the |imageCount| images specified by |images|.
44      */
45     static bool MakeMPF(SkWStream* dst, const SkData** images, size_t imageCount);
46 };
47 
48 #endif
49