1 /* 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> 20 #include <android/bitmap.h> 21 22 class SkBitmap; 23 struct SkImageInfo; 24 25 namespace android { 26 27 class Bitmap; 28 29 namespace bitmap { 30 31 enum BitmapCreateFlags { 32 kBitmapCreateFlag_None = 0x0, 33 kBitmapCreateFlag_Mutable = 0x1, 34 kBitmapCreateFlag_Premultiplied = 0x2, 35 }; 36 37 jobject createBitmap(JNIEnv* env, Bitmap* bitmap, 38 int bitmapCreateFlags, jbyteArray ninePatchChunk = nullptr, 39 jobject ninePatchInsets = nullptr, int density = -1); 40 41 Bitmap& toBitmap(jlong bitmapHandle); 42 43 /** Reinitialize a bitmap. bitmap must already have its SkAlphaType set in 44 sync with isPremultiplied 45 */ 46 void reinitBitmap(JNIEnv* env, jobject javaBitmap, const SkImageInfo& info, 47 bool isPremultiplied); 48 49 } // namespace bitmap 50 51 } // namespace android 52 53 #endif /* BITMAP_H_ */ 54