📄 vendarsplash.java
字号:
package com.ejoy;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.lcdui.*;
public class VendarSplash extends Canvas{
//Download by http://www.codefans.net
GameMIDlet m_gmid;
Image vimg; //原图片
Image tempimg; //处理过的图片
Timer timer;
int[] pixelone;
int imglength;
public VendarSplash(GameMIDlet gmid)
{
m_gmid=gmid;
timer=new Timer();
timer.schedule(new myTimerTask(this), 100, 200);
try
{
vimg=Image.createImage("/res/igs_rotate.png");
imglength=vimg.getHeight()*vimg.getWidth();
pixelone=new int[imglength];
vimg.getRGB(pixelone, 0, vimg.getWidth(), 0, 0, vimg.getWidth(), vimg.getHeight());
for(int i=0;i<imglength;i++)
{
pixelone[i]=pixelone[i]&0x00ffffff;
}
tempimg=Image.createRGBImage(pixelone, vimg.getWidth(), vimg.getHeight(), true);
}
catch(IOException e)
{
e.printStackTrace();
}
}
public void paint(Graphics g)
{
setFullScreenMode(true);
clearScreen(g);
g.drawImage(tempimg, (getWidth()-tempimg.getWidth())/2, (GameMIDlet.SCREEN_HEIGHT-tempimg.getHeight())/2, Graphics.TOP|Graphics.LEFT);
}
/**
* 清屏函数
* @param g
*/
public void clearScreen(Graphics g)
{
g.setColor(0x000000);
g.fillRect(0, 0, getWidth(), GameMIDlet.SCREEN_HEIGHT);
}
}
/**
* 计时器类,实现渐变效果
* @author net.app
*
*/
class myTimerTask extends TimerTask
{
// private long currentTime,lastTime;
private VendarSplash m_vs;
private int step=0;
public myTimerTask(VendarSplash vs)
{
m_vs=vs;
}
public void run()
{
// lastTime=System.currentTimeMillis();
for(int i=0;i<m_vs.imglength;i++)
{
/*if((m_vs.pixelone[i]>>16&0x0000ff)==0&&(m_vs.pixelone[i]>>8&0x0000ff)==0&&(m_vs.pixelone[i]&0x0000ff)==0)
continue;*/
m_vs.pixelone[i]+=0x11000000;
}
step++;
if(step>=15)
{
m_vs.timer.cancel();
m_vs.timer=null;
m_vs.vimg=null;
m_vs.tempimg=null;
System.gc();
GameAniSplash gas=new GameAniSplash(m_vs.m_gmid);
//new Thread(gas).start();
m_vs.m_gmid.setCurrent(gas);
}
m_vs.tempimg=Image.createRGBImage(m_vs.pixelone, m_vs.vimg.getWidth(), m_vs.vimg.getHeight(), true);
m_vs.repaint();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -