Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
This commit is contained in:
parent
eaec4980e1
commit
4f9533c772
1640 changed files with 126485 additions and 104808 deletions
1951
libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
Normal file
1951
libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
Normal file
File diff suppressed because it is too large
Load diff
316
libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java
Normal file
316
libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java
Normal file
|
@ -0,0 +1,316 @@
|
|||
/* AlphaCompositeContext.java -- CompositeContext impl for AlphaComposite
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
import java.awt.AWTError;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.CompositeContext;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
|
||||
/**
|
||||
* A CompositeContext implementation for {@link AlphaComposite}.
|
||||
*
|
||||
* @author Roman Kennke (kennke@aicas.com)
|
||||
*/
|
||||
public class AlphaCompositeContext
|
||||
implements CompositeContext
|
||||
{
|
||||
|
||||
/**
|
||||
* The Composite object for which we perform compositing.
|
||||
*/
|
||||
private AlphaComposite composite;
|
||||
|
||||
/**
|
||||
* The source color model.
|
||||
*/
|
||||
private ColorModel srcColorModel;
|
||||
|
||||
/**
|
||||
* The destination color model.
|
||||
*/
|
||||
private ColorModel dstColorModel;
|
||||
|
||||
/**
|
||||
* The blending factor for the source.
|
||||
*/
|
||||
private float fs;
|
||||
|
||||
/**
|
||||
* The blending factor for the destination.
|
||||
*/
|
||||
private float fd;
|
||||
|
||||
/**
|
||||
* Creates a new AlphaCompositeContext.
|
||||
*
|
||||
* @param aComp the AlphaComposite object
|
||||
* @param srcCM the source color model
|
||||
* @param dstCM the destination color model
|
||||
*/
|
||||
public AlphaCompositeContext(AlphaComposite aComp, ColorModel srcCM,
|
||||
ColorModel dstCM)
|
||||
{
|
||||
composite = aComp;
|
||||
srcColorModel = srcCM;
|
||||
dstColorModel = dstCM;
|
||||
|
||||
|
||||
// Determine the blending factors according to the rule in the
|
||||
// AlphaComposite. For some rules the factors must be determined
|
||||
// dynamically because they depend on the actual pixel value.
|
||||
switch (composite.getRule())
|
||||
{
|
||||
case AlphaComposite.CLEAR:
|
||||
fs = 0.F;
|
||||
fd= 0.F;
|
||||
break;
|
||||
case AlphaComposite.DST:
|
||||
fs = 0.F;
|
||||
fd= 1.F;
|
||||
break;
|
||||
case AlphaComposite.DST_ATOP:
|
||||
fs = 1.F; // Determined later as 1 - alpha_dst;
|
||||
fd = 1.F; // Determined later as alpha_src;
|
||||
break;
|
||||
case AlphaComposite.DST_IN:
|
||||
fs = 0.F;
|
||||
fd = 0.F; // Determined later as alpha_src;
|
||||
break;
|
||||
case AlphaComposite.DST_OUT:
|
||||
fs = 0.F;
|
||||
fd = 0.F; // Determined later as 1 - alpha_src;
|
||||
break;
|
||||
case AlphaComposite.DST_OVER:
|
||||
fs = 1.F; // Determined later as 1 - alpha_dst.
|
||||
fd= 1.F;
|
||||
break;
|
||||
case AlphaComposite.SRC:
|
||||
fs = 1.F;
|
||||
fd= 0.F;
|
||||
break;
|
||||
case AlphaComposite.SRC_ATOP:
|
||||
fs = 1.F; // Determined later as alpha_dst;
|
||||
fd = 1.F; // Determined later as 1 - alpha_src;
|
||||
break;
|
||||
case AlphaComposite.SRC_IN:
|
||||
fs = 0.F; // Determined later as alpha_dst;
|
||||
fd = 0.F;
|
||||
break;
|
||||
case AlphaComposite.SRC_OUT:
|
||||
fs = 0.F; // Determined later as 1 - alpha_dst;
|
||||
fd = 0.F;
|
||||
break;
|
||||
case AlphaComposite.SRC_OVER:
|
||||
fs = 1.F;
|
||||
fd= 1.F; // Determined later as 1 - alpha_src.
|
||||
break;
|
||||
case AlphaComposite.XOR:
|
||||
fs = 1.F; // Determined later as 1 - alpha_dst.
|
||||
fd= 1.F; // Determined later as 1 - alpha_src.
|
||||
break;
|
||||
default:
|
||||
throw new AWTError("Illegal AlphaComposite rule");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases all resources held by this composite object.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
// Nothing to do here yet.
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs compositing according to the rules specified in the
|
||||
* AlphaComposite from the constructor.
|
||||
*/
|
||||
public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
|
||||
{
|
||||
|
||||
// TODO: This implementation is very general and highly inefficient. There
|
||||
// are two possible ways to optimize this:
|
||||
// 1. Special cased implementations for common ColorModels and transfer
|
||||
// types.
|
||||
// 2. Native implementation.
|
||||
|
||||
int x0 = src.getMinX();
|
||||
int y0 = src.getMinY();
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
int x1 = x0 + width;
|
||||
int y1 = y0 + height;
|
||||
|
||||
Object srcPixel = null;
|
||||
Object dstPixel = null;
|
||||
|
||||
// Prepare the array that holds the color and alpha components of the
|
||||
// source pixels.
|
||||
float[] srcComponents;
|
||||
int srcComponentsLength = srcColorModel.getNumComponents();
|
||||
if (! srcColorModel.hasAlpha())
|
||||
srcComponentsLength += 1;
|
||||
srcComponents = new float[srcComponentsLength];
|
||||
|
||||
// Prepare the array that holds the color and alpha components of the
|
||||
// destination pixels.
|
||||
float[] dstComponents;
|
||||
int dstComponentsLength = dstColorModel.getNumComponents();
|
||||
if (! dstColorModel.hasAlpha())
|
||||
dstComponentsLength += 1;
|
||||
dstComponents = new float[dstComponentsLength];
|
||||
|
||||
if (srcComponentsLength != dstComponentsLength)
|
||||
throw new AWTError("The color models of the source and destination have"
|
||||
+ "incompatible number of color components");
|
||||
|
||||
int srcTransferType = srcColorModel.getTransferType();
|
||||
int dstTransferType = dstColorModel.getTransferType();
|
||||
|
||||
for (int y = y0; y < y1; y++)
|
||||
{
|
||||
for (int x = x0; x < x1; x++)
|
||||
{
|
||||
// Fetch source pixel.
|
||||
srcPixel = src.getDataElements(x, y, (int[]) srcPixel);
|
||||
// Fetch destination pixel.
|
||||
dstPixel = dstIn.getDataElements(x, y, dstPixel);
|
||||
// Get normalized components. This is the only type that is
|
||||
// guaranteed to be supported by all ColorModels.
|
||||
srcComponents =
|
||||
srcColorModel.getNormalizedComponents(srcPixel, srcComponents, 0);
|
||||
if (! srcColorModel.hasAlpha())
|
||||
srcComponents[srcComponentsLength - 1] = 1.0F;
|
||||
dstComponents =
|
||||
dstColorModel.getNormalizedComponents(dstPixel, dstComponents, 0);
|
||||
if (! dstColorModel.hasAlpha())
|
||||
dstComponents[dstComponentsLength - 1] = 1.0F;
|
||||
|
||||
// Prepare the input.
|
||||
float compositeAlpha = composite.getAlpha();
|
||||
srcComponents[srcComponentsLength - 1] *= compositeAlpha;
|
||||
if (srcColorModel.isAlphaPremultiplied())
|
||||
{
|
||||
for (int i = srcComponentsLength - 2; i >= 0; i--)
|
||||
srcComponents[i] *= compositeAlpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = srcComponentsLength - 1; i >= 0; i--)
|
||||
srcComponents[i] *= srcComponents[srcComponentsLength - 1];
|
||||
}
|
||||
if (! dstColorModel.isAlphaPremultiplied())
|
||||
{
|
||||
for (int i = dstComponentsLength - 2; i >= 0; i--)
|
||||
dstComponents[i] *= dstComponents[dstComponents.length - 1];
|
||||
}
|
||||
|
||||
// Determine the blending factors according to the rule in the
|
||||
// AlphaComposite. For some rules the factors must be determined
|
||||
// dynamically because they depend on the actual pixel value.
|
||||
float srcAlpha = srcComponents[srcComponentsLength - 1];
|
||||
float dstAlpha = dstComponents[dstComponentsLength - 1];
|
||||
switch (composite.getRule())
|
||||
{
|
||||
case AlphaComposite.DST_ATOP:
|
||||
fs = 1.F - dstAlpha;
|
||||
fd = srcAlpha;
|
||||
break;
|
||||
case AlphaComposite.DST_IN:
|
||||
fd = srcAlpha;
|
||||
break;
|
||||
case AlphaComposite.DST_OUT:
|
||||
fd = 1.F - srcAlpha;
|
||||
break;
|
||||
case AlphaComposite.DST_OVER:
|
||||
fs = 1.F - dstAlpha;
|
||||
break;
|
||||
case AlphaComposite.SRC_ATOP:
|
||||
fs = srcAlpha;
|
||||
fd = 1.F - srcAlpha;
|
||||
break;
|
||||
case AlphaComposite.SRC_IN:
|
||||
fs = dstAlpha;
|
||||
break;
|
||||
case AlphaComposite.SRC_OUT:
|
||||
fs = 1.F - dstAlpha;
|
||||
break;
|
||||
case AlphaComposite.SRC_OVER:
|
||||
fd= 1.F - srcAlpha;
|
||||
break;
|
||||
case AlphaComposite.XOR:
|
||||
fs = 1.F - dstAlpha;
|
||||
fd= 1.F - srcAlpha;
|
||||
break;
|
||||
default:
|
||||
// For the other cases the factors have already been determined
|
||||
// in the constructor.
|
||||
}
|
||||
|
||||
// Apply the blending equation to the pixels.
|
||||
for (int i = 0; i < srcComponentsLength; i++)
|
||||
{
|
||||
dstComponents[i] = srcComponents[i] * fs
|
||||
+ dstComponents[i] * fd;
|
||||
}
|
||||
|
||||
// Convert the result back when the destination is not
|
||||
// alpha-premultiplied.
|
||||
dstAlpha = dstComponents[dstComponentsLength - 1];
|
||||
if (!dstColorModel.isAlphaPremultiplied() && dstAlpha != 0.F)
|
||||
{
|
||||
for (int i = 0; i < dstComponentsLength - 1; i++)
|
||||
{
|
||||
dstComponents[i] = dstComponents[i] / dstAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
// Store the result in the destination raster.
|
||||
dstPixel = dstColorModel.getDataElements(dstComponents, 0,
|
||||
dstPixel);
|
||||
dstOut.setDataElements(x, y, dstPixel);
|
||||
} // End X loop.
|
||||
} // End Y loop.
|
||||
}
|
||||
|
||||
}
|
128
libjava/classpath/gnu/java/awt/java2d/CubicSegment.java
Normal file
128
libjava/classpath/gnu/java/awt/java2d/CubicSegment.java
Normal file
|
@ -0,0 +1,128 @@
|
|||
/* CubicSegment.java -- Cubic segment used for BasicStroke
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
/**
|
||||
* Cubic Bezier curve segment
|
||||
*/
|
||||
public class CubicSegment extends Segment
|
||||
{
|
||||
public Point2D cp1; // control points
|
||||
public Point2D cp2; // control points
|
||||
|
||||
/**
|
||||
* Constructor - takes coordinates of the starting point,
|
||||
* first control point, second control point and end point,
|
||||
* respecively.
|
||||
*/
|
||||
public CubicSegment(double x1, double y1, double c1x, double c1y,
|
||||
double c2x, double c2y, double x2, double y2)
|
||||
{
|
||||
super();
|
||||
P1 = new Point2D.Double(x1, y1);
|
||||
P2 = new Point2D.Double(x2, y2);
|
||||
cp1 = new Point2D.Double(c1x, c1y);
|
||||
cp2 = new Point2D.Double(c2x, c2y);
|
||||
}
|
||||
|
||||
public CubicSegment(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2)
|
||||
{
|
||||
super();
|
||||
P1 = p1;
|
||||
P2 = p2;
|
||||
this.cp1 = cp1;
|
||||
this.cp2 = cp2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones this segment
|
||||
*/
|
||||
public Object clone()
|
||||
{
|
||||
return new CubicSegment(P1.getX(), P1.getY(), cp1.getX(), cp1.getY(),
|
||||
cp2.getX(), cp2.getY(), P2.getX(), P2.getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "top" and "bottom" segments of this segment.
|
||||
* First array element is p0 + normal, second is p0 - normal.
|
||||
*/
|
||||
public Segment[] getDisplacedSegments(double radius)
|
||||
{
|
||||
this.radius = radius;
|
||||
double x0 = P1.getX();
|
||||
double y0 = P1.getY();
|
||||
double x1 = cp1.getX();
|
||||
double y1 = cp1.getY();
|
||||
double x2 = cp2.getX();
|
||||
double y2 = cp2.getY();
|
||||
double x3 = P2.getX();
|
||||
double y3 = P2.getY();
|
||||
double[] p1 = normal(x0, y0, x1, y1);
|
||||
double[] p2 = normal(x2, y2, x3, y3);
|
||||
|
||||
|
||||
// FIXME: Doesn't compile.
|
||||
// return new Segment[]{s1, s2};
|
||||
return new Segment[0];
|
||||
}
|
||||
|
||||
public void reverse()
|
||||
{
|
||||
Point2D temp = P1;
|
||||
P1 = P2;
|
||||
P2 = temp;
|
||||
temp = cp1;
|
||||
cp1 = cp2;
|
||||
cp2 = temp;
|
||||
}
|
||||
|
||||
public double[] first()
|
||||
{
|
||||
return new double[]{cp1.getX(), cp1.getY()};
|
||||
}
|
||||
|
||||
public double[] last()
|
||||
{
|
||||
return new double[]{cp2.getX(), cp2.getY()};
|
||||
}
|
||||
} // class CubicSegment
|
103
libjava/classpath/gnu/java/awt/java2d/LineSegment.java
Normal file
103
libjava/classpath/gnu/java/awt/java2d/LineSegment.java
Normal file
|
@ -0,0 +1,103 @@
|
|||
/* LineSegment.java -- Line segment used for BasicStroke
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
public class LineSegment extends Segment
|
||||
{
|
||||
public LineSegment(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
super();
|
||||
P1 = new Point2D.Double(x1, y1);
|
||||
P2 = new Point2D.Double(x2, y2);
|
||||
}
|
||||
|
||||
public LineSegment(Point2D p1, Point2D p2)
|
||||
{
|
||||
super();
|
||||
P1 = (Point2D) p1.clone();
|
||||
P2 = (Point2D) p2.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones this segment
|
||||
*/
|
||||
public Object clone()
|
||||
{
|
||||
return new LineSegment(P1, P2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "top" and "bottom" segments of this segment.
|
||||
* First array element is p0 + normal, second is p0 - normal.
|
||||
*/
|
||||
public Segment[] getDisplacedSegments(double radius)
|
||||
{
|
||||
this.radius = radius;
|
||||
double x0 = P1.getX();
|
||||
double y0 = P1.getY();
|
||||
double x1 = P2.getX();
|
||||
double y1 = P2.getY();
|
||||
double[] p = normal(x0, y0, x1, y1);
|
||||
Segment s1 = (new LineSegment(x0 + p[0], y0 + p[1],
|
||||
x1 + p[0], y1 + p[1] ));
|
||||
Segment s2 = (new LineSegment(x0 - p[0], y0 - p[1],
|
||||
x1 - p[0], y1 - p[1] ));
|
||||
return new Segment[]{s1, s2};
|
||||
}
|
||||
|
||||
public void reverse()
|
||||
{
|
||||
Point2D p = P1;
|
||||
P1 = P2;
|
||||
P2 = p;
|
||||
}
|
||||
|
||||
public double[] first()
|
||||
{
|
||||
return new double[]{P2.getX(), P2.getY()};
|
||||
}
|
||||
|
||||
public double[] last()
|
||||
{
|
||||
return new double[]{P1.getX(), P1.getY()};
|
||||
}
|
||||
} // class LineSegment
|
117
libjava/classpath/gnu/java/awt/java2d/PolyEdge.java
Normal file
117
libjava/classpath/gnu/java/awt/java2d/PolyEdge.java
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* PolyEdge.java -- An edge in a polygon, used for polygon filling
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
/**
|
||||
* An edge in a polygon. This is used by the scanline conversion algorithm
|
||||
* implemented in {@link AbstractGraphics2D#rawFillShape}.
|
||||
*
|
||||
* @author Roman Kennke (kennke@aicas.com)
|
||||
*/
|
||||
public class PolyEdge
|
||||
implements Comparable
|
||||
{
|
||||
|
||||
/**
|
||||
* The start and end coordinates of the edge. y0 is always smaller or equal
|
||||
* than y1.
|
||||
*/
|
||||
public double x0, y0, x1, y1;
|
||||
|
||||
/**
|
||||
* The slope of the edge. This is dx / dy.
|
||||
*/
|
||||
double slope;
|
||||
|
||||
/**
|
||||
* The intersection of this edge with the current scanline.
|
||||
*/
|
||||
double xIntersection;
|
||||
|
||||
/**
|
||||
* Creates a new PolyEdge with the specified coordinates.
|
||||
*
|
||||
* @param x0 the starting point, x coordinate
|
||||
* @param y0 the starting point, y coordinate
|
||||
* @param x1 the end point, x coordinate
|
||||
* @param y1 the end point, y coordinate
|
||||
*/
|
||||
PolyEdge(double x0, double y0, double x1, double y1)
|
||||
{
|
||||
if (y0 < y1)
|
||||
{
|
||||
this.x0 = x0;
|
||||
this.y0 = y0;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.x0 = x1;
|
||||
this.y0 = y1;
|
||||
this.x1 = x0;
|
||||
this.y1 = y0;
|
||||
}
|
||||
slope = (this.x1 - this.x0) / (this.y1 - this.y0);
|
||||
if (this.y0 == this.y1) // Horizontal edge.
|
||||
xIntersection = Math.min(this.x0, this.x1);
|
||||
else
|
||||
xIntersection = this.x0 + slope * (Math.ceil(this.y0) - this.y0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts PolyEdges by the x coordinate from the minimum x value.
|
||||
*/
|
||||
public int compareTo(Object o)
|
||||
{
|
||||
PolyEdge other = (PolyEdge) o;
|
||||
int comp = 0;
|
||||
if (x0 < other.x0)
|
||||
comp = -1;
|
||||
else if (x0 > other.x0)
|
||||
comp = 1;
|
||||
return comp;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Edge: " + x0 + ", " + y0 + ", " + x1 + ", " + y1 + ", slope: "
|
||||
+ slope + ", xIntersection: " + xIntersection;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* PolyEdgeComparator.java -- Sorts PolyEdges by their current intersection
|
||||
points
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Sorts {@link PolyEdge}s by their current intersection points.
|
||||
*
|
||||
* @author Roman Kennke (kennke@aicas.com)
|
||||
*/
|
||||
public class PolyEdgeComparator
|
||||
implements Comparator
|
||||
{
|
||||
|
||||
/**
|
||||
* The current scanline.
|
||||
*/
|
||||
int y;
|
||||
|
||||
public int compare(Object o1, Object o2)
|
||||
{
|
||||
PolyEdge edge1 = (PolyEdge) o1;
|
||||
PolyEdge edge2 = (PolyEdge) o2;
|
||||
int comp = 0;
|
||||
if (edge1.xIntersection < edge2.xIntersection)
|
||||
comp = -1;
|
||||
else if (edge1.xIntersection > edge2.xIntersection)
|
||||
comp = 1;
|
||||
return comp;
|
||||
}
|
||||
|
||||
}
|
213
libjava/classpath/gnu/java/awt/java2d/QuadSegment.java
Normal file
213
libjava/classpath/gnu/java/awt/java2d/QuadSegment.java
Normal file
|
@ -0,0 +1,213 @@
|
|||
/* QuadSegment.java -- QuadCurve segment used for BasicStroke
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.QuadCurve2D;
|
||||
|
||||
/**
|
||||
* Quadratic Bezier curve segment
|
||||
*
|
||||
* Note: Most peers don't support quadratics directly, so it might make
|
||||
* sense to represent them as cubics internally and just be done with it.
|
||||
* I think we should be peer-agnostic, however, and stay faithful to the
|
||||
* input geometry types as far as possible.
|
||||
*/
|
||||
public class QuadSegment extends Segment
|
||||
{
|
||||
public Point2D cp; // control point
|
||||
|
||||
/**
|
||||
* Constructor, takes the coordinates of the start, control,
|
||||
* and end point, respectively.
|
||||
*/
|
||||
public QuadSegment(double x1, double y1, double cx, double cy, double x2,
|
||||
double y2)
|
||||
{
|
||||
super();
|
||||
P1 = new Point2D.Double(x1, y1);
|
||||
P2 = new Point2D.Double(x2, y2);
|
||||
cp = new Point2D.Double(cx, cy);
|
||||
}
|
||||
|
||||
public QuadSegment(Point2D p1, Point2D cp, Point2D p2)
|
||||
{
|
||||
super();
|
||||
P1 = p1;
|
||||
P2 = p2;
|
||||
this.cp = cp;
|
||||
}
|
||||
|
||||
public QuadSegment(QuadCurve2D curve)
|
||||
{
|
||||
super();
|
||||
P1 = curve.getP1();
|
||||
P2 = curve.getP2();
|
||||
this.cp = curve.getCtrlPt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones this segment
|
||||
*/
|
||||
public Object clone()
|
||||
{
|
||||
return new QuadSegment(P1.getX(), P1.getY(), cp.getX(), cp.getY(),
|
||||
P2.getX(), P2.getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "top" and "bottom" segments of a given segment.
|
||||
* First array element is p0 + normal, second is p0 - normal.
|
||||
*/
|
||||
public Segment[] getDisplacedSegments(double radius)
|
||||
{
|
||||
this.radius = radius;
|
||||
double x0 = P1.getX();
|
||||
double y0 = P1.getY();
|
||||
double x1 = cp.getX();
|
||||
double y1 = cp.getY();
|
||||
double x2 = P2.getX();
|
||||
double y2 = P2.getY();
|
||||
|
||||
QuadCurve2D left = new QuadCurve2D.Double();
|
||||
QuadCurve2D right = new QuadCurve2D.Double();
|
||||
QuadCurve2D orig = new QuadCurve2D.Double(x0, y0, x1, y1, x2, y2);
|
||||
orig.subdivide(left, right);
|
||||
|
||||
QuadSegment s1 = offsetSubdivided(left, true);
|
||||
QuadSegment s2 = offsetSubdivided(left, false);
|
||||
|
||||
s1.add( offsetSubdivided(right, true) );
|
||||
s2.add( offsetSubdivided(right, false) );
|
||||
|
||||
return new Segment[]{s1, s2};
|
||||
}
|
||||
|
||||
private QuadSegment offsetSubdivided(QuadCurve2D curve, boolean plus)
|
||||
{
|
||||
double[] n1 = normal(curve.getX1(), curve.getY1(),
|
||||
curve.getCtrlX(), curve.getCtrlY());
|
||||
double[] n2 = normal(curve.getCtrlX(), curve.getCtrlY(),
|
||||
curve.getX2(), curve.getY2());
|
||||
|
||||
Point2D cp;
|
||||
QuadSegment s;
|
||||
if( plus )
|
||||
{
|
||||
cp = lineIntersection(curve.getX1() + n1[0],
|
||||
curve.getY1() + n1[1],
|
||||
curve.getCtrlX() + n1[0],
|
||||
curve.getCtrlY() + n1[1],
|
||||
curve.getCtrlX() + n2[0],
|
||||
curve.getCtrlY() + n2[1],
|
||||
curve.getX2() + n2[0],
|
||||
curve.getY2() + n2[1], true);
|
||||
s = new QuadSegment(curve.getX1() + n1[0], curve.getY1() + n1[1],
|
||||
cp.getX(), cp.getY(),
|
||||
curve.getX2() + n2[0], curve.getY2() + n2[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cp = lineIntersection(curve.getX1() - n1[0],
|
||||
curve.getY1() - n1[1],
|
||||
curve.getCtrlX() - n1[0],
|
||||
curve.getCtrlY() - n1[1],
|
||||
curve.getCtrlX() - n2[0],
|
||||
curve.getCtrlY() - n2[1],
|
||||
curve.getX2() - n2[0],
|
||||
curve.getY2() - n2[1], true);
|
||||
|
||||
s = new QuadSegment(curve.getX1() - n1[0], curve.getY1() - n1[1],
|
||||
cp.getX(), cp.getY(),
|
||||
curve.getX2() - n2[0], curve.getY2() - n2[1]);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
private Point2D lineIntersection(double X1, double Y1,
|
||||
double X2, double Y2,
|
||||
double X3, double Y3,
|
||||
double X4, double Y4,
|
||||
boolean infinite)
|
||||
{
|
||||
double x1 = X1;
|
||||
double y1 = Y1;
|
||||
double rx = X2 - x1;
|
||||
double ry = Y2 - y1;
|
||||
|
||||
double x2 = X3;
|
||||
double y2 = Y3;
|
||||
double sx = X4 - x2;
|
||||
double sy = Y4 - y2;
|
||||
|
||||
double determinant = sx * ry - sy * rx;
|
||||
double nom = (sx * (y2 - y1) + sy * (x1 - x2));
|
||||
|
||||
// lines can be considered parallel.
|
||||
if (Math.abs(determinant) < 1E-6)
|
||||
return null;
|
||||
|
||||
nom = nom / determinant;
|
||||
|
||||
// check if lines are within the bounds
|
||||
if(!infinite && (nom > 1.0 || nom < 0.0))
|
||||
return null;
|
||||
|
||||
return new Point2D.Double(x1 + nom * rx, y1 + nom * ry);
|
||||
}
|
||||
|
||||
public void reverse()
|
||||
{
|
||||
Point2D p = P1;
|
||||
P1 = P2;
|
||||
P2 = p;
|
||||
}
|
||||
|
||||
public double[] first()
|
||||
{
|
||||
return new double[]{cp.getX(), cp.getY()};
|
||||
}
|
||||
|
||||
public double[] last()
|
||||
{
|
||||
return new double[]{cp.getX(), cp.getY()};
|
||||
}
|
||||
}
|
101
libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java
Normal file
101
libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* RasterGraphics.java -- A Graphics2D impl for Rasters
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
|
||||
/**
|
||||
* A Graphics2D implementation that operates on Raster objects. This is
|
||||
* primarily used for BufferedImages, but can theoretically be used on
|
||||
* arbitrary WritableRasters.
|
||||
*
|
||||
* @author Roman Kennke (kennke@aicas.com)
|
||||
*/
|
||||
public class RasterGraphics
|
||||
extends AbstractGraphics2D
|
||||
{
|
||||
|
||||
/**
|
||||
* The raster on which we operate.
|
||||
*/
|
||||
private WritableRaster raster;
|
||||
|
||||
/**
|
||||
* The color model of this Graphics instance.
|
||||
*/
|
||||
private ColorModel colorModel;
|
||||
|
||||
public RasterGraphics(WritableRaster r, ColorModel cm)
|
||||
{
|
||||
raster = r;
|
||||
colorModel = cm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color model of this Graphics object.
|
||||
*
|
||||
* @return the color model of this Graphics object
|
||||
*/
|
||||
protected ColorModel getColorModel()
|
||||
{
|
||||
return colorModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a WritableRaster that is used by this class to perform the
|
||||
* rendering in. It is not necessary that the target surface immediately
|
||||
* reflects changes in the raster. Updates to the raster are notified via
|
||||
* {@link AbstractGraphics2D#updateRaster}.
|
||||
*
|
||||
* @return the destination raster
|
||||
*/
|
||||
protected WritableRaster getDestinationRaster()
|
||||
{
|
||||
return raster;
|
||||
}
|
||||
|
||||
public GraphicsConfiguration getDeviceConfiguration()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
131
libjava/classpath/gnu/java/awt/java2d/Segment.java
Normal file
131
libjava/classpath/gnu/java/awt/java2d/Segment.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
/* Segment.java -- Abstract segment used for BasicStroke
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.java2d;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
public abstract class Segment implements Cloneable
|
||||
{
|
||||
// segment type, PathIterator segment types are used.
|
||||
public Point2D P1;
|
||||
public Point2D P2;
|
||||
public Segment next;
|
||||
public Segment last;
|
||||
protected double radius;
|
||||
|
||||
public Segment()
|
||||
{
|
||||
P1 = P2 = null;
|
||||
next = null;
|
||||
last = this;
|
||||
}
|
||||
|
||||
public void add(Segment newsegment)
|
||||
{
|
||||
last.next = newsegment;
|
||||
last = last.next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverses the orientation of the whole polygon
|
||||
*/
|
||||
public void reverseAll()
|
||||
{
|
||||
reverse();
|
||||
Segment v = next;
|
||||
Segment former = this;
|
||||
next = null;
|
||||
|
||||
while (v != null)
|
||||
{
|
||||
v.reverse();
|
||||
v.last = this;
|
||||
Segment oldnext = v.next;
|
||||
v.next = former;
|
||||
|
||||
former = v;
|
||||
v = oldnext; // move to the next in list
|
||||
}
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Segment:"+P1+", "+P2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the normal vector to the slope of the line.
|
||||
* Returns: 0.5*width*(norm of derivative of the (x0,y0)-(x1,y1) vector)
|
||||
*/
|
||||
protected double[] normal(double x0, double y0, double x1, double y1)
|
||||
{
|
||||
double dx = (x1 - x0);
|
||||
double dy = (y1 - y0);
|
||||
if( dy == 0 )
|
||||
{
|
||||
dy = radius * ((dx > 0)?1:-1);
|
||||
dx = 0;
|
||||
}
|
||||
else if( dx == 0 )
|
||||
{
|
||||
dx = radius * ((dy > 0)?-1:1);
|
||||
dy = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double N = Math.sqrt(dx * dx + dy * dy);
|
||||
double odx = dx;
|
||||
dx = -radius * dy / N;
|
||||
dy = radius * odx / N;
|
||||
}
|
||||
return new double[]{ dx, dy };
|
||||
}
|
||||
|
||||
public abstract void reverse();
|
||||
|
||||
/**
|
||||
* Get the "top" and "bottom" segments of a segment.
|
||||
* First array element is p0 + normal, second is p0 - normal.
|
||||
*/
|
||||
public abstract Segment[] getDisplacedSegments(double radius);
|
||||
|
||||
public abstract double[] first();
|
||||
public abstract double[] last();
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue