Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/siemens/mp/game/ExtendedImage.java


1   /*
2    *  Siemens API for MicroEmulator
3    *  Copyright (C) 2003 Markus Heberling <markus@heberling.net>
4    *
5    *  This library is free software; you can redistribute it and/or
6    *  modify it under the terms of the GNU Lesser General Public
7    *  License as published by the Free Software Foundation; either
8    *  version 2.1 of the License, or (at your option) any later version.
9    *
10   *  This library is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   *  Lesser General Public License for more details.
14   *
15   *  You should have received a copy of the GNU Lesser General Public
16   *  License along with this library; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  package com.siemens.mp.game;
20  
21  import javax.microedition.lcdui.Graphics;
22  import javax.microedition.lcdui.Image;
23  
24  import com.barteo.emulator.device.DeviceDisplay;
25  import com.barteo.emulator.device.DeviceFactory;
26  
27  public class ExtendedImage extends com.siemens.mp.misc.NativeMem {
28      Image image;
29      
30      public ExtendedImage(Image image) {
31          this.image=image;
32      }
33      
34      public void blitToScreen(int x, int y) {
35  //        System.out.println(" public void blitToScreen(int x"+x+", int y"+y+")");
36          DeviceDisplay dd = DeviceFactory.getDevice().getDeviceDisplay();
37          Image image = dd.getDisplayImage();
38          
39          Graphics g=image.getGraphics();
40          g.drawImage(this.image,x,y,Graphics.LEFT|Graphics.TOP);
41  
42          dd.repaint();
43      }
44      
45      public void clear(byte color) {
46          Graphics g=image.getGraphics();
47          g.setColor(color);
48          g.fillRect(0,0,image.getWidth(),image.getHeight());
49      }
50      
51      
52      public Image getImage() {
53          return image;
54      }
55      
56      
57      public int getPixel(int x, int y) {
58          System.out.println("int getPixel(int x, int y)");
59          return 1;
60      }
61      
62      
63      public void getPixelBytes(byte[] pixels, int x, int y, int width, int height) {
64          System.out.println("void getPixelBytes(byte[] pixels, int x, int y, int width, int height)");
65      }
66      
67      
68      public void setPixel(int x, int y, byte color) {
69          System.out.println("void setPixel(int x, int y, byte color)");
70      }
71      
72      
73      public void setPixels(byte[] pixels, int x, int y, int width, int height) {
74          Image img=com.siemens.mp.ui.Image.createImageFromBitmap(pixels,width,height);
75          image.getGraphics().drawImage(img, x,y, 0);
76      }
77  }