Java Code Examples for sun.java2d.pipe.Region#getInstanceXYWH()

The following examples show how to use sun.java2d.pipe.Region#getInstanceXYWH() . 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: SunGraphics2D.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void setDevClip(int x, int y, int w, int h) {
    Region c = constrainClip;
    if (c == null) {
        devClip = Region.getInstanceXYWH(x, y, w, h);
    } else {
        devClip = c.getIntersectionXYWH(x, y, w, h);
    }
    validateCompClip();
}
 
Example 2
Source File: Blit.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
Example 3
Source File: SunGraphics2D.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void setDevClip(int x, int y, int w, int h) {
    Region c = constrainClip;
    if (c == null) {
        devClip = Region.getInstanceXYWH(x, y, w, h);
    } else {
        devClip = c.getIntersectionXYWH(x, y, w, h);
    }
    validateCompClip();
}
 
Example 4
Source File: CustomComponent.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 5
Source File: Blit.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
Example 6
Source File: CustomComponent.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 7
Source File: CustomComponent.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 8
Source File: Blit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
Example 9
Source File: CustomComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 10
Source File: SunGraphics2D.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void setDevClip(int x, int y, int w, int h) {
    Region c = constrainClip;
    if (c == null) {
        devClip = Region.getInstanceXYWH(x, y, w, h);
    } else {
        devClip = c.getIntersectionXYWH(x, y, w, h);
    }
    validateCompClip();
}
 
Example 11
Source File: CustomComponent.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 12
Source File: CustomComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 13
Source File: SunGraphics2D.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void setDevClip(int x, int y, int w, int h) {
    Region c = constrainClip;
    if (c == null) {
        devClip = Region.getInstanceXYWH(x, y, w, h);
    } else {
        devClip = c.getIntersectionXYWH(x, y, w, h);
    }
    validateCompClip();
}
 
Example 14
Source File: Blit.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
Example 15
Source File: CustomComponent.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 16
Source File: Blit.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
Example 17
Source File: SunGraphics2D.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void setDevClip(int x, int y, int w, int h) {
    Region c = constrainClip;
    if (c == null) {
        devClip = Region.getInstanceXYWH(x, y, w, h);
    } else {
        devClip = c.getIntersectionXYWH(x, y, w, h);
    }
    validateCompClip();
}
 
Example 18
Source File: CustomComponent.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 19
Source File: CustomComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}
 
Example 20
Source File: CustomComponent.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst,
                                         Region clip,
                                         int srcx, int srcy,
                                         int dstx, int dsty,
                                         int w, int h)
{
    /*
     * Intersect all of:
     *   - operation area (dstx, dsty, w, h)
     *   - destination bounds
     *   - (translated) src bounds
     *   - supplied clip (may be non-rectangular)
     * Intersect the rectangular regions first since those are
     * simpler operations.
     */
    Region ret = Region.getInstanceXYWH(dstx, dsty, w, h);
    ret = ret.getIntersection(dst.getBounds());
    Rectangle r = src.getBounds();
    // srcxy in src space maps to dstxy in dst space
    r.translate(dstx - srcx, dsty - srcy);
    ret = ret.getIntersection(r);
    if (clip != null) {
        // Intersect with clip last since it may be non-rectangular
        ret = ret.getIntersection(clip);
    }
    return ret;
}