Search in sources :

Example 16 with Region

use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.

the class LWContainerPeer method cutChildren.

/**
     * Removes bounds of children above specific child from the region. If above
     * is null removes all bounds of children.
     */
final Region cutChildren(Region r, final LWComponentPeer<?, ?> above) {
    boolean aboveFound = above == null;
    for (final LWComponentPeer<?, ?> child : getChildren()) {
        if (!aboveFound && child == above) {
            aboveFound = true;
            continue;
        }
        if (aboveFound) {
            if (child.isVisible()) {
                final Rectangle cb = child.getBounds();
                final Region cr = child.getRegion();
                final Region tr = cr.getTranslatedRegion(cb.x, cb.y);
                r = r.getDifference(tr.getIntersection(getContentSize()));
            }
        }
    }
    return r;
}
Also used : Rectangle(java.awt.Rectangle) Region(sun.java2d.pipe.Region)

Example 17 with Region

use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.

the class XorPixelWriter method DrawPolygons.

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;
    }
}
Also used : Region(sun.java2d.pipe.Region)

Example 18 with Region

use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.

the class X11TextRenderer method drawGlyphList.

protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
    SunToolkit.awtLock();
    try {
        X11SurfaceData x11sd = (X11SurfaceData) sg2d.surfaceData;
        Region clip = sg2d.getCompClip();
        long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY, null, sg2d.pixel);
        doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
    } finally {
        SunToolkit.awtUnlock();
    }
}
Also used : X11SurfaceData(sun.java2d.x11.X11SurfaceData) Region(sun.java2d.pipe.Region)

Example 19 with Region

use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.

the class XRRenderer method fill.

public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }
    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }
    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx, clip.getLoY() - transy, clip.getHiX() - transx, clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
Also used : ShapeSpanIterator(sun.java2d.pipe.ShapeSpanIterator) Region(sun.java2d.pipe.Region)

Example 20 with Region

use of sun.java2d.pipe.Region in project jdk8u_jdk by JetBrains.

the class X11Renderer method fill.

public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Delegate to fillPolygon() if possible...
        if (s instanceof Polygon && sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
            Polygon p = (Polygon) s;
            fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
            return;
        }
        // Otherwise we will use fillPath() for
        // high-quality fills.
        doPath(sg2d, s, true);
        return;
    }
    AffineTransform at;
    int transx, transy;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Transform (translation) will be done by XFillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }
    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx, clip.getLoY() - transy, clip.getHiX() - transx, clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        SunToolkit.awtLock();
        try {
            long xgc = validate(sg2d);
            XFillSpans(sg2d.surfaceData.getNativeOps(), xgc, ssi, ssi.getNativeIterator(), transx, transy);
        } finally {
            SunToolkit.awtUnlock();
        }
    } finally {
        ssi.dispose();
    }
}
Also used : ShapeSpanIterator(sun.java2d.pipe.ShapeSpanIterator) AffineTransform(java.awt.geom.AffineTransform) Region(sun.java2d.pipe.Region) Polygon(java.awt.Polygon)

Aggregations

Region (sun.java2d.pipe.Region)22 Rectangle (java.awt.Rectangle)5 GradientPaint (java.awt.GradientPaint)3 LinearGradientPaint (java.awt.LinearGradientPaint)3 Paint (java.awt.Paint)3 RadialGradientPaint (java.awt.RadialGradientPaint)3 TexturePaint (java.awt.TexturePaint)3 ShapeSpanIterator (sun.java2d.pipe.ShapeSpanIterator)3 Composite (java.awt.Composite)2 AffineTransform (java.awt.geom.AffineTransform)2 ColorModel (java.awt.image.ColorModel)2 Raster (java.awt.image.Raster)2 WritableRaster (java.awt.image.WritableRaster)2 CompositeType (sun.java2d.loops.CompositeType)2 AlphaComposite (java.awt.AlphaComposite)1 Polygon (java.awt.Polygon)1 PathIterator (java.awt.geom.PathIterator)1 Rectangle2D (java.awt.geom.Rectangle2D)1 BufferedImage (java.awt.image.BufferedImage)1 IntegerComponentRaster (sun.awt.image.IntegerComponentRaster)1