package org.pushingpixels.radiance.demo.component.svg.filetypes.transcoded;

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_bak 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(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 = new LinearGradientPaint(new Point2D.Double(36.0, 3.0), new Point2D.Double(36.0, 101.0), new float[] {0.0f,0.139f,0.359f,0.617f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(200, 212, 219, 255)) : new Color(200, 212, 219, 255)),((colorFilter != null) ? colorFilter.filter(new Color(216, 225, 230, 255)) : new Color(216, 225, 230, 255)),((colorFilter != null) ? colorFilter.filter(new Color(235, 240, 243, 255)) : new Color(235, 240, 243, 255)),((colorFilter != null) ? colorFilter.filter(new Color(249, 250, 251, 255)) : new Color(249, 250, 251, 255)),((colorFilter != null) ? colorFilter.filter(new Color(255, 255, 255, 255)) : new Color(255, 255, 255, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 102.0f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_1
paint = (colorFilter != null) ? colorFilter.filter(new Color(113, 145, 161, 255)) : new Color(113, 145, 161, 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, 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 = new LinearGradientPaint(new Point2D.Double(45.0369987487793, 74.18699645996094), new Point2D.Double(58.5369987487793, 87.68699645996094), new float[] {0.0f,0.35f,0.532f,0.675f,0.799f,0.908f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(255, 255, 255, 255)) : new Color(255, 255, 255, 255)),((colorFilter != null) ? colorFilter.filter(new Color(250, 251, 251, 255)) : new Color(250, 251, 251, 255)),((colorFilter != null) ? colorFilter.filter(new Color(237, 241, 244, 255)) : new Color(237, 241, 244, 255)),((colorFilter != null) ? colorFilter.filter(new Color(221, 229, 233, 255)) : new Color(221, 229, 233, 255)),((colorFilter != null) ? colorFilter.filter(new Color(199, 211, 218, 255)) : new Color(199, 211, 218, 255)),((colorFilter != null) ? colorFilter.filter(new Color(173, 189, 199, 255)) : new Color(173, 189, 199, 255)),((colorFilter != null) ? colorFilter.filter(new Color(146, 165, 176, 255)) : new Color(146, 165, 176, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 102.0f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_3
paint = (colorFilter != null) ? colorFilter.filter(new Color(113, 145, 161, 255)) : new Color(113, 145, 161, 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(8.4f, 71.8f);
generalPath.lineTo(16.4f, 71.8f);
generalPath.curveTo(18.0f, 71.8f, 19.199999f, 71.9f, 19.9f, 72.0f);
generalPath.curveTo(20.6f, 72.1f, 21.4f, 72.4f, 22.0f, 72.8f);
generalPath.curveTo(22.6f, 73.200005f, 23.1f, 73.8f, 23.5f, 74.5f);
generalPath.curveTo(23.9f, 75.2f, 24.1f, 76.0f, 24.1f, 76.8f);
generalPath.curveTo(24.1f, 77.700005f, 23.800001f, 78.600006f, 23.300001f, 79.4f);
generalPath.curveTo(22.800001f, 80.2f, 22.1f, 80.8f, 21.2f, 81.200005f);
generalPath.curveTo(22.400002f, 81.600006f, 23.400002f, 82.200005f, 24.0f, 83.00001f);
generalPath.curveTo(24.599998f, 83.80001f, 25.0f, 84.90001f, 25.0f, 86.00001f);
generalPath.curveTo(25.0f, 86.90001f, 24.8f, 87.80001f, 24.4f, 88.700005f);
generalPath.curveTo(24.0f, 89.6f, 23.4f, 90.200005f, 22.699999f, 90.8f);
generalPath.curveTo(21.999998f, 91.3f, 21.099998f, 91.600006f, 19.999998f, 91.8f);
generalPath.curveTo(19.299997f, 91.9f, 17.699999f, 91.9f, 15.099998f, 91.9f);
generalPath.lineTo(8.4f, 91.9f);
generalPath.lineTo(8.4f, 71.8f);
generalPath.closePath();
generalPath.moveTo(12.4f, 75.200005f);
generalPath.lineTo(12.4f, 79.8f);
generalPath.lineTo(15.099999f, 79.8f);
generalPath.curveTo(16.699999f, 79.8f, 17.699999f, 79.8f, 18.0f, 79.700005f);
generalPath.curveTo(18.7f, 79.600006f, 19.2f, 79.4f, 19.6f, 79.00001f);
generalPath.curveTo(20.0f, 78.60001f, 20.2f, 78.100006f, 20.2f, 77.40001f);
generalPath.curveTo(20.2f, 76.80001f, 20.0f, 76.30001f, 19.7f, 75.90001f);
generalPath.curveTo(19.400002f, 75.50001f, 18.800001f, 75.30001f, 18.2f, 75.20001f);
generalPath.curveTo(17.800001f, 75.20001f, 16.6f, 75.10001f, 14.700001f, 75.10001f);
generalPath.lineTo(12.400001f, 75.10001f);
generalPath.closePath();
generalPath.moveTo(12.4f, 83.100006f);
generalPath.lineTo(12.4f, 88.50001f);
generalPath.lineTo(16.1f, 88.50001f);
generalPath.curveTo(17.6f, 88.50001f, 18.5f, 88.50001f, 18.9f, 88.40001f);
generalPath.curveTo(19.5f, 88.30001f, 20.0f, 88.00001f, 20.4f, 87.600006f);
generalPath.curveTo(20.8f, 87.200005f, 21.0f, 86.600006f, 21.0f, 85.90001f);
generalPath.curveTo(21.0f, 85.30001f, 20.9f, 84.80001f, 20.6f, 84.40001f);
generalPath.curveTo(20.300001f, 84.00001f, 19.9f, 83.70001f, 19.300001f, 83.50001f);
generalPath.curveTo(18.7f, 83.30001f, 17.6f, 83.200005f, 15.700001f, 83.200005f);
generalPath.lineTo(12.400001f, 83.200005f);
generalPath.closePath();
generalPath.moveTo(46.6f, 91.90001f);
generalPath.lineTo(42.199997f, 91.90001f);
generalPath.lineTo(40.399998f, 87.30001f);
generalPath.lineTo(32.399998f, 87.30001f);
generalPath.lineTo(30.699997f, 91.90001f);
generalPath.lineTo(26.399998f, 91.90001f);
generalPath.lineTo(34.199997f, 71.90001f);
generalPath.lineTo(38.499996f, 71.90001f);
generalPath.lineTo(46.6f, 91.90001f);
generalPath.closePath();
generalPath.moveTo(39.2f, 84.0f);
generalPath.lineTo(36.4f, 76.6f);
generalPath.lineTo(33.7f, 84.0f);
generalPath.lineTo(39.2f, 84.0f);
generalPath.closePath();
generalPath.moveTo(48.800003f, 91.9f);
generalPath.lineTo(48.800003f, 71.9f);
generalPath.lineTo(52.800003f, 71.9f);
generalPath.lineTo(52.800003f, 80.8f);
generalPath.lineTo(61.000004f, 71.9f);
generalPath.lineTo(66.4f, 71.9f);
generalPath.lineTo(59.0f, 79.6f);
generalPath.lineTo(67.0f, 91.799995f);
generalPath.lineTo(61.8f, 91.799995f);
generalPath.lineTo(56.3f, 82.399994f);
generalPath.lineTo(53.0f, 85.7f);
generalPath.lineTo(53.0f, 91.799995f);
generalPath.lineTo(48.8f, 91.799995f);
generalPath.closePath();
shape = generalPath;
paint = (colorFilter != null) ? colorFilter.filter(new Color(76, 108, 123, 255)) : new Color(76, 108, 123, 255);
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 0.85f * origAlpha));
// _0_5
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_5_0
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(15.5f, 24.0f);
generalPath.lineTo(15.5f, 47.4f);
generalPath.lineTo(24.3f, 47.4f);
generalPath.lineTo(24.3f, 32.8f);
generalPath.lineTo(38.9f, 32.8f);
generalPath.lineTo(38.9f, 24.0f);
generalPath.lineTo(15.5f, 24.0f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(27.200000762939453, 52.57099914550781), new Point2D.Double(27.200000762939453, 76.0), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(173, 204, 220, 255)) : new Color(173, 204, 220, 255)),((colorFilter != null) ? colorFilter.filter(new Color(76, 108, 123, 255)) : new Color(76, 108, 123, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 100.0f));
g.setPaint(paint);
g.fill(shape);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
// _0_5_1
if (generalPath == null) {
   generalPath = new GeneralPath();
} else {
   generalPath.reset();
}
generalPath.moveTo(27.2f, 35.7f);
generalPath.lineTo(27.2f, 65.0f);
generalPath.lineTo(56.5f, 65.0f);
generalPath.lineTo(56.5f, 35.7f);
generalPath.lineTo(27.2f, 35.7f);
generalPath.closePath();
shape = generalPath;
paint = new LinearGradientPaint(new Point2D.Double(41.849998474121094, 35.0), new Point2D.Double(41.849998474121094, 64.30000305175781), new float[] {0.0f,1.0f}, new Color[] {((colorFilter != null) ? colorFilter.filter(new Color(173, 204, 220, 255)) : new Color(173, 204, 220, 255)),((colorFilter != null) ? colorFilter.filter(new Color(76, 108, 123, 255)) : new Color(76, 108, 123, 255))}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 100.0f));
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_bak() {
        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_bak base = new ext_bak();
       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_bak base = new ext_bak();
       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_bak::new;
    }
}

