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