toolbartogglebuttonpainter.java

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

JAVA
519
字号
        g.fill(roundRect);        roundRect = decodeRoundRect7();        g.setPaint(decodeGradient10(roundRect));        g.fill(roundRect);    }

    private Path2D decodePath1() {        path.reset();        path.moveTo(decodeX(1.4133738f), decodeY(0.120000005f));        path.lineTo(decodeX(1.9893618f), decodeY(0.120000005f));        path.curveTo(decodeAnchorX(1.9893617630004883f, 3.0f), decodeAnchorY(0.12000000476837158f, 0.0f), decodeAnchorX(2.8857147693634033f, 0.0f), decodeAnchorY(1.0416666269302368f, -3.0f), decodeX(2.8857148f), decodeY(1.0416666f));        path.lineTo(decodeX(2.9f), decodeY(1.9166667f));        path.curveTo(decodeAnchorX(2.9000000953674316f, 0.0f), decodeAnchorY(1.9166667461395264f, 3.0f), decodeAnchorX(1.9893617630004883f, 3.0f), decodeAnchorY(2.671428680419922f, 0.0f), decodeX(1.9893618f), decodeY(2.6714287f));        path.lineTo(decodeX(1.0106384f), decodeY(2.6714287f));        path.curveTo(decodeAnchorX(1.0106383562088013f, -3.0f), decodeAnchorY(2.671428680419922f, 0.0f), decodeAnchorX(0.12000000476837158f, 0.0f), decodeAnchorY(1.9166667461395264f, 3.0f), decodeX(0.120000005f), decodeY(1.9166667f));        path.lineTo(decodeX(0.120000005f), decodeY(1.0446429f));        path.curveTo(decodeAnchorX(0.12000000476837158f, 0.0f), decodeAnchorY(1.0446429252624512f, -3.000000000000001f), decodeAnchorX(1.0106383562088013f, -3.0f), decodeAnchorY(0.12000000476837158f, 0.0f), decodeX(1.0106384f), decodeY(0.120000005f));        path.lineTo(decodeX(1.4148936f), decodeY(0.120000005f));        path.lineTo(decodeX(1.4148936f), decodeY(0.4857143f));        path.lineTo(decodeX(1.0106384f), decodeY(0.4857143f));        path.curveTo(decodeAnchorX(1.0106383562088013f, -1.928571428571427f), decodeAnchorY(0.48571428656578064f, 0.0f), decodeAnchorX(0.4714285731315613f, -0.04427948362011014f), decodeAnchorY(1.038690447807312f, -2.429218094741624f), decodeX(0.47142857f), decodeY(1.0386904f));        path.lineTo(decodeX(0.47142857f), decodeY(1.9166667f));        path.curveTo(decodeAnchorX(0.4714285731315613f, 0.0f), decodeAnchorY(1.9166667461395264f, 2.2142857142856975f), decodeAnchorX(1.0106383562088013f, -1.7857142857142847f), decodeAnchorY(2.3142857551574707f, 0.0f), decodeX(1.0106384f), decodeY(2.3142858f));        path.lineTo(decodeX(1.9893618f), decodeY(2.3142858f));        path.curveTo(decodeAnchorX(1.9893617630004883f, 2.071428571428598f), decodeAnchorY(2.3142857551574707f, 0.0f), decodeAnchorX(2.5f, 0.0f), decodeAnchorY(1.9166667461395264f, 2.2142857142857046f), decodeX(2.5f), decodeY(1.9166667f));        path.lineTo(decodeX(2.5142853f), decodeY(1.0416666f));        path.curveTo(decodeAnchorX(2.5142853260040283f, 0.0f), decodeAnchorY(1.0416666269302368f, -2.1428571428571406f), decodeAnchorX(1.990121603012085f, 2.142857142857167f), decodeAnchorY(0.4714285731315613f, 0.0f), decodeX(1.9901216f), decodeY(0.47142857f));        path.lineTo(decodeX(1.4148936f), decodeY(0.4857143f));        path.lineTo(decodeX(1.4133738f), decodeY(0.120000005f));        path.closePath();        return path;    }    private RoundRectangle2D decodeRoundRect1() {        roundRect.setRoundRect(decodeX(0.4f), //x                               decodeY(0.6f), //y                               decodeX(2.6f) - decodeX(0.4f), //width                               decodeY(2.6f) - decodeY(0.6f), //height                               12.0f, 12.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect2() {        roundRect.setRoundRect(decodeX(0.4f), //x                               decodeY(0.4f), //y                               decodeX(2.6f) - decodeX(0.4f), //width                               decodeY(2.4f) - decodeY(0.4f), //height                               12.0f, 12.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect3() {        roundRect.setRoundRect(decodeX(0.6f), //x                               decodeY(0.6f), //y                               decodeX(2.4f) - decodeX(0.6f), //width                               decodeY(2.2f) - decodeY(0.6f), //height                               9.0f, 9.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect4() {        roundRect.setRoundRect(decodeX(0.120000005f), //x                               decodeY(0.120000005f), //y                               decodeX(2.8800004f) - decodeX(0.120000005f), //width                               decodeY(2.6800003f) - decodeY(0.120000005f), //height                               13.0f, 13.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect5() {        roundRect.setRoundRect(decodeX(0.4f), //x                               decodeY(0.6f), //y                               decodeX(2.6f) - decodeX(0.4f), //width                               decodeY(2.6f) - decodeY(0.6f), //height                               10.0f, 10.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect6() {        roundRect.setRoundRect(decodeX(0.4f), //x                               decodeY(0.4f), //y                               decodeX(2.6f) - decodeX(0.4f), //width                               decodeY(2.4f) - decodeY(0.4f), //height                               10.0f, 10.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect7() {        roundRect.setRoundRect(decodeX(0.6f), //x                               decodeY(0.6f), //y                               decodeX(2.4f) - decodeX(0.6f), //width                               decodeY(2.2f) - decodeY(0.6f), //height                               8.0f, 8.0f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect8() {        roundRect.setRoundRect(decodeX(0.120000005f), //x                               decodeY(0.120000005f), //y                               decodeX(2.8800004f) - decodeX(0.120000005f), //width                               decodeY(2.6799998f) - decodeY(0.120000005f), //height                               13.0f, 13.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.09f,0.52f,0.95f },                new Color[] { color3,                            decodeColor(color3,color4,0.5f),                            color4});    }    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.03f,0.06f,0.33f,0.6f,0.65f,0.7f,0.825f,0.95f,0.975f,1.0f },                new Color[] { color5,                            decodeColor(color5,color6,0.5f),                            color6,                            decodeColor(color6,color7,0.5f),                            color7,                            decodeColor(color7,color7,0.5f),                            color7,                            decodeColor(color7,color8,0.5f),                            color8,                            decodeColor(color8,color8,0.5f),                            color8});    }    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.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (1.0041667f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                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.25f * w) + x, (0.0f * h) + y, (0.25126263f * w) + x, (1.0092592f * h) + y,                new float[] { 0.0f,0.06684492f,0.13368984f,0.56684494f,1.0f },                new Color[] { color12,                            decodeColor(color12,color13,0.5f),                            color13,                            decodeColor(color13,color14,0.5f),                            color14});    }    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.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (1.0041667f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color15,                            decodeColor(color15,color16,0.5f),                            color16});    }    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.25f * w) + x, (0.0f * h) + y, (0.25126263f * w) + x, (1.0092592f * h) + y,                new float[] { 0.0f,0.06684492f,0.13368984f,0.56684494f,1.0f },                new Color[] { color17,                            decodeColor(color17,color18,0.5f),                            color18,                            decodeColor(color18,color19,0.5f),                            color19});    }    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.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (1.0041667f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color20,                            decodeColor(color20,color21,0.5f),                            color21});    }    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.25f * w) + x, (0.0f * h) + y, (0.25126263f * w) + x, (1.0092592f * h) + y,                new float[] { 0.0f,0.06684492f,0.13368984f,0.56684494f,1.0f },                new Color[] { color22,                            decodeColor(color22,color23,0.5f),                            color23,                            decodeColor(color23,color24,0.5f),                            color24});    }    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.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (1.0041667f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color26,                            decodeColor(color26,color27,0.5f),                            color27});    }    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.25f * w) + x, (0.0f * h) + y, (0.25126263f * w) + x, (1.0092592f * h) + y,                new float[] { 0.0f,0.06684492f,0.13368984f,0.56684494f,1.0f },                new Color[] { color27,                            decodeColor(color27,color28,0.5f),                            color28,                            decodeColor(color28,color28,0.5f),                            color28});    }
}

⌨️ 快捷键说明

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