Skip to content

Commit

Permalink
Remove batik dependency. (#3)
Browse files Browse the repository at this point in the history
* Removing batik dependency.

* Removing dependency on Batik gradient code.
  • Loading branch information
blackears authored Aug 10, 2016
1 parent 9d03f97 commit 5e363d0
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 4,212 deletions.
18 changes: 10 additions & 8 deletions svg-core/src/main/java/com/kitfox/svg/LinearGradient.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

import com.kitfox.svg.xml.StyleAttribute;
import java.awt.Color;
import java.awt.LinearGradientPaint;
import java.awt.MultipleGradientPaint;
import java.awt.Paint;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
Expand Down Expand Up @@ -96,18 +98,18 @@ protected void build() throws SVGException

public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
{
com.kitfox.svg.batik.MultipleGradientPaint.CycleMethodEnum method;
MultipleGradientPaint.CycleMethod method;
switch (spreadMethod)
{
default:
case SM_PAD:
method = com.kitfox.svg.batik.MultipleGradientPaint.NO_CYCLE;
method = MultipleGradientPaint.CycleMethod.NO_CYCLE;
break;
case SM_REPEAT:
method = com.kitfox.svg.batik.MultipleGradientPaint.REPEAT;
method = MultipleGradientPaint.CycleMethod.REPEAT;
break;
case SM_REFLECT:
method = com.kitfox.svg.batik.MultipleGradientPaint.REFLECT;
method = MultipleGradientPaint.CycleMethod.REFLECT;
break;
}

Expand All @@ -120,13 +122,13 @@ public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
paint = colors.length > 0 ? colors[0] : Color.black;
} else if (gradientUnits == GU_USER_SPACE_ON_USE)
{
paint = new com.kitfox.svg.batik.LinearGradientPaint(
paint = new LinearGradientPaint(
pt1,
pt2,
getStopFractions(),
getStopColors(),
method,
com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
MultipleGradientPaint.ColorSpaceType.SRGB,
gradientTransform == null
? new AffineTransform()
: gradientTransform);
Expand All @@ -145,13 +147,13 @@ public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
viewXform.concatenate(gradientTransform);
}

paint = new com.kitfox.svg.batik.LinearGradientPaint(
paint = new LinearGradientPaint(
pt1,
pt2,
getStopFractions(),
getStopColors(),
method,
com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
MultipleGradientPaint.ColorSpaceType.SRGB,
viewXform);
}

Expand Down
1 change: 0 additions & 1 deletion svg-core/src/main/java/com/kitfox/svg/Path.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import java.awt.geom.GeneralPath;
import java.awt.geom.Rectangle2D;

//import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
/**
* @author Mark McKay
* @author <a href="mailto:[email protected]">Mark McKay</a>
Expand Down
19 changes: 10 additions & 9 deletions svg-core/src/main/java/com/kitfox/svg/RadialGradient.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
package com.kitfox.svg;

import com.kitfox.svg.xml.StyleAttribute;
import java.awt.Color;
import java.awt.MultipleGradientPaint;
import java.awt.Paint;
import java.awt.RadialGradientPaint;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
Expand Down Expand Up @@ -106,18 +107,18 @@ protected void build() throws SVGException

public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
{
com.kitfox.svg.batik.MultipleGradientPaint.CycleMethodEnum method;
MultipleGradientPaint.CycleMethod method;
switch (spreadMethod)
{
default:
case SM_PAD:
method = com.kitfox.svg.batik.MultipleGradientPaint.NO_CYCLE;
method = MultipleGradientPaint.CycleMethod.NO_CYCLE;
break;
case SM_REPEAT:
method = com.kitfox.svg.batik.MultipleGradientPaint.REPEAT;
method = MultipleGradientPaint.CycleMethod.REPEAT;
break;
case SM_REFLECT:
method = com.kitfox.svg.batik.MultipleGradientPaint.REFLECT;
method = MultipleGradientPaint.CycleMethod.REFLECT;
break;
}

Expand All @@ -126,14 +127,14 @@ public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
Point2D.Float pt2 = hasFocus ? new Point2D.Float(fx, fy) : pt1;
if (gradientUnits == GU_USER_SPACE_ON_USE)
{
paint = new com.kitfox.svg.batik.RadialGradientPaint(
paint = new RadialGradientPaint(
pt1,
r,
pt2,
getStopFractions(),
getStopColors(),
method,
com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
MultipleGradientPaint.ColorSpaceType.SRGB,
gradientTransform);
} else
{
Expand All @@ -143,14 +144,14 @@ public Paint getPaint(Rectangle2D bounds, AffineTransform xform)

viewXform.concatenate(gradientTransform);

paint = new com.kitfox.svg.batik.RadialGradientPaint(
paint = new RadialGradientPaint(
pt1,
r,
pt2,
getStopFractions(),
getStopColors(),
method,
com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
MultipleGradientPaint.ColorSpaceType.SRGB,
viewXform);
}

Expand Down
3 changes: 0 additions & 3 deletions svg-core/src/main/java/com/kitfox/svg/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@
package com.kitfox.svg;

import com.kitfox.svg.util.FontSystem;
import com.kitfox.svg.util.TextBuilder;
import com.kitfox.svg.xml.StyleAttribute;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
Expand All @@ -50,7 +48,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

//import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
/**
* @author Mark McKay
* @author <a href="mailto:[email protected]">Mark McKay</a>
Expand Down
Loading

0 comments on commit 5e363d0

Please sign in to comment.