OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.ui.resources; | 5 package org.chromium.ui.resources; |
6 | 6 |
7 import android.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 import android.graphics.Rect; | 8 import android.graphics.Rect; |
9 | 9 |
| 10 import org.chromium.ui.resources.statics.NinePatchData; |
| 11 |
10 /** | 12 /** |
11 * A basic resource interface that all assets must use to be exposed to the CC l
ayer as | 13 * A basic resource interface that all assets must use to be exposed to the CC l
ayer as |
12 * UIResourceIds. | 14 * UIResourceIds. |
13 */ | 15 */ |
14 public interface Resource { | 16 public interface Resource { |
15 /** | 17 /** |
16 * This may be called more than once so if possible avoid doing redundant wo
rk. | 18 * This may be called more than once so if possible avoid doing redundant wo
rk. |
17 * @return A {@link Bitmap} representing the resource. | 19 * @return A {@link Bitmap} representing the resource. |
18 */ | 20 */ |
19 Bitmap getBitmap(); | 21 Bitmap getBitmap(); |
20 | 22 |
21 /** | 23 /** |
22 * @return The size of the bitmap. | 24 * @return The size of the bitmap. |
23 */ | 25 */ |
24 Rect getBitmapSize(); | 26 Rect getBitmapSize(); |
25 | 27 |
26 /** | 28 /** |
27 * @return The padded content area of this resource. For 9-patches this wil
l represent the | 29 * Returns the nine patch data if the resource is backed by a nine patch bit
map. In all other |
28 * valid content of the 9-patch. It can mean other things for other
Resources though. | 30 * cases, this will be null. |
| 31 * @return The nine patch data for the bitmap or null. |
29 */ | 32 */ |
30 Rect getPadding(); | 33 NinePatchData getNinePatchData(); |
31 | 34 |
32 /** | 35 /** |
33 * @return The aperture of this resource. For 9-patches this will represent
the area of the | 36 * Creates the native representation of this Resource. Note that the ownersh
ip is passed to the |
34 * {@link Bitmap} that should not be stretched. It can mean other t
hings for other | 37 * caller. |
35 * Resources though. | 38 * @return The pointer to the native Resource. |
36 */ | 39 */ |
37 Rect getAperture(); | 40 long createNativeResource(); |
38 } | 41 } |
OLD | NEW |