draw Shadow micro edition - Java javax.microedition.lcdui

Java examples for javax.microedition.lcdui:Graphics

Description

draw Shadow micro edition

Demo Code


import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class Main{
    public static Image drawShadow(int i, int j, int k, int l) {
        int i1 = i >>> 24;
        i &= 0xffffff;/*from   www . j a v a  2 s.c  o m*/
        int ai[] = new int[j * k];
        if (l == 0 || l == 2) {
            for (int j1 = 0; j1 < j; j1++) {
                int l1 = j - 1 - j1;
                if (l == 2) {
                    l1 = j1;
                }
                l1 = (i1 * (l1 - j) * (l1 - j)) / (j * j);
                for (int j2 = 0; j2 < k; j2++) {
                    ai[j1 + j * j2] = l1 << 24 | i;
                }
            }
        } else {
            for (int k1 = 0; k1 < k; k1++) {
                int i2 = k - 1 - k1;
                if (l == 3) {
                    i2 = k1;
                }
                i2 = (i1 * (i2 - k) * (i2 - k)) / (k * k);
                for (int k2 = 0; k2 < j; k2++) {
                    ai[k2 + j * k1] = i2 << 24 | i;
                }
            }
        }
        return Image.createRGBImage(ai, j, k, true);
    }
}

Related Tutorials