Flutter Engine
The Flutter Engine
SkGainmapShader.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 SkGainmapShader_DEFINED
9#define SkGainmapShader_DEFINED
10
13
14class SkColorSpace;
15class SkShader;
16class SkImage;
17struct SkGainmapInfo;
18struct SkRect;
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 */
26public:
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 * This shader must know the color space of the canvas that it will be rendered to. This color
39 * space must be specified in dstColorSpace.
40 * TODO(ccameron): Remove the need for dstColorSpace.
41 */
42 static sk_sp<SkShader> Make(const sk_sp<const SkImage>& baseImage,
43 const SkRect& baseRect,
44 const SkSamplingOptions& baseSamplingOptions,
45 const sk_sp<const SkImage>& gainmapImage,
46 const SkRect& gainmapRect,
47 const SkSamplingOptions& gainmapSamplingOptions,
48 const SkGainmapInfo& gainmapInfo,
49 const SkRect& dstRect,
50 float dstHdrRatio,
51 sk_sp<SkColorSpace> dstColorSpace);
52};
53
54#endif
#define SK_API
Definition: SkAPI.h:35
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)