• 沒有找到結果。

為了能提升Java 的繪圖效能,並使許多現有的 Java 程式可以 因此而受惠。本論文提出了一套開放式的架構,以AWT 為共同的 API,並針對繪圖工具組的這個部分作改善,使其可以採用不同繪圖 函式庫來實作。最後本論文完成了這套系統,並達成了以下三項特性:

1. 提升繪圖效能(Performance Improvement):

根據Microsoft Language Extension 這部分所完成的實作結果顯 示,本論文提出的這套系統成功地獲得了DirectX 的支援,在影 像的繪圖效能上有非常顯著而且穩定的改善。不管是透明圖或是 不透明圖,其繪圖效能的改善程度都是一致性地領先。這證明了 本系統在影像繪圖效能改善上的優勢,的確已經達到預期的目 標。此外,預先處理好的影像(Image)可以用來取代即時繪製的圖 形與文字,這也是一般遊戲軟體普遍採用的方式。如此將可大幅 度地應用DirectX 在影像處理上的優勢,有效提升影像的繪圖效 能。

2. 向下相容性(Backward Compatible):

除了可以提升繪圖效能的實作之外,本論文提出的系統也完成了 另一項實作,AWT。這部分在實例探討中,已經成功地被應用在 現有的CYC Game 上面。向下相容的優勢已經被證明是可行的。

3. 可移植性(Portability):

本論文提出的系統除了完成兩項繪圖函式庫的實作,以印證前述 兩項特點之外。也證明了這套開放式的架構,的確可以支援更多 不同繪圖函式庫的實作。因此,透過支援新的繪圖函式庫實作,

來作為移植到其他平台的方式,理論上來說是可行的,例如.Net Framework。這部分雖然並未實際完成實作,但是這可以是本系 統未來的發展方向之一。

圖 4-1 : CWT 的未來展望。

雖然CWT 在提供可以支援不同繪圖函式庫的架構已經完成,但 是要真正發揮CWT 的好處,重點在於實作採用的繪圖函式庫。因此 未來的發展方向將著重於後續的應用,以及彌補CWT 的不足之處。

1. Swing

雖然CWT 僅支援 AWT 介面,但是由於 Swing 是根據 AWT 為基 礎所做的延伸,因此理論上來說,CWT 想要延伸支援 Swing 也 是有機會的,如此一來 CWT 將可支援更多現有的 Java 程式。因 此這部份也是一項很重要的未來發展方向,如圖4-1 所示。

2. .Net Framework

[3]

首先,透過支援新的繪圖函式庫實作,來作為移植到.Net 平台的 方式。理論上來說是可行的,如此將大幅度地提升CWT 的價值,

提供現有Java 程式移植到.Net 平台的最佳解決方案。因此這部 份將會是未來最優先考慮的發展方向,如圖4-1 所示。

3. 其他繪圖函式庫

由於CWT 可以支援不同的繪圖函式庫實作,因此其他許多繪圖 函式庫也是可以考慮新增的。例如SWT、JOGL 與 LWJGL 等等。

參考文獻

[1] Bernd Kreimeier, "Dirty Java - Using the Java Native Interface within Games." Game Developer Magazine. 1999, available from

http://www.gamasutra.com/features/19990611/java_01.htm.

[2] Caspian Rychlik-Prince, Brian Matzon, Elias Naur, Erik Duijs, Ioannis Tsakpinis, Mark Bernard, "LWJGL, Lightweight Java Game Library", available from http://www.lwjgl.org/.

[3] David S. Platt, "Introducing Microsoft .NET", Third Edition, Microsoft, 2003.

[4] IBM, "SWT Standard Widget Toolkit - Development Resources" , available from

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platf orm-swt-home/dev.html.

[5] Jacob Marner, "Evaluating Java for Game Development", Department of Computer Science University of Copenhagen, Denmark, 2002.

[6] James Elliott, Robert Eckstein (Editor), Marc Loy, David Wood, Brian Cole, "Java Swing", Second Edition, O'Reilly, 2002.

[7] John Sharp, Andy Longshaw, Roxburgh Pet, Peter Roxburgh,

"Microsoft Visual J# .NET", Microsoft, 2002.

[8] John Zukowski, "Java AWT Reference", O'Reilly, 1997.

[9] Jonathan Knudsen, "Java 2D Graphics", O'Reilly 1999.

[10] Microsoft Corporation, "DirectX 7.0 SDK", 2000, available from http://www.microsoft.com/.

[11] Microsoft Corporation, "Microsoft SDK for Java 4.0", 1999, available from http://www.microsoft.com/.

[12] Microsoft Corporation, "Windows GDI SDK", 2000, available from http://www.microsoft.com/.

[13] Microsoft Corporation, "Xbox", available from http://www.microsoft.com/taiwan/xbox/.

[14] Nintendo, "Nintendo", available from http://www.nintendo.com/home.

[15] Robert Wells, "Java offers increased productivity." 1999, available from

http://www.wellscs.com/robert/java/productivity.htm.

[16] Sony Computer Entertainment, "Play Station", available from http://www.sceh.com.tw/.

[17] Sun Microsystems, "A Jolt of Efficiency", 1998, available from http://java.sun.com/features/1998/07/efficiency.html.

[18] Sun Microsystems, "Graphics Performance Improvements", available from

http://java.sun.com/products/java-media/2D/perf_graphics.html

.

[19] Sun Microsystems, "JDK 1.1.8 Documentation", 1998, available from http://java.sun.com/products/archive/jdk/1.1/index.html.

[20] Sun Microsystems, "JDK 5.0 Documentation", 2004, available from http://java.sun.com/j2se/1.5.0/docs/index.html.

[21] Sun Microsystems, "JOGL, Java bindings for OpenGL API", available from http://jogl.dev.java.net.

[22] Sun Microsystems, "Java 2 SDK, Standard Edition

Documentation Version 1.2.2_006", 1999, available from

http://java.sun.com/products/archive/j2se/1.2.2_017/index.html.

[23] Sun Microsystems, "Java 2 SDK, Standard Edition Documentation Version 1.3.1", 2001, available from http://java.sun.com/j2se/1.3/docs/index.html.

[24] Sun Microsystems, "Java 2 SDK, Standard Edition Documentation Version 1.4.2", 2003, available from http://java.sun.com/j2se/1.4.2/docs/index.html.

[25] Sun Microsystems, "Painting in AWT and Swing", available from

http://java.sun.com/products/jfc/tsc/articles/painting/index.html.

[26] Sun Microsystems, "The AWT Native Interface", available from http://java.sun.com/j2se/1.5.0/docs/guide/awt/1.3/AWT_Native _Interface.html.

[27] Sun Microsystems, "VolatileImage API User's Guide ", 2001, ftp://ftp.java.sun.com/docs/j2se1.4/VolatileImage.pdf.

[28] The OpenGL Architecture Review Board (ARB), "OpenGL", available from http://www.opengl.org/.

[29] 朱俊欣, "The Study of Portability of Java AWT to .NET Windows Forms", 交通大學資訊工程系, 碩士論文, 2004.

[30] 林秉宏, "A General Graphic Platform for Java Online Games", 交通大學資訊工程系, 碩士論文, 2002.

[31] 徐健智, "A General Development Platform for Play-on-table Game Over Internet", 交通大學資訊工程系, 碩士論文, 1999.

[32] 第三波資訊, "戲谷麻將館", available from http://www.mjonline.com.tw/.

[33] 傅鏡暉, "線上遊戲產業之道:數位內容、營運經驗", 上奇科技, 2004.

[34] 經濟部數位內容產業推動辦公室, "數位內容產業白皮書", 經濟 部工業局 2004.

[35] 群想網路科技, "CYC 遊戲大聯盟", available from http://cycgame.com.

[36] 遊戲新幹線, "仙境傳說", available from http://ro.gameflier.com/default.asp.

[37] 遊戲橘子, "天堂", available from

http://service.gamania.com/lineage/index.asp.

附錄一、DemoAnimator.java

/* 2005.06 */

package com;

import java.awt.*;

import java.awt.event.*;

public class DemoAnimator extends Canvas implements Runnable, MouseListener {

public final static String DEMO_TITLE[] = {"Transparent Image","Opaque Image", "Text","Rect","Circle",

private final static int DEMO_IMG_TRANSP_AND_CIRCLE = 7;

private final static int DEMO_IMG_TRANSP_AND_TEXT_AND_RECT = 8;

private final static int DEMO_IMG_TRANSP_AND_TEXT_AND_CIRCLE = 9;

private int demoType = 0;

private int drawCount = 1;

private boolean bDoubleBuffering = true;

//======================================================================

private final static Color fgColor = Color.gray;

private final static Color bgColor = Color.lightGray;

private final static Font textFont = new Font("Arial", Font.ITALIC | Font.BOLD, 32);

private static int frameCount = 100;

public DemoAnimator(int demoType, int drawCount) {

case DEMO_IMG_TRANSP_AND_TEXT_AND_RECT:

runImage[0] = Toolkit.getDefaultToolkit().getImage("run_4x_opaque.gif");

runImage[1] = MirrorFilter.getImage(runImage[0], MirrorFilter.LEFT_RIGHT);

private Dimension offDimension = new Dimension(0, 0);

private Image offImage;

private Graphics offGraphics;

public void paint(Graphics g)

timeStep();

g.setColor(fgColor);

private void startAnimation() {

running = true;

public void mouseClicked(MouseEvent e) {}

public void mousePressed(MouseEvent e) {}

public void mouseReleased(MouseEvent e) {

this.startAnimation();

}

public void mouseEntered(MouseEvent e) {}

public void mouseExited(MouseEvent e) {}

public static void main(String[] args) {

int demoType = Integer.parseInt(args[0]);

int drawCount = Integer.parseInt(args[1]);

Frame f = new Frame("Demo ["+DemoAnimator.DEMO_TITLE[demoType]+"]: draw "+args[1]+" times.");

f.addWindowListener(new WindowAdapter() {

f.add(new DemoAnimator(demoType, drawCount));

f.show();

}

相關文件