boolean xmajor = (ax >= ay); outcode1 = outcode(x1, y1, cxmin, cymin, cxmax, cymax); outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax); while ((outcode1 | outcode2) != 0) { int xsteps, ysteps; if ((outcode1 & outcode2) != 0) { return false; } if (outcode1 != 0) { if (0 != (outcode1 & (OUTCODE_TOP | OUTCODE_BOTTOM))) { if (0 != (outcode1 & OUTCODE_TOP)) { y1 = cymin; } else { y1 = cymax; } ysteps = y1 - boundPts[1]; if (ysteps < 0) { ysteps = -ysteps; } xsteps = 2 * ysteps * ax + ay; if (xmajor) { xsteps += ay - ax - 1; } xsteps = xsteps / (2 * ay); if (dx < 0) { xsteps = -xsteps; } x1 = boundPts[0] + xsteps; } else if (0 != (outcode1 & (OUTCODE_LEFT | OUTCODE_RIGHT))) { if (0 != (outcode1 & OUTCODE_LEFT)) { x1 = cxmin; } else { x1 = cxmax; } xsteps = x1 - boundPts[0]; if (xsteps < 0) { xsteps = -xsteps; } ysteps = 2 * xsteps * ay + ax; if (!xmajor) { ysteps += ax - ay - 1; } ysteps = ysteps / (2 * ax); if (dy < 0) { ysteps = -ysteps; } y1 = boundPts[1] + ysteps; } outcode1 = outcode(x1, y1, cxmin, cymin, cxmax, cymax); } else { if (0 != (outcode2 & (OUTCODE_TOP | OUTCODE_BOTTOM))) { if (0 != (outcode2 & OUTCODE_TOP)) { y2 = cymin; } else { y2 = cymax; } ysteps = y2 - boundPts[3]; if (ysteps < 0) { ysteps = -ysteps; } xsteps = 2 * ysteps * ax + ay; if (xmajor) { xsteps += ay - ax; } else { xsteps -= 1; } xsteps = xsteps / (2 * ay); if (dx > 0) { xsteps = -xsteps; } x2 = boundPts[2] + xsteps; } else if (0 != (outcode2 & (OUTCODE_LEFT | OUTCODE_RIGHT))) { if (0 != (outcode2 & OUTCODE_LEFT)) { x2 = cxmin; } else { x2 = cxmax; } xsteps = x2 - boundPts[2]; if (xsteps < 0) { xsteps = -xsteps; } ysteps = 2 * xsteps * ay + ax; if (xmajor) { ysteps -= 1; } else { ysteps += ax - ay; } ysteps = ysteps / (2 * ax); if (dy > 0) { ysteps = -ysteps; } y2 = boundPts[3] + ysteps; } outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax); } } boundPts[0] = x1; boundPts[1] = y1; boundPts[2] = x2; boundPts[3] = y2; boundPts[4] = dx; boundPts[5] = dy; boundPts[6] = ax; boundPts[7] = ay; } return true; } static PixelWriter createSolidPixelWriter(SunGraphics2D sg2d, SurfaceData sData) { ColorModel dstCM = sData.getColorModel(); Object srcPixel = dstCM.getDataElements(sg2d.eargb, null); return new SolidPixelWriter(srcPixel); } static PixelWriter createXorPixelWriter(SunGraphics2D sg2d, SurfaceData sData) { ColorModel dstCM = sData.getColorModel(); Object srcPixel = dstCM.getDataElements(sg2d.eargb, null); XORComposite comp = (XORComposite)sg2d.getComposite(); int xorrgb = comp.getXorColor().getRGB(); Object xorPixel = dstCM.getDataElements(xorrgb, null); switch (dstCM.getTransferType()) { case DataBuffer.TYPE_BYTE: return new XorPixelWriter.ByteData(srcPixel, xorPixel); case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: return new XorPixelWriter.ShortData(srcPixel, xorPixel); case DataBuffer.TYPE_INT: return new XorPixelWriter.IntData(srcPixel, xorPixel); case DataBuffer.TYPE_FLOAT: return new XorPixelWriter.FloatData(srcPixel, xorPixel); case DataBuffer.TYPE_DOUBLE: return new XorPixelWriter.DoubleData(srcPixel, xorPixel); default: throw new InternalError("Unsupported XOR pixel type"); } }} class SetFillRectANY extends FillRect { SetFillRectANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void FillRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); Region r = sg2d.getCompClip().getBoundsIntersectionXYWH(x, y, w, h); GeneralRenderer.doSetRect(sData, pw, r.getLoX(), r.getLoY(), r.getHiX(), r.getHiY()); }} class PixelWriterDrawHandler extends ProcessPath.DrawHandler { PixelWriter pw; SurfaceData sData; Region clip; public PixelWriterDrawHandler(SurfaceData sData, PixelWriter pw, Region clip, int strokeHint) { super(clip.getLoX(), clip.getLoY(), clip.getHiX(), clip.getHiY(), strokeHint); this.sData = sData; this.pw = pw; this.clip = clip; } public void drawLine(int x0, int y0, int x1, int y1) { GeneralRenderer.doDrawLine(sData, pw, null, clip, x0, y0, x1, y1); } public void drawPixel(int x0, int y0) { GeneralRenderer.doSetRect(sData, pw, x0, y0, x0 + 1, y0 + 1); } public void drawScanline(int x0, int x1, int y0) { GeneralRenderer.doSetRect(sData, pw, x0, y0, x1 + 1, y0 + 1); }} class SetFillPathANY extends FillPath { SetFillPathANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); }} class SetFillSpansANY extends FillSpans { SetFillSpansANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void FillSpans(SunGraphics2D sg2d, SurfaceData sData, SpanIterator si) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); int span[] = new int[4]; while (si.nextSpan(span)) { GeneralRenderer.doSetRect(sData, pw, span[0], span[1], span[2], span[3]); } }} class SetDrawLineANY extends DrawLine { SetDrawLineANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawLine(SunGraphics2D sg2d, SurfaceData sData, int x1, int y1, int x2, int y2) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); if (y1 >= y2) { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x2, y2, x1, y1); } else { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x1, y1, x2, y2); } }} class SetDrawPolygonsANY extends DrawPolygons { SetDrawPolygonsANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData, int xPoints[], int yPoints[], int nPoints[], int numPolys, int transx, int transy, boolean close) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); int off = 0; Region clip = sg2d.getCompClip(); for (int i = 0; i < numPolys; i++) { int numpts = nPoints[i]; GeneralRenderer.doDrawPoly(sData, pw, xPoints, yPoints, off, numpts, clip, transx, transy, close); off += numpts; } }} class SetDrawPathANY extends DrawPath { SetDrawPathANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); ProcessPath.drawPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy ); }} class SetDrawRectANY extends DrawRect { SetDrawRectANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); GeneralRenderer.doDrawRect(pw, sg2d, sData, x, y, w, h); }} class XorFillRectANY extends FillRect { XorFillRectANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void FillRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); Region r = sg2d.getCompClip().getBoundsIntersectionXYWH(x, y, w, h); GeneralRenderer.doSetRect(sData, pw, r.getLoX(), r.getLoY(), r.getHiX(), r.getHiY()); }} class XorFillPathANY extends FillPath { XorFillPathANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); }} class XorFillSpansANY extends FillSpans { XorFillSpansANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void FillSpans(SunGraphics2D sg2d, SurfaceData sData, SpanIterator si) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); int span[] = new int[4]; while (si.nextSpan(span)) { GeneralRenderer.doSetRect(sData, pw, span[0], span[1], span[2], span[3]); } }} class XorDrawLineANY extends DrawLine { XorDrawLineANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawLine(SunGraphics2D sg2d, SurfaceData sData, int x1, int y1, int x2, int y2) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); if (y1 >= y2) { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x2, y2, x1, y1); } else { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x1, y1, x2, y2); } }} class XorDrawPolygonsANY extends DrawPolygons { XorDrawPolygonsANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData, int xPoints[], int yPoints[], int nPoints[], int numPolys, int transx, int transy, boolean close) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); int off = 0; Region clip = sg2d.getCompClip(); for (int i = 0; i < numPolys; i++) { int numpts = nPoints[i]; GeneralRenderer.doDrawPoly(sData, pw, xPoints, yPoints, off, numpts, clip, transx, transy, close); off += numpts; } }} class XorDrawPathANY extends DrawPath { XorDrawPathANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); ProcessPath.drawPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy ); }} class XorDrawRectANY extends DrawRect { XorDrawRectANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawRect(pw, sg2d, sData, x, y, w, h); }} class XorDrawGlyphListANY extends DrawGlyphList { XorDrawGlyphListANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData sData, GlyphList gl) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawGlyphList(sData, pw, gl, sg2d.getCompClip()); }} class XorDrawGlyphListAAANY extends DrawGlyphListAA { XorDrawGlyphListAAANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData sData, GlyphList gl) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawGlyphList(sData, pw, gl, sg2d.getCompClip()); }} abstract class PixelWriter { protected WritableRaster dstRast; Lines 501–1000 of 1125. Previous lines Load more
boolean xmajor = (ax >= ay); outcode1 = outcode(x1, y1, cxmin, cymin, cxmax, cymax); outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax); while ((outcode1 | outcode2) != 0) { int xsteps, ysteps; if ((outcode1 & outcode2) != 0) { return false; } if (outcode1 != 0) { if (0 != (outcode1 & (OUTCODE_TOP | OUTCODE_BOTTOM))) { if (0 != (outcode1 & OUTCODE_TOP)) { y1 = cymin; } else { y1 = cymax; } ysteps = y1 - boundPts[1]; if (ysteps < 0) { ysteps = -ysteps; } xsteps = 2 * ysteps * ax + ay; if (xmajor) { xsteps += ay - ax - 1; } xsteps = xsteps / (2 * ay); if (dx < 0) { xsteps = -xsteps; } x1 = boundPts[0] + xsteps; } else if (0 != (outcode1 & (OUTCODE_LEFT | OUTCODE_RIGHT))) { if (0 != (outcode1 & OUTCODE_LEFT)) { x1 = cxmin; } else { x1 = cxmax; } xsteps = x1 - boundPts[0]; if (xsteps < 0) { xsteps = -xsteps; } ysteps = 2 * xsteps * ay + ax; if (!xmajor) { ysteps += ax - ay - 1; } ysteps = ysteps / (2 * ax); if (dy < 0) { ysteps = -ysteps; } y1 = boundPts[1] + ysteps; } outcode1 = outcode(x1, y1, cxmin, cymin, cxmax, cymax); } else { if (0 != (outcode2 & (OUTCODE_TOP | OUTCODE_BOTTOM))) { if (0 != (outcode2 & OUTCODE_TOP)) { y2 = cymin; } else { y2 = cymax; } ysteps = y2 - boundPts[3]; if (ysteps < 0) { ysteps = -ysteps; } xsteps = 2 * ysteps * ax + ay; if (xmajor) { xsteps += ay - ax; } else { xsteps -= 1; } xsteps = xsteps / (2 * ay); if (dx > 0) { xsteps = -xsteps; } x2 = boundPts[2] + xsteps; } else if (0 != (outcode2 & (OUTCODE_LEFT | OUTCODE_RIGHT))) { if (0 != (outcode2 & OUTCODE_LEFT)) { x2 = cxmin; } else { x2 = cxmax; } xsteps = x2 - boundPts[2]; if (xsteps < 0) { xsteps = -xsteps; } ysteps = 2 * xsteps * ay + ax; if (xmajor) { ysteps -= 1; } else { ysteps += ax - ay; } ysteps = ysteps / (2 * ax); if (dy > 0) { ysteps = -ysteps; } y2 = boundPts[3] + ysteps; } outcode2 = outcode(x2, y2, cxmin, cymin, cxmax, cymax); } } boundPts[0] = x1; boundPts[1] = y1; boundPts[2] = x2; boundPts[3] = y2; boundPts[4] = dx; boundPts[5] = dy; boundPts[6] = ax; boundPts[7] = ay; } return true; } static PixelWriter createSolidPixelWriter(SunGraphics2D sg2d, SurfaceData sData) { ColorModel dstCM = sData.getColorModel(); Object srcPixel = dstCM.getDataElements(sg2d.eargb, null); return new SolidPixelWriter(srcPixel); } static PixelWriter createXorPixelWriter(SunGraphics2D sg2d, SurfaceData sData) { ColorModel dstCM = sData.getColorModel(); Object srcPixel = dstCM.getDataElements(sg2d.eargb, null); XORComposite comp = (XORComposite)sg2d.getComposite(); int xorrgb = comp.getXorColor().getRGB(); Object xorPixel = dstCM.getDataElements(xorrgb, null); switch (dstCM.getTransferType()) { case DataBuffer.TYPE_BYTE: return new XorPixelWriter.ByteData(srcPixel, xorPixel); case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: return new XorPixelWriter.ShortData(srcPixel, xorPixel); case DataBuffer.TYPE_INT: return new XorPixelWriter.IntData(srcPixel, xorPixel); case DataBuffer.TYPE_FLOAT: return new XorPixelWriter.FloatData(srcPixel, xorPixel); case DataBuffer.TYPE_DOUBLE: return new XorPixelWriter.DoubleData(srcPixel, xorPixel); default: throw new InternalError("Unsupported XOR pixel type"); } } } class SetFillRectANY extends FillRect { SetFillRectANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void FillRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); Region r = sg2d.getCompClip().getBoundsIntersectionXYWH(x, y, w, h); GeneralRenderer.doSetRect(sData, pw, r.getLoX(), r.getLoY(), r.getHiX(), r.getHiY()); } } class PixelWriterDrawHandler extends ProcessPath.DrawHandler { PixelWriter pw; SurfaceData sData; Region clip; public PixelWriterDrawHandler(SurfaceData sData, PixelWriter pw, Region clip, int strokeHint) { super(clip.getLoX(), clip.getLoY(), clip.getHiX(), clip.getHiY(), strokeHint); this.sData = sData; this.pw = pw; this.clip = clip; } public void drawLine(int x0, int y0, int x1, int y1) { GeneralRenderer.doDrawLine(sData, pw, null, clip, x0, y0, x1, y1); } public void drawPixel(int x0, int y0) { GeneralRenderer.doSetRect(sData, pw, x0, y0, x0 + 1, y0 + 1); } public void drawScanline(int x0, int x1, int y0) { GeneralRenderer.doSetRect(sData, pw, x0, y0, x1 + 1, y0 + 1); } } class SetFillPathANY extends FillPath { SetFillPathANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); } } class SetFillSpansANY extends FillSpans { SetFillSpansANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void FillSpans(SunGraphics2D sg2d, SurfaceData sData, SpanIterator si) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); int span[] = new int[4]; while (si.nextSpan(span)) { GeneralRenderer.doSetRect(sData, pw, span[0], span[1], span[2], span[3]); } } } class SetDrawLineANY extends DrawLine { SetDrawLineANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawLine(SunGraphics2D sg2d, SurfaceData sData, int x1, int y1, int x2, int y2) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); if (y1 >= y2) { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x2, y2, x1, y1); } else { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x1, y1, x2, y2); } } } class SetDrawPolygonsANY extends DrawPolygons { SetDrawPolygonsANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData, int xPoints[], int yPoints[], int nPoints[], int numPolys, int transx, int transy, boolean close) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); int off = 0; Region clip = sg2d.getCompClip(); for (int i = 0; i < numPolys; i++) { int numpts = nPoints[i]; GeneralRenderer.doDrawPoly(sData, pw, xPoints, yPoints, off, numpts, clip, transx, transy, close); off += numpts; } } } class SetDrawPathANY extends DrawPath { SetDrawPathANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); ProcessPath.drawPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy ); } } class SetDrawRectANY extends DrawRect { SetDrawRectANY() { super(SurfaceType.AnyColor, CompositeType.SrcNoEa, SurfaceType.Any); } public void DrawRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); GeneralRenderer.doDrawRect(pw, sg2d, sData, x, y, w, h); } } class XorFillRectANY extends FillRect { XorFillRectANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void FillRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); Region r = sg2d.getCompClip().getBoundsIntersectionXYWH(x, y, w, h); GeneralRenderer.doSetRect(sData, pw, r.getLoX(), r.getLoY(), r.getHiX(), r.getHiY()); } } class XorFillPathANY extends FillPath { XorFillPathANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); } } class XorFillSpansANY extends FillSpans { XorFillSpansANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void FillSpans(SunGraphics2D sg2d, SurfaceData sData, SpanIterator si) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); int span[] = new int[4]; while (si.nextSpan(span)) { GeneralRenderer.doSetRect(sData, pw, span[0], span[1], span[2], span[3]); } } } class XorDrawLineANY extends DrawLine { XorDrawLineANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawLine(SunGraphics2D sg2d, SurfaceData sData, int x1, int y1, int x2, int y2) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); if (y1 >= y2) { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x2, y2, x1, y1); } else { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x1, y1, x2, y2); } } } class XorDrawPolygonsANY extends DrawPolygons { XorDrawPolygonsANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData, int xPoints[], int yPoints[], int nPoints[], int numPolys, int transx, int transy, boolean close) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); int off = 0; Region clip = sg2d.getCompClip(); for (int i = 0; i < numPolys; i++) { int numpts = nPoints[i]; GeneralRenderer.doDrawPoly(sData, pw, xPoints, yPoints, off, numpts, clip, transx, transy, close); off += numpts; } } } class XorDrawPathANY extends DrawPath { XorDrawPathANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); ProcessPath.drawPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy ); } } class XorDrawRectANY extends DrawRect { XorDrawRectANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawRect(SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawRect(pw, sg2d, sData, x, y, w, h); } } class XorDrawGlyphListANY extends DrawGlyphList { XorDrawGlyphListANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData sData, GlyphList gl) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawGlyphList(sData, pw, gl, sg2d.getCompClip()); } } class XorDrawGlyphListAAANY extends DrawGlyphListAA { XorDrawGlyphListAAANY() { super(SurfaceType.AnyColor, CompositeType.Xor, SurfaceType.Any); } public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData sData, GlyphList gl) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); GeneralRenderer.doDrawGlyphList(sData, pw, gl, sg2d.getCompClip()); } } abstract class PixelWriter { protected WritableRaster dstRast;