Debian Codegraph @

include/private/SkGainmapShader.h

raw
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 SkGainmapShader_DEFINED
9 #define SkGainmapShader_DEFINED
10
11 #include "include/core/SkRefCnt.h"
12 #include "include/private/base/SkAPI.h"
13
14 class SkColorSpace;
15 class SkShader;
16 class SkImage;
17 struct SkGainmapInfo;
18 struct SkRect;
19 struct SkSamplingOptions;
20
21 /**
22 * A gainmap shader will apply a gainmap to an base image using the math described alongside the
23 * definition of SkGainmapInfo.
24 */
25 class SK_API SkGainmapShader {
26 public:
27 /**
28 * Make a gainmap shader.
29 *
30 * When sampling the base image baseImage, the rectangle baseRect will be sampled to map to
31 * the rectangle dstRect. Sampling will be done according to baseSamplingOptions.
32 *
33 * When sampling the gainmap image gainmapImage, the rectangle gainmapRect will be sampled to
34 * map to the rectangle dstRect. Sampling will be done according to gainmapSamplingOptions.
35 *
36 * The gainmap will be applied according to the HDR to SDR ratio specified in dstHdrRatio.
37 */
38 static sk_sp<SkShader> Make(const sk_sp<const SkImage>& baseImage,
39 const SkRect& baseRect,
40 const SkSamplingOptions& baseSamplingOptions,
41 const sk_sp<const SkImage>& gainmapImage,
42 const SkRect& gainmapRect,
43 const SkSamplingOptions& gainmapSamplingOptions,
44 const SkGainmapInfo& gainmapInfo,
45 const SkRect& dstRect,
46 float dstHdrRatio);
47
48 static sk_sp<SkShader> Make(const sk_sp<const SkImage>& baseImage,
49 const SkRect& baseRect,
50 const SkSamplingOptions& baseSamplingOptions,
51 const sk_sp<const SkImage>& gainmapImage,
52 const SkRect& gainmapRect,
53 const SkSamplingOptions& gainmapSamplingOptions,
54 const SkGainmapInfo& gainmapInfo,
55 const SkRect& dstRect,
56 float dstHdrRatio,
57 sk_sp<SkColorSpace> dstColorSpace);
58 };
59
60 #endif