<editor-fold defaultstate="collapsed" desc="Image related">
515941
private BufferedImage create_TICKMARKS_Image(final int WIDTH) {
        if (WIDTH <= 0) {
            return null;
        }

        final BufferedImage 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_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
        G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
        G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
        G2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        final int IMAGE_WIDTH = IMAGE.getWidth();

        final AffineTransform OLD_TRANSFORM = G2.getTransform();

        final BasicStroke THIN_STROKE = new BasicStroke(0.01f * IMAGE_WIDTH, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
        final Font NUMBER_FONT = new Font("Arial", Font.PLAIN, (int) (0.073f * IMAGE_WIDTH));
        final Font CHAR_FONT = new Font("Arial", Font.PLAIN, (int) (0.075f * IMAGE_WIDTH));
        final float TEXT_DISTANCE = 0.1f * IMAGE_WIDTH;
        final float MIN_LENGTH = 0.039f * IMAGE_WIDTH;
        final float MED_LENGTH = 0.04f * IMAGE_WIDTH;

        // Create the watch itself
        final float RADIUS = IMAGE_WIDTH * 0.39f;
        CENTER.setLocation(IMAGE_WIDTH / 2.0f, IMAGE_WIDTH / 2.0f);

        // Draw ticks
        Point2D innerPoint = new Point2D.Double();
        Point2D outerPoint = new Point2D.Double();
        Point2D textPoint = new Point2D.Double();
        Line2D tick;
        int tickCounterFull = 0;
        int tickCounterHalf = 0;
        int counter = 0;

        double sinValue = 0;
        double cosValue = 0;

        final double STEP = (2.0 * Math.PI) / (72.0);

        if (isTickmarkColorFromThemeEnabled()) {
            G2.setColor(getBackgroundColor().LABEL_COLOR);
        } else {
            G2.setColor(getTickmarkColor());
        }

        for (double alpha = 2 * Math.PI; alpha >= 0; alpha -= STEP) {
            G2.setStroke(THIN_STROKE);
            sinValue = Math.sin(alpha - Math.PI);
            cosValue = Math.cos(alpha - Math.PI);

            if (tickCounterHalf == 1) {
                G2.setStroke(THIN_STROKE);
                innerPoint.setLocation(CENTER.getX() + (RADIUS - MED_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MED_LENGTH) * cosValue);
                outerPoint.setLocation(CENTER.getX() + (RADIUS - MIN_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MIN_LENGTH) * cosValue);
                // Draw ticks
                tick = new Line2D.Double(innerPoint.getX(), innerPoint.getY(), outerPoint.getX(), outerPoint.getY());
                G2.draw(tick);

                tickCounterHalf = 0;
            }

            // Different tickmark every 15 units
            if (tickCounterFull == 2) {
                G2.setStroke(THIN_STROKE);
                innerPoint.setLocation(CENTER.getX() + (RADIUS - MED_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MED_LENGTH) * cosValue);
                outerPoint.setLocation(CENTER.getX() + RADIUS * sinValue, CENTER.getY() + RADIUS * cosValue);

                // Draw ticks
                tick = new Line2D.Double(innerPoint.getX(), innerPoint.getY(), outerPoint.getX(), outerPoint.getY());
                G2.draw(tick);

                tickCounterFull = 0;
            }

            // Draw text
            textPoint.setLocation(CENTER.getX() + (RADIUS - TEXT_DISTANCE) * sinValue, CENTER.getY() + (RADIUS - TEXT_DISTANCE) * cosValue);
            if (counter != 72 && counter % 6 == 0) {
                if (counter / 2 == 0) {
                    G2.setFont(CHAR_FONT);
                    final Color FORMER_COLOR = G2.getColor();
                    G2.setColor(getPointerColor().LIGHT);
                    G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY());
                    G2.fill(UTIL.rotateTextAroundCenter(G2, "N", (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha)));
                    G2.setColor(FORMER_COLOR);
                } else if (counter / 2 == 9) {
                    G2.setFont(CHAR_FONT);
                    final Color FORMER_COLOR = G2.getColor();
                    G2.setColor(getPointerColor().LIGHT);
                    G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY());
                    G2.fill(UTIL.rotateTextAroundCenter(G2, "E", (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha)));
                    G2.setColor(FORMER_COLOR);
                } else if (counter / 2 == 18) {
                    G2.setFont(CHAR_FONT);
                    final Color FORMER_COLOR = G2.getColor();
                    G2.setColor(getPointerColor().LIGHT);
                    G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY());
                    G2.fill(UTIL.rotateTextAroundCenter(G2, "S", (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha)));
                    G2.setColor(FORMER_COLOR);
                } else if (counter / 2 == 27) {
                    G2.setFont(CHAR_FONT);
                    final Color FORMER_COLOR = G2.getColor();
                    G2.setColor(getPointerColor().LIGHT);
                    G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY());
                    G2.fill(UTIL.rotateTextAroundCenter(G2, "W", (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha)));
                    G2.setColor(FORMER_COLOR);
                } else {
                    G2.setFont(NUMBER_FONT);
                    G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY());
                    G2.fill(UTIL.rotateTextAroundCenter(G2, String.valueOf(counter / 2), (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha)));
                }
            }

            G2.setTransform(OLD_TRANSFORM);

            tickCounterHalf++;
            tickCounterFull++;

            counter++;
        }

        G2.dispose();

        return IMAGE;
    }
456544
public static void boundImage( GrayS32 img , int min , int max ) {
		ImplPixelMath.boundImage(img,min,max);
	}
1123965
private void savePreviousImageValues() {
        if (matrix != null && viewHeight != 0 && viewWidth != 0) {
            matrix.getValues(m);
            prevMatrix.setValues(m);
            prevMatchViewHeight = matchViewHeight;
            prevMatchViewWidth = matchViewWidth;
            prevViewHeight = viewHeight;
            prevViewWidth = viewWidth;
        }
    }
1356191
private void updateImage() {
		if (!over) {
			currentImage = normalImage;
			currentColor = normalColor;
			state = NORMAL;
			mouseUp = false;
		} else {
			if (mouseDown) {
				if ((state != MOUSE_DOWN) && (mouseUp)) {
					if (mouseDownSound != null) {
						mouseDownSound.play();
					}
					currentImage = mouseDownImage;
					currentColor = mouseDownColor;
					state = MOUSE_DOWN;
					
					notifyListeners();
					mouseUp = false;
				}
				
				return;
			} else {
				mouseUp = true;
				if (state != MOUSE_OVER) {
					if (mouseOverSound != null) {
						mouseOverSound.play();
					}
					currentImage = mouseOverImage;
					currentColor = mouseOverColor;
					state = MOUSE_OVER;
				}
			}
		}

		mouseDown = false;
		state = NORMAL;
	}
716679
RenderedImage createSimpleIndexImage() {
        ColorModel srcCM = src.getColorModel();
        if(srcCM instanceof IndexColorModel) {
            return src;
        }
        
        Raster srcRaster = src.getData();
        boolean hasTransparent = srcCM.getTransparency() != Transparency.OPAQUE;
        int maxColorCount = 256;
        if(hasTransparent) {
            maxColorCount = 255;
        }
        
        int num = 0;
        Set<Integer> colorSet = new HashSet<Integer>();
        int[] colorArrays = new int[maxColorCount];
        for(int x = 0; x < src.getWidth(); x++) {
            for(int y = 0; y < src.getHeight(); y++) {
                int rgb = srcCM.getRGB(srcRaster.getDataElements(x, y, null)) & 0xFFFFFF;
                if(!colorSet.contains(rgb)) {
                    if(num == maxColorCount) {
                        return null;
                    }
                    
                    colorArrays[num++] = rgb;
                    colorSet.add(rgb);
                }
            }
        }
        if(num == 0) {
            throw new IllegalStateException("This image has no color");
        }
        
        int[] colors = null;
        if(hasTransparent) {
            colors = new int[num + 1];
            System.arraycopy(colorArrays, 0, colors, 1, num);
            colors[0] = 0;
        } else {
            colors = new int[num];
            System.arraycopy(colorArrays, 0, colors, 0, num);
        }
        
        Arrays.sort(colors);
        
        byte[] red = new byte[colors.length];
        byte[] green = new byte[colors.length];
        byte[] blue = new byte[colors.length];
        for(int i = 0; i < colors.length; i++) {
            red[i] = (byte)((colors[i] >> 16) & 0xFF);
            green[i] = (byte)((colors[i] >> 8) & 0xFF);
            blue[i] = (byte)((colors[i]) & 0xFF);
        }

        IndexColorModel destCM = null;
        if(hasTransparent) {
            destCM = new IndexColorModel(8, colors.length, red, green, blue, 0);
        } else {
            destCM = new IndexColorModel(8, colors.length, red, green, blue);
        }
        
        BufferedImage image = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_INDEXED, destCM);
        WritableRaster raster = image.getRaster();
        for (int x = 0; x < src.getWidth(); x++) {
            for (int y = 0; y < src.getHeight(); y++) {
                int argb = srcCM.getRGB(srcRaster.getDataElements(x, y, null));
                if(hasTransparent && ((argb & 0xFF000000) != 0xFF000000)) {
                    raster.setSample(x, y, 0, 0);
                } else {
                    int index = Arrays.binarySearch(colors, (argb & 0x00FFFFFF));
                    if(index < 0) {
                        throw new IllegalStateException("Some colors not indexed");
                    }
                    raster.setSample(x, y, 0, index);
                }
            }
        }

        return image;
    }
991727
private BufferedImage create_POI_Image(final int WIDTH) {
        if (WIDTH <= 0) {
            return null;
        }

        final java.awt.image.BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, java.awt.Transparency.TRANSLUCENT);
        final java.awt.Graphics2D G2 = IMAGE.createGraphics();
        G2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING, java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
        //G2.setRenderingHint(java.awt.RenderingHints.KEY_RENDERING, java.awt.RenderingHints.VALUE_RENDER_QUALITY);
        //G2.setRenderingHint(java.awt.RenderingHints.KEY_DITHERING, java.awt.RenderingHints.VALUE_DITHER_ENABLE);
        //G2.setRenderingHint(java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
        //G2.setRenderingHint(java.awt.RenderingHints.KEY_COLOR_RENDERING, java.awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        G2.setRenderingHint(java.awt.RenderingHints.KEY_STROKE_CONTROL, java.awt.RenderingHints.VALUE_STROKE_NORMALIZE);
        //G2.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

        final java.awt.geom.Ellipse2D BLIP = new java.awt.geom.Ellipse2D.Double(0, 0, WIDTH, WIDTH);
        final java.awt.geom.Point2D CENTER = new java.awt.geom.Point2D.Double(BLIP.getCenterX(), BLIP.getCenterY());
        final float[] FRACTIONS = {
            0.0f,
            1.0f
        };
        final Color[] COLORS = {
            new Color(1.0f, 1.0f, 1.0f, 0.9f),
            new Color(1.0f, 1.0f, 1.0f, 0.0f)
        };
        final java.awt.RadialGradientPaint GRADIENT = new java.awt.RadialGradientPaint(CENTER, (int) (WIDTH / 2.0), FRACTIONS, COLORS);
        G2.setPaint(GRADIENT);
        G2.fill(BLIP);

        G2.dispose();

        return IMAGE;
    }
294203
public void initalizeTreeState()
    {
        _lastNodeExpandedImage = IMAGE_NODE_EXPAND_LAST;
        _nodeExpandedImage = IMAGE_NODE_EXPAND;
        _lastNodeCollapsedImage = IMAGE_NODE_COLLAPSE_LAST;
        _nodeCollapsedImage = IMAGE_NODE_COLLAPSE;
        _lastLineJoinImage = IMAGE_LINE_JOIN_LAST;
        _lineJoinImage = IMAGE_LINE_JOIN;
        _verticalLineImage = IMAGE_LINE_VERTICAL;
        _imageSpacer = IMAGE_SPACER;
        _defaultIcon = DEFAULT_ICON;
        _imageRoot = null;

        _selectionAction = null;
        _expansionAction = null;
    }
945766
private BufferedImage create_FRAME_Image(final int WIDTH, 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);
        G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        final int IMAGE_WIDTH = image.getWidth();
        final int IMAGE_HEIGHT = image.getHeight();

        transformGraphics(IMAGE_WIDTH, IMAGE_HEIGHT, G2);

        // Define shape that will be subtracted from the frame shapes and will be filled by the background later on
        final GeneralPath BACKGROUND = new GeneralPath();
        BACKGROUND.setWindingRule(Path2D.WIND_EVEN_ODD);
        BACKGROUND.moveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897);
        BACKGROUND.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028);
        BACKGROUND.curveTo(IMAGE_WIDTH * 0.6401869158878505, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.1588785046728972, IMAGE_WIDTH * 0.29439252336448596, IMAGE_HEIGHT * 0.32242990654205606);
        BACKGROUND.curveTo(IMAGE_WIDTH * 0.17289719626168223, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.6635514018691588, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897);
        BACKGROUND.curveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897);
        BACKGROUND.closePath();
        final Area SUBTRACT = new Area(BACKGROUND);

        final GeneralPath FRAME_OUTERFRAME = new GeneralPath();
        FRAME_OUTERFRAME.setWindingRule(Path2D.WIND_EVEN_ODD);
        FRAME_OUTERFRAME.moveTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0);
        FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.0);
        FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 0.3644859813084112, IMAGE_HEIGHT * 0.0, IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 0.308411214953271, IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 1.0);
        FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0);
        FRAME_OUTERFRAME.closePath();
        G2.setPaint(getOuterFrameColor());
        final Area FRAME_OUTERFRAME_AREA = new Area(FRAME_OUTERFRAME);
        FRAME_OUTERFRAME_AREA.subtract(SUBTRACT);
        G2.fill(FRAME_OUTERFRAME_AREA);

        final GeneralPath FRAME_MAIN = new GeneralPath();
        FRAME_MAIN.setWindingRule(Path2D.WIND_EVEN_ODD);
        FRAME_MAIN.moveTo(IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384);
        FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.004672897196261682, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.004672897196261682);
        FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.3364485981308411, IMAGE_HEIGHT * 0.004672897196261682, IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.35514018691588783, IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.9953271028037384);
        FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384);
        FRAME_MAIN.closePath();

        final Point2D FRAME_MAIN_START;
        final Point2D FRAME_MAIN_STOP;
        final Point2D FRAME_MAIN_CENTER = new Point2D.Double(FRAME_MAIN.getBounds2D().getCenterX(), FRAME_MAIN.getBounds2D().getCenterY());

        switch (getOrientation()) {
            case NORTH_WEST:
                FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY());
                FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY());
                break;
            case NORTH_EAST:
                FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY());
                FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY());
                break;
            case SOUTH_EAST:
                FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY());
                FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY());
                break;
            case SOUTH_WEST:
                FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY());
                FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY());
                break;
            default:
                FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY());
                FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY());
        }

        final float ANGLE_OFFSET = (float) Math.toDegrees(Math.atan((IMAGE_HEIGHT / 8.0f) / (IMAGE_WIDTH / 2.0f)));
        final Area FRAME_MAIN_AREA = new Area(FRAME_MAIN);

        if (getFrameDesign() == FrameDesign.CUSTOM) {
            G2.setPaint(getCustomFrameDesign());
            FRAME_MAIN_AREA.subtract(SUBTRACT);
            G2.fill(FRAME_MAIN_AREA);
        } else {
            switch (getFrameDesign()) {
                case BLACK_METAL:
                    float[] frameMainFractions1 = {
                        0.0f,
                        90.0f - 2 * ANGLE_OFFSET,
                        90.0f,
                        90.0f + 3 * ANGLE_OFFSET,
                        180.0f,
                        270.0f - 3 * ANGLE_OFFSET,
                        270.0f,
                        270.0f + 2 * ANGLE_OFFSET,
                        1.0f
                    };

                    Color[] frameMainColors1 = {
                        new Color(254, 254, 254, 255),
                        new Color(0, 0, 0, 255),
                        new Color(153, 153, 153, 255),
                        new Color(0, 0, 0, 255),
                        new Color(0, 0, 0, 255),
                        new Color(0, 0, 0, 255),
                        new Color(153, 153, 153, 255),
                        new Color(0, 0, 0, 255),
                        new Color(254, 254, 254, 255)
                    };

                    Paint frameMainGradient1 = new ConicalGradientPaint(true, FRAME_MAIN_CENTER, 0, frameMainFractions1, frameMainColors1);
                    G2.setPaint(frameMainGradient1);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case METAL:
                    float[] frameMainFractions2 = {
                        0.0f,
                        0.07f,
                        0.12f,
                        1.0f
                    };

                    Color[] frameMainColors2 = {
                        new Color(254, 254, 254, 255),
                        new Color(210, 210, 210, 255),
                        new Color(179, 179, 179, 255),
                        new Color(213, 213, 213, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient2 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions2, frameMainColors2);
                    G2.setPaint(frameMainGradient2);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case SHINY_METAL:
                    float[] frameMainFractions3 = {
                        0.0f,
                        90.0f - 2 * ANGLE_OFFSET,
                        90.0f,
                        90.0f + 4 * ANGLE_OFFSET,
                        180.0f,
                        270.0f - 4 * ANGLE_OFFSET,
                        270.0f,
                        270.0f + 2 * ANGLE_OFFSET,
                        1.0f
                    };

                    Color[] frameMainColors3;
                    if (isFrameBaseColorEnabled()) {
                        frameMainColors3 = new Color[]{
                            new Color(254, 254, 254, 255),
                            new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255),
                            new Color(getFrameBaseColor().brighter().brighter().getRed(), getFrameBaseColor().brighter().brighter().getGreen(), getFrameBaseColor().brighter().brighter().getBlue(), 255),
                            new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255),
                            new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255),
                            new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255),
                            new Color(getFrameBaseColor().brighter().brighter().getRed(), getFrameBaseColor().brighter().brighter().getGreen(), getFrameBaseColor().brighter().brighter().getBlue(), 255),
                            new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255),
                            new Color(254, 254, 254, 255)
                        };
                    } else {
                        frameMainColors3 = new Color[]{
                            new Color(254, 254, 254, 255),
                            new Color(179, 179, 179, 255),
                            new Color(238, 238, 238, 255),
                            new Color(179, 179, 179, 255),
                            new Color(179, 179, 179, 255),
                            new Color(179, 179, 179, 255),
                            new Color(238, 238, 238, 255),
                            new Color(179, 179, 179, 255),
                            new Color(254, 254, 254, 255)
                        };
                    }

                    Paint frameMainGradient3 = new eu.hansolo.steelseries.tools.ConicalGradientPaint(true, FRAME_MAIN_CENTER, 0, frameMainFractions3, frameMainColors3);
                    G2.setPaint(frameMainGradient3);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case GLOSSY_METAL:
                    final GeneralPath FRAME_GLOSSY1 = new GeneralPath();
                    FRAME_GLOSSY1.setWindingRule(Path2D.WIND_EVEN_ODD);
                    FRAME_GLOSSY1.moveTo(0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT);
                    FRAME_GLOSSY1.curveTo(0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT);
                    FRAME_GLOSSY1.curveTo(0.3364485981308411 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT, 0.004672897196261682 * IMAGE_WIDTH, 0.35514018691588783 * IMAGE_HEIGHT, 0.004672897196261682 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT);
                    FRAME_GLOSSY1.curveTo(0.004672897196261682 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT);
                    FRAME_GLOSSY1.closePath();
                    final Area FRAME_GLOSSY_1 = new Area(FRAME_GLOSSY1);
                    FRAME_GLOSSY_1.subtract(SUBTRACT);
                    G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.9906542056074766 * IMAGE_WIDTH, 0.9813084112149533 * IMAGE_HEIGHT), (float)(0.9789719626168224 * IMAGE_WIDTH), new float[]{0.0f, 0.94f, 1.0f}, new Color[]{new Color(0.8235294118f, 0.8235294118f, 0.8235294118f, 1f), new Color(0.8235294118f, 0.8235294118f, 0.8235294118f, 1f), new Color(1f, 1f, 1f, 1f)}));
                    G2.fill(FRAME_GLOSSY_1);

                    final GeneralPath FRAME_GLOSSY2 = new GeneralPath();
                    FRAME_GLOSSY2.setWindingRule(Path2D.WIND_EVEN_ODD);
                    FRAME_GLOSSY2.moveTo(0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT);
                    FRAME_GLOSSY2.curveTo(0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT);
                    FRAME_GLOSSY2.curveTo(0.3364485981308411 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT, 0.009345794392523364 * IMAGE_WIDTH, 0.3598130841121495 * IMAGE_HEIGHT, 0.009345794392523364 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT);
                    FRAME_GLOSSY2.curveTo(0.009345794392523364 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT);
                    FRAME_GLOSSY2.closePath();
                    final Area FRAME_GLOSSY_2 = new Area(FRAME_GLOSSY2);
                    FRAME_GLOSSY_1.subtract(SUBTRACT);
                    G2.setPaint(new LinearGradientPaint(new Point2D.Double(0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT), new Point2D.Double(0.9953271028037384 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT), new float[]{0.0f, 0.18f, 0.32f, 0.66f, 0.89f, 1.0f}, new Color[]{new Color(0.9764705882f, 0.9764705882f, 0.9764705882f, 1f), new Color(0.7843137255f, 0.7647058824f, 0.7490196078f, 1f), new Color(0.9960784314f, 0.9960784314f, 0.9921568627f, 1f), new Color(0.1137254902f, 0.1137254902f, 0.1137254902f, 1f), new Color(0.7843137255f, 0.7647058824f, 0.7490196078f, 1f), new Color(0.8196078431f, 0.8196078431f, 0.8196078431f, 1f)}));
                    G2.fill(FRAME_GLOSSY_2);

                    final GeneralPath FRAME_GLOSSY3 = new GeneralPath();
                    FRAME_GLOSSY3.setWindingRule(Path2D.WIND_EVEN_ODD);
                    FRAME_GLOSSY3.moveTo(0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT);
                    FRAME_GLOSSY3.curveTo(0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT);
                    FRAME_GLOSSY3.curveTo(0.40654205607476634 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT, 0.07009345794392523 * IMAGE_WIDTH, 0.37383177570093457 * IMAGE_HEIGHT, 0.07009345794392523 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT);
                    FRAME_GLOSSY3.curveTo(0.07009345794392523 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT);
                    FRAME_GLOSSY3.closePath();
                    final Area FRAME_GLOSSY_3 = new Area(FRAME_GLOSSY3);
                    FRAME_GLOSSY_3.subtract(SUBTRACT);
                    G2.setPaint(new Color(0.9647058824f, 0.9647058824f, 0.9647058824f, 1f));
                    G2.fill(FRAME_GLOSSY_3);

                    final GeneralPath FRAME_GLOSSY4 = new GeneralPath();
                    FRAME_GLOSSY4.setWindingRule(Path2D.WIND_EVEN_ODD);
                    FRAME_GLOSSY4.moveTo(0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT);
                    FRAME_GLOSSY4.curveTo(0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT);
                    FRAME_GLOSSY4.curveTo(0.3878504672897196 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT, 0.07476635514018691 * IMAGE_WIDTH, 0.4158878504672897 * IMAGE_HEIGHT, 0.07476635514018691 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT);
                    FRAME_GLOSSY4.curveTo(0.07476635514018691 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT);
                    FRAME_GLOSSY4.closePath();
                    final Area FRAME_GLOSSY_4 = new Area(FRAME_GLOSSY4);
                    FRAME_GLOSSY_4.subtract(SUBTRACT);
                    G2.setPaint(new Color(0.2f, 0.2f, 0.2f, 1f));
                    G2.fill(FRAME_GLOSSY_4);
                    break;

                case BRASS:
                    float[] frameMainFractions5 = {
                        0.0f,
                        0.05f,
                        0.10f,
                        0.50f,
                        0.90f,
                        0.95f,
                        1.0f
                    };

                    Color[] frameMainColors5 = {
                        new Color(249, 243, 155, 255),
                        new Color(246, 226, 101, 255),
                        new Color(240, 225, 132, 255),
                        new Color(90, 57, 22, 255),
                        new Color(249, 237, 139, 255),
                        new Color(243, 226, 108, 255),
                        new Color(202, 182, 113, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient5 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions5, frameMainColors5);
                    G2.setPaint(frameMainGradient5);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case STEEL:
                    float[] frameMainFractions6 = {
                        0.0f,
                        0.05f,
                        0.10f,
                        0.50f,
                        0.90f,
                        0.95f,
                        1.0f
                    };

                    Color[] frameMainColors6 = {
                        new Color(231, 237, 237, 255),
                        new Color(189, 199, 198, 255),
                        new Color(192, 201, 200, 255),
                        new Color(23, 31, 33, 255),
                        new Color(196, 205, 204, 255),
                        new Color(194, 204, 203, 255),
                        new Color(189, 201, 199, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient6 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions6, frameMainColors6);
                    G2.setPaint(frameMainGradient6);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case CHROME:
                    float[] frameMainFractions7 = {
                        0.0f,
                        0.09f,
                        0.12f,
                        0.16f,
                        0.25f,
                        0.29f,
                        0.33f,
                        0.38f,
                        0.48f,
                        0.52f,
                        0.63f,
                        0.68f,
                        0.8f,
                        0.83f,
                        0.87f,
                        0.97f,
                        1.0f
                    };

                    Color[] frameMainColors7 = {
                        new Color(255, 255, 255, 255),
                        new Color(255, 255, 255, 255),
                        new Color(136, 136, 138, 255),
                        new Color(164, 185, 190, 255),
                        new Color(158, 179, 182, 255),
                        new Color(112, 112, 112, 255),
                        new Color(221, 227, 227, 255),
                        new Color(155, 176, 179, 255),
                        new Color(156, 176, 177, 255),
                        new Color(254, 255, 255, 255),
                        new Color(255, 255, 255, 255),
                        new Color(156, 180, 180, 255),
                        new Color(198, 209, 211, 255),
                        new Color(246, 248, 247, 255),
                        new Color(204, 216, 216, 255),
                        new Color(164, 188, 190, 255),
                        new Color(255, 255, 255, 255)
                    };

                    Paint frameMainGradient7 = new eu.hansolo.steelseries.tools.ConicalGradientPaint(false, FRAME_MAIN_CENTER, 0, frameMainFractions7, frameMainColors7);
                    G2.setPaint(frameMainGradient7);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case GOLD:
                    float[] frameMainFractions8 = {
                        0.0f,
                        0.15f,
                        0.22f,
                        0.3f,
                        0.38f,
                        0.44f,
                        0.51f,
                        0.6f,
                        0.68f,
                        0.75f,
                        1.0f
                    };

                    Color[] frameMainColors8 = {
                        new Color(255, 255, 207, 255),
                        new Color(255, 237, 96, 255),
                        new Color(254, 199, 57, 255),
                        new Color(255, 249, 203, 255),
                        new Color(255, 199, 64, 255),
                        new Color(252, 194, 60, 255),
                        new Color(255, 204, 59, 255),
                        new Color(213, 134, 29, 255),
                        new Color(255, 201, 56, 255),
                        new Color(212, 135, 29, 255),
                        new Color(247, 238, 101, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient8 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions8, frameMainColors8);
                    G2.setPaint(frameMainGradient8);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case ANTHRACITE:
                    float[] frameMainFractions9 = {
                        0.0f,
                        0.06f,
                        0.12f,
                        1.0f
                    };
                    Color[] frameMainColors9 = {
                        new Color(118, 117, 135, 255),
                        new Color(74, 74, 82, 255),
                        new Color(50, 50, 54, 255),
                        new Color(97, 97, 108, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient9 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions9, frameMainColors9);
                    G2.setPaint(frameMainGradient9);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case TILTED_GRAY:
                    FRAME_MAIN_START.setLocation((0.2336448598130841 * IMAGE_WIDTH), (0.08411214953271028 * IMAGE_HEIGHT));
                    FRAME_MAIN_STOP.setLocation(((0.2336448598130841 + 0.5789369637935792) * IMAGE_WIDTH), ((0.08411214953271028 + 0.8268076708711319) * IMAGE_HEIGHT));
                    float[] frameMainFractions10 = {
                        0.0f,
                        0.07f,
                        0.16f,
                        0.33f,
                        0.55f,
                        0.79f,
                        1.0f
                    };
                    Color[] frameMainColors10 = {
                        new Color(255, 255, 255, 255),
                        new Color(210, 210, 210, 255),
                        new Color(179, 179, 179, 255),
                        new Color(255, 255, 255, 255),
                        new Color(197, 197, 197, 255),
                        new Color(255, 255, 255, 255),
                        new Color(102, 102, 102, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient10 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions10, frameMainColors10);
                    G2.setPaint(frameMainGradient10);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                case TILTED_BLACK:
                    FRAME_MAIN_START.setLocation((0.22897196261682243 * IMAGE_WIDTH), (0.0794392523364486 * IMAGE_HEIGHT));
                    FRAME_MAIN_STOP.setLocation(((0.22897196261682243 + 0.573576436351046) * IMAGE_WIDTH), ((0.0794392523364486 + 0.8191520442889918) * IMAGE_HEIGHT));
                    float[] frameMainFractions11 = {
                        0.0f,
                        0.21f,
                        0.47f,
                        0.99f,
                        1.0f
                    };
                    Color[] frameMainColors11 = {
                        new Color(102, 102, 102, 255),
                        new Color(0, 0, 0, 255),
                        new Color(102, 102, 102, 255),
                        new Color(0, 0, 0, 255),
                        new Color(0, 0, 0, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient11 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions11, frameMainColors11);
                    G2.setPaint(frameMainGradient11);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;

                default:
                    float[] frameMainFractions = {
                        0.0f,
                        0.07f,
                        0.12f,
                        1.0f
                    };

                    Color[] frameMainColors = {
                        new Color(254, 254, 254, 255),
                        new Color(210, 210, 210, 255),
                        new Color(179, 179, 179, 255),
                        new Color(213, 213, 213, 255)
                    };
                    Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP);
                    Paint frameMainGradient = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions, frameMainColors);
                    G2.setPaint(frameMainGradient);
                    FRAME_MAIN_AREA.subtract(SUBTRACT);
                    G2.fill(FRAME_MAIN_AREA);
                    break;
            }
        }

        // Apply frame effects
        final float[] EFFECT_FRACTIONS;
        final Color[] EFFECT_COLORS;
        final GradientWrapper EFFECT_GRADIENT;
        float scale = 1.0f;
        final Shape[] EFFECT = new Shape[100];
        switch (getFrameEffect()) {
            case EFFECT_BULGE:
                EFFECT_FRACTIONS = new float[]{
                    0.0f,
                    0.13f,
                    0.14f,
                    0.17f,
                    0.18f,
                    1.0f
                };
                EFFECT_COLORS = new Color[]{
                    new Color(0, 0, 0, 102),            // Outside
                    new Color(255, 255, 255, 151),
                    new Color(219, 219, 219, 153),
                    new Color(0, 0, 0, 95),
                    new Color(0, 0, 0, 76),       // Inside
                    new Color(0, 0, 0, 0)
                };
                EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS);
                for (int i = 0; i < 100; i++) {
                    EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale);
                    scale -= 0.01f;
                }
                G2.setStroke(new BasicStroke(1.5f));
                for (int i = 0; i < EFFECT.length; i++) {
                    G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f));
                    G2.draw(EFFECT[i]);
                }
                break;

            case EFFECT_CONE:
                EFFECT_FRACTIONS = new float[]{
                    0.0f,
                    0.0399f,
                    0.04f,
                    0.1799f,
                    0.18f,
                    1.0f
                };
                EFFECT_COLORS = new Color[]{
                    new Color(0, 0, 0, 76),
                    new Color(223, 223, 223, 127),
                    new Color(255, 255, 255, 124),
                    new Color(9, 9, 9, 51),
                    new Color(0, 0, 0, 50),
                    new Color(0, 0, 0, 0)
                };
                EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS);
                for (int i = 0; i < 100; i++) {
                    EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale);
                    scale -= 0.01f;
                }
                G2.setStroke(new BasicStroke(1.5f));
                for (int i = 0; i < EFFECT.length; i++) {
                    G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f));
                    G2.draw(EFFECT[i]);
                }
                break;

            case EFFECT_TORUS:
                EFFECT_FRACTIONS = new float[]{
                    0.0f,
                    0.08f,
                    0.1799f,
                    0.18f,
                    1.0f
                };
                EFFECT_COLORS = new Color[]{
                    new Color(0, 0, 0, 76),
                    new Color(255, 255, 255, 64),
                    new Color(13, 13, 13, 51),
                    new Color(0, 0, 0, 50),
                    new Color(0, 0, 0, 0)
                };
                EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS);
                for (int i = 0; i < 100; i++) {
                    EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale);
                    scale -= 0.01f;
                }
                G2.setStroke(new BasicStroke(1.5f));
                for (int i = 0; i < EFFECT.length; i++) {
                    G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f));
                    G2.draw(EFFECT[i]);
                }
                break;

            case EFFECT_INNER_FRAME:
                final java.awt.Shape EFFECT_BIGINNERFRAME = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, 0.8785046339035034);
                final Point2D EFFECT_BIGINNERFRAME_START = new Point2D.Double(0, EFFECT_BIGINNERFRAME.getBounds2D().getMinY());
                final Point2D EFFECT_BIGINNERFRAME_STOP = new Point2D.Double(0, EFFECT_BIGINNERFRAME.getBounds2D().getMaxY());
                EFFECT_FRACTIONS = new float[]{
                    0.0f,
                    0.3f,
                    0.5f,
                    0.71f,
                    1.0f
                };
                EFFECT_COLORS = new Color[]{
                    new Color(0, 0, 0, 183),
                    new Color(148, 148, 148, 25),
                    new Color(0, 0, 0, 159),
                    new Color(0, 0, 0, 81),
                    new Color(255, 255, 255, 158)
                };
                Util.INSTANCE.validateGradientPoints(EFFECT_BIGINNERFRAME_START, EFFECT_BIGINNERFRAME_STOP);
                final LinearGradientPaint EFFECT_BIGINNERFRAME_GRADIENT = new LinearGradientPaint(EFFECT_BIGINNERFRAME_START, EFFECT_BIGINNERFRAME_STOP, EFFECT_FRACTIONS, EFFECT_COLORS);
                G2.setPaint(EFFECT_BIGINNERFRAME_GRADIENT);
                G2.fill(EFFECT_BIGINNERFRAME);
                break;
        }

        final GeneralPath GAUGE_BACKGROUND_MAIN = new GeneralPath();
        GAUGE_BACKGROUND_MAIN.setWindingRule(Path2D.WIND_EVEN_ODD);
        GAUGE_BACKGROUND_MAIN.moveTo(IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514);
        GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.0794392523364486, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.0794392523364486);
        GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.6822429906542056, IMAGE_HEIGHT * 0.0794392523364486, IMAGE_WIDTH * 0.48130841121495327, IMAGE_HEIGHT * 0.13551401869158877, IMAGE_WIDTH * 0.3037383177570093, IMAGE_HEIGHT * 0.308411214953271);
        GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.6822429906542056, IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.9205607476635514);
        GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514);
        GAUGE_BACKGROUND_MAIN.closePath();
        G2.setColor(Color.WHITE);
        final java.awt.geom.Area GAUGE_BACKGROUND_MAIN_AREA = new java.awt.geom.Area(GAUGE_BACKGROUND_MAIN);
        GAUGE_BACKGROUND_MAIN_AREA.subtract(SUBTRACT);
        G2.fill(GAUGE_BACKGROUND_MAIN_AREA);

        G2.dispose();

        return image;
    }
277392
@Nullable
  public static BufferedImage resize(@Nullable final BufferedImage image) {
    if (null == image) return image;
    final int width = Math.min(image.getWidth(), 800);
    if (width == image.getWidth()) return image;
    final int height = image.getHeight() * width / image.getWidth();
    @javax.annotation.Nonnull final BufferedImage rerender = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    final Graphics gfx = rerender.getGraphics();
    @javax.annotation.Nonnull final RenderingHints hints = new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    ((Graphics2D) gfx).setRenderingHints(hints);
    gfx.drawImage(image, 0, 0, rerender.getWidth(), rerender.getHeight(), null);
    return rerender;
  }
293936
function ()
    {
      // Initial images and z-index
      this.images = this.currentImage = {};
      this.imageZIndex = 1;

      this.initImage = function (item) {
        item = jQuery(item);

        // Abort if the item was added to a gallery already
        if (item.data('jBox-image-gallery')) return;

        // Get the image src
        var src = item.attr(this.options.src);

        // Update responsive image src
        if (this.options.mobileImageAttr && this.options.mobileImageBreakpoint && item.attr(this.options.mobileImageAttr)) {
          if (jQuery(window).width() <= this.options.mobileImageBreakpoint) {
            src = item.attr(this.options.mobileImageAttr);
          }
        }

        // Add item to a gallery
        var gallery = item.attr(this.options.gallery) || 'default';
        !this.images[gallery] && (this.images[gallery] = []);
        this.images[gallery].push({
          src: src,
          label: (item.attr(this.options.imageLabel) || ''),
          downloadUrl: this.options.downloadButtonUrl && item.attr(this.options.downloadButtonUrl) ? item.attr(this.options.downloadButtonUrl) : null
        });

        // Remove the title attribute so it won't show the browsers tooltip
        this.options.imageLabel == 'title' && item.removeAttr('title');

        // Store data in source element for easy access
        item.data('jBox-image-gallery', gallery);
        item.data('jBox-image-id', (this.images[gallery].length - 1));
      }.bind(this);

      // Loop through images, sort and save in global variable
      this.attachedElements && this.attachedElements.length && jQuery.each(this.attachedElements, function (index, item) {
        this.initImage(item);
      }.bind(this));

      // Helper to inject the image into content area
      var appendImage = function (gallery, id, show, instant) {
        // Abort if image was appended already
        if (jQuery('#jBox-image-' + gallery + '-' + id).length) {
          return;
        }

        // Create image container
        var image = jQuery('<div/>', {
          id: 'jBox-image-' + gallery + '-' + id,
          'class': 'jBox-image-container' + (show ? ' jBox-image-' + gallery + '-current' : '')
        }).css({
          backgroundSize: this.options.imageSize,
          opacity: (instant ? 1 : 0),
          zIndex: (show ? this.imageZIndex++ : 0)
        }).appendTo(this.content);

        // Create labels
        jQuery('<div/>', {
          id: 'jBox-image-label-' + gallery + '-' + id,
          'class': 'jBox-image-label' + (show ? ' active' : '')
        }).html(this.images[gallery][id].label).click(function () { jQuery(this).toggleClass('expanded'); }).appendTo(this.imageLabel);

        // Show image
        show && image.animate({opacity: 1}, instant ? 0 : this.options.imageFade);

        return image;
      }.bind(this);

      // Function to download an image
      this.downloadImage = function (imageUrl) {
        var link = document.createElement('a');
        link.href = imageUrl;
        link.setAttribute('download', imageUrl.substring(imageUrl.lastIndexOf('/')+1));
        document.body.appendChild(link);
        link.click();
      };

      // Helper to show new image label
      var showLabel = function (gallery, id) {
        jQuery('.jBox-image-label.active').removeClass('active expanded');
        jQuery('#jBox-image-label-' + gallery + '-' + id).addClass('active');
      };

      // Helper to load image
      var loadImage = function (gallery, id, show, instant) {
        var imageContainer = appendImage(gallery, id, show, instant);
        imageContainer.addClass('jBox-image-loading');

        jQuery('<img src="' + this.images[gallery][id].src + '" />').each(function () {
          var tmpImg = new Image();
          tmpImg.onload = function () {
            imageContainer.removeClass('jBox-image-loading');
            imageContainer.css({backgroundImage: 'url("' + this.images[gallery][id].src + '")'});
          }.bind(this);

          tmpImg.onerror = function () {
            imageContainer.removeClass('jBox-image-loading');
            imageContainer.addClass('jBox-image-not-found');
          }.bind(this);

          tmpImg.src = this.images[gallery][id].src;
        }.bind(this));
      }.bind(this);

      // Show images when they are loaded or load them if not
      this.showImage = function (img) {
        // Get the gallery and the image id from the next or the previous image
        if (img != 'open') {
          var gallery = this.currentImage.gallery;
          var id = this.currentImage.id + (1 * (img == 'prev') ? -1 : 1);
          id = id > (this.images[gallery].length - 1) ? 0 : (id < 0 ? (this.images[gallery].length - 1) : id);

        // Or get image data from source element
        } else {
          // Get gallery and image id from source element
          if (this.source) {
            var gallery = this.source.data('jBox-image-gallery');
            var id = this.source.data('jBox-image-id');

          // Get gallery and image id attached elements
          } else if (this.attachedElements && this.attachedElements.length) {
            var gallery = jQuery(this.attachedElements[0]).data('jBox-image-gallery');
            var id = jQuery(this.attachedElements[0]).data('jBox-image-id');
          } else {
            return;
          }

          // Remove or show the next and prev buttons
          jQuery('.jBox-image-pointer-prev, .jBox-image-pointer-next').css({display: (this.images[gallery].length > 1 ? 'block' : 'none')});
        }

        // If there is a current image already shown, hide it
        if (jQuery('.jBox-image-' + gallery + '-current').length) {
          jQuery('.jBox-image-' + gallery + '-current').removeClass('jBox-image-' + gallery + '-current').animate({opacity: 0}, (img == 'open') ? 0 : this.options.imageFade);
        }

        // Set new current image
        this.currentImage = {gallery: gallery, id: id};

        // Show image if it already exists
        if (jQuery('#jBox-image-' + gallery + '-' + id).length) {
          jQuery('#jBox-image-' + gallery + '-' + id).addClass('jBox-image-' + gallery + '-current').css({zIndex: this.imageZIndex++, opacity: 0}).animate({opacity: 1}, (img == 'open') ? 0 : this.options.imageFade);

        // Load image
        } else {
          loadImage(gallery, id, true, (img === 'open'));
        }

        // Show label
        showLabel(gallery, id);

        // Update the image counter numbers
        if (this.imageCounter) {
          if (this.images[gallery].length > 1) {
            this.wrapper.addClass('jBox-image-has-counter');
            this.imageCounter.find('.jBox-image-counter-all').html(this.images[gallery].length);
            this.imageCounter.find('.jBox-image-counter-current').html(id + 1);
          } else {
            this.wrapper.removeClass('jBox-image-has-counter');
          }
        }

        // Preload next image
        if (this.images[gallery].length - 1) {
	        var next_id = id + 1;
	        next_id = next_id > (this.images[gallery].length - 1) ? 0 : (next_id < 0 ? (this.images[gallery].length - 1) : next_id);

	        if (!jQuery('#jBox-image-' + gallery + '-' + next_id).length) {
            loadImage(gallery, next_id, false, false);
          }
	      }
      };

      // Preload image
      if (this.options.preloadFirstImage) {
        jQuery(window).on('load', function() {
          this.showImage('open');
        }.bind(this));
      }
    }
1163317
public static void reshapeDown(ImageBase image, int inputWidth, int inputHeight, int squareWidth) {
		int w = downSampleSize(inputWidth,squareWidth);
		int h = downSampleSize(inputHeight,squareWidth);

		image.reshape(w,h);
	}
732414
public void renderIconImage(ImageTag.State state, TreeElement elem)
    {
        ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_ICON];

        assert(al != null);
        if (al.size() == 0)
            return;

        int cnt = al.size();
        for (int i = 0; i < cnt; i++) {
            TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i);
            state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue());
        }
    }
1295533
@Override
    public ImageSource apply(ImageSource input) {
        int w = input.getWidth();
        int h = input.getHeight();

        MatrixSource output = new MatrixSource(w, h);

        Vector3 s = new Vector3(1, 0, 0);
        Vector3 t = new Vector3(0, 1, 0);

        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {

                if (x < border || x == w - border || y < border || y == h - border) {
                    output.setRGB(x, y, VectorHelper.Z_NORMAL);
                    continue;
                }

                float dh = input.getR(x + 1, y) - input.getR(x - 1, y);
                float dv = input.getR(x, y + 1) - input.getR(x, y - 1);

                s.set(scale, 0, dh);
                t.set(0, scale, dv);

                Vector3 cross = s.crs(t).nor();
                int rgb = VectorHelper.vectorToColor(cross);
                output.setRGB(x, y, rgb);
            }
        }

        return new MatrixSource(output);
    }
880941
public void setImage(final Image image) {
		LinkModel model = getOrCreateComponentModel();
		model.image = image;
		model.imageUrl = null;
	}
363478
function() {
		this.width = 256;
		this.height = 224;
		this.data = new Uint8Array( this.width * this.height * 4 );

		for ( var i = 0; i < this.data.length; i++  ) {
			this.data[ i ] = 0xff;
		}

		this.context = getContext( this.el );
		this.image = this.context.getImageData( 0, 0, this.width, this.height );

		this.index = 0;
	}
18278
function(e){
    var property = e.property;
    var ruleIds = this.get('ruleIds');
    var imageIndex = property.indexOf('background');

    if (imageIndex == -1) imageIndex = property.indexOf('background-image');

    ruleIds.push(e.id);
    if (imageIndex > -1) {
      this._collectImages(e, imageIndex);
    }
  }
431743
function (url, onImageReady, applyAutocrop) {
            var _this = this;

            this.toggleLoadingImage(true);
            this.clear();
            this._applyAutocrop = (applyAutocrop !== false);

            this._image = new IMSoftcrop.Image(
                IMSoftcrop.Ratio.hashFnv32a(url),
                this
            );

            this._image.load(
                url,
                function () {
                    _this.setZoomToImage(false);
                    _this.centerImage(false);
                    _this.updateImageInfo(false);

                    if (_this._autocrop) {
                        _this.detectDetails();
                        _this.detectFaces();
                    }
                    else {
                        _this.toggleLoadingImage(false);
                    }

                    _this.applySoftcrops();
                    _this.redraw();

                    if (typeof onImageReady === 'function') {
                        onImageReady.call(_this, _this._image);
                    }
                }
            );
        }