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 
17 package com.android.camera.gallery;
18 
19 import android.graphics.Bitmap;
20 import android.net.Uri;
21 
22 import java.io.InputStream;
23 
24 /**
25  * The interface of all images used in gallery.
26  */
27 public 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. */
getContainer()35     public abstract IImageList getContainer();
36 
37     /** Get the bitmap for the full size image. */
fullSizeBitmap(int minSideLength, int maxNumberOfPixels)38     public abstract Bitmap fullSizeBitmap(int minSideLength,
39             int maxNumberOfPixels);
fullSizeBitmap(int minSideLength, int maxNumberOfPixels, boolean rotateAsNeeded, boolean useNative)40     public abstract Bitmap fullSizeBitmap(int minSideLength,
41             int maxNumberOfPixels, boolean rotateAsNeeded, boolean useNative);
getDegreesRotated()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. */
fullSizeImageData()49     public abstract InputStream fullSizeImageData();
fullSizeImageUri()50     public abstract Uri fullSizeImageUri();
51 
52     /** Get the path of the (full size) image data. */
getDataPath()53     public abstract String getDataPath();
54 
55     // Get the title of the image
getTitle()56     public abstract String getTitle();
57 
58     // Get metadata of the image
getDateTaken()59     public abstract long getDateTaken();
60 
getMimeType()61     public abstract String getMimeType();
62 
getWidth()63     public abstract int getWidth();
64 
getHeight()65     public abstract int getHeight();
66 
67     // Get property of the image
isReadonly()68     public abstract boolean isReadonly();
isDrm()69     public abstract boolean isDrm();
70 
71     // Get the bitmap of the medium thumbnail
thumbBitmap(boolean rotateAsNeeded)72     public abstract Bitmap thumbBitmap(boolean rotateAsNeeded);
73 
74     // Get the bitmap of the mini thumbnail.
miniThumbBitmap()75     public abstract Bitmap miniThumbBitmap();
76 
77     // Rotate the image
rotateImageBy(int degrees)78     public abstract boolean rotateImageBy(int degrees);
79 
80 }
81