buttonpainter.java

来自「Mobile 应用程序使用 Java Micro Edition (Java M」· Java 代码 · 共 636 行 · 第 1/3 页

JAVA
636
字号
                               decodeY(2.7142859f) - decodeY(0.2857143f), //height                               9.0f, 9.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect3() {        roundRect.setRoundRect(decodeX(0.42857143f), //x                               decodeY(0.42857143f), //y                               decodeX(2.5714285f) - decodeX(0.42857143f), //width                               decodeY(2.5714285f) - decodeY(0.42857143f), //height                               7.0f, 7.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect4() {        roundRect.setRoundRect(decodeX(0.08571429f), //x                               decodeY(0.08571429f), //y                               decodeX(2.914286f) - decodeX(0.08571429f), //width                               decodeY(2.914286f) - decodeY(0.08571429f), //height                               11.0f, 11.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect5() {        roundRect.setRoundRect(decodeX(0.2857143f), //x                               decodeY(0.42857143f), //y                               decodeX(2.7142859f) - decodeX(0.2857143f), //width                               decodeY(2.857143f) - decodeY(0.42857143f), //height                               9.0f, 9.0f); //rounding        return roundRect;    }

    private Paint decodeGradient1(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.05f,0.5f,0.95f },                new Color[] { color2,                            decodeColor(color2,color3,0.5f),                            color3});    }    private Paint decodeGradient2(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.024f,0.06f,0.276f,0.6f,0.65f,0.7f,0.856f,0.96f,0.98399997f,1.0f },                new Color[] { (Color)componentColors[0],                            decodeColor((Color)componentColors[0],(Color)componentColors[1],0.5f),                            (Color)componentColors[1],                            decodeColor((Color)componentColors[1],(Color)componentColors[2],0.5f),                            (Color)componentColors[2],                            decodeColor((Color)componentColors[2],(Color)componentColors[2],0.5f),                            (Color)componentColors[2],                            decodeColor((Color)componentColors[2],(Color)componentColors[3],0.5f),                            (Color)componentColors[3],                            decodeColor((Color)componentColors[3],(Color)componentColors[4],0.5f),                            (Color)componentColors[4]});    }    private Paint decodeGradient3(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.05f,0.5f,0.95f },                new Color[] { color10,                            decodeColor(color10,color11,0.5f),                            color11});    }    private Paint decodeGradient4(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.05f,0.5f,0.95f },                new Color[] { color18,                            decodeColor(color18,color19,0.5f),                            color19});    }    private Paint decodeGradient5(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.09f,0.52f,0.95f },                new Color[] { color26,                            decodeColor(color26,color27,0.5f),                            color27});    }    private Paint decodeGradient6(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.03f,0.06f,0.33f,0.6f,0.65f,0.7f,0.825f,0.95f,0.975f,1.0f },                new Color[] { color28,                            decodeColor(color28,color29,0.5f),                            color29,                            decodeColor(color29,color30,0.5f),                            color30,                            decodeColor(color30,color30,0.5f),                            color30,                            decodeColor(color30,color31,0.5f),                            color31,                            decodeColor(color31,color32,0.5f),                            color32});    }    private Paint decodeGradient7(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.09f,0.52f,0.95f },                new Color[] { color33,                            decodeColor(color33,color34,0.5f),                            color34});    }    private Paint decodeGradient8(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.03f,0.06f,0.33f,0.6f,0.65f,0.7f,0.825f,0.95f,0.975f,1.0f },                new Color[] { (Color)componentColors[0],                            decodeColor((Color)componentColors[0],(Color)componentColors[1],0.5f),                            (Color)componentColors[1],                            decodeColor((Color)componentColors[1],(Color)componentColors[2],0.5f),                            (Color)componentColors[2],                            decodeColor((Color)componentColors[2],(Color)componentColors[2],0.5f),                            (Color)componentColors[2],                            decodeColor((Color)componentColors[2],(Color)componentColors[3],0.5f),                            (Color)componentColors[3],                            decodeColor((Color)componentColors[3],(Color)componentColors[4],0.5f),                            (Color)componentColors[4]});    }    private Paint decodeGradient9(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.09f,0.52f,0.95f },                new Color[] { color39,                            decodeColor(color39,color40,0.5f),                            color40});    }    private Paint decodeGradient10(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.024f,0.06f,0.276f,0.6f,0.65f,0.7f,0.856f,0.96f,0.98f,1.0f },                new Color[] { (Color)componentColors[0],                            decodeColor((Color)componentColors[0],(Color)componentColors[1],0.5f),                            (Color)componentColors[1],                            decodeColor((Color)componentColors[1],(Color)componentColors[2],0.5f),                            (Color)componentColors[2],                            decodeColor((Color)componentColors[2],(Color)componentColors[2],0.5f),                            (Color)componentColors[2],                            decodeColor((Color)componentColors[2],(Color)componentColors[3],0.5f),                            (Color)componentColors[3],                            decodeColor((Color)componentColors[3],(Color)componentColors[3],0.5f),                            (Color)componentColors[3]});    }    private Paint decodeGradient11(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,                new float[] { 0.05f,0.5f,0.95f },                new Color[] { color45,                            decodeColor(color45,color46,0.5f),                            color46});    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?