• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 SkImageGeneratorNDK_DEFINED
9 #define SkImageGeneratorNDK_DEFINED
10 
11 #include "include/core/SkTypes.h"
12 #ifdef SK_ENABLE_NDK_IMAGES
13 
14 #include "include/core/SkData.h"
15 #include "include/core/SkImageGenerator.h"
16 
17 #include <memory>
18 
19 namespace SkImageGeneratorNDK {
20 /**
21  *  Create a generator that uses the Android NDK's APIs for decoding images.
22  *
23  *  Only supported on devices where __ANDROID_API__ >= 30.
24  *
25  *  As with SkCodec, the SkColorSpace passed to getPixels() determines the
26  *  type of color space transformations to apply. A null SkColorSpace means to
27  *  apply none.
28  *
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?
35  */
36 SK_API std::unique_ptr<SkImageGenerator> MakeFromEncodedNDK(sk_sp<SkData>);
37 }
38 
39 #endif // SK_ENABLE_NDK_IMAGES
40 #endif // SkImageGeneratorNDK_DEFINED
41