2005年01月28日

我写了一小程序,执行后出现一ApplicationWindow,然后在菜单里选择about选项会出现about窗口。在eclipse环境里执行没有错误。我生成jar后再执行,
ApplicationWindow会出现,但选择about菜单选项后,about窗口不出现了,而且其他的dialog都不出现了!好奇怪,有朋友知道是怎么回事吗?

2005年01月27日

唉,自己的疏忽啊!一个参数的问题。改正后,Image的Copy正常的了。还是代码如下:

private void ImageCopy()
 {
  if(souImgData == null || imgData == null)
   return;
  int sx = souCanvas.getSouImageX();
  int sy = souCanvas.getSouImageY();

///***  就是下面这个参数不对啊

//以前的是int dx = x_id; 粗心啊,自己
  int dx = x_id*width;

//*******
  int dy = y_id*height;
  int[] pixels = new int[width];
  for (int i = 0; i < height; i++) {
   souImgData.getPixels(sx, sy++, width, pixels, 0);
   imgData.setPixels(dx, dy++, width, pixels, 0);
  }
  if(image !=null)
   image.dispose();
  image = new Image(getDisplay(),imgData);  
 }

继续代码,发现可以copy了。但源图片和目标图片的高宽不一致的时候,copy的图片在目标图片上显示的位置和我指定的位置有偏差,

估计是bytesPerLine这个参数在源和目标图片上的值不一致导致的,下面的代码还需要改动才行。

private void ImageCopy()
 {
  if(souImgData == null || imgData == null)
   return;
  int sx = souCanvas.getSouImageX();
  int sy = souCanvas.getSouImageY();
  int dx = x_id;
  int dy = y_id*height;
  int[] pixels = new int[width];
  for (int i = 0; i < height; i++) {
   souImgData.getPixels(sx, sy++, width, pixels, 0);
   imgData.setPixels(dx, dy++, width, pixels, 0);
  }
  if(image !=null)
   image.dispose();
  image = new Image(getDisplay(),imgData);
 }

估计应该要在bytesPerLine参数上下功夫才对?!

2005年01月26日

从源图片取指定区域的像素,拷贝到目标图片

代码如下:

//生成源图片及源ImageData
  Image sImage = new Image(getDisplay(),”1.gif”);
  ImageData sData = sImage.getImageData();
  
  //根据源ImageData构造目标ImageData
  ImageData dData = new ImageData(sData.width,sData.height,sData.depth,sData.palette);
  int[] pixels = new int[20];
  for (int i = 0; i < 10; i++) {
   //从(0,i)取特定宽度的像素
   sData.getPixels(0, i++, 20, pixels, 0);
            //从(0,i)设置取得的像素
   dData.setPixels(0, i++, 20, pixels, 0);
  }
  //根据目标ImageData生成Image
  image = new Image(getDisplay(),imgData);
  ….
  //画image
  gc.drawImage(image,0,0);

***************************************

可是目标image始终是空白的,不知道又是什么原因?哎,遇到的难题不少啊?

代码如下:

public void paintControl(PaintEvent event)
 {
  Rectangle clientArea = getClientArea(); 
  Image _img = new Image(getDisplay(),clientArea);
  GC gc = new GC(_img);
  gc.setBackground(event.gc.getBackground());
        gc.fillRectangle(clientArea); 

……………..

//画该画的

……………..
  
  gc.dispose();  
  
  event.gc.drawImage(_img,0,0);
  _img.dispose();
 }

The default behavior for a Canvas is that before it paints itself the entire client area is filled with the current background color.  This can create screen flicker, because if the paintEvent also draws onto the GC, then the user sees a flash between the original background being filled, and the drawing occurring.  One way to avoid this is to use the style bit SWT.NO_BACKGROUND when creating the Canvas.  This prevents the native background from being drawn, however it means the program must be responsible for drawing every pixel of the client area.

自己照着上面说的自己绘制,自己先填充背景色,然后再绘制Image,但还是有闪烁。哎,老火的很,实在是不知道该怎么办了?

最近在写一个小程序,用SWT做界面。发现在Canvas重绘的时候会有闪烁,google了一下,说是Canvas在重绘时先用背景色fill客户区域,然后才把image绘到Canvas上。在image和Canvas的客户区域大小一样的时候,使用SWT.NO_BACKGROUND参数构造Canvas,就不会用背景色fill客户区域,也不会有闪烁。可现在我在Canvas上绘的image比可用的客户区域小,在重绘的时候要先fill清屏,然后在绘image,可始终有闪烁。资料太少,现在还不知道怎么做可以消除闪烁,先记在这里,等知道解决的方法后在补充在后面。解决了的朋友请指点一下!

2005年01月24日

J2ME

System.getProperty(“phone.imei”)
System.getProperty(“phone.mcc”)
System.getProperty(“phone.mcc”)
System.getProperty(“phone.mnc”)
System.getProperty(“phone.lai”)
System.getProperty(“phone.cid”)

System.getProperty(“com.siemens.IMEI”).

System.getProperty(“microedition.configuration”)

System.getProperty(“microedition.profiles”)

System.getProperty(“microedition.platform”)

System.getProperty(“microedition.locale”)

System.getProperty(“microedition.encoding”)

J2SE

System.getProperty(“java.version”)

System.getProperty(“java.vendor”)

System.getProperty(“java.vm.name”)

System.getProperty(“java.vm.version”)

System.getProperty(“os.name”)

System.getProperty(“os.arch”)

System.getProperty(“os.version”)

System.getProperty(“user.name”)

System.getProperty(“user.dir”)

查看内存利用情况
long total=Runtime.getRuntime().totalMemory();
long free=Runtime.getRuntime().freeMemory();

2005年01月19日

今天投了简历到Gameloft成都,没有抱多大的期望。专科毕业,敲门砖太小了,估计人家不会看的上。在smth看到有Gameloft的员工讲Gameloft没有学历歧视、性别歧视,我是不大相信的。投简历只是尽尽人事,如果真的拿到offer,我就只有偷笑了。不过听说Gameloft北京的薪水不是很高,想来成都就更低了吧!

宁当鸡头,不做凤尾!

2005年01月17日

手机游戏业界国际领先的公司法国Gameloft在成都招开发人员了!不过对English的听说读写要求很高,唉,看来我又没啥希望了!下面是他们的要求,有能力的兄弟切试试吧!

Software Engineer(3D Graphics) (成都)

职位描述:
Responsibilities:
- Implement cutting-edge technology in 3D graphics to games on mobile platforms.
- Design, implement and optimize special effects in 3D graphics engine.
- Develop tools for editing and conversion of graphics data.

Requirements
- Degree holder or above. major in computer science or equivalent;
- Specialized in 3D computer graphics.
- Strong knowledge in rendering algorithms and special effects;
- Proficient in C/C++
- Excellent English both in oral and written;
- Excellent teamwork and communication skills;
- Task driven and good at time management, deliverable under tight schedule;
- A passion for creating and playing video games
- Commitment to personal and peer development and sharing best practices

Pluses:
- M.S. degree or higher.
- Game industry experience.
- DirectX, OpenGL or Java 3D programming
- 3DS Max plug-in programming

Software Engineer (Game Engine Development) (成都)

职位描述:
Responsibilities:
- Help to design the architecture and work flow of engine development.
- Communicate with other developers in exchanging technical information.
- Involve in game engine research and development.

Requirements:
- Degree holder or above, major in computer science or equivalent;
- Knowledgeable in general 2D/3D graphics
- Proficient in C++ or Java;
- Excellent English both in oral and written;
- Excellent teamwork and communication skills;
- Task driven and good at time management, deliverable under tight schedule
- A passion for creating and playing video games
- Commitment to personal and peer development and sharing best practices

Pluses:
- M.S. degree or higher.
- Experience in game industry.