diff options
| author | 2020-01-19 21:13:04 -0500 | |
|---|---|---|
| committer | 2020-01-19 21:41:17 -0500 | |
| commit | f27256b956d6a48ce8d74aaab36617a41d00cee2 (patch) | |
| tree | f1a22cb4cd2f1e79dc826fbd78dab9a001152d1d /include/android/imagedecoder.h | |
| parent | 46bb0aec07de33d13c545c39f5e2720450a50731 (diff) | |
Add AImageDecoder_computeSampledSize
Bug: 135133301
Test: If9ed79d8dcf1169369ba454723f4ac8d26427b7b
This allows an NDK client to find an efficient target size to use.
Change-Id: Iabc3db1547d4863f9aa0324bc438d994eadeef01
Diffstat (limited to 'include/android/imagedecoder.h')
| -rw-r--r-- | include/android/imagedecoder.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h index 4b6446c33d..c9fde0d3b7 100644 --- a/include/android/imagedecoder.h +++ b/include/android/imagedecoder.h @@ -179,6 +179,28 @@ int AImageDecoder_setUnpremultipliedRequired(AImageDecoder*, bool required) __IN */ int AImageDecoder_setTargetSize(AImageDecoder*, int width, int height) __INTRODUCED_IN(30); + +/** + * Compute the dimensions to use for a given sampleSize. + * + * Although AImageDecoder can scale to an arbitrary target size (see + * {@link AImageDecoder_setTargetSize}), some sizes may be more efficient than + * others. This computes the most efficient target size to use to reach a + * particular sampleSize. + * + * @param sampleSize A subsampling rate of the original image. Must be greater + * than or equal to 1. A sampleSize of 2 means to skip every + * other pixel/line, resulting in a width and height that are + * 1/2 of the original dimensions, with 1/4 the number of + * pixels. + * @param width Out parameter for the width sampled by sampleSize, and rounded + * direction that the decoder can do most efficiently. + * @param height Out parameter for the height sampled by sampleSize, and rounded + * direction that the decoder can do most efficiently. + * @return ANDROID_IMAGE_DECODER result code. + */ +int AImageDecoder_computeSampledSize(const AImageDecoder*, int sampleSize, + int* width, int* height) __INTRODUCED_IN(30); /** * Specify how to crop the output after scaling (if any). * |