KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > microedition > lcdui > Image


1
2 /*
3  * MicroEmulator
4  * Copyright (C) 2001 Bartek Teodorczyk <barteo@it.pl>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */

20  
21 package javax.microedition.lcdui;
22
23 import java.io.IOException;
24
25 import com.barteo.emulator.device.DeviceFactory;
26
27
28 public class Image
29 {
30
31
32     public static Image createImage(int width, int height)
33     {
34         if (width <= 0 || height <= 0) {
35             throw new IllegalArgumentException();
36         }
37     
38         return DeviceFactory.getDevice().createImage(width, height);
39     }
40     
41                                                                 
42     public static Image createImage(String name)
43         throws IOException
44     {
45         return DeviceFactory.getDevice().createImage(name);
46     }
47                                                    
48
49     public static Image createImage(Image source)
50     {
51         return DeviceFactory.getDevice().createImage(source);
52     }
53     
54
55     public static Image createImage(byte[] imageData, int imageOffset, int imageLength)
56     {
57         return DeviceFactory.getDevice().createImage(imageData, imageOffset, imageLength);
58     }
59                                                                 
60
61     public Graphics getGraphics()
62     {
63         throw new IllegalStateException("Image is immutable");
64     }
65
66
67     public int getHeight()
68     {
69         return 0;
70     }
71
72
73     public int getWidth()
74     {
75         return 0;
76     }
77     
78     
79     public boolean isMutable()
80     {
81         return false;
82     }
83
84 }
85
Popular Tags