IImage.java revision 666ea1b28a76aeba74744148b15099254d918671
1/*
2 * Copyright (C) 2009 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
17package com.android.camera.gallery;
18
19import android.graphics.Bitmap;
20import android.net.Uri;
21
22import java.io.InputStream;
23
24/**
25 * The interface of all images used in gallery.
26 */
27public interface IImage {
28    static final int THUMBNAIL_TARGET_SIZE = 320;
29    static final int MINI_THUMB_TARGET_SIZE = 96;
30    static final int THUMBNAIL_MAX_NUM_PIXELS = 512 * 384;
31    static final int MINI_THUMB_MAX_NUM_PIXELS = 128 * 128;
32    static final int UNCONSTRAINED = -1;
33
34    /** Get the image list which contains this image. */
35    public abstract IImageList getContainer();
36
37    /** Get the bitmap for the full size image. */
38    public abstract Bitmap fullSizeBitmap(int minSideLength,
39            int maxNumberOfPixels);
40    public abstract Bitmap fullSizeBitmap(int minSideLength,
41            int maxNumberOfPixels, boolean rotateAsNeeded, boolean useNative);
42    public abstract int getDegreesRotated();
43    public static final boolean ROTATE_AS_NEEDED = true;
44    public static final boolean NO_ROTATE = false;
45    public static final boolean USE_NATIVE = true;
46    public static final boolean NO_NATIVE = false;
47
48    /** Get the input stream associated with a given full size image. */
49    public abstract InputStream fullSizeImageData();
50    public abstract long fullSizeImageId();
51    public abstract Uri fullSizeImageUri();
52
53    /** Get the path of the (full size) image data. */
54    public abstract String getDataPath();
55
56    // Get the title of the image
57    public abstract String getTitle();
58
59    // Get metadata of the image
60    public abstract long getDateTaken();
61
62    public abstract String getMimeType();
63
64    public abstract int getWidth();
65
66    public abstract int getHeight();
67
68    public abstract String getDisplayName();
69
70    // Get property of the image
71    public abstract boolean isReadonly();
72    public abstract boolean isDrm();
73
74    // Get the bitmap of the medium thumbnail
75    public abstract Bitmap thumbBitmap(boolean rotateAsNeeded);
76
77    // Get the bitmap of the mini thumbnail.
78    public abstract Bitmap miniThumbBitmap();
79
80    // Rotate the image
81    public abstract boolean rotateImageBy(int degrees);
82
83}
84