01: /*
02: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24: package com.sun.mmedia;
25:
26: /**
27: * Provides methods to set parameters of platform specific images.
28: * Since Image class is defined differently on different platforms
29: * (midp, j2se, etc), core components can refer to images only as instances
30: * of class Object.
31: * This interface can help in checking if a given Object is an image and to
32: * retrieve image parameters.
33: *
34: * @created November 8, 2005
35: */
36: public interface ImageAccess {
37:
38: /*
39: * returns how many alpha levels supported by the system.
40: * Min value is 2: totally opaque & totally transparent.
41: */
42: public int alphaLevelsNumber();
43:
44: /*
45: * Checks if the object is Image or not.
46: */
47: public boolean isImage(Object image);
48:
49: /*
50: * Checks if the object is mutable or immutable Image.
51: * Shall be called only after isImage() check passed.
52: */
53: public boolean isMutableImage(Object image);
54:
55: /*
56: * Returns Image width, or -1 if Object is not Image.
57: */
58: public int getImageWidth(Object image);
59:
60: /*
61: * Returns Image height, or -1 if Object is not Image.
62: */
63: public int getImageHeight(Object image);
64:
65: /*
66: * Returns RGB image data (4 bytes in ARGB format per pixel)
67: or null if Object is not Image.
68: */
69: public byte[] getRGBByteImageData(Object image);
70:
71: /*
72: * Returns RGB image data (32-bit int per pixel)
73: or null if Object is not Image.
74: */
75: public int[] getRGBIntImageData(Object image);
76:
77: /*
78: * Returns an immutable copy of a given Image or null if Object is not Image.
79: */
80: public Object imageCreateFromImage(Object image);
81:
82: /*
83: * Returns an image created from the stream or null in case of failure.
84: */
85: public Object imageCreateFromStream(java.io.InputStream stream);
86:
87: /*
88: * Returns an image created from the byte array or null in case of filure.
89: */
90: public Object imageCreateFromByteArray(byte[] data, int offset,
91: int length);
92: }
|