1 // Copyright 2009 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.images
;
5 import com
.google
.appengine
.api
.blobstore
.BlobKey
;
7 import java
.io
.Serializable
;
10 * {@code Image} represents an image that can be manipulated by the
11 * {@link ImagesService}.
14 public interface Image
extends Serializable
{
17 * Image formats usable by the images api.
19 public enum Format
{PNG
, JPEG
, GIF
, TIFF
, BMP
, ICO
, WEBP
}
22 * Gets the width of the image.
24 * @throws IllegalArgumentException If the {@code imageData} provided is
27 public int getWidth();
30 * Gets the height of the image.
31 * @return image height
32 * @throws IllegalArgumentException If the {@code imageData} provided is
35 public int getHeight();
38 * Gets the encoding format of the image.
39 * @return image format
40 * @throws IllegalArgumentException If the {@code imageData} provided is
43 public Format
getFormat();
46 * Gets the raw imageData of the image.
47 * @return the image data of the image
49 public byte[] getImageData();
52 * Sets the image to contain the image data contained in {@code imageData}.
53 * @param imageData new image data for the image to store
54 * @throws IllegalArgumentException If {@code imageData} is null or empty
56 public void setImageData(byte[] imageData
);
59 * If this image is backed by a blob, return the associated {@link
60 * BlobKey}. If this method returns non-{@code null}, none of the
61 * other methods will currently be available.
63 public BlobKey
getBlobKey();