Search in sources :

Example 21 with Region

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

the class GDIWindowSurfaceData method copyArea.

public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, int dx, int dy) {
    CompositeType comptype = sg2d.imageComp;
    if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE && sg2d.clipState != sg2d.CLIP_SHAPE && (CompositeType.SrcOverNoEa.equals(comptype) || CompositeType.SrcNoEa.equals(comptype))) {
        x += sg2d.transX;
        y += sg2d.transY;
        int dstx1 = x + dx;
        int dsty1 = y + dy;
        int dstx2 = dstx1 + w;
        int dsty2 = dsty1 + h;
        Region clip = sg2d.getCompClip();
        if (dstx1 < clip.getLoX())
            dstx1 = clip.getLoX();
        if (dsty1 < clip.getLoY())
            dsty1 = clip.getLoY();
        if (dstx2 > clip.getHiX())
            dstx2 = clip.getHiX();
        if (dsty2 > clip.getHiY())
            dsty2 = clip.getHiY();
        if (dstx1 < dstx2 && dsty1 < dsty2) {
            gdiPipe.devCopyArea(this, dstx1 - dx, dsty1 - dy, dx, dy, dstx2 - dstx1, dsty2 - dsty1);
        }
        return true;
    }
    return false;
}
Also used : Region(sun.java2d.pipe.Region) CompositeType(sun.java2d.loops.CompositeType)

Example 22 with Region

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

the class XorPixelWriter method doDrawRect.

public static void doDrawRect(PixelWriter pw, SunGraphics2D sg2d, SurfaceData sData, int x, int y, int w, int h) {
    if (w < 0 || h < 0) {
        return;
    }
    int x2 = Region.dimAdd(Region.dimAdd(x, w), 1);
    int y2 = Region.dimAdd(Region.dimAdd(y, h), 1);
    Region r = sg2d.getCompClip().getBoundsIntersectionXYXY(x, y, x2, y2);
    if (r.isEmpty()) {
        return;
    }
    int cx1 = r.getLoX();
    int cy1 = r.getLoY();
    int cx2 = r.getHiX();
    int cy2 = r.getHiY();
    if (w < 2 || h < 2) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy2);
        return;
    }
    if (cy1 == y) {
        doSetRect(sData, pw, cx1, cy1, cx2, cy1 + 1);
    }
    if (cx1 == x) {
        doSetRect(sData, pw, cx1, cy1 + 1, cx1 + 1, cy2 - 1);
    }
    if (cx2 == x2) {
        doSetRect(sData, pw, cx2 - 1, cy1 + 1, cx2, cy2 - 1);
    }
    if (cy2 == y2) {
        doSetRect(sData, pw, cx1, cy2 - 1, cx2, cy2);
    }
}
Also used : Region(sun.java2d.pipe.Region)

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