Java Code Examples for sun.java2d.SunGraphics2D#CLIP_SHAPE

The following examples show how to use sun.java2d.SunGraphics2D#CLIP_SHAPE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GDIWindowSurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    CompositeType comptype = sg2d.imageComp;
    if (sg2d.clipState != SunGraphics2D.CLIP_SHAPE &&
        (CompositeType.SrcOverNoEa.equals(comptype) ||
         CompositeType.SrcNoEa.equals(comptype)))
    {
        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;
}
 
Example 2
Source File: LoopPipe.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 3
Source File: LoopPipe.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 4
Source File: GDIWindowSurfaceData.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    CompositeType comptype = sg2d.imageComp;
    if (sg2d.clipState != SunGraphics2D.CLIP_SHAPE &&
        (CompositeType.SrcOverNoEa.equals(comptype) ||
         CompositeType.SrcNoEa.equals(comptype)))
    {
        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;
}
 
Example 5
Source File: LoopPipe.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 6
Source File: LoopPipe.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 7
Source File: LoopPipe.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 8
Source File: LoopPipe.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 9
Source File: LoopPipe.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 10
Source File: LoopPipe.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 11
Source File: LoopPipe.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 12
Source File: LoopPipe.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int[] spanbox = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 13
Source File: LoopPipe.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 14
Source File: LoopPipe.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 15
Source File: LoopPipe.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 16
Source File: LoopPipe.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) {
    // REMIND: Eventually, the plan is that it will not be possible for
    // fs to be null since the FillSpans loop will be the fundamental
    // loop implemented for any destination type...
    if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
        si = sg2d.clipRegion.filter(si);
        // REMIND: Region.filter produces a Java-only iterator
        // with no native counterpart...
    } else {
        sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop;
        if (fs != null) {
            fs.FillSpans(sg2d, sg2d.getSurfaceData(), si);
            return;
        }
    }
    int spanbox[] = new int[4];
    SurfaceData sd = sg2d.getSurfaceData();
    while (si.nextSpan(spanbox)) {
        int x = spanbox[0];
        int y = spanbox[1];
        int w = spanbox[2] - x;
        int h = spanbox[3] - y;
        sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
    }
}
 
Example 17
Source File: GDIWindowSurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void validatePipe(SunGraphics2D sg2d) {
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
        sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
        (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY ||
         sg2d.compositeState == SunGraphics2D.COMP_XOR))
    {
        if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
            // Do this to init textpipe correctly; we will override the
            // other non-text pipes below
            // REMIND: we should clean this up eventually instead of
            // having this work duplicated.
            super.validatePipe(sg2d);
        } else {
            switch (sg2d.textAntialiasHint) {

            case SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT:
                /* equate DEFAULT to OFF which it is for us */
            case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
                sg2d.textpipe = solidTextRenderer;
                break;

            case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
                sg2d.textpipe = aaTextRenderer;
                break;

            default:
                switch (sg2d.getFontInfo().aaHint) {

                case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
                case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
                    sg2d.textpipe = lcdTextRenderer;
                    break;

                case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
                    sg2d.textpipe = aaTextRenderer;
                    break;

                default:
                    sg2d.textpipe = solidTextRenderer;
                }
            }
        }
        sg2d.imagepipe = imagepipe;
        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
            sg2d.drawpipe = gdiTxPipe;
            sg2d.fillpipe = gdiTxPipe;
        } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN){
            sg2d.drawpipe = gdiTxPipe;
            sg2d.fillpipe = gdiPipe;
        } else {
            sg2d.drawpipe = gdiPipe;
            sg2d.fillpipe = gdiPipe;
        }
        sg2d.shapepipe = gdiPipe;
        // This is needed for AA text.
        // Note that even a SolidTextRenderer can dispatch AA text
        // if a GlyphVector overrides the AA setting.
        // We use getRenderLoops() rather than setting solidloops
        // directly so that we get the appropriate loops in XOR mode.
        if (sg2d.loops == null) {
            // assert(some pipe will always be a LoopBasedPipe)
            sg2d.loops = getRenderLoops(sg2d);
        }
    } else {
        super.validatePipe(sg2d);
    }
}