Initializes internal data structures based on the input image's size.  Should be called each time a new image
is processed.
@param width Image width
@param height Image height
197843
@Override
	public void initialize(int width, int height) {
		// see if it has already been initialized
		if( bottomWidth == width && bottomHeight == height )
			return;

		this.bottomWidth = width;
		this.bottomHeight = height;
		layers = imageType.createArray(getNumLayers());
		double scaleFactor = getScale(0);

		if (scaleFactor == 1) {
			if (!saveOriginalReference) {
				layers[0] = imageType.createImage(bottomWidth, bottomHeight);
			}
		} else {
			layers[0] = imageType.createImage((int)Math.ceil(bottomWidth / scaleFactor), (int)Math.ceil(bottomHeight / scaleFactor));
		}

		for (int i = 1; i < layers.length; i++) {
			scaleFactor = getScale(i);
			layers[i] = imageType.createImage((int)Math.ceil(bottomWidth / scaleFactor), (int)Math.ceil(bottomHeight / scaleFactor));
		}
	}
49375
public void initialize( T image , RectangleRotate_F32 initial ) {
		this.region.set(initial);
		calcHistogram.computeHistogram(image,initial);
		System.arraycopy(calcHistogram.getHistogram(),0,keyHistogram,0,keyHistogram.length);

		this.minimumWidth = initial.width*minimumSizeRatio;
	}
989192
@Override
    public final AbstractGauge init(final int WIDTH, final int HEIGHT) {
        final int GAUGE_WIDTH = isFrameVisible() ? WIDTH : getGaugeBounds().width;
        final int GAUGE_HEIGHT = isFrameVisible() ? HEIGHT : getGaugeBounds().height;

        if (GAUGE_WIDTH <= 1 || GAUGE_HEIGHT <= 1) {
            return this;
        }

        if (!isFrameVisible()) {
            setFramelessOffset(-getGaugeBounds().width * 0.0841121495, -getGaugeBounds().width * 0.0841121495);
        } else {
            setFramelessOffset(getGaugeBounds().x, getGaugeBounds().y);
        }

        // Create Background Image
        if (bImage != null) {
            bImage.flush();
        }
        bImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);

        // Create Foreground Image
        if (fImage != null) {
            fImage.flush();
        }
        fImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);

        if (isFrameVisible()) {
            create_FRAME_Image(GAUGE_WIDTH, bImage);
        }

        if (isBackgroundVisible()) {
            create_BACKGROUND_Image(GAUGE_WIDTH, bImage);
        }

        if (isGlowVisible()) {
            if (glowImageOff != null) {
                glowImageOff.flush();
            }
            glowImageOff = create_GLOW_Image(GAUGE_WIDTH, getGlowColor(), false);
            if (glowImageOn != null) {
                glowImageOn.flush();
            }
            glowImageOn = create_GLOW_Image(GAUGE_WIDTH, getGlowColor(), true);
        } else {
            setGlowPulsating(false);
        }

        final double TRACK_ORIENTATION_OFFSET;
        switch (getOrientation()) {
            case NORTH_EAST:
                TRACK_ORIENTATION_OFFSET = Math.PI / 2;
                TRACK_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), 0);
                break;
            case SOUTH_EAST:
                TRACK_ORIENTATION_OFFSET = Math.PI;
                TRACK_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), -(GAUGE_WIDTH / 1.55));
                break;
            case SOUTH_WEST:
                TRACK_ORIENTATION_OFFSET = 1.5 * Math.PI;
                TRACK_OFFSET.setLocation(0, -(GAUGE_WIDTH / 1.55));
                break;
            case NORTH_WEST:

            default:
                TRACK_ORIENTATION_OFFSET = 0;
                TRACK_OFFSET.setLocation(0, 0);
                break;
        }

        if (isTrackVisible()) {
            create_TRACK_Image(GAUGE_WIDTH, getModel().getFreeAreaAngle(), TICKMARK_ROTATION_OFFSET + TRACK_ORIENTATION_OFFSET, getMinValue(), getMaxValue(), getAngleStep(), getTrackStart(), getTrackSection(), getTrackStop(), getTrackStartColor(), getTrackSectionColor(), getTrackStopColor(), 0.68f, new Point2D.Double(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037), getTickmarkDirection(), TRACK_OFFSET, bImage);
        }

        if (!getAreas().isEmpty()){
            createAreas(bImage);
        }

        if (!getSections().isEmpty()) {
            createSections(bImage);
        }

        //final double TICKMARKS_ORIENTATION_OFFSET;
        switch (getOrientation()) {
            case NORTH_EAST:
                //TICKMARKS_ORIENTATION_OFFSET = Math.PI / 2;
                TICKMARKS_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), 0);
                //tickLabelRotationOffset = 0;
                break;
            case SOUTH_EAST:
                //TICKMARKS_ORIENTATION_OFFSET = Math.PI;
                TICKMARKS_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), -(GAUGE_WIDTH / 1.55));
                //tickLabelRotationOffset = Math.PI;
                break;
            case SOUTH_WEST:
                //TICKMARKS_ORIENTATION_OFFSET = 1.5 * Math.PI;
                TICKMARKS_OFFSET.setLocation(0, -(GAUGE_WIDTH / 1.55));
                //tickLabelRotationOffset = Math.PI;
                break;
            case NORTH_WEST:

            default:
                //TICKMARKS_ORIENTATION_OFFSET = 0;
                TICKMARKS_OFFSET.setLocation(0, 0);
                //tickLabelRotationOffset = 0;
                break;
        }

        TICKMARK_FACTORY.create_RADIAL_TICKMARKS_Image(GAUGE_WIDTH,
                                                       getModel().getNiceMinValue(),
                                                       getModel().getNiceMaxValue(),
                                                       getModel().getMaxNoOfMinorTicks(),
                                                       getModel().getMaxNoOfMajorTicks(),
                                                       getModel().getMinorTickSpacing(),
                                                       getModel().getMajorTickSpacing(),
                                                       getGaugeType(),
                                                       getCustomGaugeType(),
                                                       getMinorTickmarkType(),
                                                       getMajorTickmarkType(),
                                                       isTickmarksVisible(),
                                                       isTicklabelsVisible(),
                                                       getModel().isMinorTickmarksVisible(),
                                                       getModel().isMajorTickmarksVisible(),
                                                       getLabelNumberFormat(),
                                                       isTickmarkSectionsVisible(),
                                                       getBackgroundColor(),
                                                       getTickmarkColor(),
                                                       isTickmarkColorFromThemeEnabled(),
                                                       getTickmarkSections(),
                                                       isSectionTickmarksOnly(),
                                                       getSections(),
                                                       0.68f,
                                                       0.09f,
                                                       new Point2D.Double(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037),
                                                       new Point2D.Double(0, 0),
                                                       Orientation.NORTH_WEST,
                                                       getModel().getTicklabelOrientation(),
                                                       getModel().isNiceScale(),
                                                       getModel().isLogScale(),
                                                       bImage);

        if (pointerImage != null) {
            pointerImage.flush();
        }
        pointerImage = create_POINTER_Image(GAUGE_WIDTH, getPointerType());

        if (pointerShadowImage != null) {
            pointerShadowImage.flush();
        }
        if (getModel().isPointerShadowVisible()) {
            pointerShadowImage = create_POINTER_SHADOW_Image(GAUGE_WIDTH, getPointerType());
        } else {
            pointerShadowImage = null;
        }

        create_POSTS_Image(GAUGE_WIDTH, fImage);

        if (isForegroundVisible()) {
            create_FOREGROUND_Image(GAUGE_WIDTH, fImage);
        }

        final double THRESHOLD_ORIENTATION_OFFSET;
        switch (getOrientation()) {
            case NORTH_EAST:
                THRESHOLD_ORIENTATION_OFFSET = Math.PI / 2;
                THRESHOLD_OFFSET.setLocation(bImage.getWidth() * 0.775, bImage.getHeight() * 0.81);
                if (!isLogScale()) {
                    thresholdRotationOffset = ROTATION_OFFSET + (getMaxValue() - getThreshold() - getMinValue()) * getAngleStep();
                } else {
                    thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getMaxValue() - getThreshold() - getMinValue()) * getLogAngleStep();
                }
                break;
            case SOUTH_EAST:
                THRESHOLD_ORIENTATION_OFFSET = Math.PI / 2;
                THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.79), (bImage.getHeight() * 0.16));
                if (!isLogScale()) {
                    thresholdRotationOffset = Math.PI / 2 + ROTATION_OFFSET + (getMaxValue() - getThreshold() - getMinValue()) * getAngleStep();
                } else {
                    thresholdRotationOffset = Math.PI / 2 + ROTATION_OFFSET + UTIL.logOfBase(BASE, getMaxValue() - getThreshold() - getMinValue()) * getLogAngleStep();
                }
                break;
            case SOUTH_WEST:
                THRESHOLD_ORIENTATION_OFFSET = -Math.PI / 2;
                THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.19), (bImage.getHeight() * 0.16));
                if (!isLogScale()) {
                    thresholdRotationOffset = ROTATION_OFFSET + (getThreshold() - getMinValue()) * getAngleStep();
                } else {
                    thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getThreshold() - getMinValue()) * getLogAngleStep();
                }
                break;
            case NORTH_WEST:

            default:
                THRESHOLD_ORIENTATION_OFFSET = 0;
                THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.805), (bImage.getHeight() * 0.19));
                if (!isLogScale()) {
                    thresholdRotationOffset = ROTATION_OFFSET + (getThreshold() - getMinValue()) * getAngleStep();
                } else {
                    thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getThreshold() - getMinValue()) * getLogAngleStep();
                }
                break;
        }

        if (thresholdImage != null) {
            thresholdImage.flush();
        }
        thresholdImage = create_THRESHOLD_Image(GAUGE_WIDTH, THRESHOLD_ORIENTATION_OFFSET);

        final double MIN_MEASURED_ORIENTATION_OFFSET;
        switch (getOrientation()) {
            case NORTH_EAST:
                MIN_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
                measuredRotationOffset = ROTATION_OFFSET;
                MEASURED_OFFSET.setLocation(bImage.getWidth() * 0.87, bImage.getHeight() * 0.815);
                break;
            case SOUTH_EAST:
                MIN_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
                MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.87), (bImage.getHeight() * 0.15));
                measuredRotationOffset = Math.PI / 2 + ROTATION_OFFSET;
                break;
            case SOUTH_WEST:
                MIN_MEASURED_ORIENTATION_OFFSET = -Math.PI / 2;
                MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.10), (bImage.getHeight() * 0.16));
                measuredRotationOffset = ROTATION_OFFSET;
                break;
            case NORTH_WEST:

            default:
                MIN_MEASURED_ORIENTATION_OFFSET = 0;
                MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.811), (bImage.getHeight() * 0.11));
                measuredRotationOffset = ROTATION_OFFSET;
                break;
        }
        if (minMeasuredImage != null) {
            minMeasuredImage.flush();
        }
        minMeasuredImage = create_MEASURED_VALUE_Image(GAUGE_WIDTH, new Color(0, 23, 252, 255), MIN_MEASURED_ORIENTATION_OFFSET);

        final double MAX_MEASURED_ORIENTATION_OFFSET;
        switch (getOrientation()) {
            case NORTH_EAST:
                MAX_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
                measuredRotationOffset = ROTATION_OFFSET;
                MEASURED_OFFSET.setLocation(bImage.getWidth() * 0.87, bImage.getHeight() * 0.815);
                break;
            case SOUTH_EAST:
                MAX_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
                MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.87), (bImage.getHeight() * 0.15));
                measuredRotationOffset = Math.PI / 2 + ROTATION_OFFSET;
                break;
            case SOUTH_WEST:
                MAX_MEASURED_ORIENTATION_OFFSET = -Math.PI / 2;
                MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.10), (bImage.getHeight() * 0.16));
                measuredRotationOffset = ROTATION_OFFSET;
                break;
            case NORTH_WEST:

            default:
                MAX_MEASURED_ORIENTATION_OFFSET = 0;
                MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.811), (bImage.getHeight() * 0.11));
                measuredRotationOffset = ROTATION_OFFSET;
                break;
        }
        if (maxMeasuredImage != null) {
            maxMeasuredImage.flush();
        }
        maxMeasuredImage = create_MEASURED_VALUE_Image(GAUGE_WIDTH, new Color(252, 29, 0, 255), MAX_MEASURED_ORIENTATION_OFFSET);

        if (disabledImage != null) {
            disabledImage.flush();
        }
        disabledImage = create_DISABLED_Image(GAUGE_WIDTH);

        // Adjust the rotation center of the pointer
        switch (getOrientation()) {
            case NORTH_EAST:
                ROTATION_CENTER.setLocation(GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037);
                titleOffsetYFactor = 0.6f;
                unitOffsetYFactor = 0.67f;
                break;
            case SOUTH_EAST:
                ROTATION_CENTER.setLocation(GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037);
                titleOffsetYFactor = 0.3f;
                unitOffsetYFactor = 0.37f;
                break;
            case SOUTH_WEST:
                ROTATION_CENTER.setLocation(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037);
                titleOffsetYFactor = 0.3f;
                unitOffsetYFactor = 0.37f;
                break;
            case NORTH_WEST:

            default:
                ROTATION_CENTER.setLocation(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037);
                titleOffsetYFactor = 0.6f;
                unitOffsetYFactor = 0.67f;
                break;
        }

        setCurrentLedImage(getLedImageOff());

        return this;
    }
872612
public void setCanvasWidthHeight(int width, int height) {
        hudWidth = width;
        hudHeight = height;
        HUD = Bitmap.createBitmap(width, height, Config.ARGB_8888);
        canvas = new Canvas(HUD);
        texture = null;
    }
316332
protected final void init() {
		if (inited) {
			return;
		}
		
		inited = true;
		if (texture != null) {
			width = texture.getImageWidth();
			height = texture.getImageHeight();
			textureOffsetX = 0;
			textureOffsetY = 0;
			textureWidth = texture.getWidth();
			textureHeight = texture.getHeight();
		}
		
		initImpl();
	
		centerX = width / 2;
		centerY = height / 2;
	}
588869
public void setSize(int width, int height) {
    rootElement.getStyle().setWidth(width, Unit.PX);
    rootElement.getStyle().setHeight(height, Unit.PX);
  }
204470
public void setSize(final int X, final int Y, final int WIDTH, final int HEIGHT) {
        bounds.setBounds(X, Y, WIDTH, HEIGHT);
        fireStateChanged();
    }
1192214
@Override
    public AbstractGauge init(final int WIDTH, final int HEIGHT) {
        if (WIDTH <= 1 || HEIGHT <= 1) {
            return this;
        }

        if (!isFrameVisible()) {
            setFramelessOffset(-getInnerBounds().width * 0.0841121495, -getInnerBounds().width * 0.0841121495);
        } else {
            setFramelessOffset(getInnerBounds().x, getInnerBounds().y);
        }

        // Create Background Image
        if (bImage != null) {
            bImage.flush();
        }
        bImage = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT);

        // Create Foreground Image
        if (fImage != null) {
            fImage.flush();
        }
        fImage = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT);

        if (isFrameVisible()) {
            switch (getFrameType()) {
                case SQUARE:
                    FRAME_FACTORY.createLinearFrame(WIDTH, WIDTH, getFrameDesign(), getCustomFrameDesign(), getFrameEffect(), bImage);
                    break;
                case ROUND:

                default:
                    FRAME_FACTORY.createRadialFrame(WIDTH, getFrameDesign(), getCustomFrameDesign(), getFrameEffect(), bImage);
                    break;
            }
        }

        if (isBackgroundVisible()) {
            switch (getFrameType()) {
                case SQUARE:
                    BACKGROUND_FACTORY.createLinearBackground(WIDTH, WIDTH, getBackgroundColor(), getCustomBackground(), getModel().getTextureColor(), bImage);
                    break;
                case ROUND:

                default:
                    BACKGROUND_FACTORY.createRadialBackground(WIDTH, getBackgroundColor(), getCustomBackground(), getModel().getTextureColor(), bImage);
                    break;
            }
        }

        create_TICKMARKS_Image(WIDTH, 60f, 0.075, 0.14, bImage);

        if (smallTickmarkImage != null) {
            smallTickmarkImage.flush();
        }
        smallTickmarkImage = create_TICKMARKS_Image((int) (0.285 * WIDTH), 30f, 0.095, 0.17, null);

        if (mainPointerImage != null) {
            mainPointerImage.flush();
        }
        mainPointerImage = create_MAIN_POINTER_Image(WIDTH);

        if (mainPointerShadowImage != null) {
            mainPointerShadowImage.flush();
        }
        mainPointerShadowImage = create_MAIN_POINTER_SHADOW_Image(WIDTH);

        if (smallPointerImage != null) {
            smallPointerImage.flush();
        }
        smallPointerImage = create_SMALL_POINTER_Image(WIDTH);

        if (smallPointerShadowImage != null) {
            smallPointerShadowImage.flush();
        }
        smallPointerShadowImage = create_SMALL_POINTER_SHADOW_Image(WIDTH);

        if (isForegroundVisible()) {
            switch (getFrameType()) {
                case SQUARE:
                    FOREGROUND_FACTORY.createLinearForeground(WIDTH, WIDTH, false, bImage);
                    break;

                case ROUND:

                default:
                    FOREGROUND_FACTORY.createRadialForeground(WIDTH, false, getForegroundType(), fImage);
                    break;
            }
        }

        if (disabledImage != null) {
            disabledImage.flush();
        }
        disabledImage = DISABLED_FACTORY.createRadialDisabled(WIDTH);

        return this;
    }
60246
function(width, height) {
            this.width = width;
            this.height = height;
            for (var i = 0; i < this.width; i++) {
                if(!this.data){
                    this.data = [];
                }

                if(this.data[i] === void 0){
                    this.data[i] = [];
                }
            }
        }
1162951
function(width, height) {
    if (width === this._width && height === this._height) {
      return;
    }
    this._resize = true;
    this._width = width;
    this._height = height;
  }
1164500
public void setImageSize(Point size) {
		Assert.isNotNull(size);
		Assert.isTrue(size.x >= 0 && size.y >= 0);
		fSize = size;
	}
1245711
function( width, height ) {
		if( arguments.length === 2 ) {
			this.width = width;
			this.height = height;
		} else {
			this.width = this.container.width();
			this.height = this.container.height();
		}

		if( this.isInitialised === true ) {
			this.root.callDownwards( 'setSize' );
		}
	}
726154
public void set(double x, double y, double width, double height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }
1205286
public void setDimension(int width, int height) {
        setWidth(String.valueOf(width));
        setHeight(String.valueOf(height));
        reload();
    }
494671
public final void init(final int WIDTH, final int HEIGHT) {
        if (WIDTH <= 1 || HEIGHT <= 1) {
            return;
        }

        if (bgImage != null) {
            bgImage.flush();
        }

        if (lcdImage != null) {
            lcdImage.flush();
        }

        if (glowImageOn != null) {
            glowImageOn.flush();
        }
        glowImageOn = GlowImageFactory.INSTANCE.createLcdGlow(WIDTH, HEIGHT, glowColor, true);

        lcdImage = create_LCD_Image(WIDTH, HEIGHT, null);
        final double CORNER_RADIUS = WIDTH > HEIGHT ? (HEIGHT * 0.095) : (WIDTH * 0.095);
        disabledShape = new RoundRectangle2D.Double(0, 0, WIDTH, HEIGHT, CORNER_RADIUS, CORNER_RADIUS);
        if (isDigitalFont()) {
            lcdValueFont = LCD_DIGITAL_FONT.deriveFont(0.7f * getInnerBounds().height).deriveFont(Font.PLAIN);
            if (useCustomLcdUnitFont) {
                lcdUnitFont = customLcdUnitFont.deriveFont(0.2f * getInnerBounds().height);
            } else {
                lcdUnitFont = LCD_STANDARD_FONT.deriveFont(0.2f * getInnerBounds().height);
            }
        } else {
            lcdValueFont = LCD_STANDARD_FONT.deriveFont(0.625f * getInnerBounds().height);
            if (useCustomLcdUnitFont) {
                lcdUnitFont = customLcdUnitFont.deriveFont(0.2f * getInnerBounds().height);
            } else {
                lcdUnitFont = LCD_STANDARD_FONT.deriveFont(0.2f * getInnerBounds().height);
            }
        }
        lcdInfoFont = LCD_STANDARD_FONT.deriveFont(Font.BOLD, 0.18f * getInnerBounds().height);

        if (lcdThresholdImage != null) {
            lcdThresholdImage.flush();
        }
        lcdThresholdImage = create_LCD_THRESHOLD_Image((int) (HEIGHT * 0.2045454545), (int) (HEIGHT * 0.2045454545), lcdColor.TEXT_COLOR);

        if (!sections.isEmpty()) {
            sectionsBackground.clear();
            sectionsForeground.clear();

            final float[] HSB_START = (Color.RGBtoHSB(lcdColor.GRADIENT_START_COLOR.getRed(), lcdColor.GRADIENT_START_COLOR.getGreen(), lcdColor.GRADIENT_START_COLOR.getBlue(), null));
            final float[] HSB_FRACTION1 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION1_COLOR.getRed(), lcdColor.GRADIENT_FRACTION1_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION1_COLOR.getBlue(), null));
            final float[] HSB_FRACTION2 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION2_COLOR.getRed(), lcdColor.GRADIENT_FRACTION2_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION2_COLOR.getBlue(), null));
            final float[] HSB_FRACTION3 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION3_COLOR.getRed(), lcdColor.GRADIENT_FRACTION3_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION3_COLOR.getBlue(), null));
            final float[] HSB_STOP = (Color.RGBtoHSB(lcdColor.GRADIENT_STOP_COLOR.getRed(), lcdColor.GRADIENT_STOP_COLOR.getGreen(), lcdColor.GRADIENT_STOP_COLOR.getBlue(), null));

            // Hue values of the gradient colors
            final float HUE_START = HSB_START[0];
            final float HUE_FRACTION1 = HSB_FRACTION1[0];
            final float HUE_FRACTION2 = HSB_FRACTION2[0];
            final float HUE_FRACTION3 = HSB_FRACTION3[0];
            final float HUE_STOP = HSB_STOP[0];

            // Brightness values of the gradient colors
            final float BRIGHTNESS_START = HSB_START[2];
            final float BRIGHTNESS_FRACTION1 = HSB_FRACTION1[2];
            final float BRIGHTNESS_FRACTION2 = HSB_FRACTION2[2];
            final float BRIGHTNESS_FRACTION3 = HSB_FRACTION3[2];
            final float BRIGHTNESS_STOP = HSB_STOP[2];

            for (Section section : sections) {
                final Color[] BACKGROUND_COLORS;
                final Color FOREGROUND_COLOR;
                final float[] HSB_SECTION = Color.RGBtoHSB(section.getColor().getRed(), section.getColor().getGreen(), section.getColor().getBlue(), null);
                final float HUE_SECTION = HSB_SECTION[0];
                final float SATURATION_SECTION = HSB_SECTION[1];
                final float BRIGHTNESS_SECTION = HSB_SECTION[2];
                if (!UTIL.isMonochrome(section.getColor())) {
                    // Section color is not monochrome
                    if (lcdColor == LcdColor.SECTIONS_LCD) {
                        BACKGROUND_COLORS = new Color[]{
                            new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_START - 0.31f)),
                            new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION1 - 0.31f)),
                            new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION2 - 0.31f)),
                            new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION3 - 0.31f)),
                            new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_STOP - 0.31f))
                        };
                    } else {
                        final float HUE_DIFF = HUE_SECTION - HUE_FRACTION3;
                        BACKGROUND_COLORS = new Color[]{
                            UTIL.setHue(lcdColor.GRADIENT_START_COLOR, (HUE_START + HUE_DIFF) % 360),
                            UTIL.setHue(lcdColor.GRADIENT_FRACTION1_COLOR, (HUE_FRACTION1 + HUE_DIFF) % 360),
                            UTIL.setHue(lcdColor.GRADIENT_FRACTION2_COLOR, (HUE_FRACTION2 + HUE_DIFF) % 360),
                            UTIL.setHue(lcdColor.GRADIENT_FRACTION3_COLOR, (HUE_FRACTION3 + HUE_DIFF) % 360),
                            UTIL.setHue(lcdColor.GRADIENT_STOP_COLOR, (HUE_STOP + HUE_DIFF) % 360)
                        };
                    }
                    FOREGROUND_COLOR = UTIL.setSaturationBrightness(section.getColor(), 0.57f, 0.83f);
                } else {
                    // Section color is monochrome
                    final float BRIGHTNESS_DIFF = BRIGHTNESS_SECTION - BRIGHTNESS_FRACTION1;

                    BACKGROUND_COLORS = new Color[]{
                        UTIL.setSaturationBrightness(lcdColor.GRADIENT_START_COLOR, 0, BRIGHTNESS_START + BRIGHTNESS_DIFF),
                        UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION1_COLOR, 0, BRIGHTNESS_FRACTION1 + BRIGHTNESS_DIFF),
                        UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION2_COLOR, 0, BRIGHTNESS_FRACTION2 + BRIGHTNESS_DIFF),
                        UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION3_COLOR, 0, BRIGHTNESS_FRACTION3 + BRIGHTNESS_DIFF),
                        UTIL.setSaturationBrightness(lcdColor.GRADIENT_STOP_COLOR, 0, BRIGHTNESS_STOP + BRIGHTNESS_DIFF)
                    };
                    if (UTIL.isDark(section.getColor())) {
                        FOREGROUND_COLOR = Color.WHITE;
                    } else {
                        FOREGROUND_COLOR = Color.BLACK;
                    }
                }
                sectionsBackground.add(create_LCD_Image(WIDTH, HEIGHT, BACKGROUND_COLORS));
                sectionsForeground.add(FOREGROUND_COLOR);
            }
        }

        // Quality overlay related parameters
        overlayCornerRadius = WIDTH > HEIGHT ? (HEIGHT * 0.095) - 1 : (WIDTH * 0.095) - 1;
        overlayFactor = (float) (lcdValue / (lcdMaxValue - lcdMinValue));
        if (Double.compare(overlayFactor, 1.0) > 0) {
            factor = 1.0f;
        } else if (Double.compare(overlayFactor, 0) < 0) {
            factor = 0.0f;
        } else {
            factor = overlayFactor;
        }
        overlayColors = new Color[] {
            UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor), 0.5f),
            UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor).darker(), 0.5f),
            UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor), 0.5f)
        };
        final int INSET = (int) (qualityOverlay.getHeight() * 0.0909090909);
        overlayInsets.set(INSET, INSET, INSET, INSET);
        qualityOverlayLookup = new GradientWrapper(new Point2D.Double(overlayInsets.left, 0), new Point2D.Double(lcdImage.getMinX() + lcdImage.getWidth() - overlayInsets.right, 0), qualityOverlayFractions, qualityOverlayColors);
        qualityOverlayGradient = new LinearGradientPaint(new Point2D.Double(0, overlayInsets.top), new Point2D.Double(0, HEIGHT - overlayInsets.bottom), new float[]{0.0f, 0.5f, 1.0f}, overlayColors);
        qualityOverlay.setRoundRect(overlayInsets.left, overlayInsets.top, (INNER_BOUNDS.width * overlayFactor) - overlayInsets.left - overlayInsets.right, INNER_BOUNDS.height - overlayInsets.top - overlayInsets.bottom, overlayCornerRadius, overlayCornerRadius);

        // Prepare bargraph
        bargraphSegmentFactor = 20 / (lcdMaxValue - lcdMinValue);
        prepareBargraph(WIDTH, HEIGHT);
    }
1081259
@Override
    public final AbstractGauge init(int WIDTH, int HEIGHT) {
        final int GAUGE_WIDTH = isFrameVisible() ? WIDTH : getGaugeBounds().width;
        final int GAUGE_HEIGHT = isFrameVisible() ? HEIGHT : getGaugeBounds().height;
        if (GAUGE_WIDTH <= 1 || GAUGE_HEIGHT <= 1) {
            return this;
        }

        if (!isFrameVisible()) {
            setFramelessOffset(-getGaugeBounds().width * 0.0841121495, -getGaugeBounds().width * 0.0841121495);
        } else {
            setFramelessOffset(getGaugeBounds().x, getGaugeBounds().y);
        }

        // Create background image
        if (bImage != null) {
            bImage.flush();
        }
        bImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);

        // Create the symbol image
        if (symbolOnImage != null) {
            symbolOnImage.flush();
        }
        symbolOnImage = SYMBOL_FACTORY.createSymbol(GAUGE_WIDTH, symbolType, onColor, customOnColor, glow);

        // Create the symbol image
        if (symbolOffImage != null) {
            symbolOffImage.flush();
        }
        symbolOffImage = SYMBOL_FACTORY.createSymbol(GAUGE_WIDTH, symbolType, offColor, customOffColor, false);

        // Create foreground image
        if (fImage != null) {
            fImage.flush();
        }
        fImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);

        if (isFrameVisible()) {
            switch (getFrameType()) {
                case ROUND:
                    FRAME_FACTORY.createRadialFrame(GAUGE_WIDTH, getFrameDesign(), getCustomFrameDesign(), getFrameEffect(), bImage);
                    break;
                case SQUARE:
                    FRAME_FACTORY.createLinearFrame(GAUGE_WIDTH, GAUGE_WIDTH, getFrameDesign(), getCustomFrameDesign(), getFrameEffect(), bImage);
                    break;
                default:
                    FRAME_FACTORY.createRadialFrame(GAUGE_WIDTH, getFrameDesign(), getCustomFrameDesign(), getFrameEffect(), bImage);
                    break;
            }
        }

        if (isBackgroundVisible()) {
            create_BACKGROUND_Image(GAUGE_WIDTH, "", "", bImage);
        }

        //create_TITLE_Image(WIDTH, getTitle(), getUnitString(), bImage);

        if (isForegroundVisible()) {
            switch (getFrameType()) {
                case SQUARE:
                    FOREGROUND_FACTORY.createLinearForeground(GAUGE_WIDTH, GAUGE_WIDTH, false, bImage);
                    break;

                case ROUND:

                default:
                    FOREGROUND_FACTORY.createRadialForeground(GAUGE_WIDTH, false, getForegroundType(), fImage);
                    break;
            }
        }

        if (disabledImage != null) {
            disabledImage.flush();
        }
        disabledImage = create_DISABLED_Image(GAUGE_WIDTH);

        return this;
    }
677919
def _initializeDimensions(self, inputData):
    
    if len(inputData.shape) == 2:
      self.imageHeight, self.numImages = inputData.shape
      self.imageWidth, self.numChannels = None, None

    elif len(inputData.shape) == 3:
      self.imageHeight, \
      self.imageWidth, \
      self.numImages = inputData.shape
      self.numChannels = None

    elif len(inputData.shape) == 4:
      self.imageHeight, \
      self.imageWidth, \
      self.numChannels, \
      self.numImages = inputData.shape

    else:
      raise ValueError("The provided image set has more than 4 dimensions.")