blob: 21a93f066d9b44e16b3505629582a1c0b09b2611 [file] [log] [blame]
John Reckf29ed282015-04-07 07:32:03 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef BITMAP_H_
17#define BITMAP_H_
18
19#include <jni.h>
John Reck00799f72017-03-01 18:05:41 -080020#include <android/bitmap.h>
Derek Sollenberger8b994192019-07-16 13:23:29 -040021
Derek Sollenberger8b994192019-07-16 13:23:29 -040022struct SkImageInfo;
John Reckf29ed282015-04-07 07:32:03 -070023
24namespace android {
25
sergeyvc1c54062016-10-19 18:47:26 -070026class Bitmap;
John Reckf29ed282015-04-07 07:32:03 -070027
sergeyvc69853c2016-10-07 14:14:09 -070028namespace bitmap {
29
30enum BitmapCreateFlags {
31 kBitmapCreateFlag_None = 0x0,
32 kBitmapCreateFlag_Mutable = 0x1,
33 kBitmapCreateFlag_Premultiplied = 0x2,
34};
35
sergeyvc1c54062016-10-19 18:47:26 -070036jobject createBitmap(JNIEnv* env, Bitmap* bitmap,
Derek Sollenberger8b994192019-07-16 13:23:29 -040037 int bitmapCreateFlags, jbyteArray ninePatchChunk = nullptr,
38 jobject ninePatchInsets = nullptr, int density = -1);
sergeyvc69853c2016-10-07 14:14:09 -070039
Leon Scroggins III71fae622019-03-26 16:28:41 -040040Bitmap& toBitmap(jlong bitmapHandle);
sergeyvc69853c2016-10-07 14:14:09 -070041
42/** Reinitialize a bitmap. bitmap must already have its SkAlphaType set in
43 sync with isPremultiplied
44*/
45void reinitBitmap(JNIEnv* env, jobject javaBitmap, const SkImageInfo& info,
46 bool isPremultiplied);
47
sergeyvc69853c2016-10-07 14:14:09 -070048} // namespace bitmap
49
John Reckf29ed282015-04-07 07:32:03 -070050} // namespace android
51
52#endif /* BITMAP_H_ */