org.apache.batik.ext.awt_1.6.0.v201011041432

16:40:52.660 INFO  jd.cli.Main - Decompiling org.apache.batik.ext.awt_1.6.0.v201011041432.jar
package org.apache.batik.ext.awt;

import java.awt.RenderingHints.Key;
import java.awt.Shape;

final class AreaOfInterestHintKey
  extends RenderingHints.Key
{
  AreaOfInterestHintKey(int paramInt)
  {
    super(paramInt);
  }
  
  public boolean isCompatibleValue(Object paramObject)
  {
    boolean bool = true;
    if ((paramObject != null) && (!(paramObject instanceof Shape))) {
      bool = false;
    }
    return bool;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.AreaOfInterestHintKey
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.RenderingHints.Key;

public class AvoidTilingHintKey
  extends RenderingHints.Key
{
  AvoidTilingHintKey(int paramInt)
  {
    super(paramInt);
  }
  
  public boolean isCompatibleValue(Object paramObject)
  {
    if (paramObject == null) {
      return false;
    }
    return (paramObject == RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_ON) || (paramObject == RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_OFF) || (paramObject == RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_DEFAULT);
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.AvoidTilingHintKey
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.RenderingHints.Key;
import java.awt.image.BufferedImage;
import java.lang.ref.Reference;

final class BufferedImageHintKey
  extends RenderingHints.Key
{
  BufferedImageHintKey(int paramInt)
  {
    super(paramInt);
  }
  
  public boolean isCompatibleValue(Object paramObject)
  {
    if (paramObject == null) {
      return true;
    }
    if (!(paramObject instanceof Reference)) {
      return false;
    }
    Reference localReference = (Reference)paramObject;
    paramObject = localReference.get();
    if (paramObject == null) {
      return true;
    }
    return (paramObject instanceof BufferedImage);
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.BufferedImageHintKey
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.RenderingHints.Key;

public final class ColorSpaceHintKey
  extends RenderingHints.Key
{
  public static Object VALUE_COLORSPACE_ARGB = new Object();
  public static Object VALUE_COLORSPACE_RGB = new Object();
  public static Object VALUE_COLORSPACE_GREY = new Object();
  public static Object VALUE_COLORSPACE_AGREY = new Object();
  public static Object VALUE_COLORSPACE_ALPHA = new Object();
  public static Object VALUE_COLORSPACE_ALPHA_CONVERT = new Object();
  public static final String PROPERTY_COLORSPACE = "org.apache.batik.gvt.filter.Colorspace";
  
  ColorSpaceHintKey(int paramInt)
  {
    super(paramInt);
  }
  
  public boolean isCompatibleValue(Object paramObject)
  {
    if (paramObject == VALUE_COLORSPACE_ARGB) {
      return true;
    }
    if (paramObject == VALUE_COLORSPACE_RGB) {
      return true;
    }
    if (paramObject == VALUE_COLORSPACE_GREY) {
      return true;
    }
    if (paramObject == VALUE_COLORSPACE_AGREY) {
      return true;
    }
    if (paramObject == VALUE_COLORSPACE_ALPHA) {
      return true;
    }
    return paramObject == VALUE_COLORSPACE_ALPHA_CONVERT;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.ColorSpaceHintKey
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.Color;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.awt.geom.Point2D.Float;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;

public final class LinearGradientPaint
  extends MultipleGradientPaint
{
  private Point2D start;
  private Point2D end;
  
  public LinearGradientPaint(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float[] paramArrayOfFloat, Color[] paramArrayOfColor)
  {
    this(new Point2D.Float(paramFloat1, paramFloat2), new Point2D.Float(paramFloat3, paramFloat4), paramArrayOfFloat, paramArrayOfColor, MultipleGradientPaint.NO_CYCLE, MultipleGradientPaint.SRGB);
  }
  
  public LinearGradientPaint(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float[] paramArrayOfFloat, Color[] paramArrayOfColor, MultipleGradientPaint.CycleMethodEnum paramCycleMethodEnum)
  {
    this(new Point2D.Float(paramFloat1, paramFloat2), new Point2D.Float(paramFloat3, paramFloat4), paramArrayOfFloat, paramArrayOfColor, paramCycleMethodEnum, MultipleGradientPaint.SRGB);
  }
  
  public LinearGradientPaint(Point2D paramPoint2D1, Point2D paramPoint2D2, float[] paramArrayOfFloat, Color[] paramArrayOfColor)
  {
    this(paramPoint2D1, paramPoint2D2, paramArrayOfFloat, paramArrayOfColor, MultipleGradientPaint.NO_CYCLE, MultipleGradientPaint.SRGB);
  }
  
  public LinearGradientPaint(Point2D paramPoint2D1, Point2D paramPoint2D2, float[] paramArrayOfFloat, Color[] paramArrayOfColor, MultipleGradientPaint.CycleMethodEnum paramCycleMethodEnum, MultipleGradientPaint.ColorSpaceEnum paramColorSpaceEnum)
  {
    this(paramPoint2D1, paramPoint2D2, paramArrayOfFloat, paramArrayOfColor, paramCycleMethodEnum, paramColorSpaceEnum, new AffineTransform());
  }
  
  public LinearGradientPaint(Point2D paramPoint2D1, Point2D paramPoint2D2, float[] paramArrayOfFloat, Color[] paramArrayOfColor, MultipleGradientPaint.CycleMethodEnum paramCycleMethodEnum, MultipleGradientPaint.ColorSpaceEnum paramColorSpaceEnum, AffineTransform paramAffineTransform)
  {
    super(paramArrayOfFloat, paramArrayOfColor, paramCycleMethodEnum, paramColorSpaceEnum, paramAffineTransform);
    if ((paramPoint2D1 == null) || (paramPoint2D2 == null)) {
      throw new NullPointerException("Start and end points must benon-null");
    }
    if (paramPoint2D1.equals(paramPoint2D2)) {
      throw new IllegalArgumentException("Start point cannot equalendpoint");
    }
    start = ((Point2D)paramPoint2D1.clone());
    end = ((Point2D)paramPoint2D2.clone());
  }
  
  public PaintContext createContext(ColorModel paramColorModel, Rectangle paramRectangle, Rectangle2D paramRectangle2D, AffineTransform paramAffineTransform, RenderingHints paramRenderingHints)
  {
    paramAffineTransform = new AffineTransform(paramAffineTransform);
    paramAffineTransform.concatenate(gradientTransform);
    try
    {
      return new LinearGradientPaintContext(paramColorModel, paramRectangle, paramRectangle2D, paramAffineTransform, paramRenderingHints, start, end, fractions, getColors(), cycleMethod, colorSpace);
    }
    catch (NoninvertibleTransformException localNoninvertibleTransformException)
    {
      localNoninvertibleTransformException.printStackTrace();
      throw new IllegalArgumentException("transform should beinvertible");
    }
  }
  
  public Point2D getStartPoint()
  {
    return new Point2D.Double(start.getX(), start.getY());
  }
  
  public Point2D getEndPoint()
  {
    return new Point2D.Double(end.getX(), end.getY());
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.LinearGradientPaint
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.Color;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Float;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;

final class LinearGradientPaintContext
  extends MultipleGradientPaintContext
{
  private float dgdX;
  private float dgdY;
  private float gc;
  private float pixSz;
  private static final int DEFAULT_IMPL = 1;
  private static final int ANTI_ALIAS_IMPL = 3;
  private int fillMethod;
  
  public LinearGradientPaintContext(ColorModel paramColorModel, Rectangle paramRectangle, Rectangle2D paramRectangle2D, AffineTransform paramAffineTransform, RenderingHints paramRenderingHints, Point2D paramPoint2D1, Point2D paramPoint2D2, float[] paramArrayOfFloat, Color[] paramArrayOfColor, MultipleGradientPaint.CycleMethodEnum paramCycleMethodEnum, MultipleGradientPaint.ColorSpaceEnum paramColorSpaceEnum)
    throws NoninvertibleTransformException
  {
    super(paramColorModel, paramRectangle, paramRectangle2D, paramAffineTransform, paramRenderingHints, paramArrayOfFloat, paramArrayOfColor, paramCycleMethodEnum, paramColorSpaceEnum);
    Point2D.Float localFloat1 = new Point2D.Float((float)paramPoint2D1.getX(), (float)paramPoint2D1.getY());
    Point2D.Float localFloat2 = new Point2D.Float((float)paramPoint2D2.getX(), (float)paramPoint2D2.getY());
    float f1 = x - x;
    float f2 = y - y;
    float f3 = f1 * f1 + f2 * f2;
    float f4 = f1 / f3;
    float f5 = f2 / f3;
    dgdX = (a00 * f4 + a10 * f5);
    dgdY = (a01 * f4 + a11 * f5);
    float f6 = Math.abs(dgdX);
    float f7 = Math.abs(dgdY);
    if (f6 > f7) {
      pixSz = f6;
    } else {
      pixSz = f7;
    }
    gc = ((a02 - x) * f4 + (a12 - y) * f5);
    Object localObject1 = paramRenderingHints.get(RenderingHints.KEY_COLOR_RENDERING);
    Object localObject2 = paramRenderingHints.get(RenderingHints.KEY_RENDERING);
    fillMethod = 1;
    if ((paramCycleMethodEnum == MultipleGradientPaint.REPEAT) || (hasDiscontinuity))
    {
      if (localObject2 == RenderingHints.VALUE_RENDER_QUALITY) {
        fillMethod = 3;
      }
      if (localObject1 == RenderingHints.VALUE_COLOR_RENDER_SPEED) {
        fillMethod = 1;
      } else if (localObject1 == RenderingHints.VALUE_COLOR_RENDER_QUALITY) {
        fillMethod = 3;
      }
    }
  }
  
  protected void fillHardNoCycle(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    float f1 = dgdX * paramInt3 + gc;
    for (int i = 0; i < paramInt6; i++)
    {
      float f2 = f1 + dgdY * (paramInt4 + i);
      int j = paramInt1 + paramInt5;
      int k;
      int m;
      if (dgdX == 0.0F)
      {
        if (f2 <= 0.0F)
        {
          k = gradientUnderflow;
        }
        else if (f2 >= 1.0F)
        {
          k = gradientOverflow;
        }
        else
        {
          for (m = 0; m < gradientsLength - 1; m++) {
            if (f2 < fractions[(m + 1)]) {
              break;
            }
          }
          float f3 = f2 - fractions[m];
          float f4 = f3 * 255.0F / normalizedIntervals[m] + 0.5F;
          k = gradients[m][((int)f4)];
        }
        while (paramInt1 < j) {
          paramArrayOfInt[(paramInt1++)] = k;
        }
      }
      else
      {
        float f5;
        float f6;
        int n;
        int i1;
        if (dgdX >= 0.0F)
        {
          f5 = (1.0F - f2) / dgdX;
          f6 = (float)Math.ceil((0.0F - f2) / dgdX);
          n = gradientUnderflow;
          i1 = gradientOverflow;
        }
        else
        {
          f5 = (0.0F - f2) / dgdX;
          f6 = (float)Math.ceil((1.0F - f2) / dgdX);
          n = gradientOverflow;
          i1 = gradientUnderflow;
        }
        if (f5 > paramInt5) {
          k = paramInt5;
        } else {
          k = (int)f5;
        }
        if (f6 > paramInt5) {
          m = paramInt5;
        } else {
          m = (int)f6;
        }
        int i2 = paramInt1 + k;
        int i3;
        if (m > 0)
        {
          i3 = paramInt1 + m;
          while (paramInt1 < i3) {
            paramArrayOfInt[(paramInt1++)] = n;
          }
          f2 += dgdX * m;
        }
        float f7;
        int[] arrayOfInt;
        double d;
        int i4;
        int i5;
        int i6;
        int i7;
        if (dgdX > 0.0F)
        {
          for (i3 = 0; i3 < gradientsLength - 1; i3++) {
            if (f2 < fractions[(i3 + 1)]) {
              break;
            }
          }
          while (paramInt1 < i2)
          {
            f7 = f2 - fractions[i3];
            arrayOfInt = gradients[i3];
            d = Math.ceil((fractions[(i3 + 1)] - f2) / dgdX);
            if (d > paramInt5) {
              i4 = paramInt5;
            } else {
              i4 = (int)d;
            }
            i5 = paramInt1 + i4;
            if (i5 > i2) {
              i5 = i2;
            }
            i6 = (int)(f7 * 255.0F / normalizedIntervals[i3] * 65536.0F) + 32768;
            i7 = (int)(dgdX * 255.0F / normalizedIntervals[i3] * 65536.0F);
            while (paramInt1 < i5)
            {
              paramArrayOfInt[(paramInt1++)] = arrayOfInt[(i6 >> 16)];
              i6 += i7;
            }
            f2 = (float)(f2 + dgdX * d);
            i3++;
          }
        }
        else
        {
          for (i3 = gradientsLength - 1; i3 > 0; i3--) {
            if (f2 > fractions[i3]) {
              break;
            }
          }
          while (paramInt1 < i2)
          {
            f7 = f2 - fractions[i3];
            arrayOfInt = gradients[i3];
            d = Math.ceil(f7 / -dgdX);
            if (d > paramInt5) {
              i4 = paramInt5;
            } else {
              i4 = (int)d;
            }
            i5 = paramInt1 + i4;
            if (i5 > i2) {
              i5 = i2;
            }
            i6 = (int)(f7 * 255.0F / normalizedIntervals[i3] * 65536.0F) + 32768;
            i7 = (int)(dgdX * 255.0F / normalizedIntervals[i3] * 65536.0F);
            while (paramInt1 < i5)
            {
              paramArrayOfInt[(paramInt1++)] = arrayOfInt[(i6 >> 16)];
              i6 += i7;
            }
            f2 = (float)(f2 + dgdX * d);
            i3--;
          }
        }
        while (paramInt1 < j) {
          paramArrayOfInt[(paramInt1++)] = i1;
        }
      }
      paramInt1 += paramInt2;
    }
  }
  
  protected void fillSimpleNoCycle(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    float f1 = dgdX * paramInt3 + gc;
    float f2 = dgdX * fastGradientArraySize;
    int i = (int)(f2 * 65536.0F);
    int[] arrayOfInt = gradient;
    for (int j = 0; j < paramInt6; j++)
    {
      float f3 = f1 + dgdY * (paramInt4 + j);
      f3 *= fastGradientArraySize;
      f3 = (float)(f3 + 0.5D);
      int k = paramInt1 + paramInt5;
      float f4 = dgdX * fastGradientArraySize * paramInt5;
      if (f4 < 0.0F) {
        f4 = -f4;
      }
      int m;
      if (f4 < 0.3D)
      {
        if (f3 <= 0.0F) {
          m = gradientUnderflow;
        } else if (f3 >= fastGradientArraySize) {
          m = gradientOverflow;
        } else {
          m = arrayOfInt[((int)f3)];
        }
        while (paramInt1 < k) {
          paramArrayOfInt[(paramInt1++)] = m;
        }
      }
      else
      {
        int n;
        int i1;
        int i2;
        if (dgdX > 0.0F)
        {
          m = (int)((fastGradientArraySize - f3) / f2);
          n = (int)Math.ceil(0.0F - f3 / f2);
          i1 = gradientUnderflow;
          i2 = gradientOverflow;
        }
        else
        {
          m = (int)((0.0F - f3) / f2);
          n = (int)Math.ceil((fastGradientArraySize - f3) / f2);
          i1 = gradientOverflow;
          i2 = gradientUnderflow;
        }
        if (m > paramInt5) {
          m = paramInt5;
        }
        int i3 = paramInt1 + m;
        if (n > 0)
        {
          if (n > paramInt5) {
            n = paramInt5;
          }
          i4 = paramInt1 + n;
          while (paramInt1 < i4) {
            paramArrayOfInt[(paramInt1++)] = i1;
          }
          f3 += f2 * n;
        }
        int i4 = (int)(f3 * 65536.0F);
        while (paramInt1 < i3)
        {
          paramArrayOfInt[(paramInt1++)] = arrayOfInt[(i4 >> 16)];
          i4 += i;
        }
        while (paramInt1 < k) {
          paramArrayOfInt[(paramInt1++)] = i2;
        }
      }
      paramInt1 += paramInt2;
    }
  }
  
  protected void fillSimpleRepeat(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    float f1 = dgdX * paramInt3 + gc;
    float f2 = (dgdX - (int)dgdX) * fastGradientArraySize;
    if (f2 < 0.0F) {
      f2 += fastGradientArraySize;
    }
    int[] arrayOfInt = gradient;
    for (int i = 0; i < paramInt6; i++)
    {
      float f3 = f1 + dgdY * (paramInt4 + i);
      f3 -= (int)f3;
      if (f3 < 0.0F) {
        f3 += 1.0F;
      }
      f3 *= fastGradientArraySize;
      f3 = (float)(f3 + 0.5D);
      int j = paramInt1 + paramInt5;
      while (paramInt1 < j)
      {
        int k = (int)f3;
        if (k >= fastGradientArraySize)
        {
          f3 -= fastGradientArraySize;
          k -= fastGradientArraySize;
        }
        paramArrayOfInt[(paramInt1++)] = arrayOfInt[k];
        f3 += f2;
      }
      paramInt1 += paramInt2;
    }
  }
  
  protected void fillSimpleReflect(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    float f1 = dgdX * paramInt3 + gc;
    int[] arrayOfInt = gradient;
    for (int i = 0; i < paramInt6; i++)
    {
      float f2 = f1 + dgdY * (paramInt4 + i);
      f2 -= 2 * (int)(f2 / 2.0F);
      float f3 = dgdX;
      if (f2 < 0.0F)
      {
        f2 = -f2;
        f3 = -f3;
      }
      f3 -= 2.0F * ((int)f3 / 2.0F);
      if (f3 < 0.0F) {
        f3 = (float)(f3 + 2.0D);
      }
      int j = 2 * fastGradientArraySize;
      f2 *= fastGradientArraySize;
      f2 = (float)(f2 + 0.5D);
      f3 *= fastGradientArraySize;
      int k = paramInt1 + paramInt5;
      while (paramInt1 < k)
      {
        int m = (int)f2;
        if (m >= j)
        {
          f2 -= j;
          m -= j;
        }
        if (m <= fastGradientArraySize) {
          paramArrayOfInt[(paramInt1++)] = arrayOfInt[m];
        } else {
          paramArrayOfInt[(paramInt1++)] = arrayOfInt[(j - m)];
        }
        f2 += f3;
      }
      paramInt1 += paramInt2;
    }
  }
  
  protected void fillRaster(int[] paramArrayOfInt, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    float f1 = dgdX * paramInt3 + gc;
    int i;
    float f2;
    int j;
    if (fillMethod == 3) {
      for (i = 0; i < paramInt6; i++)
      {
        f2 = f1 + dgdY * (paramInt4 + i);
        j = paramInt1 + paramInt5;
        while (paramInt1 < j)
        {
          paramArrayOfInt[(paramInt1++)] = indexGradientAntiAlias(f2, pixSz);
          f2 += dgdX;
        }
        paramInt1 += paramInt2;
      }
    } else if (!isSimpleLookup)
    {
      if (cycleMethod == MultipleGradientPaint.NO_CYCLE) {
        fillHardNoCycle(paramArrayOfInt, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6);
      } else {
        for (i = 0; i < paramInt6; i++)
        {
          f2 = f1 + dgdY * (paramInt4 + i);
          j = paramInt1 + paramInt5;
          while (paramInt1 < j)
          {
            paramArrayOfInt[(paramInt1++)] = indexIntoGradientsArrays(f2);
            f2 += dgdX;
          }
          paramInt1 += paramInt2;
        }
      }
    }
    else if (cycleMethod == MultipleGradientPaint.NO_CYCLE) {
      fillSimpleNoCycle(paramArrayOfInt, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6);
    } else if (cycleMethod == MultipleGradientPaint.REPEAT) {
      fillSimpleRepeat(paramArrayOfInt, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6);
    } else {
      fillSimpleReflect(paramArrayOfInt, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.LinearGradientPaintContext
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

public class MultipleGradientPaint$ColorSpaceEnum {}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.MultipleGradientPaint.ColorSpaceEnum
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

public class MultipleGradientPaint$CycleMethodEnum {}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.MultipleGradientPaint.CycleMethodEnum
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.Color;
import java.awt.Paint;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;

public abstract class MultipleGradientPaint
  implements Paint
{
  protected int transparency;
  protected float[] fractions;
  protected Color[] colors;
  protected AffineTransform gradientTransform;
  protected CycleMethodEnum cycleMethod;
  protected ColorSpaceEnum colorSpace;
  public static final CycleMethodEnum NO_CYCLE = new CycleMethodEnum();
  public static final CycleMethodEnum REFLECT = new CycleMethodEnum();
  public static final CycleMethodEnum REPEAT = new CycleMethodEnum();
  public static final ColorSpaceEnum SRGB = new ColorSpaceEnum();
  public static final ColorSpaceEnum LINEAR_RGB = new ColorSpaceEnum();
  
  public MultipleGradientPaint(float[] paramArrayOfFloat, Color[] paramArrayOfColor, CycleMethodEnum paramCycleMethodEnum, ColorSpaceEnum paramColorSpaceEnum, AffineTransform paramAffineTransform)
  {
    if (paramArrayOfFloat == null) {
      throw new IllegalArgumentException("Fractions array cannot be null");
    }
    if (paramArrayOfColor == null) {
      throw new IllegalArgumentException("Colors array cannot be null");
    }
    if (paramArrayOfFloat.length != paramArrayOfColor.length) {
      throw new IllegalArgumentException("Colors and fractions must have equal size");
    }
    if (paramArrayOfColor.length < 2) {
      throw new IllegalArgumentException("User must specify at least 2 colors");
    }
    if ((paramColorSpaceEnum != LINEAR_RGB) && (paramColorSpaceEnum != SRGB)) {
      throw new IllegalArgumentException("Invalid colorspace for interpolation.");
    }
    if ((paramCycleMethodEnum != NO_CYCLE) && (paramCycleMethodEnum != REFLECT) && (paramCycleMethodEnum != REPEAT)) {
      throw new IllegalArgumentException("Invalid cycle method.");
    }
    if (paramAffineTransform == null) {
      throw new IllegalArgumentException("Gradient transform cannot be null.");
    }
    fractions = new float[paramArrayOfFloat.length];
    System.arraycopy(paramArrayOfFloat, 0, fractions, 0, paramArrayOfFloat.length);
    colors = new Color[paramArrayOfColor.length];
    System.arraycopy(paramArrayOfColor, 0, colors, 0, paramArrayOfColor.length);
    colorSpace = paramColorSpaceEnum;
    cycleMethod = paramCycleMethodEnum;
    gradientTransform = ((AffineTransform)paramAffineTransform.clone());
    int i = 1;
    for (int j = 0; j < paramArrayOfColor.length; j++) {
      i = (i != 0) && (paramArrayOfColor[j].getAlpha() == 255) ? 1 : 0;
    }
    if (i != 0) {
      transparency = 1;
    } else {
      transparency = 3;
    }
  }
  
  public Color[] getColors()
  {
    Color[] arrayOfColor = new Color[colors.length];
    System.arraycopy(colors, 0, arrayOfColor, 0, colors.length);
    return arrayOfColor;
  }
  
  public float[] getFractions()
  {
    float[] arrayOfFloat = new float[fractions.length];
    System.arraycopy(fractions, 0, arrayOfFloat, 0, fractions.length);
    return arrayOfFloat;
  }
  
  public int getTransparency()
  {
    return transparency;
  }
  
  public CycleMethodEnum getCycleMethod()
  {
    return cycleMethod;
  }
  
  public ColorSpaceEnum getColorSpace()
  {
    return colorSpace;
  }
  
  public AffineTransform getTransform()
  {
    return (AffineTransform)gradientTransform.clone();
  }
  
  public abstract PaintContext createContext(ColorModel paramColorModel, Rectangle paramRectangle, Rectangle2D paramRectangle2D, AffineTransform paramAffineTransform, RenderingHints paramRenderingHints);
  
  public static class ColorSpaceEnum {}
  
  public static class CycleMethodEnum {}
}

/* Location:
 * Qualified Name:     org.apache.batik.ext.awt.MultipleGradientPaint
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.ext.awt;

import java.awt.Color;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferInt;
import java.awt.image.DirectColorModel;
import java.awt.image.Raster;
import java.awt.image.SinglePixelPackedSampleModel;
import java.awt.image.WritableRaster;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import org.apache.batik.ext.awt.image.GraphicsUtil;

abstract class MultipleGradientPaintContext
  implements PaintContext
{
  protected static final boolean DEBUG = false;
  protected ColorModel dataModel;
  protected ColorModel model;
  private static ColorModel lrgbmodel_NA = new DirectColorModel(ColorSpace.getInstance(1004), 24, 16711680, 65280, 255, 0, false, 3);
  private static ColorModel srgbmodel_NA = new DirectColorModel(ColorSpace.getInstance(1000), 24, 16711680, 65280, 255, 0, false, 3);
  private static ColorModel lrgbmodel_A = new DirectColorModel(ColorSpace.getInstance(1004), 32, 16711680, 65280, 255, -16777216, false, 3);
  private static ColorModel srgbmodel_A = new DirectColorModel(ColorSpace.getInstance(1000), 32, 16711680, 65280, 255, -16777216, false, 3);
  protected static ColorModel cachedModel;
  protected static WeakReference cached;
  protected WritableRaster saved;
  protected MultipleGradientPaint.CycleMethodEnum cycleMethod;
  protected MultipleGradientPaint.ColorSpaceEnum colorSpace;
  protected float a00;
  protected float a01;
  protected float a10;
  protected float a11;
  protected float a02;
  protected float a12;
  protected boolean isSimpleLookup = true;
  protected boolean hasDiscontinuity = false;
  protected int fastGradientArraySize;
  protected int[] gradient;
  protected int[][] gradients;
  protected int gradientAverage;
  protected int gradientUnderflow;
  protected int gradientOverflow;
  protected int gradientsLength;
  protected float[] normalizedIntervals;
  protected float[] fractions;
  private int transparencyTest;
  private static final int[] SRGBtoLinearRGB = new int['?'];
  private static final int[] LinearRGBtoSRGB = new int['?'];
  protected static final int GRADIENT_SIZE = 256;
  protected static final int GRADIENT_SIZE_INDEX = 255;
  private static final int MAX_GRADIENT_ARRAY_SIZE = 5000;
  
  public MultipleGradientPaintContext(ColorModel paramColorModel, Rectangle paramRectangle, Rectangle2D paramRectangle2D, AffineTransform paramAffineTransform, RenderingHints paramRenderingHints, float[] paramArrayOfFloat, Color[] paramArrayOfColor, MultipleGradientPaint.CycleMethodEnum paramCycleMethodEnum, MultipleGradientPaint.ColorSpaceEnum paramColorSpaceEnum)
    throws NoninvertibleTransformException
  {
    int i = 0;
    int j = 0;
    int k = paramArrayOfFloat.length;
    if (paramArrayOfFloat[0] != 0.0F)
    {
      i = 1;
      k++;
    }
    if (paramArrayOfFloat[(paramArrayOfFloat.length - 1)] != 1.0F)
    {
      j = 1;
      k++;
    }
    for (int m = 0; m < paramArrayOfFloat.length - 1; m++) {
      if (paramArrayOfFloat[m] == paramArrayOfFloat[(m + 1)]) {
        k--;
      }
    }
    fractions = new float[k];
    Color[] arrayOfColor1 = new Color[k - 1];
    Color[] arrayOfColor2 = new Color[k - 1];
    normalizedIntervals = new float[k - 1];
    gradientUnderflow = paramArrayOfColor[0].getRGB();
    gradientOverflow = paramArrayOfColor[(paramArrayOfColor.length - 1)].getRGB();
    int n = 0;
    if (i != 0)
    {
      fractions[0] = 0.0F;
      arrayOfColor1[0] = paramArrayOfColor[0];
      arrayOfColor2[0] = paramArrayOfColor[0];
      normalizedIntervals[0] = paramArrayOfFloat[0];
      n++;
    }
    for (int i1 = 0; i1 < paramArrayOfFloat.length - 1; i1++) {
      if (paramArrayOfFloat[i1] == paramArrayOfFloat[(i1 + 1)])
      {
        if (!paramArrayOfColor[i1].equals(paramArrayOfColor[(i1 + 1)])) {
          hasDiscontinuity = true;
        }
      }
      else
      {
        fractions[n] = paramArrayOfFloat[i1];
        arrayOfColor1[n] = paramArrayOfColor[i1];
        arrayOfColor2[n] = paramArrayOfColor[(i1 + 1)];
        normalizedIntervals[n] = (paramArrayOfFloat[(i1 + 1)] - paramArrayOfFloat[i1]);
        n++;
      }
    }
    fractions[n] = paramArrayOfFloat[(paramArrayOfFloat.length - 1)];
    if (j != 0)
    {
      arrayOfColor1[n] = (arrayOfColor2[n] = paramArrayOfColor[(paramArrayOfColor.length - 1)]);
      normalizedIntervals[n] = (1.0F - paramArrayOfFloat[(paramArrayOfFloat.length - 1)]);
      n++;
      fractions[n] = 1.0F;
    }
    AffineTransform localAffineTransform = paramAffineTransform.createInverse();
    double[] arrayOfDouble = new double[6];
    localAffineTransform.getMatrix(arrayOfDouble);
    a00 = ((float)arrayOfDouble[0]);
    a10 = ((float)arrayOfDouble[1]);
    a01 = ((float)arrayOfDouble[2]);
    a11 = ((float)arrayOfDouble[3]);
    a02 = ((float)arrayOfDouble[4]);
    a12 = ((float)arrayOfDouble[5]);
    cycleMethod = paramCycleMethodEnum;
    colorSpace = paramColorSpaceEnum;
    if (paramColorModel.getColorSpace() == lrgbmodel_A.getColorSpace()) {
      dataModel = lrgbmodel_A;
    } else if (paramColorModel.getColorSpace() == srgbmodel_A.getColorSpace()) {
      dataModel = srgbmodel_A;
    } else {
      throw new IllegalArgumentException("Unsupported ColorSpace for interpolation");
    }
    calculateGradientFractions(arrayOfColor1, arrayOfColor2);
    model = GraphicsUtil.coerceColorModel(dataModel, paramColorModel.isAlphaPremultiplied());
  }
  
  protected final void calculateGradientFractions(Color[] paramArrayOfColor1, Color[] paramArrayOfColor2)
  {
    if (colorSpace == MultipleGradientPaint.LINEAR_RGB) {
      for (i = 0; i < paramArrayOfColor1.length; i++)
      {
        paramArrayOfColor1[i] = new Color(SRGBtoLinearRGB[paramArrayOfColor1[i].getRed()], SRGBtoLinearRGB[paramArrayOfColor1[i].getGreen()], SRGBtoLinearRGB[paramArrayOfColor1[i].getBlue()], paramArrayOfColor1[i].getAlpha());
        paramArrayOfColor2[i] = new Color(SRGBtoLinearRGB[paramArrayOfColor2[i].getRed()], SRGBtoLinearRGB[paramArrayOfColor2[i].getGreen()], SRGBtoLinearRGB[paramArrayOfColor2[i].getBlue()], paramArrayOfColor2[i].getAlpha());
      }
    }
    transparencyTest = -16777216;
    if (cycleMethod == MultipleGradientPaint.NO_CYCLE)
    {
      transparencyTest &= gradientUnderflow;
      transparencyTest &= gradientOverflow;
    }
    gradients = new int[fractions.length - 1][];
    gradientsLength = gradients.length;
    int i = normalizedIntervals.length;
    float f = 1.0F;
    for (int j = 0; j < i; j++) {
      f = f > normalizedIntervals[j] ? normalizedIntervals[j] : f;
    }
    int k = 0;
    if (f == 0.0F)
    {
      k = Integer.MAX_VALUE;
      hasDiscontinuity = true;
    }
    else
    {
      for (int m = 0; m < normalizedIntervals.length; m++) {
        k = (int)(k + normalizedIntervals[m] / f * 256.0F);
      }
    }
    if (k > 5000)
    {
      calculateMultipleArrayGradient(paramArrayOfColor1, paramArrayOfColor2);
      if ((cycleMethod == MultipleGradientPaint.REPEAT) && (gradients[0][0] != gradients[(gradients.length - 1)]['�'])) {
        hasDiscontinuity = true;
      }
    }
    else
    {
      calculateSingleArrayGradient(paramArrayOfColor1, paramArrayOfColor2, f);
      if ((cycleMethod == MultipleGradientPaint.REPEAT) && (gradient[0] != gradient[fastGradientArraySize])) {
        hasDiscontinuity = true;
      }
    }
    if (transparencyTest >>> 24 == 255)
    {
      if (dataModel.getColorSpace() == lrgbmodel_NA.getColorSpace()) {
        dataModel = lrgbmodel_NA;
      } else if (dataModel.getColorSpace() == srgbmodel_NA.getColorSpace()) {
        dataModel = srgbmodel_NA;
      }
      model = dataModel;
    }
  }
  
  private void calculateSingleArrayGradient(Color[] paramArrayOfColor1, Color[] paramArrayOfColor2, float paramFloat)
  {
    isSimpleLookup = true;
    int k = 1;
    int m = 32768;
    int n = 32768;
    int i1 = 32768;
    int i2 = 32768;
    for (int i3 = 0; i3 < gradients.length; i3++)
    {
      i4 = (int)(normalizedIntervals[i3] / paramFloat * 255.0F);
      k += i4;
      gradients[i3] = new int[i4];
      int i = paramArrayOfColor1[i3].getRGB();
      int j = paramArrayOfColor2[i3].getRGB();
      interpolate(i, j, gradients[i3]);
      i5 = gradients[i3]['?'];
      float f = normalizedIntervals[i3];
      m += (int)((i5 >> 8 & 0xFF0000) * f);
      n += (int)((i5 & 0xFF0000) * f);
      i1 += (int)((i5 << 8 & 0xFF0000) * f);
      i2 += (int)((i5 << 16 & 0xFF0000) * f);
      transparencyTest &= i;
      transparencyTest &= j;
    }
    gradientAverage = ((m & 0xFF0000) << 8 | n & 0xFF0000 | (i1 & 0xFF0000) >> 8 | (i2 & 0xFF0000) >> 16);
    gradient = new int[k];
    int i4 = 0;
    for (int i5 = 0; i5 < gradients.length; i5++)
    {
      System.arraycopy(gradients[i5], 0, gradient, i4, gradients[i5].length);
      i4 += gradients[i5].length;
    }
    gradient[(gradient.length - 1)] = paramArrayOfColor2[(paramArrayOfColor2.length - 1)].getRGB();
    int i6;
    if (colorSpace == MultipleGradientPaint.LINEAR_RGB)
    {
      if (dataModel.getColorSpace() == ColorSpace.getInstance(1000))
      {
        for (i6 = 0; i6 < gradient.length; i6++) {
          gradient[i6] = convertEntireColorLinearRGBtoSRGB(gradient[i6]);
        }
        gradientAverage = convertEntireColorLinearRGBtoSRGB(gradientAverage);
      }
    }
    else if (dataModel.getColorSpace() == ColorSpace.getInstance(1004))
    {
      for (i6 = 0; i6 < gradient.length; i6++) {
        gradient[i6] = convertEntireColorSRGBtoLinearRGB(gradient[i6]);
      }
      gradientAverage = convertEntireColorSRGBtoLinearRGB(gradientAverage);
    }
    fastGradientArraySize = (gradient.length - 1);
  }
  
  private void calculateMultipleArrayGradient(Color[] paramArrayOfColor1, Color[] paramArrayOfColor2)
  {
    isSimpleLookup = false;
    int k = 32768;
    int m = 32768;
    int n = 32768;
    int i1 = 32768;
    int i3;
    for (int i2 = 0; i2 < gradients.length; i2++) {
      if (normalizedIntervals[i2] != 0.0F)
      {
        gradients[i2] = new int['?'];
        int i = paramArrayOfColor1[i2].getRGB();
        int j = paramArrayOfColor2[i2].getRGB();
        interpolate(i, j, gradients[i2]);
        i3 = gradients[i2]['?'];
        float f = normalizedIntervals[i2];
        k += (int)((i3 >> 8 & 0xFF0000) * f);
        m += (int)((i3 & 0xFF0000) * f);
        n += (int)((i3 << 8 & 0xFF0000) * f);
        i1 += (int)((i3 << 16 & 0xFF0000) * f);
        transparencyTest &= i;
        transparencyTest &= j;
      }
    }
    gradientAverage = ((k & 0xFF0000) << 8 | m & 0xFF0000 | (n & 0xFF0000) >> 8 | (i1 & 0xFF0000) >> 16);
    int i4;
    if (colorSpace == MultipleGradientPaint.LINEAR_RGB)
    {
      if (dataModel.getColorSpace() == ColorSpace.getInstance(1000))
      {
        for (i3 = 0; i3 < gradients.length; i3++) {
          for (i4 = 0; i4 < gradients[i3].length; i4++) {
            gradients[i3][i4] = convertEntireColorLinearRGBtoSRGB(gradients[i3][i4]);
          }
        }
        gradientAverage = convertEntireColorLinearRGBtoSRGB(gradientAverage);
      }
    }
    else if (dataModel.getColorSpace() == ColorSpace.getInstance(1004))
    {
      for (i3 = 0; i3 < gradients.length; i3++) {
        for (i4 = 0; i4 < gradients[i3].length; i4++) {
          gradients[i3][i4] = convertEntireColorSRGBtoLinearRGB(gradients[i3][i4]);
        }
      }
      gradientAverage = convertEntireColorSRGBtoLinearRGB(gradientAverage);
    }
  }
  
  private void interpolate(int paramInt1, int paramInt2, int[] paramArrayOfInt)
  {
    float f = 1.0F / paramArrayOfInt.length;
    int i = paramInt1 >> 24 & 0xFF;
    int j = paramInt1 >> 16 & 0xFF;
    int k = paramInt1 >> 8 & 0xFF;
    int m = paramInt1 & 0xFF;
    int n = (paramInt2 >> 24 & 0xFF) - i;
    int i1 = (paramInt2 >> 16 & 0xFF) - j;
    int i2 = (paramInt2 >> 8 & 0xFF) - k;
    int i3 = (paramInt2 & 0xFF) - m;
    for (int i4 = 0; i4 < paramArrayOfInt.length; i4++) {
      paramArrayOfInt[i4] = ((int)(i + i4 * n * f + 0.5D) << 24 | (int)(j + i4 * i1 * f + 0.5D) << 16 | (int)(k + i4 * i2 * f + 0.5D) << 8 | (int)(m + i4 * i3 * f + 0.5D));
    }
  }
  
  private int convertEntireColorLinearRGBtoSRGB(int paramInt)
  {
    int i = paramInt >> 24 & 0xFF;
    int j = paramInt >> 16 & 0xFF;
    int k = paramInt >> 8 & 0xFF;
    int m = paramInt & 0xFF;
    j = LinearRGBtoSRGB[j];
    k = LinearRGBtoSRGB[k];
    m = LinearRGBtoSRGB[m];
    return i << 24 | j << 16 | k << 8 | m;
  }
  
  private int convertEntireColorSRGBtoLinearRGB(int paramInt)
  {
    int i = paramInt >> 24 & 0xFF;
    int j = paramInt >> 16 & 0xFF;
    int k = paramInt >> 8 & 0xFF;
    int m = paramInt & 0xFF;
    j = SRGBtoLinearRGB[j];
    k = SRGBtoLinearRGB[k];
    m = SRGBtoLinearRGB[m];
    return i << 24 | j << 16 | k << 8 | m;
  }
  
  protected final int indexIntoGradientsArrays(float paramFloat)
  {
    int k;
    if (cycleMethod == MultipleGradientPaint.NO_CYCLE)
    {
      if (paramFloat >= 1.0F) {
        return gradientOverflow;
      }
      if (paramFloat <= 0.0F) {
        return gradientUnderflow;
      }
    }
    else
    {
      if (cycleMethod == MultipleGradientPaint.REPEAT)
      {
        paramFloat -= (int)paramFloat;
        if (paramFloat < 0.0F) {
          paramFloat += 1.0F;
        }
        i = 0;
        int j = 0;
        k = 0;
        int m;
        if (isSimpleLookup)
        {
          paramFloat *= gradient.length;
          m = (int)paramFloat;
          if (m + 1 < gradient.length) {
            return gradient[m];
          }
          i = (int)((paramFloat - m) * 65536.0F);
          j = gradient[m];
          k = gradient[0];
        }
        else
        {
          for (m = 0; m < gradientsLength; m++) {
            if (paramFloat < fractions[(m + 1)])
            {
              float f2 = paramFloat - fractions[m];
              f2 = f2 / normalizedIntervals[m] * 256.0F;
              int n = (int)f2;
              if ((n + 1 < gradients[m].length) || (m + 1 < gradientsLength)) {
                return gradients[m][n];
              }
              i = (int)((f2 - n) * 65536.0F);
              j = gradients[m][n];
              k = gradients[0][0];
              break;
            }
          }
        }
        return ((j >> 8 & 0xFF0000) + ((k >>> 24) - (j >>> 24)) * i & 0xFF0000) << 8 | (j & 0xFF0000) + ((k >> 16 & 0xFF) - (j >> 16 & 0xFF)) * i & 0xFF0000 | ((j << 8 & 0xFF0000) + ((k >> 8 & 0xFF) - (j >> 8 & 0xFF)) * i & 0xFF0000) >> 8 | ((j << 16 & 0xFF0000) + ((k & 0xFF) - (j & 0xFF)) * i & 0xFF0000) >> 16;
      }
      if (paramFloat < 0.0F) {
        paramFloat = -paramFloat;
      }
      i = (int)paramFloat;
      paramFloat -= i;
      if ((i & 0x1) == 1) {
        paramFloat = 1.0F - paramFloat;
      }
    }
    if (isSimpleLookup) {
      return gradient[((int)(paramFloat * fastGradientArraySize))];
    }
    for (int i = 0; i < gradientsLength; i++) {
      if (paramFloat < fractions[(i + 1)])
      {
        float f1 = paramFloat - fractions[i];
        k = (int)(f1 / normalizedIntervals[i] * 255.0F);
        return gradients[i][k];
      }
    }
    return gradientOverflow;
  }
  
  protected final int indexGradientAntiAlias(float paramFloat1, float paramFloat2)
  {
    int k;
    int m;
    if (cycleMethod == MultipleGradientPaint.NO_CYCLE)
    {
      float f1 = paramFloat1 - paramFloat2 / 2.0F;
      f2 = paramFloat1 + paramFloat2 / 2.0F;
      if (f1 >= 1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd