2 * Copyright 2020 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkImageGeneratorNDK_DEFINED
9 #define SkImageGeneratorNDK_DEFINED
11 #include "include/core/SkTypes.h"
12 #ifdef SK_ENABLE_NDK_IMAGES
14 #include "include/core/SkData.h"
15 #include "include/core/SkImageGenerator.h"
19 namespace SkImageGeneratorNDK {
21 * Create a generator that uses the Android NDK's APIs for decoding images.
23 * Only supported on devices where __ANDROID_API__ >= 30.
25 * As with SkCodec, the SkColorSpace passed to getPixels() determines the
26 * type of color space transformations to apply. A null SkColorSpace means to
29 * A note on scaling: Calling getPixels() on the resulting SkImageGenerator
30 * with dimensions that do not match getInfo() requests a scale. For WebP
31 * files, dimensions smaller than those of getInfo are supported. For Jpeg
32 * files, dimensions of 1/2, 1/4, and 1/8 are supported. TODO: Provide an
33 * API like SkCodecImageGenerator::getScaledDimensions() to report which
34 * dimensions are supported?
36 SK_API std::unique_ptr<SkImageGenerator> MakeFromEncodedNDK(sk_sp<SkData>);
39 #endif // SK_ENABLE_NDK_IMAGES
40 #endif // SkImageGeneratorNDK_DEFINED