Java 类sun.java2d.pipe.Region 实例源码

项目:openjdk-jdk10    文件:X11PMBlitBgLoops.java   
@Override
public void BlitBg(SurfaceData src, SurfaceData dst,
                   Composite comp, Region clip, int bgColor,
                   int sx, int sy,
                   int dx, int dy,
                   int w, int h)
{
    SunToolkit.awtLock();
    try {
        int pixel = dst.pixelFor(bgColor);
        X11SurfaceData x11sd = (X11SurfaceData)dst;
        // use false for needExposures since we clip to the pixmap
        long xgc = x11sd.getBlitGC(clip, false);
        nativeBlitBg(src.getNativeOps(), dst.getNativeOps(),
                     xgc, pixel,
                     sx, sy, dx, dy, w, h);
    } finally {
        SunToolkit.awtUnlock();
    }
}
项目:OpenJSharp    文件:GeneralRenderer.java   
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;
    }
}
项目:openjdk-jdk10    文件:GDIRenderer.java   
public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) {
    int box[] = new int[4];
    GDIWindowSurfaceData sd;
    try {
        sd = (GDIWindowSurfaceData)sg2d.surfaceData;
    } catch (ClassCastException e) {
        throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
    }
    Region clip = sg2d.getCompClip();
    Composite comp = sg2d.composite;
    int eargb = sg2d.eargb;
    while (si.nextSpan(box)) {
        doFillRect(sd, clip, comp, eargb,
                   box[0], box[1], box[2]-box[0], box[3]-box[1]);
    }
}
项目:jdk8u-jdk    文件:GeneralRenderer.java   
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;
    }
}
项目:jdk8u-jdk    文件:XRRenderer.java   
public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
    Region compClip = sg2d.getCompClip();
    int transX1 = Region.clipAdd(x1, sg2d.transX);
    int transY1 = Region.clipAdd(y1, sg2d.transY);
    int transX2 = Region.clipAdd(x2, sg2d.transX);
    int transY2 = Region.clipAdd(y2, sg2d.transY);

    SunToolkit.awtLock();
    try {
        validateSurface(sg2d);
        lineGen.rasterizeLine(rectBuffer, transX1, transY1,
                transX2, transY2, compClip.getLoX(), compClip.getLoY(),
                compClip.getHiX(), compClip.getHiY(), true, true);
        tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
    } finally {
        SunToolkit.awtUnlock();
    }
}
项目:jdk8u-jdk    文件:X11PMBlitBgLoops.java   
@Override
public void BlitBg(SurfaceData src, SurfaceData dst,
                   Composite comp, Region clip, int bgColor,
                   int sx, int sy,
                   int dx, int dy,
                   int w, int h)
{
    SunToolkit.awtLock();
    try {
        int pixel = dst.pixelFor(bgColor);
        X11SurfaceData x11sd = (X11SurfaceData)dst;
        // use false for needExposures since we clip to the pixmap
        long xgc = x11sd.getBlitGC(clip, false);
        nativeBlitBg(src.getNativeOps(), dst.getNativeOps(),
                     xgc, pixel,
                     sx, sy, dx, dy, w, h);
    } finally {
        SunToolkit.awtUnlock();
    }
}
项目:jdk8u-jdk    文件:Blit.java   
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int srcx, int srcy, int dstx, int dsty,
                 int width, int height)
{
    tracePrimitive(target);
    target.Blit(src, dst, comp, clip,
                srcx, srcy, dstx, dsty, width, height);
}
项目:openjdk-jdk10    文件:GDIRenderer.java   
void doDrawArc(GDIWindowSurfaceData sData,
               Region clip, Composite comp, int color,
               int x, int y, int w, int h,
               int angleStart, int angleExtent)
{
    GraphicsPrimitive.tracePrimitive("GDIDrawArc");
    super.doDrawArc(sData, clip, comp, color, x, y, w, h,
                    angleStart, angleExtent);
}
项目:jdk8u-jdk    文件:Container.java   
final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
    checkTreeLock();
    if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
        mixingLog.fine("this = " + this +
            "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
    }
    if (fromZorder == -1) {
        return;
    }
    if (shape.isEmpty()) {
        return;
    }
    // An invalid container with not-null layout should be ignored
    // by the mixing code, the container will be validated later
    // and the mixing code will be executed later.
    if (getLayout() != null && !isValid()) {
        return;
    }
    for (int index = fromZorder; index <= toZorder; index++) {
        Component comp = getComponent(index);
        if (!comp.isLightweight()) {
            comp.subtractAndApplyShape(shape);
        } else if (comp instanceof Container &&
                ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
            ((Container)comp).recursiveSubtractAndApplyShape(shape);
        }
    }
}
项目:openjdk-jdk10    文件:GDIRenderer.java   
void doFillOval(GDIWindowSurfaceData sData,
                Region clip, Composite comp, int color,
                int x, int y, int w, int h)
{
    GraphicsPrimitive.tracePrimitive("GDIFillOval");
    super.doFillOval(sData, clip, comp, color, x, y, w, h);
}
项目:jdk8u-jdk    文件:GDIRenderer.java   
void doDrawPoly(GDIWindowSurfaceData sData,
                Region clip, Composite comp, int color,
                int transx, int transy,
                int[] xpoints, int[] ypoints,
                int npoints, boolean isclosed)
{
    GraphicsPrimitive.tracePrimitive("GDIDrawPoly");
    super.doDrawPoly(sData, clip, comp, color, transx, transy,
                     xpoints, ypoints, npoints, isclosed);
}
项目:openjdk-jdk10    文件:GDIRenderer.java   
void doFillRoundRect(GDIWindowSurfaceData sData,
                     Region clip, Composite comp, int color,
                     int x, int y, int w, int h,
                     int arcW, int arcH)
{
    GraphicsPrimitive.tracePrimitive("GDIFillRoundRect");
    super.doFillRoundRect(sData, clip, comp, color,
                          x, y, w, h, arcW, arcH);
}
项目:openjdk-jdk10    文件:BlitBg.java   
@Override
public void BlitBg(SurfaceData src, SurfaceData dst,
                   Composite comp, Region clip,
                   int bgColor,
                   int srcx, int srcy, int dstx, int dsty,
                   int width, int height)
{
    tracePrimitive(target);
    target.BlitBg(src, dst, comp, clip, bgColor,
                  srcx, srcy, dstx, dsty, width, height);
}
项目:openjdk-jdk10    文件:OGLBlitLoops.java   
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    OGLBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx1, sy1, sx2, sy2,
                         dx1, dy1, dx2, dy2,
                         true);
}
项目:openjdk-jdk10    文件:GDIRenderer.java   
void doFillArc(GDIWindowSurfaceData sData,
               Region clip, Composite comp, int color,
               int x, int y, int w, int h,
               int angleStart, int angleExtent)
{
    GraphicsPrimitive.tracePrimitive("GDIFillArc");
    super.doFillArc(sData, clip, comp, color, x, y, w, h,
                    angleStart, angleExtent);
}
项目:jdk8u-jdk    文件:GDIRenderer.java   
void doFillRect(GDIWindowSurfaceData sData,
                Region clip, Composite comp, int color,
                int x, int y, int w, int h)
{
    GraphicsPrimitive.tracePrimitive("GDIFillRect");
    super.doFillRect(sData, clip, comp, color, x, y, w, h);
}
项目:OpenJSharp    文件:GDIRenderer.java   
void doDrawRect(GDIWindowSurfaceData sData,
                Region clip, Composite comp, int color,
                int x, int y, int w, int h)
{
    GraphicsPrimitive.tracePrimitive("GDIDrawRect");
    super.doDrawRect(sData, clip, comp, color, x, y, w, h);
}
项目:jdk8u-jdk    文件:OGLBlitLoops.java   
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    OGLBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, false);
}
项目:openjdk-jdk10    文件:SunGraphics2D.java   
public Region getCompClip() {
    if (!surfaceData.isValid()) {
        // revalidateAll() implicitly recalculcates the composite clip
        revalidateAll();
    }

    return clipRegion;
}
项目:jdk8u-jdk    文件:MaskBlit.java   
public void MaskBlit(SurfaceData src, SurfaceData dst,
                     Composite comp, Region clip,
                     int srcx, int srcy, int dstx, int dsty,
                     int width, int height,
                     byte[] mask, int maskoff, int maskscan)
{
    tracePrimitive(target);
    target.MaskBlit(src, dst, comp, clip,
                    srcx, srcy, dstx, dsty, width, height,
                    mask, maskoff, maskscan);
}
项目:jdk8u-jdk    文件:LWWindowPeer.java   
@Override
void initializeImpl() {
    super.initializeImpl();


    if (getTarget() instanceof Frame) {
        setTitle(((Frame) getTarget()).getTitle());
        setState(((Frame) getTarget()).getExtendedState());
    } else if (getTarget() instanceof Dialog) {
        setTitle(((Dialog) getTarget()).getTitle());
    }

    updateAlwaysOnTopState();
    updateMinimumSize();
    updateFocusableWindowState();

    final Shape shape = getTarget().getShape();
    if (shape != null) {
        applyShape(Region.getInstance(shape, null));
    }

    final float opacity = getTarget().getOpacity();
    if (opacity < 1.0f) {
        setOpacity(opacity);
    }

    setOpaque(getTarget().isOpaque());

    updateInsets(platformWindow.getInsets());
    if (getSurfaceData() == null) {
        replaceSurfaceData(false);
    }
    activateDisplayListener();
}
项目:openjdk-jdk10    文件:SunGraphics2D.java   
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        clipRegion = devClip.getIntersection((Rectangle2D) usrClip);
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int box[] = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box, sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
项目:jdk8u-jdk    文件:SunGraphics2D.java   
public Region getCompClip() {
    if (!surfaceData.isValid()) {
        // revalidateAll() implicitly recalculcates the composite clip
        revalidateAll();
    }

    return clipRegion;
}
项目:openjdk-jdk10    文件:OGLBlitLoops.java   
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    OGLBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, true);
}
项目:OpenJSharp    文件:BlitBg.java   
@Override
public void BlitBg(SurfaceData src, SurfaceData dst,
                   Composite comp, Region clip,
                   int bgColor,
                   int srcx, int srcy, int dstx, int dsty,
                   int width, int height)
{
    tracePrimitive(target);
    target.BlitBg(src, dst, comp, clip, bgColor,
                  srcx, srcy, dstx, dsty, width, height);
}
项目:openjdk-jdk10    文件:RegionOps.java   
public void addRect(int lox, int loy, int hix, int hiy) {
    Region r2 = Region.getInstanceXYXY(lox, loy, hix, hiy);
    if (theRegion == null) {
        theRegion = r2;
    } else {
        theRegion = theRegion.getUnion(r2);
    }
}
项目:jdk8u-jdk    文件:D3DBlitLoops.java   
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx, sy, sx+w, sy+h,
                         dx, dy, dx+w, dy+h,
                         false);
}
项目:OpenJSharp    文件:D3DBlitLoops.java   
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    D3DBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx1, sy1, sx2, sy2,
                         dx1, dy1, dx2, dy2,
                         true);
}
项目:jdk8u-jdk    文件:D3DBlitLoops.java   
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx, sy, sx+w, sy+h,
                         dx, dy, dx+w, dy+h,
                         true);
}
项目:jdk8u-jdk    文件:Blit.java   
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    performop.MaskBlit(srcData, dstData, comp, clip,
                       srcx, srcy, dstx, dsty,
                       width, height,
                       null, 0, 0);
}
项目:openjdk-jdk10    文件:OGLBlitLoops.java   
public synchronized void Blit(SurfaceData src, SurfaceData dst,
                              Composite comp, Region clip,
                              int sx, int sy, int dx, int dy,
                              int w, int h)
{
    Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
                                        CompositeType.SrcNoEa,
                                        SurfaceType.IntArgbPre);

    SurfaceData cachedSrc = null;
    if (srcTmp != null) {
        // use cached intermediate surface, if available
        cachedSrc = srcTmp.get();
    }

    // convert source to IntArgbPre
    src = convertFrom(convertsrc, src, sx, sy, w, h,
                      cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE);

    // copy IntArgbPre intermediate surface to OpenGL surface
    performop.Blit(src, dst, comp, clip,
                   0, 0, dx, dy, w, h);

    if (src != cachedSrc) {
        // cache the intermediate surface
        srcTmp = new WeakReference<>(src);
    }
}
项目:openjdk-jdk10    文件:OGLBlitLoops.java   
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    OGLBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, false);
}
项目:OpenJSharp    文件:TransformHelper.java   
public native void Transform(MaskBlit output,
SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform itx, int txtype,
int sx1, int sy1, int sx2, int sy2,
int dx1, int dy1, int dx2, int dy2,
int edges[], int dxoff, int dyoff);
项目:OpenJSharp    文件:TransformHelper.java   
public void Transform(MaskBlit output,
                      SurfaceData src, SurfaceData dst,
                      Composite comp, Region clip,
                      AffineTransform itx, int txtype,
                      int sx1, int sy1, int sx2, int sy2,
                      int dx1, int dy1, int dx2, int dy2,
                      int edges[], int dxoff, int dyoff)
{
    tracePrimitive(target);
    target.Transform(output, src, dst, comp, clip, itx, txtype,
                     sx1, sy1, sx2, sy2,
                     dx1, dy1, dx2, dy2,
                     edges, dxoff, dyoff);
}
项目:jdk8u-jdk    文件:D3DMaskBlit.java   
@Override
protected void validateContext(SurfaceData dstData,
                               Composite comp, Region clip)
{
    D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
    D3DContext.validateContext(d3dDst, d3dDst,
                               clip, comp, null, null, null,
                               D3DContext.NO_CONTEXT_FLAGS);
}
项目:openjdk-jdk10    文件:OGLMaskBlit.java   
@Override
protected void validateContext(SurfaceData dstData,
                               Composite comp, Region clip)
{
    OGLSurfaceData oglDst = (OGLSurfaceData)dstData;
    OGLContext.validateContext(oglDst, oglDst,
                               clip, comp, null, null, null,
                               OGLContext.NO_CONTEXT_FLAGS);
}
项目:OpenJSharp    文件:SunGraphics2D.java   
/**
 * Constrain rendering for lightweight objects.
 */
public void constrain(int x, int y, int w, int h, Region region) {
    if ((x | y) != 0) {
        translate(x, y);
    }
    if (transformState > TRANSFORM_TRANSLATESCALE) {
        clipRect(0, 0, w, h);
        return;
    }
    // changes parameters according to the current scale and translate.
    final double scaleX = transform.getScaleX();
    final double scaleY = transform.getScaleY();
    x = constrainX = (int) transform.getTranslateX();
    y = constrainY = (int) transform.getTranslateY();
    w = Region.dimAdd(x, Region.clipScale(w, scaleX));
    h = Region.dimAdd(y, Region.clipScale(h, scaleY));

    Region c = constrainClip;
    if (c == null) {
        c = Region.getInstanceXYXY(x, y, w, h);
    } else {
        c = c.getIntersectionXYXY(x, y, w, h);
    }
    if (region != null) {
        region = region.getScaledRegion(scaleX, scaleY);
        region = region.getTranslatedRegion(x, y);
        c = c.getIntersection(region);
    }

    if (c == constrainClip) {
        // Common case to ignore
        return;
    }

    constrainClip = c;
    if (!devClip.isInsideQuickCheck(c)) {
        devClip = devClip.getIntersection(c);
        validateCompClip();
    }
}
项目:OpenJSharp    文件:SunGraphics2D.java   
public Region getCompClip() {
    if (!surfaceData.isValid()) {
        // revalidateAll() implicitly recalculcates the composite clip
        revalidateAll();
    }

    return clipRegion;
}
项目:openjdk-jdk10    文件:MaskBlit.java   
/**
 * All MaskBlit implementors must have this invoker method
 */
public native void MaskBlit(SurfaceData src, SurfaceData dst,
                            Composite comp, Region clip,
                            int srcx, int srcy,
                            int dstx, int dsty,
                            int width, int height,
                            byte[] mask, int maskoff, int maskscan);
项目:openjdk-jdk10    文件:D3DBlitLoops.java   
@Override
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    // see comment above
    D3DVolatileSurfaceManager.handleVItoScreenOp(src, dst);
}