Debian Codegraph @

src/image/SkImageGeneratorPriv.h

raw
1 /*
2 * Copyright 2023 Google LLC
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 SkImageGeneratorPriv_DEFINED
9 #define SkImageGeneratorPriv_DEFINED
10
11 #include "include/core/SkRefCnt.h" // IWYU pragma: keep
12
13 #include <memory>
14 #include <optional>
15
16 class SkColorSpace;
17 class SkData;
18 class SkImageGenerator;
19 class SkMatrix;
20 class SkPaint;
21 class SkPicture;
22 class SkSurfaceProps;
23 enum SkAlphaType : int;
24 namespace SkImages { enum class BitDepth; }
25 struct SkISize;
26
27 namespace SkImageGenerators {
28 /** Return a new image generator backed by the specified picture. If the size is empty or
29 * the picture is NULL, this returns NULL.
30 * The optional matrix and paint arguments are passed to drawPicture() at rasterization
31 * time.
32 */
33 std::unique_ptr<SkImageGenerator> MakeFromPicture(const SkISize&,
34 sk_sp<SkPicture>,
35 const SkMatrix*,
36 const SkPaint*,
37 SkImages::BitDepth,
38 sk_sp<SkColorSpace>,
39 SkSurfaceProps props);
40
41 std::unique_ptr<SkImageGenerator> MakeFromPicture(const SkISize&,
42 sk_sp<SkPicture>,
43 const SkMatrix*,
44 const SkPaint*,
45 SkImages::BitDepth,
46 sk_sp<SkColorSpace>);
47
48 /**
49 * If the default image decoder system can interpret the specified (encoded) data, then
50 * this returns a new ImageGenerator for it. Otherwise this returns NULL. Either way
51 * the caller is still responsible for managing their ownership of the data.
52 * By default, images will be converted to premultiplied pixels. The alpha type can be
53 * overridden by specifying kPremul_SkAlphaType or kUnpremul_SkAlphaType. Specifying
54 * kOpaque_SkAlphaType is not supported, and will return NULL.
55 */
56 std::unique_ptr<SkImageGenerator> MakeFromEncoded(sk_sp<const SkData>,
57 std::optional<SkAlphaType> = std::nullopt);
58 }
59
60 #endif