📄 positionfilter.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: PositionFilter.java
package se.southend.drops.pixelfilter;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
// Referenced classes of package se.southend.drops.pixelfilter:
// Filter, RGBTools
public class PositionFilter
implements Filter
{
public PositionFilter()
{
}
public PositionFilter(Image fromImage)
{
setImage(fromImage);
}
public void setImage(Image fromImage)
{
if(fromImage == null)
{
return;
} else
{
width = fromImage.getWidth() + 1;
height = fromImage.getHeight() + 1;
int fromRGB[] = new int[width * height];
fromImage.getRGB(fromRGB, 0, width, 0, 0, width - 1, height - 1);
setRGB(fromRGB, width, height);
return;
}
}
public void setRGB(int fromRGB[], int width, int height)
{
this.fromRGB = fromRGB;
this.width = width;
this.height = height;
rgb = new int[fromRGB.length];
needsRender = true;
}
public Image getImage()
{
return Image.createRGBImage(getRGB(), getWidth(), getHeight(), true);
}
public int[] getRGB()
{
return rgb;
}
public int getWidth()
{
return width;
}
public int getHeight()
{
return height;
}
public void setPosition(int xDecimal, int yDecimal)
{
if(xDecimal == this.xDecimal && yDecimal == this.yDecimal)
{
return;
} else
{
this.xDecimal = xDecimal;
this.yDecimal = yDecimal;
needsRender = true;
return;
}
}
public void render()
{
if(!needsRender)
{
return;
} else
{
rgb = position(fromRGB, rgb, width, height, xDecimal, yDecimal);
needsRender = false;
return;
}
}
public void paintAt(Graphics graphics, int x, int y)
{
render();
graphics.drawRGB(rgb, 0, width, x, y, width, height, true);
}
public static final int[] position(int src[], int dest[], int width, int height, int xDecimal, int yDecimal)
{
if(yDecimal != 0)
{
for(int x = 0; x < width; x++)
dest[x] = RGBTools.blendARGB(src[x], src[x] & 0xffffff, yDecimal);
for(int y = 1; y < height - 1; y++)
{
int y_width = y * width;
for(int x = 0; x < width; x++)
dest[x + y_width] = RGBTools.blendARGB(src[x + y_width], src[(x + y_width) - width], yDecimal);
}
int height_1_width = (height - 1) * width;
for(int x = 0; x < width; x++)
dest[height_1_width + x] = RGBTools.blendARGB(src[(height_1_width - width) + x] & 0xffffff, src[(height_1_width - width) + x], yDecimal);
} else
{
int rgbLength = src.length;
for(int i = 0; i < rgbLength; i++)
dest[i] = src[i];
}
if(xDecimal != 0)
{
int prev = 0;
int curr = 0;
for(int y = 0; y < height; y++)
{
int y_width = y * width;
curr = dest[y_width];
dest[y_width] = RGBTools.blendARGB(dest[y_width], dest[y_width] & 0xffffff, xDecimal);
for(int x = 1; x < width - 1; x++)
{
prev = curr;
curr = dest[x + y_width];
dest[x + y_width] = RGBTools.blendARGB(dest[x + y_width], prev, xDecimal);
}
dest[(y_width + width) - 1] = RGBTools.blendARGB(curr & 0xffffff, curr, xDecimal);
}
}
return dest;
}
protected int fromRGB[];
protected int rgb[];
protected int width;
protected int height;
protected int xDecimal;
protected int yDecimal;
private boolean needsRender;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -