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. */ 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 Uri fullSizeImageUri(); 51 52 /** Get the path of the (full size) image data. */ 53 public abstract String getDataPath(); 54 55 // Get the title of the image 56 public abstract String getTitle(); 57 58 // Get metadata of the image 59 public abstract long getDateTaken(); 60 61 public abstract String getMimeType(); 62 63 public abstract int getWidth(); 64 65 public abstract int getHeight(); 66 67 // Get property of the image 68 public abstract boolean isReadonly(); 69 public abstract boolean isDrm(); 70 71 // Get the bitmap of the medium thumbnail 72 public abstract Bitmap thumbBitmap(boolean rotateAsNeeded); 73 74 // Get the bitmap of the mini thumbnail. 75 public abstract Bitmap miniThumbBitmap(); 76 77 // Rotate the image 78 public abstract boolean rotateImageBy(int degrees); 79 80 } 81