package org.pushingpixels.radiance.demo.theming.main.check.svg.filetypes;

import java.awt.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.ref.WeakReference;
import java.util.Base64;
import java.util.Stack;
import javax.imageio.ImageIO;
import javax.swing.SwingUtilities;
import javax.swing.plaf.UIResource;

import org.pushingpixels.radiance.common.api.icon.RadianceIcon;
import org.pushingpixels.radiance.common.api.icon.RadianceIconUIResource;

/**
 * This class has been automatically generated using <a
 * href="https://github.com/kirill-grouchnikov/radiance">Radiance SVG transcoder</a>.
 */
public class ext_image implements RadianceIcon {
    private Shape shape = null;
    private GeneralPath generalPath = null;
    private Paint paint = null;
    private Stroke stroke = null;
    private Shape clip = null;
    private RadianceIcon.ColorFilter colorFilter = null;
    private Stack<AffineTransform> transformsStack = new Stack<>();

    

	private void _paint0(Graphics2D g,float origAlpha) {
// 
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
transformsStack.push(g.getTransform());
g.transform(new AffineTransform(0.009999999776482582f, 0.0f, 0.0f, 0.009999999776482582f, 0.13999999687075615f, -0.0f));
// _0
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_0
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(0.0f, 1.0f);
generalPath.lineTo(0.0f, 99.0f);
generalPath.lineTo(72.0f, 99.0f);
generalPath.lineTo(72.0f, 27.7f);
generalPath.lineTo(45.0f, 1.0f);
generalPath.lineTo(0.0f, 1.0f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-63.0, 145.11099243164062), new Point2D.Double(-63.0, 243.11099243164062), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(75, 160, 216, 255)) : new Color(75, 160, 216, 255)),((colorFilter != null) ? colorFilter.filter(new Color(254, 254, 254, 255)) : new Color(254, 254, 254, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_1
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(45.0f, 1.0f);
generalPath.lineTo(72.0f, 27.7f);
generalPath.lineTo(72.0f, 99.0f);
generalPath.lineTo(0.0f, 99.0f);
generalPath.lineTo(0.0f, 1.0f);
generalPath.lineTo(45.0f, 1.0f);
generalPath.closePath();
shape = generalPath;
paint = (colorFilter != null) ? colorFilter.filter(new Color(0, 0, 0, 0)) : new Color(0, 0, 0, 0);
g.setPaint(paint);
g.fill(shape);
paint = (colorFilter != null) ? colorFilter.filter(new Color(0, 153, 219, 255)) : new Color(0, 153, 219, 255);
stroke = new BasicStroke(2.0f,0,0,4.0f,null,0.0f);
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(45.0f, 1.0f);
generalPath.lineTo(72.0f, 27.7f);
generalPath.lineTo(72.0f, 99.0f);
generalPath.lineTo(0.0f, 99.0f);
generalPath.lineTo(0.0f, 1.0f);
generalPath.lineTo(45.0f, 1.0f);
generalPath.closePath();
shape = generalPath;
g.setPaint(paint);
g.setStroke(stroke);
g.draw(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_2
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(45.0f, 27.7f);
generalPath.lineTo(72.0f, 27.7f);
generalPath.lineTo(45.0f, 1.0f);
generalPath.lineTo(45.0f, 27.7f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-41.250999450683594, 228.9969940185547), new Point2D.Double(-47.00600051879883, 223.24200439453125), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 133, 201, 255)) : new Color(0, 133, 201, 255)),((colorFilter != null) ? colorFilter.filter(new Color(220, 233, 247, 255)) : new Color(220, 233, 247, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_3
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(45.0f, 1.0f);
generalPath.lineTo(72.0f, 27.7f);
generalPath.lineTo(45.0f, 27.7f);
generalPath.lineTo(45.0f, 1.0f);
generalPath.closePath();
shape = generalPath;
paint = (colorFilter != null) ? colorFilter.filter(new Color(0, 0, 0, 0)) : new Color(0, 0, 0, 0);
g.setPaint(paint);
g.fill(shape);
paint = (colorFilter != null) ? colorFilter.filter(new Color(0, 153, 219, 255)) : new Color(0, 153, 219, 255);
stroke = new BasicStroke(2.0f,0,2,4.0f,null,0.0f);
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(45.0f, 1.0f);
generalPath.lineTo(72.0f, 27.7f);
generalPath.lineTo(45.0f, 27.7f);
generalPath.lineTo(45.0f, 1.0f);
generalPath.closePath();
shape = generalPath;
g.setPaint(paint);
g.setStroke(stroke);
g.draw(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_4
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(9.0f, 36.6f);
generalPath.lineTo(36.0f, 36.6f);
generalPath.lineTo(36.0f, 9.9f);
generalPath.lineTo(9.0f, 9.9f);
generalPath.lineTo(9.0f, 36.6f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-76.5, 207.47500610351562), new Point2D.Double(-76.5, 234.20199584960938), new float[] {0.0f,0.005f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(230, 235, 246, 255)) : new Color(230, 235, 246, 255)),((colorFilter != null) ? colorFilter.filter(new Color(230, 235, 246, 255)) : new Color(230, 235, 246, 255)),((colorFilter != null) ? colorFilter.filter(new Color(0, 175, 238, 255)) : new Color(0, 175, 238, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_5
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(18.4f, 15.5f);
generalPath.curveTo(14.099999f, 13.2f, 12.0f, 17.2f, 12.0f, 17.2f);
generalPath.lineTo(16.4f, 17.5f);
generalPath.curveTo(11.4f, 19.0f, 12.7f, 23.9f, 12.7f, 23.9f);
generalPath.lineTo(17.1f, 19.9f);
generalPath.curveTo(16.1f, 22.1f, 18.300001f, 23.699999f, 18.300001f, 23.699999f);
generalPath.lineTo(19.6f, 18.3f);
generalPath.curveTo(19.6f, 18.3f, 24.3f, 23.599998f, 25.7f, 29.0f);
generalPath.curveTo(23.800001f, 29.9f, 21.0f, 31.5f, 18.7f, 31.8f);
generalPath.curveTo(15.6f, 32.2f, 11.900001f, 34.3f, 11.900001f, 34.3f);
generalPath.lineTo(11.900001f, 36.8f);
generalPath.lineTo(35.9f, 36.8f);
generalPath.lineTo(36.0f, 30.3f);
generalPath.lineTo(34.0f, 29.199999f);
generalPath.curveTo(32.0f, 28.999998f, 29.5f, 28.3f, 28.0f, 28.199999f);
generalPath.curveTo(26.2f, 25.3f, 23.2f, 20.699999f, 20.7f, 18.199999f);
generalPath.lineTo(27.6f, 18.599998f);
generalPath.curveTo(25.7f, 14.199999f, 21.0f, 15.799998f, 21.0f, 15.799998f);
generalPath.lineTo(24.2f, 13.099998f);
generalPath.curveTo(23.5f, 12.799998f, 22.900002f, 12.699999f, 22.300001f, 12.699999f);
generalPath.curveTo(19.6f, 12.699999f, 18.400002f, 15.499999f, 18.400002f, 15.499999f);
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-74.93499755859375, 207.47500610351562), new Point2D.Double(-74.93499755859375, 231.38400268554688), new float[] {0.0f,0.005f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 150, 216, 255)) : new Color(0, 150, 216, 255)),((colorFilter != null) ? colorFilter.filter(new Color(0, 150, 216, 255)) : new Color(0, 150, 216, 255)),((colorFilter != null) ? colorFilter.filter(new Color(0, 95, 142, 255)) : new Color(0, 95, 142, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_6
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(9.0f, 49.6f);
generalPath.lineTo(63.0f, 49.6f);
generalPath.lineTo(63.0f, 45.5f);
generalPath.lineTo(9.0f, 45.5f);
generalPath.lineTo(9.0f, 49.6f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-77.51300048828125, 211.052001953125), new Point2D.Double(-48.48699951171875, 182.0240020751953), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 149, 214, 255)) : new Color(0, 149, 214, 255)),((colorFilter != null) ? colorFilter.filter(new Color(131, 190, 231, 255)) : new Color(131, 190, 231, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_7
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(9.0f, 60.1f);
generalPath.lineTo(63.0f, 60.1f);
generalPath.lineTo(63.0f, 56.0f);
generalPath.lineTo(9.0f, 56.0f);
generalPath.lineTo(9.0f, 60.1f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-77.51399993896484, 200.5260009765625), new Point2D.Double(-48.486000061035156, 171.4980010986328), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 149, 214, 255)) : new Color(0, 149, 214, 255)),((colorFilter != null) ? colorFilter.filter(new Color(131, 190, 231, 255)) : new Color(131, 190, 231, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_8
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(9.0f, 70.7f);
generalPath.lineTo(63.0f, 70.7f);
generalPath.lineTo(63.0f, 66.6f);
generalPath.lineTo(9.0f, 66.6f);
generalPath.lineTo(9.0f, 70.7f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-77.51399993896484, 189.99899291992188), new Point2D.Double(-48.486000061035156, 160.9709930419922), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 149, 214, 255)) : new Color(0, 149, 214, 255)),((colorFilter != null) ? colorFilter.filter(new Color(131, 190, 231, 255)) : new Color(131, 190, 231, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_9
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(9.0f, 81.2f);
generalPath.lineTo(63.0f, 81.2f);
generalPath.lineTo(63.0f, 77.1f);
generalPath.lineTo(9.0f, 77.1f);
generalPath.lineTo(9.0f, 81.2f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-77.51399993896484, 179.4720001220703), new Point2D.Double(-48.486000061035156, 150.4429931640625), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 147, 214, 255)) : new Color(0, 147, 214, 255)),((colorFilter != null) ? colorFilter.filter(new Color(102, 180, 227, 255)) : new Color(102, 180, 227, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_10
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(9.0f, 91.7f);
generalPath.lineTo(63.0f, 91.7f);
generalPath.lineTo(63.0f, 87.6f);
generalPath.lineTo(9.0f, 87.6f);
generalPath.lineTo(9.0f, 91.7f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(-77.51300048828125, 168.94500732421875), new Point2D.Double(-48.48699951171875, 139.91700744628906), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(0, 135, 203, 255)) : new Color(0, 135, 203, 255)),((colorFilter != null) ? colorFilter.filter(new Color(74, 166, 220, 255)) : new Color(74, 166, 220, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 99.0f, 244.11099243164062f));
g.setPaint(paint);
g.fill(shape);
g.setTransform(transformsStack.pop());

}



    @SuppressWarnings("unused")
	private void innerPaint(Graphics2D g) {
        float origAlpha = 1.0f;
        Composite origComposite = g.getComposite();
        if (origComposite instanceof AlphaComposite) {
            AlphaComposite origAlphaComposite = 
                (AlphaComposite)origComposite;
            if (origAlphaComposite.getRule() == AlphaComposite.SRC_OVER) {
                origAlpha = origAlphaComposite.getAlpha();
            }
        }
        
	    _paint0(g, origAlpha);


	    shape = null;
	    generalPath = null;
	    paint = null;
	    stroke = null;
	    clip = null;
        transformsStack.clear();
	}

    /**
     * Returns the X of the bounding box of the original SVG image.
     * 
     * @return The X of the bounding box of the original SVG image.
     */
    public static double getOrigX() {
        return 0.12999999523162842;
    }

    /**
     * Returns the Y of the bounding box of the original SVG image.
     * 
     * @return The Y of the bounding box of the original SVG image.
     */
    public static double getOrigY() {
        return 0.0;
    }

	/**
	 * Returns the width of the bounding box of the original SVG image.
	 * 
	 * @return The width of the bounding box of the original SVG image.
	 */
	public static double getOrigWidth() {
		return 0.7400000095367432;
	}

	/**
	 * Returns the height of the bounding box of the original SVG image.
	 * 
	 * @return The height of the bounding box of the original SVG image.
	 */
	public static double getOrigHeight() {
		return 1.0;
	}

	/** The current width of this icon. */
	private int width;

    /** The current height of this icon. */
	private int height;

	/**
	 * Creates a new transcoded SVG image. This is marked as private to indicate that app
	 * code should be using the {@link #of(int, int)} method to obtain a pre-configured instance.
	 */
	private ext_image() {
        this.width = (int) getOrigWidth();
        this.height = (int) getOrigHeight();
	}

    @Override
	public int getIconHeight() {
		return height;
	}

    @Override
	public int getIconWidth() {
		return width;
	}

	@Override
	public synchronized void setDimension(Dimension newDimension) {
		this.width = newDimension.width;
		this.height = newDimension.height;
	}

    @Override
    public boolean supportsColorFilter() {
        return true;
    }

    @Override
    public void setColorFilter(ColorFilter colorFilter) {
        this.colorFilter = colorFilter;
    }

    @Override
	public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
		Graphics2D g2d = (Graphics2D) g.create();
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                RenderingHints.VALUE_INTERPOLATION_BICUBIC);
		g2d.translate(x, y);

        double coef1 = (double) this.width / getOrigWidth();
        double coef2 = (double) this.height / getOrigHeight();
        double coef = Math.min(coef1, coef2);
        g2d.clipRect(0, 0, this.width, this.height);
        g2d.scale(coef, coef);
        g2d.translate(-getOrigX(), -getOrigY());
        if (coef1 != coef2) {
            if (coef1 < coef2) {
               int extraDy = (int) ((getOrigWidth() - getOrigHeight()) / 2.0);
               g2d.translate(0, extraDy);
            } else {
               int extraDx = (int) ((getOrigHeight() - getOrigWidth()) / 2.0);
               g2d.translate(extraDx, 0);
            }
        }
        Graphics2D g2ForInner = (Graphics2D) g2d.create();
        innerPaint(g2ForInner);
        g2ForInner.dispose();
        g2d.dispose();
	}
    
    /**
     * Returns a new instance of this icon with specified dimensions.
     *
     * @param width Required width of the icon
     * @param height Required height of the icon
     * @return A new instance of this icon with specified dimensions.
     */
    public static RadianceIcon of(int width, int height) {
       ext_image base = new ext_image();
       base.width = width;
       base.height = height;
       return base;
    }

    /**
     * Returns a new {@link UIResource} instance of this icon with specified dimensions.
     *
     * @param width Required width of the icon
     * @param height Required height of the icon
     * @return A new {@link UIResource} instance of this icon with specified dimensions.
     */
    public static RadianceIconUIResource uiResourceOf(int width, int height) {
       ext_image base = new ext_image();
       base.width = width;
       base.height = height;
       return new RadianceIconUIResource(base);
    }

    /**
     * Returns a factory that returns instances of this icon on demand.
     *
     * @return Factory that returns instances of this icon on demand.
     */
    public static Factory factory() {
        return ext_image::new;
    }
}

