togglebuttonpainter.java
来自「Mobile 应用程序使用 Java Micro Edition (Java M」· Java 代码 · 共 689 行 · 第 1/3 页
JAVA
689 行
decodeX(2.914286f) - decodeX(0.08571429f), //width decodeY(2.9142857f) - decodeY(0.08571429f), //height 11.0f, 11.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[] { 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.03f,0.06f,0.33f,0.6f,0.65f,0.7f,0.825f,0.95f,0.975f,1.0f }, new Color[] { color4, decodeColor(color4,color5,0.5f), color5, decodeColor(color5,color6,0.5f), color6, decodeColor(color6,color6,0.5f), color6, decodeColor(color6,color7,0.5f), color7, decodeColor(color7,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.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[] { 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.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 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.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 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.09f,0.52f,0.95f }, new Color[] { color17, decodeColor(color17,color18,0.5f), color18}); } 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.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 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.05f,0.5f,0.95f }, new Color[] { 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.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, new float[] { 0.0f,0.5f,1.0f }, new Color[] { color31, decodeColor(color31,color32,0.5f), color32}); } 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.06684492f,0.13368984f,0.56684494f,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]}); } 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.0f,0.5f,1.0f }, new Color[] { color36, decodeColor(color36,color37,0.5f), color37}); } private Paint decodeGradient12(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.5f,1.0f }, new Color[] { color41, decodeColor(color41,color42,0.5f), color42}); } private Paint decodeGradient13(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.5f,1.0f }, new Color[] { color47, decodeColor(color47,color48,0.5f), color48}); } private Paint decodeGradient14(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.06684492f,0.13368984f,0.56684494f,1.0f }, new Color[] { color48, decodeColor(color48,color49,0.5f), color49, decodeColor(color49,color49,0.5f), color49}); }
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?