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)40 public abstract Bitmap fullSizeBitmap(int minSideLength, 41 int maxNumberOfPixels, boolean rotateAsNeeded); fullSizeBitmap(int minSideLength, int maxNumberOfPixels, boolean rotateAsNeeded, boolean useNative)42 public abstract Bitmap fullSizeBitmap(int minSideLength, 43 int maxNumberOfPixels, boolean rotateAsNeeded, boolean useNative); getDegreesRotated()44 public abstract int getDegreesRotated(); 45 public static final boolean ROTATE_AS_NEEDED = true; 46 public static final boolean NO_ROTATE = false; 47 public static final boolean USE_NATIVE = true; 48 public static final boolean NO_NATIVE = false; 49 50 /** Get the input stream associated with a given full size image. */ fullSizeImageData()51 public abstract InputStream fullSizeImageData(); fullSizeImageId()52 public abstract long fullSizeImageId(); fullSizeImageUri()53 public abstract Uri fullSizeImageUri(); 54 55 /** Get the path of the (full size) image data. */ getDataPath()56 public abstract String getDataPath(); 57 58 // Get/Set the title of the image setTitle(String name)59 public abstract void setTitle(String name); getTitle()60 public abstract String getTitle(); 61 62 // Get metadata of the image getDateTaken()63 public abstract long getDateTaken(); 64 getMimeType()65 public abstract String getMimeType(); 66 getWidth()67 public abstract int getWidth(); 68 getHeight()69 public abstract int getHeight(); 70 getDisplayName()71 public abstract String getDisplayName(); 72 73 // Get property of the image isReadonly()74 public abstract boolean isReadonly(); isDrm()75 public abstract boolean isDrm(); 76 77 // Get the bitmap/uri of the medium thumbnail thumbBitmap(boolean rotateAsNeeded)78 public abstract Bitmap thumbBitmap(boolean rotateAsNeeded); thumbUri()79 public abstract Uri thumbUri(); 80 81 // Get the bitmap of the mini thumbnail. miniThumbBitmap()82 public abstract Bitmap miniThumbBitmap(); 83 84 // Rotate the image rotateImageBy(int degrees)85 public abstract boolean rotateImageBy(int degrees); 86 87 } 88