- 浏览: 316665 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
a455642158:
xiajy 写道他妈的都该名字了,更可恶的金山手机助手是:sj ...
解决ADB server didn't ACK问题 -
wwt455653509:
关闭tadb.exe,重启eclipse搞定
解决ADB server didn't ACK问题 -
Frederic:
感谢,真是帮了大忙!腾讯
解决ADB server didn't ACK问题 -
xiajy:
他妈的都该名字了,更可恶的金山手机助手是:sjk_daemon ...
解决ADB server didn't ACK问题 -
xiaofeilv321:
赞同
解决ADB server didn't ACK问题
import javax.microedition.lcdui.Graphics;
/*
* 图片任意角度翻转算法
* 同时实现了Nokia特有API
* author. BB
* Sprite.java
*
*
*/
public class Sprite {
/** SIN TABLE **/
public final static int SIN_TABLE[] ={
0, 4, 8, 13, 17, 22, 26, 31, 35, 39,
44, 48, 53, 57, 61, 65, 70, 74, 78, 83,
87, 91, 95, 99, 103, 107, 111, 115, 119, 123,
127, 131, 135, 138, 142, 146, 149, 153, 156, 160,
163, 167, 170, 173, 177, 180, 183, 186, 189, 192,
195, 198, 200, 203, 206, 208, 211, 213, 216, 218,
220, 223, 225, 227, 229, 231, 232, 234, 236, 238,
239, 241, 242, 243, 245, 246, 247, 248, 249, 250,
251, 251, 252, 253, 253, 254, 254, 254, 254, 254,
255, 254, 254, 254, 254, 254, 253, 253, 252, 251,
251, 250, 249, 248, 247, 246, 245, 243, 242, 241,
239, 238, 236, 234, 232, 231, 229, 227, 225, 223,
220, 218, 216, 213, 211, 208, 206, 203, 200, 198,
195, 192, 189, 186, 183, 180, 177, 173, 170, 167,
163, 160, 156, 153, 149, 146, 142, 138, 135, 131,
127, 123, 119, 115, 111, 107, 103, 99, 95, 91,
87, 83, 78, 74, 70, 65, 61, 57, 53, 48,
44, 39, 35, 31, 26, 22, 17, 13, 8, 4,
0, -4, -8, -13, -17, -22, -26, -31, -35, -39,
-44, -48, -53, -57, -61, -65, -70, -74, -78, -83,
-87, -91, -95, -99, -103, -107, -111, -115, -119, -123,
-127, -131, -135, -138, -142, -146, -149, -153, -156, -160,
-163, -167, -170, -173, -177, -180, -183, -186, -189, -192,
-195, -198, -200, -203, -206, -208, -211, -213, -216, -218,
-220, -223, -225, -227, -229, -231, -232, -234, -236, -238,
-239, -241, -242, -243, -245, -246, -247, -248, -249, -250,
-251, -251, -252, -253, -253, -254, -254, -254, -254, -254,
-255, -254, -254, -254, -254, -254, -253, -253, -252, -251,
-251, -250, -249, -248, -247, -246, -245, -243, -242, -241,
-239, -238, -236, -234, -232, -231, -229, -227, -225, -223,
-220, -218, -216, -213, -211, -208, -206, -203, -200, -198,
-195, -192, -189, -186, -183, -180, -177, -173, -170, -167,
-163, -160, -156, -153, -149, -146, -142, -138, -135, -131,
-127, -123, -119, -115, -111, -107, -103, -99, -95, -91,
-87, -83, -78, -74, -70, -65, -61, -57, -53, -48,
-44, -39, -35, -31, -26, -22, -17, -13, -8, -4
};
/** 透明 **/
public static int TRANSPARENT = 0;
/** 不透明 **/
public static int OPAQUE = 15;
/**
* 像素值
* 包含动画帧,主下标标识动画帧数,副下标的值代表像素值
*/
public short pixels[][];
/*
* 精灵的宽度
* 该版本默认精灵各个帧的宽度一样大小
*/
public short width;
/*
* 精灵的高度
* 该版本默认精灵各个帧的高度一样大小
*/
public short height;
/*
* 动画帧数
*/
public byte numOfFrame;
/*
* 当前动画帧数
*/
public int curFrame;
/*
* 构造函数
* 确保传入的各个值为合理的值
* 使用的话请自己做判断
* @param _pixels 动画的像素值
* @param _width 宽度
* @param _height 高度
*/
public Sprite(short[][] _pixels, short _width, short _height){
pixels = _pixels;
width = _width;
height = _height;
numOfFrame = (byte)_pixels.length;
curFrame = 0;
}
/*
* 构造函数
*/
public Sprite(){
}
/*
* 投影
* @param cData
* @param l
* @param i1
* @param j1
* @param k1
* @return
*/
private final short project(short cData[], int l, int i1, int j1, int k1) {
int j3 = (j1 & 0xffff) >> 8;
int k3 = (k1 & 0xffff) >> 8;
int l3 = (256 - j3) * (256 - k3);
int i4 = j3 * (256 - k3);
int j4 = (256 - j3) * k3;
int k4 = j3 * k3;
int l2 = j1 >> 16;
int i3 = k1 >> 16;
l2 %= l;
i3 %= i1;
i3 *= l;
short word0 = cData[l2 + i3];
short word2 = cData[(l2 + (i3 + l)) % (cData.length - 1)];
l2 = ++l2 % l;
short word1 = cData[l2 + i3];
short word3 = cData[(l2 + (i3 + l)) % (cData.length - 1)];
int l1 = word0 >> 12 & 0xf;
int i2 = word1 >> 12 & 0xf;
int j2 = word2 >> 12 & 0xf;
int k2 = word3 >> 12 & 0xf;
int k5 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
l1 = word0 >> 8 & 0xf;
i2 = word1 >> 8 & 0xf;
j2 = word2 >> 8 & 0xf;
k2 = word3 >> 8 & 0xf;
int l4 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
l1 = word0 >> 4 & 0xf;
i2 = word1 >> 4 & 0xf;
j2 = word2 >> 4 & 0xf;
k2 = word3 >> 4 & 0xf;
int i5 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
l1 = word0 & 0xf;
i2 = word1 & 0xf;
j2 = word2 & 0xf;
k2 = word3 & 0xf;
int j5 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
return (short) ((k5 << 12) + (l4 << + (i5 << 4) + j5);
}
/*
* 翻转
* @param count 在360度内翻转的个数
* @return 返回一个翻转后的精灵
*/
public Sprite rotate(int count) {
Sprite sprite = new Sprite();
short radius = 30;
if (width == 40 && height == 40)
radius = 57;
else if (width == 8 && height ==
radius = 12;
else if (width == 6 && height == 12)
radius = 14;
else if (width == 24 && height == 24)
radius = 34;
else if (width == 26 && height == 26)
radius = 27;
else if (width == 8 && height == 15)
radius = 17;
else if (width == 10 && height == 16)
radius = 19;
else if (width == 11 && height == 15)
radius = 19;
else
System.out.println("Wrong size: " + width + " " + width + " "+ count);
sprite.width = radius;
sprite.height = radius;
sprite.numOfFrame = (byte)count;
sprite.pixels = new short[count][];
for (int j1 = 0; j1 < count; j1++) {
sprite.pixels[j1] = new short[sprite.width * sprite.height];
int k1 = j1 * (360 / count);
short l1 = width;
short i2 = height;
width = sprite.width;
height = sprite.height;
int j2 = width / 2;
int k2 = l1 / 2;
int l2 = i2 / 2;
int i3 = SIN_TABLE[k1 % 360] << 8;
int j3 = SIN_TABLE[(k1 + 90) % 360] << 8;
int k4 = 0;
int i4 = -j2 * j3;
int j4 = -j2 * i3;
for (int l4 = 0; l4 < sprite.pixels[j1].length; l4++)
sprite.pixels[j1][l4] = (short) (TRANSPARENT << 12);
for (int i5 = 0; i5 < height; i5++) {
int k3 = -j2 * j3;
int l3 = -j2 * i3;
for (int j5 = 0; j5 < width; j5++) {
//x
int k5 = (k3 - j4 >> 16) + k2;
//y
int l5 = (i4 + l3 >> 16) + l2;
if (k5 >= 0 && l5 >= 0 && l5 < i2 && k5 < l1)
sprite.pixels[j1][k4] = project(pixels[0], l1, i2,
(k3 - j4) + (k2 << 16), i4 + l3 + (l2 << 16));
k3 += j3;
l3 += i3;
k4++;
}
i4 += j3;
j4 += i3;
k4 -= width;
k4 += sprite.width;
}
height = i2;
width = l1;
}
return sprite;
}
/*
* 绘制精灵
* 在这里实现了Nokia的特有API
* 大家可以扩展该方法
* @param g
* @param x
* @param y
* @param manipulate
*/
public void draw(Graphics g, int x, int y, int manipulate) {
drawPixels(g, true, 0, width, x, y, width,
height, manipulate, 4444);
}
public void drawPixels(Graphics g, boolean transparency,
int offset, int scanlength, int x, int y, int width, int height,
int manipulation, int format) {
int l1 = map2Manipulation(manipulation);
int j1;
int k1;
if ((l1 & 4) != 0) {
j1 = height;
k1 = width;
} else {
j1 = width;
k1 = height;
}
short newPixels[] = new short [j1 * k1];
if(manipulation == 0){
newPixels = pixels[curFrame];
}
else
for (int i2 = 0; i2 < k1; i2++) {
for (int j2 = 0; j2 < j1; j2++) {
int j = j2;
int k = i2;
if ((l1 & 1) != 0)
j = j1 - 1 - j;
if ((l1 & 2) != 0)
k = k1 - 1 - k;
if ((l1 & 4) != 0) {
int k2 = j;
j = k;
k = k2;
}
newPixels[j1 * i2 + j2] = pixels[curFrame][width * k + j];
}
}
int off = offset;
int vw = x + j1;
int vh = y + k1;
for(int idy = y; idy < vh; idy++){
int voff = off;
for(int idx = x; idx < vw; idx++){
short pixel = newPixels[voff++];
int k3 = idx;
for(; idx < vw - 1 && newPixels[voff] == pixel; voff++)
idx++;
if((pixel >> 12 & 0xff) != 0)
{
int l3 = 0xf0 & pixel << 4;
l3 |= 0xf000 & pixel << 8;
l3 |= 0xf00000 & pixel << 12;
g.setColor(l3);
g.drawLine(k3, idy, idx, idy);
}
}
off += j1;
}
}
private static int map2Manipulation(int i) throws IllegalArgumentException {
int j = 0;
if ((i & 0x2000) != 0)
j ^= 1;
if ((i & 0x4000) != 0)
j ^= 2;
switch (i & 0xffff9fff) {
case 90: // 'Z'
j ^= 6;
break;
case 180:
j ^= 3;
break;
case 270:
j ^= 5;
break;
default:
throw new IllegalArgumentException();
case 0: // '\0'
break;
}
return j;
}
}
/*
* 图片任意角度翻转算法
* 同时实现了Nokia特有API
* author. BB
* Sprite.java
*
*
*/
public class Sprite {
/** SIN TABLE **/
public final static int SIN_TABLE[] ={
0, 4, 8, 13, 17, 22, 26, 31, 35, 39,
44, 48, 53, 57, 61, 65, 70, 74, 78, 83,
87, 91, 95, 99, 103, 107, 111, 115, 119, 123,
127, 131, 135, 138, 142, 146, 149, 153, 156, 160,
163, 167, 170, 173, 177, 180, 183, 186, 189, 192,
195, 198, 200, 203, 206, 208, 211, 213, 216, 218,
220, 223, 225, 227, 229, 231, 232, 234, 236, 238,
239, 241, 242, 243, 245, 246, 247, 248, 249, 250,
251, 251, 252, 253, 253, 254, 254, 254, 254, 254,
255, 254, 254, 254, 254, 254, 253, 253, 252, 251,
251, 250, 249, 248, 247, 246, 245, 243, 242, 241,
239, 238, 236, 234, 232, 231, 229, 227, 225, 223,
220, 218, 216, 213, 211, 208, 206, 203, 200, 198,
195, 192, 189, 186, 183, 180, 177, 173, 170, 167,
163, 160, 156, 153, 149, 146, 142, 138, 135, 131,
127, 123, 119, 115, 111, 107, 103, 99, 95, 91,
87, 83, 78, 74, 70, 65, 61, 57, 53, 48,
44, 39, 35, 31, 26, 22, 17, 13, 8, 4,
0, -4, -8, -13, -17, -22, -26, -31, -35, -39,
-44, -48, -53, -57, -61, -65, -70, -74, -78, -83,
-87, -91, -95, -99, -103, -107, -111, -115, -119, -123,
-127, -131, -135, -138, -142, -146, -149, -153, -156, -160,
-163, -167, -170, -173, -177, -180, -183, -186, -189, -192,
-195, -198, -200, -203, -206, -208, -211, -213, -216, -218,
-220, -223, -225, -227, -229, -231, -232, -234, -236, -238,
-239, -241, -242, -243, -245, -246, -247, -248, -249, -250,
-251, -251, -252, -253, -253, -254, -254, -254, -254, -254,
-255, -254, -254, -254, -254, -254, -253, -253, -252, -251,
-251, -250, -249, -248, -247, -246, -245, -243, -242, -241,
-239, -238, -236, -234, -232, -231, -229, -227, -225, -223,
-220, -218, -216, -213, -211, -208, -206, -203, -200, -198,
-195, -192, -189, -186, -183, -180, -177, -173, -170, -167,
-163, -160, -156, -153, -149, -146, -142, -138, -135, -131,
-127, -123, -119, -115, -111, -107, -103, -99, -95, -91,
-87, -83, -78, -74, -70, -65, -61, -57, -53, -48,
-44, -39, -35, -31, -26, -22, -17, -13, -8, -4
};
/** 透明 **/
public static int TRANSPARENT = 0;
/** 不透明 **/
public static int OPAQUE = 15;
/**
* 像素值
* 包含动画帧,主下标标识动画帧数,副下标的值代表像素值
*/
public short pixels[][];
/*
* 精灵的宽度
* 该版本默认精灵各个帧的宽度一样大小
*/
public short width;
/*
* 精灵的高度
* 该版本默认精灵各个帧的高度一样大小
*/
public short height;
/*
* 动画帧数
*/
public byte numOfFrame;
/*
* 当前动画帧数
*/
public int curFrame;
/*
* 构造函数
* 确保传入的各个值为合理的值
* 使用的话请自己做判断
* @param _pixels 动画的像素值
* @param _width 宽度
* @param _height 高度
*/
public Sprite(short[][] _pixels, short _width, short _height){
pixels = _pixels;
width = _width;
height = _height;
numOfFrame = (byte)_pixels.length;
curFrame = 0;
}
/*
* 构造函数
*/
public Sprite(){
}
/*
* 投影
* @param cData
* @param l
* @param i1
* @param j1
* @param k1
* @return
*/
private final short project(short cData[], int l, int i1, int j1, int k1) {
int j3 = (j1 & 0xffff) >> 8;
int k3 = (k1 & 0xffff) >> 8;
int l3 = (256 - j3) * (256 - k3);
int i4 = j3 * (256 - k3);
int j4 = (256 - j3) * k3;
int k4 = j3 * k3;
int l2 = j1 >> 16;
int i3 = k1 >> 16;
l2 %= l;
i3 %= i1;
i3 *= l;
short word0 = cData[l2 + i3];
short word2 = cData[(l2 + (i3 + l)) % (cData.length - 1)];
l2 = ++l2 % l;
short word1 = cData[l2 + i3];
short word3 = cData[(l2 + (i3 + l)) % (cData.length - 1)];
int l1 = word0 >> 12 & 0xf;
int i2 = word1 >> 12 & 0xf;
int j2 = word2 >> 12 & 0xf;
int k2 = word3 >> 12 & 0xf;
int k5 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
l1 = word0 >> 8 & 0xf;
i2 = word1 >> 8 & 0xf;
j2 = word2 >> 8 & 0xf;
k2 = word3 >> 8 & 0xf;
int l4 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
l1 = word0 >> 4 & 0xf;
i2 = word1 >> 4 & 0xf;
j2 = word2 >> 4 & 0xf;
k2 = word3 >> 4 & 0xf;
int i5 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
l1 = word0 & 0xf;
i2 = word1 & 0xf;
j2 = word2 & 0xf;
k2 = word3 & 0xf;
int j5 = l1 * l3 + i2 * i4 + j2 * j4 + k2 * k4 >> 16;
return (short) ((k5 << 12) + (l4 << + (i5 << 4) + j5);
}
/*
* 翻转
* @param count 在360度内翻转的个数
* @return 返回一个翻转后的精灵
*/
public Sprite rotate(int count) {
Sprite sprite = new Sprite();
short radius = 30;
if (width == 40 && height == 40)
radius = 57;
else if (width == 8 && height ==
radius = 12;
else if (width == 6 && height == 12)
radius = 14;
else if (width == 24 && height == 24)
radius = 34;
else if (width == 26 && height == 26)
radius = 27;
else if (width == 8 && height == 15)
radius = 17;
else if (width == 10 && height == 16)
radius = 19;
else if (width == 11 && height == 15)
radius = 19;
else
System.out.println("Wrong size: " + width + " " + width + " "+ count);
sprite.width = radius;
sprite.height = radius;
sprite.numOfFrame = (byte)count;
sprite.pixels = new short[count][];
for (int j1 = 0; j1 < count; j1++) {
sprite.pixels[j1] = new short[sprite.width * sprite.height];
int k1 = j1 * (360 / count);
short l1 = width;
short i2 = height;
width = sprite.width;
height = sprite.height;
int j2 = width / 2;
int k2 = l1 / 2;
int l2 = i2 / 2;
int i3 = SIN_TABLE[k1 % 360] << 8;
int j3 = SIN_TABLE[(k1 + 90) % 360] << 8;
int k4 = 0;
int i4 = -j2 * j3;
int j4 = -j2 * i3;
for (int l4 = 0; l4 < sprite.pixels[j1].length; l4++)
sprite.pixels[j1][l4] = (short) (TRANSPARENT << 12);
for (int i5 = 0; i5 < height; i5++) {
int k3 = -j2 * j3;
int l3 = -j2 * i3;
for (int j5 = 0; j5 < width; j5++) {
//x
int k5 = (k3 - j4 >> 16) + k2;
//y
int l5 = (i4 + l3 >> 16) + l2;
if (k5 >= 0 && l5 >= 0 && l5 < i2 && k5 < l1)
sprite.pixels[j1][k4] = project(pixels[0], l1, i2,
(k3 - j4) + (k2 << 16), i4 + l3 + (l2 << 16));
k3 += j3;
l3 += i3;
k4++;
}
i4 += j3;
j4 += i3;
k4 -= width;
k4 += sprite.width;
}
height = i2;
width = l1;
}
return sprite;
}
/*
* 绘制精灵
* 在这里实现了Nokia的特有API
* 大家可以扩展该方法
* @param g
* @param x
* @param y
* @param manipulate
*/
public void draw(Graphics g, int x, int y, int manipulate) {
drawPixels(g, true, 0, width, x, y, width,
height, manipulate, 4444);
}
public void drawPixels(Graphics g, boolean transparency,
int offset, int scanlength, int x, int y, int width, int height,
int manipulation, int format) {
int l1 = map2Manipulation(manipulation);
int j1;
int k1;
if ((l1 & 4) != 0) {
j1 = height;
k1 = width;
} else {
j1 = width;
k1 = height;
}
short newPixels[] = new short [j1 * k1];
if(manipulation == 0){
newPixels = pixels[curFrame];
}
else
for (int i2 = 0; i2 < k1; i2++) {
for (int j2 = 0; j2 < j1; j2++) {
int j = j2;
int k = i2;
if ((l1 & 1) != 0)
j = j1 - 1 - j;
if ((l1 & 2) != 0)
k = k1 - 1 - k;
if ((l1 & 4) != 0) {
int k2 = j;
j = k;
k = k2;
}
newPixels[j1 * i2 + j2] = pixels[curFrame][width * k + j];
}
}
int off = offset;
int vw = x + j1;
int vh = y + k1;
for(int idy = y; idy < vh; idy++){
int voff = off;
for(int idx = x; idx < vw; idx++){
short pixel = newPixels[voff++];
int k3 = idx;
for(; idx < vw - 1 && newPixels[voff] == pixel; voff++)
idx++;
if((pixel >> 12 & 0xff) != 0)
{
int l3 = 0xf0 & pixel << 4;
l3 |= 0xf000 & pixel << 8;
l3 |= 0xf00000 & pixel << 12;
g.setColor(l3);
g.drawLine(k3, idy, idx, idy);
}
}
off += j1;
}
}
private static int map2Manipulation(int i) throws IllegalArgumentException {
int j = 0;
if ((i & 0x2000) != 0)
j ^= 1;
if ((i & 0x4000) != 0)
j ^= 2;
switch (i & 0xffff9fff) {
case 90: // 'Z'
j ^= 6;
break;
case 180:
j ^= 3;
break;
case 270:
j ^= 5;
break;
default:
throw new IllegalArgumentException();
case 0: // '\0'
break;
}
return j;
}
}
发表评论
-
RSS
2011-05-05 10:18 0RSS手机阅读 -
checkout lwuit源代码
2010-12-07 16:22 1253步骤一:安装SVN 步骤二:去 LWUIT 官网免费注册一个 ... -
wave混音的实现(2)
2010-11-11 20:43 2416关于混音算法,参考的是http://jacky-zhang.i ... -
混音算法
2010-11-11 20:41 4984一、最简单的混音算法 现在一般的软件混音算法是对输入的音频数据 ... -
wave混音的实现(1)
2010-11-11 20:36 2234先看关于wav文件的头信息 下面是封装好的一个辅助类。用于生 ... -
直接通过链接打开模拟器
2010-03-30 22:13 1067提示:需要JDK1.5 或以上支持 在jad的url之前添加 ... -
j2me优化秘密
2008-04-25 13:36 1742以下是经验总结: *只优化需要的代码 *只在有价值的地方优化 ... -
OpenBaseMovil
2008-04-17 11:05 1537http://www.openbasemovil.org/do ... -
Forum_Nokia_Technical_Library_v1_30_en(chm)
2008-04-16 16:13 1164Forum Nokia Technical Library ... -
mwt
2008-04-10 13:16 1521自己写了一个demo及一些练习 -
Different platform, different keycodes
2008-04-03 09:55 1589package opusmicro.keycode.tes ... -
floggy
2008-03-27 14:31 1332As J2ME developers we couldn't ... -
Canvas翻页效果
2008-03-26 16:01 2673仅供交流学习 -
Canvas下调用输入法
2008-03-26 15:45 2419示例程序。 -
J2ME中文的支持问题
2008-03-11 14:41 1491在使用MotoJ2SDK进行J2ME应用程序的开发,经常会遇到 ... -
camera support
2008-03-11 12:48 1504microedition.platform 平台名称,如j ... -
keycodes on different devices
2008-03-11 11:50 1177Device UP DOWN LEFT RIG ... -
各品牌手机键值
2008-03-11 11:48 2353原文(http://www.jum.cn/bbs/archiv ... -
A J2ME FAQ
2008-03-11 11:41 1805J2ME technologies What are the ... -
J2MEKNOWLEDGE
2008-01-24 18:46 1098example
相关推荐
在J2ME(Java 2 Micro Edition)平台上,图片的任意角度旋转是一个常见的需求,尤其在游戏和图形应用中。本文将深入探讨如何在J2ME中实现这一功能,包括解决旋转过程中的关键问题和优化算法。 首先,我们需要了解...
根据提供的信息,我们可以深入探讨如何在手机上实现任意角度的图像翻转算法,尤其是在J2ME(Java 2 Micro Edition)环境下。此技术通常应用于移动设备上的游戏开发、UI设计等场景,使得开发者能够创建更加生动和交互...
在这个J2ME(Java Micro Edition)版本中,该算法被优化以适应移动设备的性能限制。 A*算法的核心思想是结合了Dijkstra算法的最短路径特性以及优先级队列(通常用二叉堆实现)的高效性,同时引入了启发式函数来估计...
在本文中,我们将深入探讨基于Java 2 Micro Edition(J2ME)的透明泡泡碰撞算法。J2ME是一种轻量级的Java平台,主要用于移动设备和嵌入式系统的开发。这个"j2me透明泡泡碰撞算法小演示"项目提供了一个简单的实例,...
Java 2 Micro Edition (J2ME) 是一种用于开发小型设备和嵌入式系统的 Java 平台,如手机、智能手表或家用电器等。在 J2ME 应用程序中,有时我们需要处理文件的压缩和解压缩,以节省存储空间或在网络上传输数据时减少...
在J2ME中实现任意角度图片旋转是一项技术挑战,涉及到图像处理、数学计算以及设备兼容性等多个方面。本文主要探讨如何在J2ME环境中解决这些问题,以实现高效、准确的图片旋转。 首先,我们需要理解基本的图像旋转...
J2ME(Java Micro Edition)是Java平台的一个版本,主要用于移动设备和嵌入式系统,因此将A*算法应用于J2ME可以帮助创建智能导航或策略游戏等应用。 A*算法的核心在于它使用了一个评估函数来衡量从起点到目标点的...
**标题:“J2ME中的A*算法”** 在Java 2 Micro Edition (J2ME)平台上,实现路径寻找算法对于开发具有导航功能的移动应用至关重要。A*(发音为“A-star”)算法是一种广泛应用的图搜索算法,尤其适用于游戏、地图...
本文将深入探讨J2ME中如何应用插值算法来实现图片的放大和缩小。 首先,我们需要理解图像的基本概念。图像由像素组成,每个像素都有特定的颜色值。在放大图像时,单纯地扩大像素格子会显得粗糙,而插值算法则可以...
5. **镜像效果**:可以通过将图片沿着水平或垂直轴翻转来实现镜像效果。这需要创建一个新的空白图片,然后在适当的位置反向绘制原图片的像素。 6. **对比度和亮度调整**:这涉及到颜色空间的转换。开发者可以遍历...
自己做的扫雷代码,图片自己画的,使用了递归算法,基本实现扫雷的功能,按5开方块,按1标志旗子。
在这个特定的"j2me 图片处理特效"资源中,我们可以深入探讨几个关键的知识点。 首先,图片处理是移动应用开发中的重要部分,特别是在游戏和娱乐应用中。J2ME提供了基本的图像操作接口,如` javax.microedition....
本文主要讨论如何使用插值算法在J2ME环境中实现图片的放大和缩小。首先,我们需要理解图像缩放的基本原理。 1. 图像缩放的基本思想: 图像放大或缩小涉及到图像坐标系统的变换。在放大图像时,新的目标图像坐标可能...
在本文中,我们将深入探讨如何在Java 2 Micro Edition (J2ME)环境中实现一个具有翻书效果的图片处理功能。这个技术主要适用于移动设备,如早期的智能手机和平板电脑,利用J2ME来增强用户体验。 首先,我们看到标题...
本篇将深入探讨J2ME中的SQRT(开平方根)算法及其演示程序。 首先,开平方根是一种数学运算,它返回一个非负数的平方根。在计算机科学中,尤其是游戏开发或图形处理中,这个运算非常常见,例如计算距离、角度和速度...
总的来说,“j2me 45角度地图结构”涉及到了坐标系统转换、图形渲染、碰撞检测和性能优化等多个方面。理解和掌握这些知识点对于J2ME游戏开发者来说至关重要,能够帮助他们更高效地构建出引人入胜的游戏世界。
### J2ME中平方根算法 #### 背景介绍 Java 2 Micro Edition(简称J2ME)是Sun Microsystems为嵌入式设备和移动终端提供的Java平台版本。它主要针对资源有限的设备,如手机、PDA和个人数字助理等。J2ME包括两个关键...
在J2ME(Java 2 Micro Edition)平台上实现A*寻路算法,主要是因为J2ME是Java的一个轻量级版本,适用于移动设备和嵌入式系统。虽然资源有限,但J2ME平台依然能够处理复杂的算法,如A*,以支持游戏和其他需要路径规划...
这意味着如果你需要在透明图片上叠加其他元素,可能需要自己实现混合算法。此外,J2ME平台的设备性能各异,因此在处理大图片或大量图片时,应考虑性能优化,如预先裁剪图片、缓存已渲染的图片等。 为了进一步实践和...
【标题】:“图片分类 J2ME中的图片处理” 【描述】:“图片的特点及分类;png图片的格式分析;图片在J2me中的应用。” 【标签】:“图片处理” “J2ME” “png” 在Java的移动开发领域,J2ME(Java 2 Micro ...