package screensaver;
import java
import java
import java
import java
import dec
import java
import java
import java
import java
import java
import java
import dec
import dec
public class ScreenPicSaver
{
MediaTracker tracker = new MediaTracker(new Component()
{});
public ScreenPicSaver()
{}
public Image loadbitmap(String sdir
{
Image image;
System
try
{
FileInputStream fs = new FileInputStream(sdir + sfile);
int bflen =
byte bf[] = new byte[bflen];
fs
int bilen =
byte bi[] = new byte[bilen];
fs
// 解釋數據
int nsize = ( ( (int) bf[
| ( ( (int) bf[
| ( ( (int) bf[
| (int) bf[
System
System
int nbisize = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nwidth = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nheight = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nplanes = ( ( (int) bi[
System
int nbitcount = ( ( (int) bi[
System
// 查找表明壓縮的非零值
int ncompression = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nsizeimage = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nxpm = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nypm = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nclrused = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
int nclrimp = ( ( (int) bi[
| ( ( (int) bi[
| ( ( (int) bi[
| (int) bi[
System
if (nbitcount ==
{
//
//
int npad = (nsizeimage / nheight)
int ndata[] = new int[nheight * nwidth];
byte brgb[] = new byte[ (nwidth + npad) *
fs
int nindex =
for (int j =
{
for (int i =
{
ndata[nwidth * (nheight
(
| ( ( (int) brgb[nindex +
| ( ( (int) brgb[nindex +
| (int) brgb[nindex] &
/** System
+i +
+ ( (int) (brgb[
+ ( (int) brgb[
+ ( (int) brgb[
}*/
nindex +=
}
nindex += npad;
}
image = Toolkit
(new MemoryImageSource(nwidth
ndata
}
else if (nbitcount ==
{
// 必須確定顏色數
// 則顏色數由它決定
// bitsperpixel 計算顏色數
int nNumColors =
if (nclrused >
{
nNumColors = nclrused;
}
else
{
nNumColors = (
}
System
// 某些位圖不計算 sizeimage 域
// 這些情況並對它們進行修正
if (nsizeimage ==
{
nsizeimage = ( ( ( (nwidth * nbitcount) +
nsizeimage *= nheight;
System
}
// 讀取調色板顏色
int npalette[] = new int[nNumColors];
byte bpalette[] = new byte[nNumColors *
fs
int nindex
for (int n =
{
npalette[n] = (
| ( ( (int) bpalette[nindex
| ( ( (int) bpalette[nindex
| (int) bpalette[nindex
/**System
+
+ ( (int) (bpalette[nindex
+ ( (int) (bpalette[nindex
+ ( (int) bpal
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19747.html