org.apache.batik.ext.awt
Class LinearGradientPaintContext

java.lang.Object
  extended by org.apache.batik.ext.awt.MultipleGradientPaintContext
      extended by org.apache.batik.ext.awt.LinearGradientPaintContext
All Implemented Interfaces:
java.awt.PaintContext

final class LinearGradientPaintContext
extends MultipleGradientPaintContext

Provides the actual implementation for the LinearGradientPaint This is where the pixel processing is done.

Version:
$Id: LinearGradientPaintContext.java,v 1.13 2005/03/27 08:58:32 cam Exp $
Author:
Nicholas Talian, Vincent Hardy, Jim Graham, Jerry Evans, Vincent Hardy
See Also:
PaintContext, Paint, GradientPaint

Field Summary
private static int ANTI_ALIAS_IMPL
           
private static int DEFAULT_IMPL
           
private  float dgdX
          The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc
private  float dgdY
          The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc
private  int fillMethod
           
private  float gc
          The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc
private  float pixSz
          The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc
 
Fields inherited from class org.apache.batik.ext.awt.MultipleGradientPaintContext
a00, a01, a02, a10, a11, a12, cached, cachedModel, colorSpace, cycleMethod, dataModel, DEBUG, fastGradientArraySize, fractions, gradient, GRADIENT_SIZE, GRADIENT_SIZE_INDEX, gradientAverage, gradientOverflow, gradients, gradientsLength, gradientUnderflow, hasDiscontinuity, isSimpleLookup, model, normalizedIntervals, saved
 
Constructor Summary
LinearGradientPaintContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform t, java.awt.RenderingHints hints, java.awt.geom.Point2D dStart, java.awt.geom.Point2D dEnd, float[] fractions, java.awt.Color[] colors, MultipleGradientPaint.CycleMethodEnum cycleMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace)
          Constructor for LinearGradientPaintContext.
 
Method Summary
protected  void fillHardNoCycle(int[] pixels, int off, int adjust, int x, int y, int w, int h)
           
protected  void fillRaster(int[] pixels, int off, int adjust, int x, int y, int w, int h)
          Return a Raster containing the colors generated for the graphics operation.
protected  void fillSimpleNoCycle(int[] pixels, int off, int adjust, int x, int y, int w, int h)
           
protected  void fillSimpleReflect(int[] pixels, int off, int adjust, int x, int y, int w, int h)
           
protected  void fillSimpleRepeat(int[] pixels, int off, int adjust, int x, int y, int w, int h)
           
 
Methods inherited from class org.apache.batik.ext.awt.MultipleGradientPaintContext
calculateGradientFractions, dispose, getCachedRaster, getColorModel, getRaster, indexGradientAntiAlias, indexIntoGradientsArrays, putCachedRaster
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dgdX

private float dgdX
The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc


dgdY

private float dgdY
The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc


gc

private float gc
The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc


pixSz

private float pixSz
The following invariants are used to process the gradient value from a device space coordinate, (X, Y): g(X, Y) = dgdX*X + dgdY*Y + gc


DEFAULT_IMPL

private static final int DEFAULT_IMPL
See Also:
Constant Field Values

ANTI_ALIAS_IMPL

private static final int ANTI_ALIAS_IMPL
See Also:
Constant Field Values

fillMethod

private int fillMethod
Constructor Detail

LinearGradientPaintContext

public LinearGradientPaintContext(java.awt.image.ColorModel cm,
                                  java.awt.Rectangle deviceBounds,
                                  java.awt.geom.Rectangle2D userBounds,
                                  java.awt.geom.AffineTransform t,
                                  java.awt.RenderingHints hints,
                                  java.awt.geom.Point2D dStart,
                                  java.awt.geom.Point2D dEnd,
                                  float[] fractions,
                                  java.awt.Color[] colors,
                                  MultipleGradientPaint.CycleMethodEnum cycleMethod,
                                  MultipleGradientPaint.ColorSpaceEnum colorSpace)
                           throws java.awt.geom.NoninvertibleTransformException
Constructor for LinearGradientPaintContext.

Parameters:
cm - ColorModel that receives the Paint data. This is used only as a hint.
deviceBounds - the device space bounding box of the graphics primitive being rendered
userBounds - the user space bounding box of the graphics primitive being rendered
t - the AffineTransform from user space into device space (gradientTransform should be concatenated with this)
hints - the hints that the context object uses to choose between rendering alternatives
dStart - gradient start point, in user space
dEnd - gradient end point, in user space
fractions - the fractions specifying the gradient distribution
colors - the gradient colors
cycleMethod - either NO_CYCLE, REFLECT, or REPEAT
colorSpace - which colorspace to use for interpolation, either SRGB or LINEAR_RGB
Throws:
java.awt.geom.NoninvertibleTransformException
Method Detail

fillHardNoCycle

protected void fillHardNoCycle(int[] pixels,
                               int off,
                               int adjust,
                               int x,
                               int y,
                               int w,
                               int h)

fillSimpleNoCycle

protected void fillSimpleNoCycle(int[] pixels,
                                 int off,
                                 int adjust,
                                 int x,
                                 int y,
                                 int w,
                                 int h)

fillSimpleRepeat

protected void fillSimpleRepeat(int[] pixels,
                                int off,
                                int adjust,
                                int x,
                                int y,
                                int w,
                                int h)

fillSimpleReflect

protected void fillSimpleReflect(int[] pixels,
                                 int off,
                                 int adjust,
                                 int x,
                                 int y,
                                 int w,
                                 int h)

fillRaster

protected void fillRaster(int[] pixels,
                          int off,
                          int adjust,
                          int x,
                          int y,
                          int w,
                          int h)
Return a Raster containing the colors generated for the graphics operation. This is where the area is filled with colors distributed linearly.

Specified by:
fillRaster in class MultipleGradientPaintContext
Parameters:
x - The area in device space for which colors are generated.
y - The area in device space for which colors are generated.
w - The area in device space for which colors are generated.
h - The area in device space for which colors are generated.