手机上实现任意角度翻转算法[适用任何机型] |
| 作者:bb 来源:迷你手游 发布时间:2005-11-3 14:03:23 |
|
t 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 << 8) + (i5 << 4) + j5); } /* Sprite sprite = new Sprite(); short radius = 30; if (width == 40 && height == 40) radius = 57; else if (width == 8 && height == 8) 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 + 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; } /* 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]; } |
| [] [返回上一页] [打 印] |
|
文章评论 |
