protected BufferedImage create_BARGRAPH_TRACK_Image(final int WIDTH, final double START_ANGLE,
                                                                       final double ANGLE_EXTEND,
                                                                       final double APEX_ANGLE,
                                                                       final double BARGRAPH_OFFSET,
                                                                       BufferedImage image) {
        if (WIDTH <= 0) {
            return null;
        }

        if (image == null) {
            image = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT);
        }
        final Graphics2D G2 = image.createGraphics();
        G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//        G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
//        G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
//        G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
//        G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
//        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);

        final int IMAGE_WIDTH = image.getWidth();
        final int IMAGE_HEIGHT = image.getHeight();

        // Create led track
        final java.awt.geom.Arc2D BACK = new java.awt.geom.Arc2D.Double(java.awt.geom.Arc2D.PIE);
        BACK.setFrame(IMAGE_WIDTH * 0.1074766355, IMAGE_HEIGHT * 0.1074766355, IMAGE_WIDTH * 0.785046729, IMAGE_HEIGHT * 0.785046729);
        BACK.setAngleStart(START_ANGLE + 2);
        BACK.setAngleExtent(ANGLE_EXTEND - 5);

        final Ellipse2D BACK_SUB = new Ellipse2D.Double(IMAGE_WIDTH * 0.1822429907, IMAGE_HEIGHT * 0.1822429907, IMAGE_WIDTH * 0.6355140187, IMAGE_HEIGHT * 0.6355140187);

        final java.awt.geom.Area LED_TRACK_FRAME = new java.awt.geom.Area(BACK);
        LED_TRACK_FRAME.subtract(new java.awt.geom.Area(BACK_SUB));

        final Point2D LED_TRACK_FRAME_START = new Point2D.Double(0, LED_TRACK_FRAME.getBounds2D().getMinY());
        final Point2D LED_TRACK_FRAME_STOP = new Point2D.Double(0, LED_TRACK_FRAME.getBounds2D().getMaxY());
        final float[] LED_TRACK_FRAME_FRACTIONS = {
            0.0f,
            0.22f,
            0.76f,
            1.0f
        };
        final Color[] LED_TRACK_FRAME_COLORS = {
            new Color(0, 0, 0, 255),
            new Color(51, 51, 51, 255),
            new Color(51, 51, 51, 255),
            new Color(100, 100, 100, 255)
        };
        Util.INSTANCE.validateGradientPoints(LED_TRACK_FRAME_START, LED_TRACK_FRAME_STOP);
        final LinearGradientPaint LED_TRACK_FRAME_GRADIENT = new LinearGradientPaint(LED_TRACK_FRAME_START, LED_TRACK_FRAME_STOP, LED_TRACK_FRAME_FRACTIONS, LED_TRACK_FRAME_COLORS);
        G2.setPaint(LED_TRACK_FRAME_GRADIENT);
        G2.fill(LED_TRACK_FRAME);

        final java.awt.geom.Arc2D FRONT = new java.awt.geom.Arc2D.Double(java.awt.geom.Arc2D.PIE);
        FRONT.setFrame(IMAGE_WIDTH * 0.1121495327, IMAGE_HEIGHT * 0.1121495327, IMAGE_WIDTH * 0.7803738318, IMAGE_HEIGHT * 0.7803738318);
        FRONT.setAngleStart(START_ANGLE);
        FRONT.setAngleExtent(ANGLE_EXTEND);

        final Ellipse2D FRONT_SUB = new Ellipse2D.Double(IMAGE_WIDTH * 0.1822429907, IMAGE_HEIGHT * 0.1822429907, IMAGE_WIDTH * 0.6448598131, IMAGE_HEIGHT * 0.6448598131);

        final java.awt.geom.Area LED_TRACK_MAIN = new java.awt.geom.Area(BACK);
        LED_TRACK_MAIN.subtract(new java.awt.geom.Area(FRONT_SUB));

        final Point2D LED_TRACK_MAIN_START = new Point2D.Double(0, LED_TRACK_MAIN.getBounds2D().getMinY());
        final Point2D LED_TRACK_MAIN_STOP = new Point2D.Double(0, LED_TRACK_MAIN.getBounds2D().getMaxY());
        final float[] LED_TRACK_MAIN_FRACTIONS = {
            0.0f,
            1.0f
        };
        final Color[] LED_TRACK_MAIN_COLORS = {
            new Color(17, 17, 17, 255),
            new Color(51, 51, 51, 255)
        };
        Util.INSTANCE.validateGradientPoints(LED_TRACK_MAIN_START, LED_TRACK_MAIN_STOP);
        final LinearGradientPaint LED_TRACK_MAIN_GRADIENT = new LinearGradientPaint(LED_TRACK_MAIN_START, LED_TRACK_MAIN_STOP, LED_TRACK_MAIN_FRACTIONS, LED_TRACK_MAIN_COLORS);
        G2.setPaint(LED_TRACK_MAIN_GRADIENT);
        G2.fill(LED_TRACK_MAIN);

        // Draw the inactive leds
        final Point2D CENTER = new Point2D.Double(WIDTH / 2.0, WIDTH / 2.0);
        final Rectangle2D LED = new Rectangle2D.Double(WIDTH * 0.1168224299, WIDTH * 0.4859813084, WIDTH * 0.06074766355140187, WIDTH * 0.023364486);
        final Point2D LED_CENTER = new Point2D.Double(LED.getCenterX(), LED.getCenterY());

        final Color[] LED_COLORS = new Color[]{
            new Color(60, 60, 60, 255),
            new Color(50, 50, 50, 255)
        };
        final RadialGradientPaint LED_GRADIENT = new RadialGradientPaint(LED_CENTER, (float) (0.030373831775700934 * IMAGE_WIDTH), LED_FRACTIONS, LED_COLORS);
        G2.setPaint(LED_GRADIENT);

        final AffineTransform OLD_TRANSFORM = G2.getTransform();

        for (double angle = 0; angle <= APEX_ANGLE; angle += 5.0) {
            G2.rotate(Math.toRadians(angle + BARGRAPH_OFFSET), CENTER.getX(), CENTER.getY());
            G2.fill(LED);
            G2.setTransform(OLD_TRANSFORM);
        }

        G2.dispose();

        return image;
    }
protected BufferedImage create_BARGRAPH_TRACK_Image ( final int WIDTH , final double START_ANGLE , final double ANGLE_EXTEND , final double APEX_ANGLE , final double BARGRAPH_OFFSET , BufferedImage image ) { if ( WIDTH <= 0 ) { return null ; } if ( image == null ) { image = UTIL . createImage ( WIDTH , WIDTH , Transparency . TRANSLUCENT ) ; } final Graphics2D G2 = image . createGraphics ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; final int IMAGE_WIDTH = image . getWidth ( ) ; final int IMAGE_HEIGHT = image . getHeight ( ) ; final java . awt . geom . Arc2D BACK = new java . awt . geom . Arc2D . Double ( java . awt . geom . Arc2D . PIE ) ; BACK . setFrame ( IMAGE_WIDTH * 0.1074766355 , IMAGE_HEIGHT * 0.1074766355 , IMAGE_WIDTH * 0.785046729 , IMAGE_HEIGHT * 0.785046729 ) ; BACK . setAngleStart ( START_ANGLE + 2 ) ; BACK . setAngleExtent ( ANGLE_EXTEND - 5 ) ; final Ellipse2D BACK_SUB = new Ellipse2D . Double ( IMAGE_WIDTH * 0.1822429907 , IMAGE_HEIGHT * 0.1822429907 , IMAGE_WIDTH * 0.6355140187 , IMAGE_HEIGHT * 0.6355140187 ) ; final java . awt . geom . Area LED_TRACK_FRAME = new java . awt . geom . Area ( BACK ) ; LED_TRACK_FRAME . subtract ( new java . awt . geom . Area ( BACK_SUB ) ) ; final Point2D LED_TRACK_FRAME_START = new Point2D . Double ( 0 , LED_TRACK_FRAME . getBounds2D ( ) . getMinY ( ) ) ; final Point2D LED_TRACK_FRAME_STOP = new Point2D . Double ( 0 , LED_TRACK_FRAME . getBounds2D ( ) . getMaxY ( ) ) ; final float [ ] LED_TRACK_FRAME_FRACTIONS = { 0.0f , 0.22f , 0.76f , 1.0f } ; final Color [ ] LED_TRACK_FRAME_COLORS = { new Color ( 0 , 0 , 0 , 255 ) , new Color ( 51 , 51 , 51 , 255 ) , new Color ( 51 , 51 , 51 , 255 ) , new Color ( 100 , 100 , 100 , 255 ) } ; Util . INSTANCE . validateGradientPoints ( LED_TRACK_FRAME_START , LED_TRACK_FRAME_STOP ) ; final LinearGradientPaint LED_TRACK_FRAME_GRADIENT = new LinearGradientPaint ( LED_TRACK_FRAME_START , LED_TRACK_FRAME_STOP , LED_TRACK_FRAME_FRACTIONS , LED_TRACK_FRAME_COLORS ) ; G2 . setPaint ( LED_TRACK_FRAME_GRADIENT ) ; G2 . fill ( LED_TRACK_FRAME ) ; final java . awt . geom . Arc2D FRONT = new java . awt . geom . Arc2D . Double ( java . awt . geom . Arc2D . PIE ) ; FRONT . setFrame ( IMAGE_WIDTH * 0.1121495327 , IMAGE_HEIGHT * 0.1121495327 , IMAGE_WIDTH * 0.7803738318 , IMAGE_HEIGHT * 0.7803738318 ) ; FRONT . setAngleStart ( START_ANGLE ) ; FRONT . setAngleExtent ( ANGLE_EXTEND ) ; final Ellipse2D FRONT_SUB = new Ellipse2D . Double ( IMAGE_WIDTH * 0.1822429907 , IMAGE_HEIGHT * 0.1822429907 , IMAGE_WIDTH * 0.6448598131 , IMAGE_HEIGHT * 0.6448598131 ) ; final java . awt . geom . Area LED_TRACK_MAIN = new java . awt . geom . Area ( BACK ) ; LED_TRACK_MAIN . subtract ( new java . awt . geom . Area ( FRONT_SUB ) ) ; final Point2D LED_TRACK_MAIN_START = new Point2D . Double ( 0 , LED_TRACK_MAIN . getBounds2D ( ) . getMinY ( ) ) ; final Point2D LED_TRACK_MAIN_STOP = new Point2D . Double ( 0 , LED_TRACK_MAIN . getBounds2D ( ) . getMaxY ( ) ) ; final float [ ] LED_TRACK_MAIN_FRACTIONS = { 0.0f , 1.0f } ; final Color [ ] LED_TRACK_MAIN_COLORS = { new Color ( 17 , 17 , 17 , 255 ) , new Color ( 51 , 51 , 51 , 255 ) } ; Util . INSTANCE . validateGradientPoints ( LED_TRACK_MAIN_START , LED_TRACK_MAIN_STOP ) ; final LinearGradientPaint LED_TRACK_MAIN_GRADIENT = new LinearGradientPaint ( LED_TRACK_MAIN_START , LED_TRACK_MAIN_STOP , LED_TRACK_MAIN_FRACTIONS , LED_TRACK_MAIN_COLORS ) ; G2 . setPaint ( LED_TRACK_MAIN_GRADIENT ) ; G2 . fill ( LED_TRACK_MAIN ) ; final Point2D CENTER = new Point2D . Double ( WIDTH / 2.0 , WIDTH / 2.0 ) ; final Rectangle2D LED = new Rectangle2D . Double ( WIDTH * 0.1168224299 , WIDTH * 0.4859813084 , WIDTH * 0.06074766355140187 , WIDTH * 0.023364486 ) ; final Point2D LED_CENTER = new Point2D . Double ( LED . getCenterX ( ) , LED . getCenterY ( ) ) ; final Color [ ] LED_COLORS = new Color [ ] { new Color ( 60 , 60 , 60 , 255 ) , new Color ( 50 , 50 , 50 , 255 ) } ; final RadialGradientPaint LED_GRADIENT = new RadialGradientPaint ( LED_CENTER , ( float ) ( 0.030373831775700934 * IMAGE_WIDTH ) , LED_FRACTIONS , LED_COLORS ) ; G2 . setPaint ( LED_GRADIENT ) ; final AffineTransform OLD_TRANSFORM = G2 . getTransform ( ) ; for ( double angle = 0 ; angle <= APEX_ANGLE ; angle += 5.0 ) { G2 . rotate ( Math . toRadians ( angle + BARGRAPH_OFFSET ) , CENTER . getX ( ) , CENTER . getY ( ) ) ; G2 . fill ( LED ) ; G2 . setTransform ( OLD_TRANSFORM ) ; } G2 . dispose ( ) ; return image ; }
Returns the bargraph track image
with the given with and height.
@param WIDTH
@param START_ANGLE
@param ANGLE_EXTEND
@param APEX_ANGLE
@param BARGRAPH_OFFSET
@param image
@return buffered image containing the bargraph track image