bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public void drawRenderableImage(RenderableImage image, AffineTransform xform) { // FIXME: Implement this. throw new UnsupportedOperationException("Not yet implemented"); }
|
public void drawRenderableImage(RenderableImage image, AffineTransform xform) { // FIXME: Implement this. Rectangle areaOfInterest = new Rectangle((int) image.getMinX(), (int) image.getHeight(), (int) image.getWidth(), (int) image.getHeight()); drawRenderableImageImpl(image, xform, areaOfInterest); }
| 10,478
|
public void drawRenderedImage(RenderedImage image, AffineTransform xform) { // FIXME: Implement this. throw new UnsupportedOperationException("Not yet implemented"); }
|
public void drawRenderedImage(RenderedImage image, AffineTransform xform) { // FIXME: Implement this. Rectangle areaOfInterest = new Rectangle(image.getMinX(), image.getHeight(), image.getWidth(), image.getHeight()); drawRenderedImageImpl(image, xform, areaOfInterest); }
| 10,479
|
protected void fillScanline(PaintContext pCtx, int x0, int x1, int y) { Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1); ColorModel paintColorModel = pCtx.getColorModel(); CompositeContext cCtx = composite.createContext(paintColorModel, getColorModel(), renderingHints); cCtx.compose(paintRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, x1 - x0, 1); cCtx.dispose(); }
|
protected void fillScanline(PaintContext pCtx, int x0, int x1, int y) { Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1); ColorModel paintColorModel = pCtx.getColorModel(); CompositeContext cCtx = composite.createContext(paintColorModel, getColorModel(), renderingHints); WritableRaster targetChild = destinationRaster.createWritableTranslatedChild(-x0,- y); cCtx.compose(paintRaster, targetChild, targetChild); updateRaster(destinationRaster, x0, y, x1 - x0, 1); cCtx.dispose(); }
| 10,481
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,482
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,483
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,484
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,485
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; Object pixel = null; int[] comps = null; int x1 = x0 + numPixels; for (int x = x0; x < x1; x++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,486
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = (double) lastAlphaInt / (double) AA_SAMPLING; alpha[i] = 0; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,487
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,488
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
|
private void fillScanlineAA(int[] alpha, int x0, int y, int numScanlinePixels, PaintContext pCtx) { // FIXME: This doesn't work. Fixit. CompositeContext cCtx = composite.createContext(pCtx.getColorModel(), getColorModel(), renderingHints); Raster paintRaster = pCtx.getRaster(x0, y, numScanlinePixels, 1); System.err.println("paintColorModel: " + pCtx.getColorModel()); WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster(); int numBands = paintRaster.getNumBands(); int[] pixels = new int[numScanlinePixels + paintRaster.getNumBands()]; pixels = paintRaster.getPixels(x0, y, numScanlinePixels, 1, pixels); ColorModel cm = pCtx.getColorModel(); double lastAlpha = 0.; int lastAlphaInt = 0; int[] components = new int[4]; for (int i = 0; i < pixels.length; i++) { if (alpha[i] != 0) { lastAlphaInt += alpha[i]; lastAlpha = lastAlphaInt / AA_SAMPLING; } components = cm.getComponents(pixel[i], components, 0); components[0] = (int) (components[0] * lastAlpha); pixel[i] = cm.getDataElement(components, 0); } aaRaster.setPixels(0, 0, numScanlinePixels, 1, pixels); cCtx.compose(aaRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, numScanlinePixels, 1); cCtx.dispose(); }
| 10,489
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
| 10,490
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
| 10,491
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, deviceBounds, userBounds, inclClipBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
| 10,492
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); } }
|
protected void fillShape(Shape s, boolean isFont) { // Determine if we need to antialias stuff. boolean antialias = false; if (isFont) { Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); // We default to antialiasing on for text as long as we have no // good hinting implemented. antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } else { Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING); antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON); } Rectangle2D userBounds = s.getBounds2D(); // Flatten the path. TODO: Determine the best flattening factor // wrt to speed and quality. PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillShape() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; // TODO: Use ArrayList<PolyEdge> here when availble. ArrayList segs = new ArrayList(); double segX = 0.; // The start point of the current edge. double segY = 0.; double polyX = 0.; // The start point of the current polygon. double polyY = 0.; double minX = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double minY = Integer.MAX_VALUE; double maxY = Integer.MIN_VALUE; //System.err.println("fill polygon"); while (! path.isDone()) { int segType = path.currentSegment(seg); minX = Math.min(minX, seg[0]); maxX = Math.max(maxX, seg[0]); minY = Math.min(minY, seg[1]); maxY = Math.max(maxY, seg[1]); //System.err.println("segment: " + segType + ", " + seg[0] + ", " + seg[1]); if (segType == PathIterator.SEG_MOVETO) { segX = seg[0]; segY = seg[1]; polyX = seg[0]; polyY = seg[1]; } else if (segType == PathIterator.SEG_CLOSE) { // Close the polyline. PolyEdge edge = new PolyEdge(segX, segY, polyX, polyY); segs.add(edge); } else if (segType == PathIterator.SEG_LINETO) { PolyEdge edge = new PolyEdge(segX, segY, seg[0], seg[1]); segs.add(edge); segX = seg[0]; segY = seg[1]; } path.next(); } if (segs.size() > 0) { if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else fillShapeImpl(segs, deviceBounds, userBounds, inclClipBounds); } }
| 10,493
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,494
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(ColorModel.getRGBdefault(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,495
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,496
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) icMinY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,497
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((icMinY - Math.floor(icMinY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,498
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= icMaxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,499
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean insideClip = false; boolean insideShape = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,500
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (edge.y1 <= (y + (subY / (double) AA_SAMPLING))) continue; if (insideClip && insideShape) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,501
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,502
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,503
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); if (! emptyScanline) fillScanlineAA(alpha, leftX, (int) y, rightX - leftX, pCtx, (int) minX); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,504
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
|
private void fillShapeAntialias(ArrayList segs, double minX, double minY, double maxX, double maxY, Rectangle2D userBounds) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // The antialiasing is implemented using a sampling technique, we do // not scan whole lines but fractions of the line. Rectangle deviceBounds = new Rectangle((int) minX, (int) minY, (int) Math.ceil(maxX) - (int) minX, (int) Math.ceil(maxY) - (int) minY); PaintContext pCtx = paint.createContext(getColorModel(), deviceBounds, userBounds, transform, renderingHints); // This array will contain the oversampled transparency values for // each pixel in the scanline. int numScanlines = (int) Math.ceil(maxY) - (int) minY; int numScanlinePixels = (int) Math.ceil(maxX) - (int) minX + 1; if (alpha == null || alpha.length < (numScanlinePixels + 1)) alpha = new int[numScanlinePixels + 1]; int firstLine = (int) minY; //System.err.println("minY: " + minY); int firstSubline = (int) (Math.ceil((minY - Math.floor(minY)) * AA_SAMPLING)); double firstLineDouble = firstLine + firstSubline / (double) AA_SAMPLING; //System.err.println("firstSubline: " + firstSubline); // Create table of all edges. // The edge buckets, sorted and indexed by their Y values. //System.err.println("numScanlines: " + numScanlines); if (edgeTable == null || edgeTable.length < numScanlines * AA_SAMPLING + AA_SAMPLING) edgeTable = new ArrayList[numScanlines * AA_SAMPLING + AA_SAMPLING]; //System.err.println("firstLineDouble: " + firstLineDouble); for (Iterator i = segs.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); int yindex = (int) (Math.ceil((edge.y0 - firstLineDouble) * AA_SAMPLING)); //System.err.println("yindex: " + yindex + " for y0: " + edge.y0); // Initialize edge's slope and initial xIntersection. edge.slope = ((edge.x1 - edge.x0) / (edge.y1 - edge.y0)) / AA_SAMPLING; if (edge.y0 == edge.y1) // Horizontal edge. edge.xIntersection = Math.min(edge.x0, edge.x1); else { double alignedFirst = Math.ceil(edge.y0 * AA_SAMPLING) / AA_SAMPLING; edge.xIntersection = edge.x0 + (edge.slope * AA_SAMPLING) * (alignedFirst - edge.y0); } //System.err.println(edge); // FIXME: Sanity check should not be needed when clipping works. if (yindex >= 0 && yindex < edgeTable.length) { if (edgeTable[yindex] == null) // Create bucket when needed. edgeTable[yindex] = new ArrayList(); edgeTable[yindex].add(edge); // Add edge to the bucket of its line. } } // The activeEdges list contains all the edges of the current scanline // ordered by their intersection points with this scanline. ArrayList activeEdges = new ArrayList(); PolyEdgeComparator comparator = new PolyEdgeComparator(); // Scan all lines. int yindex = 0; //System.err.println("firstLine: " + firstLine + ", maxY: " + maxY + ", firstSubline: " + firstSubline); for (int y = firstLine; y <= maxY; y++) { for (int subY = firstSubline; subY < AA_SAMPLING; subY++) { //System.err.println("scanline: " + y + ", subScanline: " + subY); ArrayList bucket = edgeTable[yindex]; // Update all the x intersections in the current activeEdges table // and remove entries that are no longer in the scanline. for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // TODO: Do the following using integer arithmetics. if ((y + ((double) subY / (double) AA_SAMPLING)) > edge.y1) i.remove(); else { edge.xIntersection += edge.slope; //System.err.println("edge: " + edge); //edge.xIntersection = edge.x0 + edge.slope * (y - edge.y0); //System.err.println("edge.xIntersection: " + edge.xIntersection); } } if (bucket != null) { activeEdges.addAll(bucket); edgeTable[yindex].clear(); } // Sort current edges. We are using a bubble sort, because the order // of the intersections will not change in most situations. They // will only change, when edges intersect each other. int size = activeEdges.size(); if (size > 1) { for (int i = 1; i < size; i++) { PolyEdge e1 = (PolyEdge) activeEdges.get(i - 1); PolyEdge e2 = (PolyEdge) activeEdges.get(i); if (comparator.compare(e1, e2) > 0) { // Swap e2 with its left neighbor until it 'fits'. int j = i; do { activeEdges.set(j, e1); activeEdges.set(j - 1, e2); j--; if (j >= 1) e1 = (PolyEdge) activeEdges.get(j - 1); } while (j >= 1 && comparator.compare(e1, e2) > 0); } } } // Now draw all pixels inside the polygon. // This is the last edge that intersected the scanline. PolyEdge previous = null; // Gets initialized below. boolean active = false; //System.err.println("scanline: " + y + ", subscanline: " + subY); for (Iterator i = activeEdges.iterator(); i.hasNext();) { PolyEdge edge = (PolyEdge) i.next(); // Only fill scanline, if the current edge actually intersects // the scanline. There may be edges that lie completely // within the current scanline. //System.err.println("previous: " + previous); //System.err.println("edge: " + edge); if (active) { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); // TODO: Eliminate the aligments. int x0 = (int) Math.min(Math.max(previous.xIntersection, minX), maxX); int x1 = (int) Math.min(Math.max(edge.xIntersection, minX), maxX); //System.err.println("minX: " + minX + ", x0: " + x0 + ", x1: " + x1 + ", maxX: " + maxX); // TODO: Pull out cast. alpha[x0 - (int) minX]++; alpha[x1 - (int) minX + 1]--; previous = edge; active = false; } } else { // TODO: Use integer arithmetics here. if (edge.y1 > (y + (subY / (double) AA_SAMPLING))) { //System.err.println(edge); previous = edge; active = true; } } } yindex++; } firstSubline = 0; // Render full scanline. //System.err.println("scanline: " + y); fillScanlineAA(alpha, (int) minX, (int) y, numScanlinePixels, pCtx); } if (paint instanceof Color && composite == AlphaComposite.SrcOver) rawSetForeground((Color) paint); pCtx.dispose(); }
| 10,505
|
public FontRenderContext getFontRenderContext() { //return new FontRenderContext(transform, false, false); return new FontRenderContext(new AffineTransform(), false, false); }
|
public FontRenderContext getFontRenderContext() { //return new FontRenderContext(transform, false, false); return new FontRenderContext(transform, false, true); }
| 10,506
|
protected void init() { setPaint(Color.BLACK); setFont(new Font("SansSerif", Font.PLAIN, 12)); isOptimized = true; // FIXME: Should not be necessary. A clip of null should mean // 'clip against device bounds. clip = getDeviceBounds(); destinationRaster = getDestinationRaster(); }
|
protected void init() { setPaint(Color.BLACK); setFont(new Font("SansSerif", Font.PLAIN, 12)); isOptimized = true; // FIXME: Should not be necessary. A clip of null should mean // 'clip against device bounds. clip = getDeviceBounds(); }
| 10,507
|
protected void rawDrawLine(int x0, int y0, int x1, int y1) { // This is an implementation of Bresenham's line drawing algorithm. int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); // same as 2*dy - dx while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
|
protected void rawDrawLine(int x0, int y0, int x1, int y1) { // This is an implementation of Bresenham's line drawing algorithm. int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); // same as 2*dy - dx while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
| 10,508
|
protected void rawDrawLine(int x0, int y0, int x1, int y1) { // This is an implementation of Bresenham's line drawing algorithm. int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); // same as 2*dy - dx while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
|
protected void rawDrawLine(int x0, int y0, int x1, int y1) { // This is an implementation of Bresenham's line drawing algorithm. int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; drawPixel(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); // same as 2*dy - dx while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; drawPixel(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; drawPixel(x0, y0); } } }
| 10,509
|
protected void rawFillRect(int x, int y, int w, int h) { int x2 = x + w; int y2 = y + h; for (int xc = x; xc < x2; xc++) { for (int yc = y; yc < y2; yc++) { drawPixel(xc, yc); } } }
|
protected void rawFillRect(int x, int y, int w, int h) { int x2 = x + w; int y2 = y + h; for (int xc = x; xc < x2; xc++) { for (int yc = y; yc < y2; yc++) { drawPixel(xc, yc); } } }
| 10,510
|
public void scale(double scaleX, double scaleY) { transform.scale(scaleX, scaleY); if (clip != null) { AffineTransform clipTransform = new AffineTransform(); clipTransform.scale(-scaleX, -scaleY); updateClip(clipTransform); } updateOptimization(); }
|
public void scale(double scaleX, double scaleY) { transform.scale(scaleX, scaleY); if (clip != null) { AffineTransform clipTransform = new AffineTransform(); clipTransform.scale(1 / scaleX, 1 / scaleY); updateClip(clipTransform); } updateOptimization(); }
| 10,511
|
public void setPaint(Paint p) { if (p != null) { paint = p; if (! (paint instanceof Color)) isOptimized = false; else { updateOptimization(); rawSetForeground((Color) paint); } } }
|
public void setPaint(Paint p) { if (p != null) { paint = p; if (! (paint instanceof Color)) isOptimized = false; else { updateOptimization(); } } }
| 10,512
|
public Area(Shape s) { this(); Vector p = makeSegment(s); // empty path if (p == null) return; // delete empty paths for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); /* * Resolve self intersecting paths into non-intersecting * solids and holes. * Algorithm is as follows: * 1: Create nodes at all self intersections * 2: Put all segments into a list * 3: Grab a segment, follow it, change direction at each node, * removing segments from the list in the process * 4: Repeat (3) until no segments remain in the list * 5: Remove redundant paths and sort into solids and holes */ Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } // we have intersecting points. Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); }
|
public Area() { this(); Vector p = makeSegment(s); // empty path if (p == null) return; // delete empty paths for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); /* * Resolve self intersecting paths into non-intersecting * solids and holes. * Algorithm is as follows: * 1: Create nodes at all self intersections * 2: Put all segments into a list * 3: Grab a segment, follow it, change direction at each node, * removing segments from the list in the process * 4: Repeat (3) until no segments remain in the list * 5: Remove redundant paths and sort into solids and holes */ Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } // we have intersecting points. Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); }
| 10,513
|
public Area(Shape s) { this(); Vector p = makeSegment(s); // empty path if (p == null) return; // delete empty paths for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); /* * Resolve self intersecting paths into non-intersecting * solids and holes. * Algorithm is as follows: * 1: Create nodes at all self intersections * 2: Put all segments into a list * 3: Grab a segment, follow it, change direction at each node, * removing segments from the list in the process * 4: Repeat (3) until no segments remain in the list * 5: Remove redundant paths and sort into solids and holes */ Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } // we have intersecting points. Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); }
|
public Area(Shape s) { this(); Vector p = makeSegment(s); // empty path if (p == null) return; // delete empty paths for (int i = 0; i < p.size(); i++) if (((Segment) p.elementAt(i)).getSignedArea() == 0.0) p.remove(i--); /* * Resolve self intersecting paths into non-intersecting * solids and holes. * Algorithm is as follows: * 1: Create nodes at all self intersections * 2: Put all segments into a list * 3: Grab a segment, follow it, change direction at each node, * removing segments from the list in the process * 4: Repeat (3) until no segments remain in the list * 5: Remove redundant paths and sort into solids and holes */ Vector paths = new Vector(); Segment v; for (int i = 0; i < p.size(); i++) { Segment path = (Segment) p.elementAt(i); createNodesSelf(path); } if (p.size() > 1) { for (int i = 0; i < p.size() - 1; i++) for (int j = i + 1; j < p.size(); j++) { Segment path1 = (Segment) p.elementAt(i); Segment path2 = (Segment) p.elementAt(j); createNodes(path1, path2); } } // we have intersecting points. Vector segments = new Vector(); for (int i = 0; i < p.size(); i++) { Segment path = v = (Segment) p.elementAt(i); do { segments.add(v); v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); }
| 10,514
|
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i){ return peer.createGlyphVector (this, ctx, i);}
|
public GlyphVector createGlyphVector (FontRenderContext ctx, String str){ return peer.createGlyphVector (this, ctx, i);}
| 10,515
|
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i){ return peer.createGlyphVector (this, ctx, i);}
|
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i){ return peer.createGlyphVector (this, ctx, new StringCharacterIterator (str));}
| 10,516
|
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); }
|
PolyEdge(double x0, double y0, double x1, double y1, boolean clip) { 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); }
| 10,517
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
| 10,519
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
|
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
| 10,520
|
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
|
TemplateNode clone(Stylesheet stylesheet) TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) ret.children = children.clone(stylesheet); } if (next != null) ret.next = next.clone(stylesheet); } return ret; }
| 10,521
|
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
|
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new WhenNode(test.clone(stylesheet)); if (children != null) { ret.children = children.clone(stylesheet); if (next != null) { ret.next = next.clone(stylesheet); return ret;
| 10,522
|
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); boolean success = (ret instanceof Boolean) ? ((Boolean) ret).booleanValue() : Expr._boolean(context, ret); if (success) { if (children != null) { children.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } else { if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } }
|
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException Object ret = test.evaluate(context, pos, len); boolean success = (ret instanceof Boolean) ? ((Boolean) ret).booleanValue() : Expr._boolean(context, ret); if (success) if (children != null) children.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } else if (next != null) next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } }
| 10,523
|
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); boolean success = (ret instanceof Boolean) ? ((Boolean) ret).booleanValue() : Expr._boolean(context, ret); if (success) { if (children != null) { children.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } else { if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } }
|
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Object ret = test.evaluate(context, pos, len); boolean success = (ret instanceof Boolean) ? ((Boolean) ret).booleanValue() : Expr._boolean(context, ret); if (success) { if (children != null) { children.apply(stylesheet, mode, context, pos, len, parent, nextSibling); else { if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling);
| 10,524
|
public boolean references(QName var) { if (test != null && test.references(var)) { return true; } return super.references(var); }
|
public boolean references(QName var) if (test != null && test.references(var)) return true; } return super.references(var); }
| 10,525
|
public boolean references(QName var) { if (test != null && test.references(var)) { return true; } return super.references(var); }
|
public boolean references(QName var) { if (test != null && test.references(var)) { return true; return super.references(var);
| 10,526
|
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("test="); buf.append(test); buf.append(']'); return buf.toString(); }
|
public String toString() { StringBuffer buf = new StringBuffer("when"); buf.append('['); buf.append("test="); buf.append(test); buf.append(']'); return buf.toString(); }
| 10,527
|
protected final void repaint() { // FIXME: Is this good? This possibly causes alot of the component // hierarchy to be repainted on every caret blink. if (textComponent != null) textComponent.repaint(); }
|
protected final void repaint() { // FIXME: Is this good? This possibly causes alot of the component // hierarchy to be repainted on every caret blink. if (textComponent != null) textComponent.repaint(); }
| 10,531
|
public CannotProceedHolder(CannotProceed initialValue) { value = initialValue; }
|
public CannotProceedHolder() { value = initialValue; }
| 10,533
|
public CannotProceedHolder(CannotProceed initialValue) { value = initialValue; }
|
public CannotProceedHolder(CannotProceed initialValue) { }
| 10,534
|
public static short[] read(InputStream input) { ShortSeqHolder h = new ShortSeqHolder(); h._read(input); return h.value; }
|
public static short[] read(InputStream input) { ShortSeqHolder h = new ShortSeqHolder(); h._read(input); return h.value; }
| 10,535
|
public static void write(OutputStream output, short[] value) { ShortSeqHolder h = new ShortSeqHolder(value); h._write(output); }
|
public static void write(OutputStream output, short[] value) { ShortSeqHolder h = new ShortSeqHolder(value); h._write(output); }
| 10,536
|
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Rectangle tr = new Rectangle(); // text rectangle Rectangle ir = new Rectangle(); // icon rectangle Rectangle vr = new Rectangle(); // view rectangle Rectangle br = new Rectangle(); // border rectangle Rectangle ar = new Rectangle(); // accelerator rectangle Rectangle cr = new Rectangle(); // checkIcon rectangle int vertAlign = m.getVerticalAlignment(); int horAlign = m.getHorizontalAlignment(); int vertTextPos = m.getVerticalTextPosition(); int horTextPos = m.getHorizontalTextPosition(); Font f = m.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); SwingUtilities.calculateInnerArea(m, br); SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); paintBackground(g, m, m.getBackground()); /* * MenuItems insets are equal to menuItems margin, space between text and * menuItems border. We need to paint insets region as well. */ Insets insets = m.getInsets(); br.x -= insets.left; br.y -= insets.top; br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; // Menu item is considered to be highlighted when it is selected. // But we don't want to paint the background of JCheckBoxMenuItems if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() && (m.getParent() instanceof MenuElement)) { if (m.isContentAreaFilled()) { g.setColor(selectionBackground); g.fillRect(br.x, br.y, br.width, br.height); } } else { if (m.isContentAreaFilled()) { g.setColor(m.getBackground()); g.fillRect(br.x, br.y, br.width, br.height); } } // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) { SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign, horAlign, vertTextPos, horTextPos, vr, cr, tr, defaultTextIconGap); checkIcon.paintIcon(m, g, cr.x, cr.y); // We need to calculate position of the menu text and position of // user menu icon if there exists one relative to the check icon. // So we need to adjust view rectangle s.t. its starting point is at // checkIcon.width + defaultTextIconGap. vr.x = cr.x + cr.width + defaultTextIconGap; } // if this is a submenu, then paint arrow icon to indicate it. if (arrowIcon != null && (c instanceof JMenu)) { if (!((JMenu) c).isTopLevelMenu()) { int width = arrowIcon.getIconWidth(); int height = arrowIcon.getIconHeight(); arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap, vr.y + 2); } } // paint text and user menu icon if it exists Icon i = m.getIcon(); SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, tr, defaultTextIconGap); if (i != null) i.paintIcon(c, g, ir.x, ir.y); paintText(g, m, tr, m.getText()); // paint accelerator String acceleratorText = ""; if (m.getAccelerator() != null) { acceleratorText = getAcceleratorText(m.getAccelerator()); fm = g.getFontMetrics(acceleratorFont); ar.width = fm.stringWidth(acceleratorText); ar.x = br.width - ar.width; vr.x = br.width - ar.width - defaultTextIconGap; SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, ar, defaultTextIconGap); paintAccelerator(g, m, ar, acceleratorText); } }
|
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Rectangle tr = new Rectangle(); // text rectangle Rectangle ir = new Rectangle(); // icon rectangle Rectangle vr = new Rectangle(); // view rectangle Rectangle br = new Rectangle(); // border rectangle Rectangle ar = new Rectangle(); // accelerator rectangle Rectangle cr = new Rectangle(); // checkIcon rectangle int vertAlign = m.getVerticalAlignment(); int horAlign = m.getHorizontalAlignment(); int vertTextPos = m.getVerticalTextPosition(); int horTextPos = m.getHorizontalTextPosition(); Font f = m.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); SwingUtilities.calculateInnerArea(m, br); SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); paintBackground(g, m, m.getBackground()); /* * MenuItems insets are equal to menuItems margin, space between text and * menuItems border. We need to paint insets region as well. */ Insets insets = m.getInsets(); br.x -= insets.left; br.y -= insets.top; br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; // Menu item is considered to be highlighted when it is selected. // But we don't want to paint the background of JCheckBoxMenuItems if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() && (m.getParent() instanceof MenuElement)) { if (m.isContentAreaFilled()) { g.setColor(selectionBackground); g.fillRect(br.x, br.y, br.width, br.height); } } else { if (m.isContentAreaFilled()) { g.setColor(m.getBackground()); g.fillRect(br.x, br.y, br.width, br.height); } } // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) { SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign, horAlign, vertTextPos, horTextPos, vr, cr, tr, defaultTextIconGap); checkIcon.paintIcon(m, g, cr.x, cr.y); // We need to calculate position of the menu text and position of // user menu icon if there exists one relative to the check icon. // So we need to adjust view rectangle s.t. its starting point is at // checkIcon.width + defaultTextIconGap. vr.x = cr.x + cr.width + defaultTextIconGap; } // if this is a submenu, then paint arrow icon to indicate it. if (arrowIcon != null && (c instanceof JMenu)) { if (!((JMenu) c).isTopLevelMenu()) { int width = arrowIcon.getIconWidth(); int height = arrowIcon.getIconHeight(); arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap, vr.y + 2); } } // paint text and user menu icon if it exists Icon i = m.getIcon(); SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, tr, defaultTextIconGap); if (i != null) i.paintIcon(c, g, ir.x, ir.y); paintText(g, m, tr, m.getText()); // paint accelerator String acceleratorText = ""; if (m.getAccelerator() != null) { acceleratorText = getAcceleratorText(m.getAccelerator()); fm = g.getFontMetrics(acceleratorFont); ar.width = fm.stringWidth(acceleratorText); ar.x = br.width - ar.width; vr.x = br.width - ar.width - defaultTextIconGap; SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, ar, defaultTextIconGap); paintAccelerator(g, m, ar, acceleratorText); } }
| 10,538
|
public boolean isContentAreaFilled() { // Checks whether the "content area" of the button should be filled. return false; }
|
public boolean isContentAreaFilled() { // Checks whether the "content area" of the button should be filled. return false; }
| 10,539
|
public FrameWrapper(JInternalFrame iFrame) { this.frame = iFrame; this.setText(iFrame.getTitle()); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { JInternalFrame frame = FrameWrapper.this.frame; frame.setIcon(false); frame.getDesktopPane().setSelectedFrame(frame); } catch (PropertyVetoException ex) { //igonre } } }); this.frame.addInternalFrameListener(new InternalFrameListener() { public void internalFrameActivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.WHITE); } public void internalFrameClosed(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameClosing(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameDeactivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.LIGHT_GRAY); } public void internalFrameDeiconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameIconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameOpened(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } }); final JPopupMenu frameActions = new JPopupMenu(); JMenuItem minimize = new JMenuItem("Minimize"); frameActions.add(minimize); minimize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setIcon(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem maximize = new JMenuItem("Maximize"); frameActions.add(maximize); maximize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setMaximum(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem close = new JMenuItem("Close"); frameActions.add(close); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setClosed(true); }catch(PropertyVetoException e){ //ignore } } }); this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY()); } } } }); }
|
public FrameWrapper(JInternalFrame iFrame) { this.frame = iFrame; this.setText(iFrame.getTitle()); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { JInternalFrame frame = FrameWrapper.this.frame; frame.setIcon(false); frame.getDesktopPane().setSelectedFrame(frame); } catch (PropertyVetoException ex) { //igonre } } }); this.frame.addInternalFrameListener(new InternalFrameListener() { public void internalFrameActivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.WHITE); } public void internalFrameClosed(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameClosing(InternalFrameEvent event) { remove(FrameWrapper.this); revalidate(); repaint(); } public void internalFrameDeactivated(InternalFrameEvent event) { FrameWrapper.this.setBackground(Color.LIGHT_GRAY); } public void internalFrameDeiconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameIconified(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } public void internalFrameOpened(InternalFrameEvent event) { //To change body of implemented methods use File | Settings | File Templates. } }); final JPopupMenu frameActions = new JPopupMenu(); JMenuItem minimize = new JMenuItem("Minimize"); frameActions.add(minimize); minimize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setIcon(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem maximize = new JMenuItem("Maximize"); frameActions.add(maximize); maximize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setMaximum(true); }catch(PropertyVetoException e){ //ignore } } }); JMenuItem close = new JMenuItem("Close"); frameActions.add(close); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { frame.setClosed(true); }catch(PropertyVetoException e){ //ignore } } }); this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY()); } } } }); }
| 10,540
|
public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY()); } } }
|
public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (frameActions .isShowing()) { frameActions .setVisible(false); } else { frameActions.show(frame.getDesktopPane(), event.getX(), event.getY()); } } }
| 10,541
|
public final CertPath generateCertPath(InputStream inStream) throws CertificateException { throw new CertificateException("not implemented"); }
|
public final CertPath generateCertPath(InputStream inStream) throws CertificateException { return certFacSpi.engineGenerateCertPath(inStream); }
| 10,544
|
public Icon getPressedIcon() { return pressed_button; }
|
public Icon getPressedIcon() { return pressed_button; }
| 10,546
|
Icon getRolloverSelectedIcon() { // Returns the rollover selection icon for the button. return null; }
|
Icon getRolloverSelectedIcon() { // Returns the rollover selection icon for the button. return null; }
| 10,547
|
public Icon getRolloverIcon() { // Returns the rollover icon for the button. return null; }
|
public Icon getRolloverIcon() { // Returns the rollover icon for the button. return null; }
| 10,548
|
Icon getSelectedIcon() { // Returns the selected icon for the button. return selected_button; }
|
Icon getSelectedIcon() { // Returns the selected icon for the button. return selected_button; }
| 10,549
|
public Icon getDisabledSelectedIcon() { //Returns the icon used by the button when it's disabled and selected. return disabled_selected_button; }
|
public Icon getDisabledSelectedIcon() { //Returns the icon used by the button when it's disabled and selected. return disabled_selected_button; }
| 10,550
|
public Icon getDisabledIcon() { return disabled_button; }
|
public Icon getDisabledIcon() { return disabled_button; }
| 10,551
|
public void addChangeListener(ChangeListener l) { getModel().addChangeListener(l); }
|
public void addChangeListener(ChangeListener l) { getModel().addChangeListener(l); }
| 10,552
|
public void removeChangeListener(ChangeListener l) { getModel().removeChangeListener(l); }
|
public void removeChangeListener(ChangeListener l) { getModel().removeChangeListener(l); }
| 10,553
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
| 10,554
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; manager = a_poa.the_POAManager(); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
| 10,555
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
|
public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb, gnuPOA a_poa ) { Id = an_id; setServant(a_servant); poa = a_poa; if (poa != null) { manager = poa.the_POAManager(); } else { manager = null; } repository_ids = null; orb = an_orb; }
| 10,556
|
RETokenRange(int subIndex, char lo, char hi, boolean ins) { super(subIndex); this.lo = (insens = ins) ? Character.toLowerCase(lo) : lo; this.hi = ins ? Character.toLowerCase(hi) : hi; }
|
RETokenRange(int subIndex, char lo, char hi, boolean ins) { super(subIndex); this.lo = (insens = ins) ? Character.toLowerCase(lo) : lo; this.hi = ins ? Character.toLowerCase(hi) : hi; }
| 10,558
|
boolean match(CharIndexed input, REMatch mymatch) { char c = input.charAt(mymatch.index); if (c == CharIndexed.OUT_OF_BOUNDS) return false; if (insens) c = Character.toLowerCase(c); if ((c >= lo) && (c <= hi)) { ++mymatch.index; return next(input, mymatch); } return false; }
|
boolean match(CharIndexed input, REMatch mymatch) { char c = input.charAt(mymatch.index); if (c == CharIndexed.OUT_OF_BOUNDS) return false; if (insens) c = Character.toLowerCase(c); if ((c >= lo) && (c <= hi)) { ++mymatch.index; return next(input, mymatch); } return false; }
| 10,559
|
public void characters (char buf [], int offset, int len) throws SAXException { docHandler.characters (buf, offset, len); }
|
public void characters(char[] buf, int offset, int len) throws SAXException { docHandler.characters (buf, offset, len); }
| 10,560
|
public void ignorableWhitespace (char buf [], int offset, int len) throws SAXException { docHandler.ignorableWhitespace (buf, offset, len); }
|
public void ignorableWhitespace(char[] buf, int offset, int len) throws SAXException { docHandler.ignorableWhitespace (buf, offset, len); }
| 10,561
|
String absolutize (String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException { // FIXME normalize system IDs -- when? // - Convert to UTF-8 // - Map reserved and non-ASCII characters to %HH try { if (baseURI == null) { warn ("No base URI; hope this SYSTEM id is absolute: " + systemId); return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) { // Let unknown URI schemes pass through unless we need // the JVM to map them to i/o streams for us... if (!nice) throw e; // sometimes sysids for notations or unparsed entities // aren't really URIs... warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); return systemId; } }
|
String absolutize (String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException { // FIXME normalize system IDs -- when? // - Convert to UTF-8 // - Map reserved and non-ASCII characters to %HH try { if (baseURI == null) { warn ("No base URI; hope this SYSTEM id is absolute: " + systemId); return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) { // Let unknown URI schemes pass through unless we need // the JVM to map them to i/o streams for us... if (!nice) throw e; // sometimes sysids for notations or unparsed entities // aren't really URIs... warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); return systemId; } }
| 10,562
|
String absolutize (String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException { // FIXME normalize system IDs -- when? // - Convert to UTF-8 // - Map reserved and non-ASCII characters to %HH try { if (baseURI == null) { warn ("No base URI; hope this SYSTEM id is absolute: " + systemId); return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) { // Let unknown URI schemes pass through unless we need // the JVM to map them to i/o streams for us... if (!nice) throw e; // sometimes sysids for notations or unparsed entities // aren't really URIs... warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); return systemId; } }
|
String absolutize (String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException { // FIXME normalize system IDs -- when? // - Convert to UTF-8 // - Map reserved and non-ASCII characters to %HH try { if (baseURI == null) { warn ("No base URI; hope this SYSTEM id is absolute: " + systemId); return new URL (systemId).toString (); } else return new URL (new URL (baseURI), systemId).toString (); } catch (MalformedURLException e) { // Let unknown URI schemes pass through unless we need // the JVM to map them to i/o streams for us... if (!nice) throw e; // sometimes sysids for notations or unparsed entities // aren't really URIs... warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); return systemId; } }
| 10,563
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) { prefixStack.pushContext(); } } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
| 10,564
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
| 10,565
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
| 10,566
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
| 10,567
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
|
void attribute (String qname, String value, boolean isSpecified) throws SAXException { if (!attributes) { attributes = true; if (namespaces) prefixStack.pushContext (); } // process namespace decls immediately; // then maybe forget this as an attribute if (namespaces) { int index; // default NS declaration? if (getFeature (FEATURE + "string-interning")) { if ("xmlns" == qname) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (prefix.equals("")) fatal ("missing prefix in namespace declaration attribute"); if (value.length () == 0) { verror ("missing URI in namespace declaration attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } else { if ("xmlns".equals(qname)) { declarePrefix ("", value); if (!xmlNames) return; } // NS prefix declaration? else if ((index = qname.indexOf (':')) == 5 && qname.startsWith ("xmlns")) { String prefix = qname.substring (6); if (value.length () == 0) { verror ("missing URI in namespace decl attribute: " + qname); } else declarePrefix (prefix, value); if (!xmlNames) return; } } } // remember this attribute ... attributeCount++; // attribute type comes from querying parser's DTD records attributesList.add(new Attribute(qname, value, isSpecified)); }
| 10,568
|
void charData (char ch[], int start, int length) throws SAXException { contentHandler.characters (ch, start, length); }
|
void charData(char[] ch, int start, int length) throws SAXException { contentHandler.characters (ch, start, length); }
| 10,569
|
void comment (char ch[], int start, int length) throws SAXException { if (lexicalHandler != base) lexicalHandler.comment (ch, start, length); }
|
void comment(char[] ch, int start, int length) throws SAXException { if (lexicalHandler != base) lexicalHandler.comment (ch, start, length); }
| 10,570
|
void comment (char ch[], int start, int length) throws SAXException { if (lexicalHandler != base) lexicalHandler.comment (ch, start, length); }
|
void comment (char ch[], int start, int length) throws SAXException { if (lexicalHandler != base) { lexicalHandler.comment(ch, start, length); } }
| 10,571
|
private void declarePrefix (String prefix, String uri) throws SAXException { int index = uri.indexOf (':'); // many versions of nwalsh docbook stylesheets // have bogus URLs; so this can't be an error... if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri); // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] //Namespace Constraints //name for xml prefix must be http://www.w3.org/XML/1998/namespace boolean prefixEquality = prefix.equals("xml"); boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal ("xml is by definition bound to the namespace name " + "http://www.w3.org/XML/1998/namespace"); //xmlns prefix declaration is illegal but xml prefix declaration is llegal... if (prefixEquality && uriEquality) return; //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ prefixEquality = prefix.equals("xmlns"); uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + " to prefix xmlns"); //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it if (prefixEquality && uriEquality) fatal ("declaring the xmlns prefix is illegal"); uri = uri.intern (); prefixStack.declarePrefix (prefix, uri); contentHandler.startPrefixMapping (prefix, uri); }
|
private void declarePrefix (String prefix, String uri) throws SAXException { int index = uri.indexOf (':'); // many versions of nwalsh docbook stylesheets // have bogus URLs; so this can't be an error... if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri); // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] //Namespace Constraints //name for xml prefix must be http://www.w3.org/XML/1998/namespace boolean prefixEquality = prefix.equals("xml"); boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal ("xml is by definition bound to the namespace name " + "http://www.w3.org/XML/1998/namespace"); //xmlns prefix declaration is illegal but xml prefix declaration is llegal... if (prefixEquality && uriEquality) return; //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ prefixEquality = prefix.equals("xmlns"); uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + " to prefix xmlns"); //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it if (prefixEquality && uriEquality) fatal ("declaring the xmlns prefix is illegal"); uri = uri.intern (); prefixStack.declarePrefix (prefix, uri); contentHandler.startPrefixMapping (prefix, uri); }
| 10,572
|
private void declarePrefix (String prefix, String uri) throws SAXException { int index = uri.indexOf (':'); // many versions of nwalsh docbook stylesheets // have bogus URLs; so this can't be an error... if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri); // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] //Namespace Constraints //name for xml prefix must be http://www.w3.org/XML/1998/namespace boolean prefixEquality = prefix.equals("xml"); boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal ("xml is by definition bound to the namespace name " + "http://www.w3.org/XML/1998/namespace"); //xmlns prefix declaration is illegal but xml prefix declaration is llegal... if (prefixEquality && uriEquality) return; //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ prefixEquality = prefix.equals("xmlns"); uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + " to prefix xmlns"); //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it if (prefixEquality && uriEquality) fatal ("declaring the xmlns prefix is illegal"); uri = uri.intern (); prefixStack.declarePrefix (prefix, uri); contentHandler.startPrefixMapping (prefix, uri); }
|
private void declarePrefix (String prefix, String uri) throws SAXException { int index = uri.indexOf (':'); // many versions of nwalsh docbook stylesheets // have bogus URLs; so this can't be an error... if (index < 1 && uri.length () != 0) warn ("relative URI for namespace: " + uri); // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] //Namespace Constraints //name for xml prefix must be http://www.w3.org/XML/1998/namespace boolean prefixEquality = prefix.equals("xml"); boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) { fatal("xml is by definition bound to the namespace name " + "http://www.w3.org/XML/1998/namespace"); //xmlns prefix declaration is illegal but xml prefix declaration is llegal... if (prefixEquality && uriEquality) return; //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ prefixEquality = prefix.equals("xmlns"); uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + " to prefix xmlns"); //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it if (prefixEquality && uriEquality) fatal ("declaring the xmlns prefix is illegal"); uri = uri.intern (); prefixStack.declarePrefix (prefix, uri); contentHandler.startPrefixMapping (prefix, uri); }
| 10,573
|
void endElement (String elname) throws SAXException { ContentHandler handler = contentHandler; if (!namespaces) { handler.endElement ("", "", elname); return; } prefixStack.processName (elname, nsTemp, false); handler.endElement (nsTemp [0], nsTemp [1], elname); Enumeration prefixes = prefixStack.getDeclaredPrefixes (); while (prefixes.hasMoreElements ()) handler.endPrefixMapping ((String) prefixes.nextElement ()); prefixStack.popContext (); }
|
void endElement (String elname) throws SAXException { ContentHandler handler = contentHandler; if (!namespaces) { handler.endElement ("", "", elname); return; } prefixStack.processName (elname, nsTemp, false); handler.endElement (nsTemp [0], nsTemp [1], elname); Enumeration prefixes = prefixStack.getDeclaredPrefixes (); while (prefixes.hasMoreElements ()) handler.endPrefixMapping ((String) prefixes.nextElement ()); prefixStack.popContext (); }
| 10,574
|
void endExternalEntity (String name) throws SAXException { if (!"[document]".equals (name)) lexicalHandler.endEntity (name); entityStack.pop (); }
|
void endExternalEntity (String name) throws SAXException { if (!"[document]".equals (name)) lexicalHandler.endEntity (name); entityStack.pop (); }
| 10,575
|
public ContentHandler getContentHandler () { return contentHandler == base ? null : contentHandler; }
|
public ContentHandler getContentHandler () { return (contentHandler == base) ? null : contentHandler; }
| 10,576
|
public ErrorHandler getErrorHandler () { return errorHandler == base ? null : errorHandler; }
|
public ErrorHandler getErrorHandler () { return errorHandler == base ? null : errorHandler; }
| 10,577
|
InputSource getExternalSubset (String name, String baseURI) throws SAXException, IOException { if (resolver2 == null || !useResolver2 || !extPE) return null; return resolver2.getExternalSubset (name, baseURI); }
|
InputSource getExternalSubset (String name, String baseURI) throws SAXException, IOException { if (resolver2 == null || !useResolver2 || !extPE) return null; } return resolver2.getExternalSubset(name, baseURI); }
| 10,578
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals(featureId)) { return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,579
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals(featureId)) { return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,580
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; } if ((FEATURE + "external-parameter-entities").equals(featureId)) { return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,581
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals(featureId)) { return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,582
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals(featureId)) { return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,583
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals(featureId)) { return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,584
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals(featureId)) { return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,585
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals(featureId)) { return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,586
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,587
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals (featureId)) return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
|
public boolean getFeature (String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { if ((FEATURE + "validation").equals (featureId)) return false; // external entities (both types) are optionally included if ((FEATURE + "external-general-entities").equals (featureId)) return extGE; if ((FEATURE + "external-parameter-entities") .equals (featureId)) return extPE; // element/attribute names are as written in document; no mangling if ((FEATURE + "namespace-prefixes").equals (featureId)) return xmlNames; // report element/attribute namespaces? if ((FEATURE + "namespaces").equals (featureId)) return namespaces; // all PEs and GEs are reported if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) return true; // default is true if ((FEATURE + "string-interning").equals (featureId)) return stringInterning; // EXTENSIONS 1.1 // always returns isSpecified info if ((FEATURE + "use-attributes2").equals (featureId)) return true; // meaningful between startDocument/endDocument if ((FEATURE + "is-standalone").equals (featureId)) { if (parser == null) throw new SAXNotSupportedException (featureId); return parser.isStandalone (); } // optionally don't absolutize URIs in declarations if ((FEATURE + "resolve-dtd-uris").equals(featureId)) { return resolveAll; // optionally use resolver2 interface methods, if possible if ((FEATURE + "use-entity-resolver2").equals (featureId)) return useResolver2; throw new SAXNotRecognizedException (featureId); }
| 10,588
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.