draw Corner Shadow micro edition - Java javax.microedition.lcdui

Java examples for javax.microedition.lcdui:Graphics

Description

draw Corner Shadow micro edition

Demo Code


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

public class Main{
    public static Image drawCornerShadow(int i, int j, int k, int l) {
        int i1 = i >>> 24;
        i &= 0xffffff;//from w ww  . j a v  a  2  s  . c o m
        int ai[] = new int[j * k];
        int j1 = 0;
        int k1 = 0;
        byte byte0 = 0;
        int l1 = 0;
        switch (l) {
        case 0: // '\0'
            j1 = 1;
            k1 = -j + 1;
            byte0 = -1;
            l1 = k - 1;
            break;

        case 1: // '\001'
            j1 = 1;
            k1 = 0;
            byte0 = -1;
            l1 = k - 1;
            break;

        case 2: // '\002'
            j1 = 1;
            k1 = 0;
            byte0 = 1;
            l1 = 0;
            break;

        case 3: // '\003'
            j1 = 1;
            k1 = -j + 1;
            byte0 = 1;
            l1 = 0;
            break;
        }
        for (l = 0; l < j; l++) {
            for (int i2 = 0; i2 < k; i2++) {
                float f1 = l * j1 + k1;
                int j2 = i2 * byte0 + l1;
                f1 = (float) Math.sqrt(f1 * f1 + j2 * j2);
                j2 = (int) (((float) i1 * (f1 - (float) j) * (f1 - (float) j)) / (float) (j * j));
                if (f1 > (float) j) {
                    j2 = 0;
                }
                if (j2 < 0) {
                    j2 = 0;
                }
                ai[l + j * i2] = j2 << 24 | i;
            }
        }
        return Image.createRGBImage(ai, j, k, true);
    }
}

Related Tutorials