Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org> Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. From-SVN: r116139
This commit is contained in:
parent
abab460491
commit
ac1ed908de
1294 changed files with 99479 additions and 35933 deletions
|
@ -39,6 +39,7 @@ package gnu.java.awt.java2d;
|
|||
|
||||
import java.awt.AWTError;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.AWTPermission;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
|
@ -72,6 +73,7 @@ import java.awt.geom.RoundRectangle2D;
|
|||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.RenderedImage;
|
||||
|
@ -144,7 +146,7 @@ public abstract class AbstractGraphics2D
|
|||
/**
|
||||
* The transformation for this Graphics2D instance
|
||||
*/
|
||||
private AffineTransform transform;
|
||||
protected AffineTransform transform;
|
||||
|
||||
/**
|
||||
* The foreground.
|
||||
|
@ -539,6 +541,15 @@ public abstract class AbstractGraphics2D
|
|||
*/
|
||||
public void setComposite(Composite comp)
|
||||
{
|
||||
if (! (comp instanceof AlphaComposite))
|
||||
{
|
||||
// FIXME: this check is only required "if this Graphics2D
|
||||
// context is drawing to a Component on the display screen".
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new AWTPermission("readDisplayPixels"));
|
||||
}
|
||||
|
||||
composite = comp;
|
||||
if (! (comp.equals(AlphaComposite.SrcOver)))
|
||||
isOptimized = false;
|
||||
|
@ -2054,7 +2065,34 @@ public abstract class AbstractGraphics2D
|
|||
*
|
||||
* @return the destination raster
|
||||
*/
|
||||
protected abstract WritableRaster getDestinationRaster();
|
||||
protected WritableRaster getDestinationRaster()
|
||||
{
|
||||
// TODO: Ideally we would fetch the xdrawable's surface pixels for
|
||||
// initialization of the raster.
|
||||
Rectangle db = getDeviceBounds();
|
||||
if (destinationRaster == null)
|
||||
{
|
||||
int[] bandMasks = new int[]{ 0xFF0000, 0xFF00, 0xFF };
|
||||
destinationRaster = Raster.createPackedRaster(DataBuffer.TYPE_INT,
|
||||
db.width, db.height,
|
||||
bandMasks, null);
|
||||
// Initialize raster with white.
|
||||
int x0 = destinationRaster.getMinX();
|
||||
int x1 = destinationRaster.getWidth() + x0;
|
||||
int y0 = destinationRaster.getMinY();
|
||||
int y1 = destinationRaster.getHeight() + y0;
|
||||
int numBands = destinationRaster.getNumBands();
|
||||
for (int y = y0; y < y1; y++)
|
||||
{
|
||||
for (int x = x0; x < x1; x++)
|
||||
{
|
||||
for (int b = 0; b < numBands; b++)
|
||||
destinationRaster.setSample(x, y, b, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
return destinationRaster;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the backend that the raster has changed in the specified
|
||||
|
|
|
@ -39,6 +39,7 @@ exception statement from your version. */
|
|||
package gnu.java.awt.java2d;
|
||||
|
||||
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
/**
|
||||
|
@ -78,34 +79,89 @@ public class CubicSegment extends Segment
|
|||
*/
|
||||
public Object clone()
|
||||
{
|
||||
return new CubicSegment(P1.getX(), P1.getY(), cp1.getX(), cp1.getY(),
|
||||
cp2.getX(), cp2.getY(), P2.getX(), P2.getY());
|
||||
CubicSegment segment = null;
|
||||
|
||||
try
|
||||
{
|
||||
segment = (CubicSegment) super.clone();
|
||||
|
||||
segment.P1 = (Point2D) P1.clone();
|
||||
segment.P2 = (Point2D) P2.clone();
|
||||
segment.cp1 = (Point2D) cp1.clone();
|
||||
segment.cp2 = (Point2D) cp2.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException cnse)
|
||||
{
|
||||
InternalError ie = new InternalError();
|
||||
ie.initCause(cnse);
|
||||
throw ie;
|
||||
}
|
||||
|
||||
return segment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "top" and "bottom" segments of this segment.
|
||||
* First array element is p0 + normal, second is p0 - normal.
|
||||
* Get the "top" and "bottom" segments of this segment. First array element is
|
||||
* p0 + normal, second is p0 - normal.
|
||||
*/
|
||||
public Segment[] getDisplacedSegments(double radius)
|
||||
{
|
||||
// It is, apparently, impossible to derive a curve parallel to a bezier
|
||||
// curve (unless it's a straight line), so we have no choice but to
|
||||
// approximate the displaced segments. Similar to FlattenPathIterator.
|
||||
|
||||
Segment segmentTop = null;
|
||||
Segment segmentBottom = null;
|
||||
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];
|
||||
CubicCurve2D[] curves = new CubicCurve2D[10];
|
||||
curves[0] = new CubicCurve2D.Double(P1.getX(), P1.getY(), cp1.getX(),
|
||||
cp1.getY(), cp2.getX(), cp2.getY(),
|
||||
P2.getX(), P2.getY());
|
||||
int numCurves = 1;
|
||||
|
||||
// Hard-coded a recursion limit of 10 and flatness of 1... should we make
|
||||
// this an option somewhere?
|
||||
while (numCurves > 0)
|
||||
{
|
||||
// The curve is flat enough, or we've reached our recursion limit,
|
||||
// so take the current start/end points and add it as a line segment
|
||||
// to our final approximated curves
|
||||
if (curves[numCurves - 1].getFlatnessSq() <= (radius / 3) || numCurves == 10)
|
||||
{
|
||||
Segment[] displaced = new LineSegment(
|
||||
curves[numCurves - 1].getP1(),
|
||||
curves[numCurves - 1].getP2()).getDisplacedSegments(radius);
|
||||
if (segmentTop == null)
|
||||
{
|
||||
segmentTop = displaced[0];
|
||||
segmentBottom = displaced[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
segmentTop.add(displaced[0]);
|
||||
segmentBottom.add(displaced[1]);
|
||||
}
|
||||
numCurves--;
|
||||
}
|
||||
|
||||
// Otherwise, subdivide again and continue
|
||||
else
|
||||
{
|
||||
CubicCurve2D left = new CubicCurve2D.Double();
|
||||
CubicCurve2D right = new CubicCurve2D.Double();
|
||||
curves[numCurves - 1].subdivide(left, right);
|
||||
curves[numCurves - 1] = right;
|
||||
curves[numCurves] = left;
|
||||
curves[numCurves - 1] = right;
|
||||
curves[numCurves] = left;
|
||||
numCurves++;
|
||||
}
|
||||
}
|
||||
|
||||
return new Segment[] { segmentTop, segmentBottom };
|
||||
}
|
||||
|
||||
|
||||
public void reverse()
|
||||
{
|
||||
Point2D temp = P1;
|
||||
|
@ -116,12 +172,12 @@ public class CubicSegment extends Segment
|
|||
cp2 = temp;
|
||||
}
|
||||
|
||||
public double[] first()
|
||||
public double[] cp1()
|
||||
{
|
||||
return new double[]{cp1.getX(), cp1.getY()};
|
||||
}
|
||||
|
||||
public double[] last()
|
||||
public double[] cp2()
|
||||
{
|
||||
return new double[]{cp2.getX(), cp2.getY()};
|
||||
}
|
||||
|
|
|
@ -62,7 +62,22 @@ public class LineSegment extends Segment
|
|||
*/
|
||||
public Object clone()
|
||||
{
|
||||
return new LineSegment(P1, P2);
|
||||
LineSegment segment = null;
|
||||
|
||||
try
|
||||
{
|
||||
segment = (LineSegment) super.clone();
|
||||
segment.P1 = (Point2D) P1.clone();
|
||||
segment.P2 = (Point2D) P2.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException cnse)
|
||||
{
|
||||
InternalError ie = new InternalError();
|
||||
ie.initCause(cnse);
|
||||
throw ie;
|
||||
}
|
||||
|
||||
return segment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,12 +106,12 @@ public class LineSegment extends Segment
|
|||
P2 = p;
|
||||
}
|
||||
|
||||
public double[] first()
|
||||
public double[] cp1()
|
||||
{
|
||||
return new double[]{P2.getX(), P2.getY()};
|
||||
}
|
||||
|
||||
public double[] last()
|
||||
public double[] cp2()
|
||||
{
|
||||
return new double[]{P1.getX(), P1.getY()};
|
||||
}
|
||||
|
|
|
@ -88,8 +88,24 @@ public class QuadSegment extends Segment
|
|||
*/
|
||||
public Object clone()
|
||||
{
|
||||
return new QuadSegment(P1.getX(), P1.getY(), cp.getX(), cp.getY(),
|
||||
P2.getX(), P2.getY());
|
||||
QuadSegment segment = null;
|
||||
|
||||
try
|
||||
{
|
||||
segment = (QuadSegment) super.clone();
|
||||
|
||||
segment.P1 = (Point2D) P1.clone();
|
||||
segment.P2 = (Point2D) P2.clone();
|
||||
segment.cp = (Point2D) cp.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException cnse)
|
||||
{
|
||||
InternalError ie = new InternalError();
|
||||
ie.initCause(cnse);
|
||||
throw ie;
|
||||
}
|
||||
|
||||
return segment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,12 +217,12 @@ public class QuadSegment extends Segment
|
|||
P2 = p;
|
||||
}
|
||||
|
||||
public double[] first()
|
||||
public double[] cp1()
|
||||
{
|
||||
return new double[]{cp.getX(), cp.getY()};
|
||||
}
|
||||
|
||||
public double[] last()
|
||||
public double[] cp2()
|
||||
{
|
||||
return new double[]{cp.getX(), cp.getY()};
|
||||
}
|
||||
|
|
|
@ -42,24 +42,38 @@ import java.awt.geom.Point2D;
|
|||
|
||||
public abstract class Segment implements Cloneable
|
||||
{
|
||||
// segment type, PathIterator segment types are used.
|
||||
// Start and end points of THIS segment
|
||||
public Point2D P1;
|
||||
public Point2D P2;
|
||||
|
||||
// Segments can be linked together internally as a linked list
|
||||
public Segment first;
|
||||
public Segment next;
|
||||
public Segment last;
|
||||
|
||||
// Half the stroke width
|
||||
protected double radius;
|
||||
|
||||
/**
|
||||
* Create a new, empty segment
|
||||
*/
|
||||
public Segment()
|
||||
{
|
||||
P1 = P2 = null;
|
||||
first = this;
|
||||
next = null;
|
||||
last = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a segment to the polygon
|
||||
* @param newsegment segment to add
|
||||
*/
|
||||
public void add(Segment newsegment)
|
||||
{
|
||||
newsegment.first = first;
|
||||
last.next = newsegment;
|
||||
last = last.next;
|
||||
last = last.next.last;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,6 +82,7 @@ public abstract class Segment implements Cloneable
|
|||
public void reverseAll()
|
||||
{
|
||||
reverse();
|
||||
first = last;
|
||||
Segment v = next;
|
||||
Segment former = this;
|
||||
next = null;
|
||||
|
@ -91,7 +106,7 @@ public abstract class Segment implements Cloneable
|
|||
|
||||
/**
|
||||
* Get the normal vector to the slope of the line.
|
||||
* Returns: 0.5*width*(norm of derivative of the (x0,y0)-(x1,y1) vector)
|
||||
* @return vector of length radius, normal to the (x0,y0)-(x1,y1) vector)
|
||||
*/
|
||||
protected double[] normal(double x0, double y0, double x1, double y1)
|
||||
{
|
||||
|
@ -117,6 +132,9 @@ public abstract class Segment implements Cloneable
|
|||
return new double[]{ dx, dy };
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the current segment
|
||||
*/
|
||||
public abstract void reverse();
|
||||
|
||||
/**
|
||||
|
@ -125,7 +143,16 @@ public abstract class Segment implements Cloneable
|
|||
*/
|
||||
public abstract Segment[] getDisplacedSegments(double radius);
|
||||
|
||||
public abstract double[] first();
|
||||
public abstract double[] last();
|
||||
/**
|
||||
* Returns the coordinates of the first control point, or the start point
|
||||
* for a line segment.
|
||||
*/
|
||||
public abstract double[] cp1();
|
||||
|
||||
/**
|
||||
* Returns the coordinates of the second control point, or the end point
|
||||
* for a line segment.
|
||||
*/
|
||||
public abstract double[] cp2();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue