You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/10/25 21:01:49 UTC

svn commit: r1402274 [8/31] - in /incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext: ./ awt/ awt/color/ awt/font/ awt/g2d/ awt/geom/ awt/image/ awt/image/codec/ awt/image/codec/jpeg/ awt/image/codec/pn...

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/AbstractLight.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/AbstractLight.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/AbstractLight.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/AbstractLight.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,146 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+import java.awt.Color;
+
+/**
+ * An abstract implementation of the Light interface.
+ *
+ * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
+ * @version $Id: AbstractLight.java 475477 2006-11-15 22:44:28Z cam $
+ */
+public abstract class AbstractLight implements Light {
+    /**
+     * Conversion function for light values.
+     */
+    public static final double sRGBToLsRGB(double value) {
+        if(value <= 0.003928)
+            return value/12.92;
+        return Math.pow((value+0.055)/1.055, 2.4);
+    }
+
+    /**
+     * Light color in linear sRGB
+     */
+    private double[] color;
+
+    /**
+     * @param  linear if true the color is returned in the Linear sRGB
+     *                colorspace otherwise the color is in the gamma
+     *                corrected sRGB color space.
+     * @return the light's color 
+     */
+    public double[] getColor(boolean linear){
+        double [] ret = new double[3];
+        if (linear) {
+            ret[0] = sRGBToLsRGB(color[0]);
+            ret[1] = sRGBToLsRGB(color[1]);
+            ret[2] = sRGBToLsRGB(color[2]);
+        } else {
+            ret[0] = color[0];
+            ret[1] = color[1];
+            ret[2] = color[2];
+        }
+        return ret;
+    }
+
+    public AbstractLight(Color color){
+        setColor(color);
+    }
+
+    /**
+     * Sets the new light color, <tt>newColor</tt> should be in sRGB.
+     */
+    public void setColor(Color newColor){
+        color = new double[3];
+        color[0] = newColor.getRed()  /255.;
+        color[1] = newColor.getGreen()/255.;
+        color[2] = newColor.getBlue() /255.;
+    }
+
+    /**
+     * @return true if the light is constant over the whole surface
+     */
+    public boolean isConstant(){
+        return true;
+    }
+
+    /**
+     * Returns a light map, starting in (x, y) with dx, dy increments, a given
+     * width and height, and z elevations stored in the fourth component on the 
+     * N array.
+     *
+     * @param x x-axis coordinate where the light should be computed
+     * @param y y-axis coordinate where the light should be computed
+     * @param dx delta x for computing light vectors in user space
+     * @param dy delta y for computing light vectors in user space
+     * @param width number of samples to compute on the x axis
+     * @param height number of samples to compute on the y axis
+     * @param z array containing the z elevation for all the points
+     */
+    public double[][][] getLightMap(double x, double y, 
+                                    final double dx, final double dy,
+                                    final int width, final int height,
+                                    final double[][][] z)
+    {
+        double[][][] L = new double[height][][];
+
+        for(int i=0; i<height; i++){
+            L[i] = getLightRow(x, y, dx, width, z[i], null);
+            y += dy;
+        }
+
+        return L;
+    }
+
+    /**
+     * Returns a row of the light map, starting at (x, y) with dx
+     * increments, a given width, and z elevations stored in the
+     * fourth component on the N array.
+     *
+     * @param x x-axis coordinate where the light should be computed
+     * @param y y-axis coordinate where the light should be computed
+     * @param dx delta x for computing light vectors in user space
+     * @param width number of samples to compute on the x axis
+     * @param z array containing the z elevation for all the points
+     * @param lightRow array to store the light info to, if null it will
+     *                 be allocated for you and returned.
+     *
+     * @return an array width columns where each element
+     *         is an array of three components representing the x, y and z
+     *         components of the light vector.  */
+    public double[][] getLightRow(double x, double y, 
+                                  final double dx, final int width,
+                                  final double[][] z,
+                                  final double[][] lightRow) {
+        double [][] ret = lightRow;
+        if (ret == null) 
+            ret = new double[width][3];
+
+        for(int i=0; i<width; i++){
+            getLight(x, y, z[i][3], ret[i]);
+            x += dx;
+        }
+
+        return ret;
+    }
+}
+
+

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/AbstractLight.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ComponentTransferFunction.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ComponentTransferFunction.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ComponentTransferFunction.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ComponentTransferFunction.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,73 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+/**
+ * Defines the interface expected from a component
+ * transfer function.
+ *
+ * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
+ * @version $Id: ComponentTransferFunction.java 478249 2006-11-22 17:29:37Z dvholten $
+ */
+public interface ComponentTransferFunction {
+    /**
+     * The various transfer types
+     */
+    int IDENTITY = 0;
+    int TABLE    = 1;
+    int DISCRETE = 2;
+    int LINEAR   = 3;
+    int GAMMA    = 4;
+
+    /**
+     * Returns the type of this transfer function
+     */
+    int getType();
+
+    /**
+     * Returns the slope value for this transfer function
+     */
+    float getSlope();
+
+    /**
+     * Returns the table values for this transfer function
+     */
+    float[] getTableValues();
+
+    /**
+     * Returns the intercept value for this transfer function
+     */
+    float getIntercept();
+
+    /**
+     * Returns the amplitude value for this transfer function
+     */
+    float getAmplitude();
+
+    /**
+     * Returns the exponent value for this transfer function
+     */
+    float getExponent();
+
+    /**
+     * Returns the offset value for this transfer function
+     */
+    float getOffset();
+}
+

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ComponentTransferFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/CompositeRule.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/CompositeRule.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/CompositeRule.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/CompositeRule.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,278 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+/**
+ * This is a typesafe enumeration of the standard Composite rules for
+ * the CompositeRable operation. (over, in, out, atop, xor, arith)
+ *
+ * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
+ * @version $Id: CompositeRule.java 478249 2006-11-22 17:29:37Z dvholten $
+ */
+public final class CompositeRule implements java.io.Serializable {
+
+    /** Porter-Duff src over rule, also used for feBlend <tt>normal</tt>. */
+    public static final int RULE_OVER = 1;
+
+    /** Porter-Duff src in rule. */
+    public static final int RULE_IN = 2;
+
+    /** Porter-Duff src out rule. */
+    public static final int RULE_OUT = 3;
+
+    /** Porter-Duff src atop rule. */
+    public static final int RULE_ATOP = 4;
+
+    /** Porter-Duff src xor rule. */
+    public static final int RULE_XOR = 5;
+
+    /** Arithmatic rule 'out = k1*i1*i2 + k2*i1 + k3*i2 + k4'. */
+    public static final int RULE_ARITHMETIC = 6;
+
+    /** SVG feBlend Multiply rule */
+    public static final int RULE_MULTIPLY = 7;
+
+    /** SVG feBlend Screen rule */
+    public static final int RULE_SCREEN = 8;
+
+    /** SVG feBlend Darken rule */
+    public static final int RULE_DARKEN = 9;
+
+    /** SVG feBlend Lighten rule */
+    public static final int RULE_LIGHTEN = 10;
+
+
+      /**
+       * Porter-Duff Source Over Destination rule. The source is
+       * composited over the destination.<pre>
+       *
+       *  Fs = 1 and Fd = (1-As), thus:
+       *
+       *        Cd = Cs + Cd*(1-As)
+       *        Ad = As + Ad*(1-As)</pre>
+       * </pre>
+       */
+    public static final CompositeRule OVER = new CompositeRule(RULE_OVER);
+
+      /**
+       * Porter-Duff Source In Destination rule. The part of the
+       * source lying inside of the destination replaces the destination.<pre>
+       *
+       *  Fs = Ad and Fd = 0, thus:
+       *
+       *        Cd = Cs*Ad
+       *        Ad = As*Ad
+       * </pre>
+       */
+    public static final CompositeRule IN = new CompositeRule(RULE_IN);
+
+      /**
+       * Porter-Duff Source Out Destination rule. The part of the
+       * source lying outside of the destination replaces the destination.<pre>
+       *
+       *  Fs = (1-Ad) and Fd = 0, thus:
+       *
+       *        Cd = Cs*(1-Ad)
+       *        Ad = As*(1-Ad)
+       * </pre>
+       */
+    public static final CompositeRule OUT = new CompositeRule(RULE_OUT);
+
+      /**
+       * Porter-Duff Source Atop Destination rule. The part of the
+       * source lying inside of the destination replaces the destination,
+       * destination remains outside of source.<pre>
+       *
+       *  Fs = Ad and Fd = (1-As), thus:
+       *
+       *        Cd = Cs*Ad + Cd*(1-As)
+       *        Ad = As*Ad + Ad*(1-As)
+       * </pre>
+       */
+    public static final CompositeRule ATOP = new CompositeRule(RULE_ATOP);
+
+      /**
+       * Xor rule. The source and destination are Xor'ed togeather.<pre>
+       *
+       *  Fs = (1-Ad) and Fd = (1-As), thus:
+       *
+       *        Cd = Cs*(1-Ad) + Cd*(1-As)
+       *        Ad = As*(1-Ad) + Ad*(1-As)
+       * </pre>
+       */
+    public static final CompositeRule XOR = new CompositeRule(RULE_XOR);
+
+      /**
+       * Factory to create artithmatic CompositeRules.
+       * 'out = k1*i1*i2 + k2*i1 + k3*i2 + k4'
+       * Note that arithmatic CompositeRules are not singletons.
+       */
+    public static CompositeRule ARITHMETIC
+        (float k1, float k2, float k3, float k4) {
+        return new CompositeRule(k1, k2, k3, k4);
+    }
+
+      /**
+       * FeBlend Multiply rule. <pre>
+       *
+       *        Cd = Cs*(1-Ad) + Cd*(1-As) + Cs*Cd
+       *        Ad = 1 - (1-Ad)*(1-As)
+       * </pre>
+       */
+    public static final CompositeRule MULTIPLY =
+        new CompositeRule(RULE_MULTIPLY);
+
+      /**
+       * FeBlend Screen rule. <pre>
+       *
+       *        Cd = Cs + Cd - Cs*Cd
+       *        Ad = 1 - (1-Ad)*(1-As)
+       * </pre>
+       */
+    public static final CompositeRule SCREEN =
+        new CompositeRule(RULE_SCREEN);
+
+      /**
+       * FeBlend Darken rule. <pre>
+       *
+       *        Cd = Min(Cs*(1-Ad) + Cd,
+       *                 Cd*(1-As) + Cs)
+       *        Ad = 1 - (1-Ad)*(1-As)
+       * </pre>
+       */
+    public static final CompositeRule DARKEN =
+        new CompositeRule(RULE_DARKEN);
+
+
+      /**
+       * FeBlend Lighten rule. <pre>
+       *
+       *        Cd = Max(Cs*(1-Ad) + Cd,
+       *                 Cd*(1-As) + Cs)
+       *        Ad = 1 - (1-Ad)*(1-As)
+       * </pre>
+       */
+    public static final CompositeRule LIGHTEN =
+        new CompositeRule(RULE_LIGHTEN);
+
+
+    /**
+     * Returns the type of this composite rule
+     */
+    public int getRule() {
+        return rule;
+    }
+
+      /**
+       * The composite rule for this object.
+       */
+    private int rule;
+
+      /* Arithmatic constants, only used for RULE_ARITHMETIC */
+    private float k1, k2, k3, k4;
+
+    private CompositeRule(int rule) {
+        this.rule = rule;
+    }
+
+    private CompositeRule(float k1, float k2, float k3, float k4) {
+        rule = RULE_ARITHMETIC;
+        this.k1 = k1;
+        this.k2 = k2;
+        this.k3 = k3;
+        this.k4 = k4;
+    }
+
+    public float [] getCoefficients() {
+        if (rule != RULE_ARITHMETIC)
+            return null;
+
+        return new float[] {k1, k2, k3, k4};
+    }
+
+    /**
+     * This is called by the serialization code before it returns
+     * an unserialized object. To provide for unicity of
+     * instances, the instance that was read is replaced by its
+     * static equivalent. See the serialiazation specification for
+     * further details on this method's logic.
+     */
+    private Object readResolve() throws java.io.ObjectStreamException {
+        switch(rule){
+        case RULE_OVER:
+            return OVER;
+        case RULE_IN:
+            return IN;
+        case RULE_OUT:
+            return OUT;
+        case RULE_ATOP:
+            return ATOP;
+        case RULE_XOR:
+            return XOR;
+        case RULE_ARITHMETIC:
+            return this;
+        case RULE_MULTIPLY:
+            return MULTIPLY;
+        case RULE_SCREEN:
+            return SCREEN;
+        case RULE_DARKEN:
+            return DARKEN;
+        case RULE_LIGHTEN:
+            return LIGHTEN;
+        default:
+            throw new Error("Unknown Composite Rule type");
+        }
+    }
+
+    /**
+     * This is called by the serialization code before it returns
+     * an unserialized object. To provide for unicity of
+     * instances, the instance that was read is replaced by its
+     * static equivalent. See the serialiazation specification for
+     * further details on this method's logic.
+     */
+    public String toString() {
+        switch(rule){
+        case RULE_OVER:
+            return "[CompositeRule: OVER]";
+        case RULE_IN:
+            return "[CompositeRule: IN]";
+        case RULE_OUT:
+            return "[CompositeRule: OUT]";
+        case RULE_ATOP:
+            return "[CompositeRule: ATOP]";
+        case RULE_XOR:
+            return "[CompositeRule: XOR]";
+        case RULE_ARITHMETIC:
+            return ("[CompositeRule: ARITHMATIC k1:" +
+                    k1 + " k2: " + k2 + " k3: " + k3 + " k4: " + k4 + ']' );
+        case RULE_MULTIPLY:
+            return "[CompositeRule: MULTIPLY]";
+        case RULE_SCREEN:
+            return "[CompositeRule: SCREEN]";
+        case RULE_DARKEN:
+            return "[CompositeRule: DARKEN]";
+        case RULE_LIGHTEN:
+            return "[CompositeRule: LIGHTEN]";
+        default:
+            throw new Error("Unknown Composite Rule type");
+        }
+    }
+
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/CompositeRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ConcreteComponentTransferFunction.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ConcreteComponentTransferFunction.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ConcreteComponentTransferFunction.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ConcreteComponentTransferFunction.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,182 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+
+
+/**
+ * This class implements the interface expected from a component
+ * transfer function.
+ *
+ * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
+ * @version $Id: ConcreteComponentTransferFunction.java 478249 2006-11-22 17:29:37Z dvholten $
+ */
+public class ConcreteComponentTransferFunction implements ComponentTransferFunction {
+    private int type;
+    private float slope;
+    private float[] tableValues;
+    private float intercept;
+    private float amplitude;
+    private float exponent;
+    private float offset;
+
+    /**
+     * Instances should be created through the various
+     * factory methods.
+     */
+    private ConcreteComponentTransferFunction(){
+    }
+
+    /**
+     * Returns an instance initialized as an identity
+     * transfer function
+     */
+    public static ComponentTransferFunction getIdentityTransfer(){
+        ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction();
+        f.type = IDENTITY;
+        return f;
+    }
+
+    /**
+     * Returns a table transfer function
+     */
+    public static ComponentTransferFunction
+        getTableTransfer(float[] tableValues){
+        ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction();
+        f.type = TABLE;
+
+        if(tableValues == null){
+            throw new IllegalArgumentException();
+        }
+
+        if(tableValues.length < 2){
+            throw new IllegalArgumentException();
+        }
+
+        f.tableValues = new float[tableValues.length];
+        System.arraycopy(tableValues, 0,
+                         f.tableValues, 0,
+                         tableValues.length);
+
+        return f;
+    }
+
+    /**
+     * Returns a discrete transfer function
+     */
+    public static ComponentTransferFunction
+        getDiscreteTransfer(float[] tableValues){
+        ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction();
+        f.type = DISCRETE;
+
+        if(tableValues == null){
+            throw new IllegalArgumentException();
+        }
+
+        if(tableValues.length < 2){
+            throw new IllegalArgumentException();
+        }
+
+        f.tableValues = new float[tableValues.length];
+        System.arraycopy(tableValues, 0,
+                         f.tableValues, 0,
+                         tableValues.length);
+
+        return f;
+    }
+
+    /**
+     * Returns a linear transfer function
+     */
+    public static ComponentTransferFunction
+        getLinearTransfer(float slope, float intercept){
+        ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction();
+        f.type = LINEAR;
+        f.slope = slope;
+        f.intercept = intercept;
+
+        return f;
+    }
+
+    /**
+     * Returns a gamma function
+     */
+    public static ComponentTransferFunction
+        getGammaTransfer(float amplitude,
+                         float exponent,
+                         float offset){
+        ConcreteComponentTransferFunction f = new ConcreteComponentTransferFunction();
+        f.type = GAMMA;
+        f.amplitude = amplitude;
+        f.exponent = exponent;
+        f.offset = offset;
+
+        return f;
+    }
+
+    /**
+     * Returns the type of this transfer function
+     */
+    public int getType(){
+        return type;
+    }
+
+    /**
+     * Returns the slope value for this transfer function
+     */
+    public float getSlope(){
+        return slope;
+    }
+
+    /**
+     * Returns the table values for this transfer function
+     */
+    public float[] getTableValues(){
+        return tableValues;
+    }
+
+    /**
+     * Returns the intercept value for this transfer function
+     */
+    public float getIntercept(){
+        return intercept;
+    }
+
+    /**
+     * Returns the amplitude value for this transfer function
+     */
+    public float getAmplitude(){
+        return amplitude;
+    }
+
+    /**
+     * Returns the exponent value for this transfer function
+     */
+    public float getExponent(){
+        return exponent;
+    }
+
+    /**
+     * Returns the offset value for this transfer function
+     */
+    public float getOffset(){
+        return offset;
+    }
+}
+

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/ConcreteComponentTransferFunction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DiscreteTransfer.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DiscreteTransfer.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DiscreteTransfer.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DiscreteTransfer.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,79 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+
+/**
+ * This class defines the Discrete type transfer function for the
+ * feComponentTransfer filter, as defined in chapter 15, section 11
+ * of the SVG specification.
+ *
+ * @author <a href="mailto:sheng.pei@sun.com">Sheng Pei</a>
+ * @version $Id: DiscreteTransfer.java 475477 2006-11-15 22:44:28Z cam $
+ */
+public class DiscreteTransfer implements TransferFunction {
+    /**
+     * This byte array stores the lookuptable data
+     */
+    public byte [] lutData;
+
+    /**
+     * This int array is the input table values from the user
+     */
+    public int [] tableValues;
+
+    /*
+     * The number of the input table's elements
+     */
+    private int n;
+
+    /**
+     * The input is an int array which will be used
+     * later to construct the lut data
+     */
+    public DiscreteTransfer(int [] tableValues){
+        this.tableValues = tableValues;
+        this.n = tableValues.length;
+    }
+
+    /*
+     * This method will build the lut data. Each entry
+     * has the value as its index.
+     */
+    private void buildLutData(){
+        lutData = new byte [256];
+        int i, j;
+        for (j=0; j<=255; j++){
+            i = (int)(Math.floor(j*n/255f));
+            if(i == n){
+                i = n-1;
+            }
+            lutData[j] = (byte)(tableValues[i] & 0xff);
+        }
+    }
+
+    /**
+     * This method will return the lut data in order
+     * to construct a LookUpTable object
+     */
+    public byte [] getLookupTable(){
+        buildLutData();
+        return lutData;
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DiscreteTransfer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DistantLight.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DistantLight.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DistantLight.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DistantLight.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,144 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+import java.awt.Color;
+
+/**
+ * A light source placed at the infinity, such that the light angle is
+ * constant over the whole surface.
+ *
+ * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
+ * @version $Id: DistantLight.java 501495 2007-01-30 18:00:36Z dvholten $
+ */
+public class DistantLight extends AbstractLight {
+    /**
+     * The azimuth of the distant light, i.e., the angle of the light vector
+     * on the (X, Y) plane
+     */
+    private double azimuth;
+
+    /**
+     * The elevation of the distant light, i.e., the angle of the light
+     * vector on the (X, Z) plane.
+     */
+    private double elevation;
+
+    /**
+     * Light vector
+     */
+    private double Lx, Ly, Lz;
+
+    /**
+     * @return the DistantLight's azimuth
+     */
+    public double getAzimuth(){
+        return azimuth;
+    }
+
+    /**
+     * @return the DistantLight's elevation
+     */
+    public double getElevation(){
+        return elevation;
+    }
+
+    public DistantLight(double azimuth, double elevation, Color color){
+        super(color);
+
+        this.azimuth = azimuth;
+        this.elevation = elevation;
+
+        Lx = Math.cos( Math.toRadians( azimuth ) ) * Math.cos( Math.toRadians( elevation ) );
+        Ly = Math.sin( Math.toRadians( azimuth ) ) * Math.cos( Math.toRadians( elevation ) );
+        Lz = Math.sin( Math.toRadians( elevation ));
+    }
+
+    /**
+     * @return true if the light is constant over the whole surface
+     */
+    public boolean isConstant(){
+        return true;
+    }
+
+    /**
+     * Computes the light vector in (x, y)
+     *
+     * @param x x-axis coordinate where the light should be computed
+     * @param y y-axis coordinate where the light should be computed
+     * @param L array of length 3 where the result is stored
+     */
+    public void getLight(final double x, final double y, final double z,
+                         final double[] L){
+        L[0] = Lx;
+        L[1] = Ly;
+        L[2] = Lz;
+    }
+
+    /**
+     * Returns a row of the light map, starting at (x, y) with dx
+     * increments, a given width, and z elevations stored in the
+     * fourth component on the N array.
+     *
+     * @param x x-axis coordinate where the light should be computed
+     * @param y y-axis coordinate where the light should be computed
+     * @param dx delta x for computing light vectors in user space
+     * @param width number of samples to compute on the x axis
+     * @param z array containing the z elevation for all the points
+     * @param lightRow array to store the light info to, if null it will
+     *                 be allocated for you and returned.
+     *
+     * @return an array width columns where each element
+     *         is an array of three components representing the x, y and z
+     *         components of the light vector.  */
+    public double[][] getLightRow(double x, double y,
+                                  final double dx, final int width,
+                                  final double[][] z,
+                                  final double[][] lightRow) {
+        double [][] ret = lightRow;
+
+        if (ret == null) {
+            // If we are allocating then use the same light vector for
+            // all entries.
+            ret = new double[width][];
+
+            double[] CL = new double[3];
+            CL[0]=Lx;
+            CL[1]=Ly;
+            CL[2]=Lz;
+
+            for(int i=0; i<width; i++){
+                ret[i] = CL;
+            }
+        } else {
+            final double lx = Lx;
+            final double ly = Ly;
+            final double lz = Lz;
+
+            for(int i=0; i<width; i++){
+                ret[i][0] = lx;
+                ret[i][1] = ly;
+                ret[i][2] = lz;
+            }
+        }
+
+        return ret;
+    }
+}
+

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/DistantLight.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/GammaTransfer.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/GammaTransfer.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/GammaTransfer.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/GammaTransfer.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,90 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image;
+
+
+/**
+ * GammaTransfer.java
+ *
+ * This class defines the Gamma type transfer function for the
+ * feComponentTransfer filter, as defined in chapter 15, section 11 of the SVG
+ * specification.
+ *
+ * @author <a href="mailto:sheng.pei@sun.com">Sheng Pei</a>
+ * @version $Id: GammaTransfer.java 475477 2006-11-15 22:44:28Z cam $ 
+ */
+public class GammaTransfer implements TransferFunction {
+    /**
+     * This byte array stores the lookuptable data
+     */
+    public byte [] lutData;
+
+    /**
+     * The amplitude of the Gamma function
+     */
+    public float amplitude;
+
+    /**
+     * The exponent of the Gamma function
+     */
+    public float exponent;
+
+    /**
+     * The offset of the Gamma function
+     */
+    public float offset;
+
+    /**
+     * Three floats as the input for the Gamma function
+     */
+    public GammaTransfer(float amplitude, float exponent, float offset){
+        this.amplitude = amplitude;
+        this.exponent = exponent;
+        this.offset = offset;
+    }
+
+    /*
+     * This method will build the lut data. Each entry's
+     * value is in form of "amplitude*pow(C, exponent) + offset"
+     */
+    private void buildLutData(){
+        lutData = new byte [256];
+        int j, v;
+        for (j=0; j<=255; j++){
+            v = (int)Math.round(255*(amplitude*Math.pow(j/255f, exponent)+offset));
+            if(v > 255){
+                v = (byte)0xff;
+            }
+            else if(v < 0){
+                v = (byte)0x00;
+            }
+            lutData[j] = (byte)(v & 0xff);
+        }
+    }
+
+
+    /**
+     * This method will return the lut data in order
+     * to construct a LookUpTable object
+     */
+    public byte [] getLookupTable(){
+        buildLutData();
+        return lutData;
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/GammaTransfer.java
------------------------------------------------------------------------------
    svn:eol-style = native