blob: 73eca3aa8ef86aa9505ec20cd9f91b5fa7e1b959 [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
22class SkBitmap;
23struct SkImageInfo;
John Reckf29ed282015-04-07 07:32:03 -070024
25namespace android {
26
sergeyvc1c54062016-10-19 18:47:26 -070027class Bitmap;
John Reckf29ed282015-04-07 07:32:03 -070028
sergeyvc69853c2016-10-07 14:14:09 -070029namespace bitmap {
30
31enum BitmapCreateFlags {
32 kBitmapCreateFlag_None = 0x0,
33 kBitmapCreateFlag_Mutable = 0x1,
34 kBitmapCreateFlag_Premultiplied = 0x2,
35};
36
sergeyvc1c54062016-10-19 18:47:26 -070037jobject createBitmap(JNIEnv* env, Bitmap* bitmap,
Derek Sollenberger8b994192019-07-16 13:23:29 -040038 int bitmapCreateFlags, jbyteArray ninePatchChunk = nullptr,
39 jobject ninePatchInsets = nullptr, int density = -1);
sergeyvc69853c2016-10-07 14:14:09 -070040
Leon Scroggins III71fae622019-03-26 16:28:41 -040041Bitmap& toBitmap(jlong bitmapHandle);
sergeyvc69853c2016-10-07 14:14:09 -070042
43/** Reinitialize a bitmap. bitmap must already have its SkAlphaType set in
44 sync with isPremultiplied
45*/
46void reinitBitmap(JNIEnv* env, jobject javaBitmap, const SkImageInfo& info,
47 bool isPremultiplied);
48
sergeyvc69853c2016-10-07 14:14:09 -070049} // namespace bitmap
50
John Reckf29ed282015-04-07 07:32:03 -070051} // namespace android
52
53#endif /* BITMAP_H_ */