OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_ANDROID_JAVA_BITMAP_H_ | 5 #ifndef UI_GFX_ANDROID_JAVA_BITMAP_H_ |
6 #define UI_GFX_ANDROID_JAVA_BITMAP_H_ | 6 #define UI_GFX_ANDROID_JAVA_BITMAP_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <vector> |
10 | 11 |
11 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 | 18 |
18 // A Java counterpart will be generated for this enum. | 19 // A Java counterpart will be generated for this enum. |
19 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.gfx | 20 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.gfx |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 int width, | 62 int width, |
62 int height, | 63 int height, |
63 SkColorType color_type); | 64 SkColorType color_type); |
64 | 65 |
65 // Converts |skbitmap| to a Java-backed bitmap (android.graphics.Bitmap). | 66 // Converts |skbitmap| to a Java-backed bitmap (android.graphics.Bitmap). |
66 // Note: |skbitmap| is assumed to be non-null, non-empty and one of RGBA_8888 or | 67 // Note: |skbitmap| is assumed to be non-null, non-empty and one of RGBA_8888 or |
67 // RGB_565 formats. | 68 // RGB_565 formats. |
68 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( | 69 GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( |
69 const SkBitmap* skbitmap); | 70 const SkBitmap* skbitmap); |
70 | 71 |
| 72 // Converts |skbitmaps| to an array of Java-backed bitmaps |
| 73 // (android.graphics.Bitmap). If an input bitmap is null or empty, its |
| 74 // corresponding output bitmap is null. If an input bitmap is non-null and |
| 75 // non-empty, it is assumed to be in RGBA_8888 or RGB_565 format. |
| 76 GFX_EXPORT base::android::ScopedJavaLocalRef<jobjectArray> ConvertToJavaBitmaps( |
| 77 const std::vector<SkBitmap>& skbitmaps); |
| 78 |
71 // Converts |bitmap| to an SkBitmap of the same size and format. | 79 // Converts |bitmap| to an SkBitmap of the same size and format. |
72 // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. | 80 // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. |
73 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); | 81 GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); |
74 | 82 |
75 // Returns a Skia color type value for the requested input java Bitmap.Config. | 83 // Returns a Skia color type value for the requested input java Bitmap.Config. |
76 GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); | 84 GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); |
77 | 85 |
78 } // namespace gfx | 86 } // namespace gfx |
79 | 87 |
80 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ | 88 #endif // UI_GFX_ANDROID_JAVA_BITMAP_H_ |
OLD | NEW |