Java Code Examples for sun.java2d.loops.CompositeType#SrcNoEa

The following examples show how to use sun.java2d.loops.CompositeType#SrcNoEa . 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: DrawImage.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected boolean scaleSurfaceData(SunGraphics2D sg,
                                   Region clipRegion,
                                   SurfaceData srcData,
                                   SurfaceData dstData,
                                   SurfaceType srcType,
                                   SurfaceType dstType,
                                   int sx1, int sy1,
                                   int sx2, int sy2,
                                   double dx1, double dy1,
                                   double dx2, double dy2)
{
    CompositeType comp = sg.imageComp;
    if (CompositeType.SrcOverNoEa.equals(comp) &&
        (srcData.getTransparency() == Transparency.OPAQUE))
    {
        comp = CompositeType.SrcNoEa;
    }

    ScaledBlit blit = ScaledBlit.getFromCache(srcType, comp, dstType);
    if (blit != null) {
        blit.Scale(srcData, dstData, sg.composite, clipRegion,
                   sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
        return true;
    }
    return false;
}
 
Example 2
Source File: SunGraphics2D.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void validateColor() {
    int eargb;
    if (imageComp == CompositeType.Clear) {
        eargb = 0;
    } else {
        eargb = foregroundColor.getRGB();
        if (compositeState <= COMP_ALPHA &&
            imageComp != CompositeType.SrcNoEa &&
            imageComp != CompositeType.SrcOverNoEa)
        {
            AlphaComposite alphacomp = (AlphaComposite) composite;
            int a = Math.round(alphacomp.getAlpha() * (eargb >>> 24));
            eargb = (eargb & 0x00ffffff) | (a << 24);
        }
    }
    this.eargb = eargb;
    this.pixel = surfaceData.pixelFor(eargb);
}
 
Example 3
Source File: GDIBlitLoops.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This constructor sets mask for this primitive which can be
 * retrieved in native code to set the appropriate values for GDI.
 */
public GDIBlitLoops(SurfaceType srcType, SurfaceType dstType,
                    int rmask, int gmask, int bmask)
{
    super(srcType, CompositeType.SrcNoEa, dstType);
    this.rmask = rmask;
    this.gmask = gmask;
    this.bmask = bmask;
}
 
Example 4
Source File: GDIBlitLoops.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This constructor sets mask for this primitive which can be
 * retrieved in native code to set the appropriate values for GDI.
 */
public GDIBlitLoops(SurfaceType srcType, SurfaceType dstType,
                    int rmask, int gmask, int bmask)
{
    super(srcType, CompositeType.SrcNoEa, dstType);
    this.rmask = rmask;
    this.gmask = gmask;
    this.bmask = bmask;
}
 
Example 5
Source File: SurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static CompositeType getFillCompositeType(SunGraphics2D sg2d) {
    CompositeType compType = sg2d.imageComp;
    if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) {
        if (compType == CompositeType.SrcOverNoEa) {
            compType = CompositeType.OpaqueSrcOverNoEa;
        } else {
            compType = CompositeType.SrcNoEa;
        }
    }
    return compType;
}
 
Example 6
Source File: GDIBlitLoops.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This constructor sets mask for this primitive which can be
 * retrieved in native code to set the appropriate values for GDI.
 */
public GDIBlitLoops(SurfaceType srcType, SurfaceType dstType,
                    int rmask, int gmask, int bmask)
{
    super(srcType, CompositeType.SrcNoEa, dstType);
    this.rmask = rmask;
    this.gmask = gmask;
    this.bmask = bmask;
}
 
Example 7
Source File: D3DBlitLoops.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
D3DSurfaceToSwBlit(SurfaceType dstType, int typeval) {
    super(D3DSurfaceData.D3DSurface,
          CompositeType.SrcNoEa,
          dstType);
    this.typeval = typeval;
}
 
Example 8
Source File: D3DBlitLoops.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
D3DSurfaceToSwBlit(SurfaceType dstType, int typeval) {
    super(D3DSurfaceData.D3DSurface,
          CompositeType.SrcNoEa,
          dstType);
    this.typeval = typeval;
}
 
Example 9
Source File: OGLBlitLoops.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
OGLSwToTextureBlit(SurfaceType srcType, int typeval) {
    super(srcType,
          CompositeType.SrcNoEa,
          OGLSurfaceData.OpenGLTexture);
    this.typeval = typeval;
}
 
Example 10
Source File: X11PMBlitBgLoops.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public X11PMBlitBgLoops(SurfaceType srcType, SurfaceType dstType)
{
    super(srcType, CompositeType.SrcNoEa, dstType);
}
 
Example 11
Source File: SunGraphics2D.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the Composite in the current graphics state. Composite is used
 * in all drawing methods such as drawImage, drawString, drawPath,
 * and fillPath.  It specifies how new pixels are to be combined with
 * the existing pixels on the graphics device in the rendering process.
 * @param comp The Composite object to be used for drawing.
 * @see java.awt.Graphics#setXORMode
 * @see java.awt.Graphics#setPaintMode
 * @see AlphaComposite
 */
public void setComposite(Composite comp) {
    if (composite == comp) {
        return;
    }
    int newCompState;
    CompositeType newCompType;
    if (comp instanceof AlphaComposite) {
        AlphaComposite alphacomp = (AlphaComposite) comp;
        newCompType = CompositeType.forAlphaComposite(alphacomp);
        if (newCompType == CompositeType.SrcOverNoEa) {
            if (paintState == PAINT_OPAQUECOLOR ||
                (paintState > PAINT_ALPHACOLOR &&
                 paint.getTransparency() == Transparency.OPAQUE))
            {
                newCompState = COMP_ISCOPY;
            } else {
                newCompState = COMP_ALPHA;
            }
        } else if (newCompType == CompositeType.SrcNoEa ||
                   newCompType == CompositeType.Src ||
                   newCompType == CompositeType.Clear)
        {
            newCompState = COMP_ISCOPY;
        } else if (surfaceData.getTransparency() == Transparency.OPAQUE &&
                   newCompType == CompositeType.SrcIn)
        {
            newCompState = COMP_ISCOPY;
        } else {
            newCompState = COMP_ALPHA;
        }
    } else if (comp instanceof XORComposite) {
        newCompState = COMP_XOR;
        newCompType = CompositeType.Xor;
    } else if (comp == null) {
        throw new IllegalArgumentException("null Composite");
    } else {
        surfaceData.checkCustomComposite();
        newCompState = COMP_CUSTOM;
        newCompType = CompositeType.General;
    }
    if (compositeState != newCompState ||
        imageComp != newCompType)
    {
        compositeState = newCompState;
        imageComp = newCompType;
        invalidatePipe();
        validFontInfo = false;
    }
    composite = comp;
    if (paintState <= PAINT_ALPHACOLOR) {
        validateColor();
    }
}
 
Example 12
Source File: OGLBlitLoops.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
OGLSwToTextureBlit(SurfaceType srcType, int typeval) {
    super(srcType,
          CompositeType.SrcNoEa,
          OGLSurfaceData.OpenGLTexture);
    this.typeval = typeval;
}
 
Example 13
Source File: D3DBlitLoops.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
D3DSwToTextureBlit(SurfaceType srcType, int typeval) {
    super(srcType,
          CompositeType.SrcNoEa,
          D3DSurfaceData.D3DTexture);
    this.typeval = typeval;
}
 
Example 14
Source File: X11PMBlitLoops.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public X11PMBlitLoops(SurfaceType srcType, SurfaceType dstType,
                      boolean over) {
    super(srcType,
          over ? CompositeType.SrcOverNoEa : CompositeType.SrcNoEa,
          dstType);
}
 
Example 15
Source File: OGLBlitLoops.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
OGLSwToTextureBlit(SurfaceType srcType, int typeval) {
    super(srcType,
          CompositeType.SrcNoEa,
          OGLSurfaceData.OpenGLTexture);
    this.typeval = typeval;
}
 
Example 16
Source File: OGLBlitLoops.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
OGLSurfaceToSwBlit(final SurfaceType dstType,final int typeval) {
    super(OGLSurfaceData.OpenGLSurface,
          CompositeType.SrcNoEa,
          dstType);
    this.typeval = typeval;
}
 
Example 17
Source File: SunGraphics2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
    if (w <= 0 || h <= 0) {
        return;
    }

    if (transformState == SunGraphics2D.TRANSFORM_ISIDENT) {
        // do nothing
    } else if (transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += transX;
        y += transY;
    } else if (transformState == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
        // In case of negative scale transform, reflect the rect coords.
        if (w < 0) {
            w = -w;
            x -= w;
        }
        if (h < 0) {
            h = -h;
            y -= h;
        }
    } else {
        throw new InternalError("transformed copyArea not implemented yet");
    }

    SurfaceData theData = surfaceData;
    if (theData.copyArea(this, x, y, w, h, dx, dy)) {
        return;
    }

    // REMIND: This method does not deal with missing data from the
    // source object (i.e. it does not send exposure events...)

    Region clip = getCompClip();

    Composite comp = composite;
    if (lastCAcomp != comp) {
        SurfaceType dsttype = theData.getSurfaceType();
        CompositeType comptype = imageComp;
        if (CompositeType.SrcOverNoEa.equals(comptype) &&
            theData.getTransparency() == Transparency.OPAQUE)
        {
            comptype = CompositeType.SrcNoEa;
        }
        lastCAblit = Blit.locate(dsttype, comptype, dsttype);
        lastCAcomp = comp;
    }

    Blit ob = lastCAblit;
    if (dy == 0 && dx > 0 && dx < w) {
        while (w > 0) {
            int partW = Math.min(w, dx);
            w -= partW;
            int sx = x + w;
            ob.Blit(theData, theData, comp, clip,
                    sx, y, sx+dx, y+dy, partW, h);
        }
        return;
    }
    if (dy > 0 && dy < h && dx > -w && dx < w) {
        while (h > 0) {
            int partH = Math.min(h, dy);
            h -= partH;
            int sy = y + h;
            ob.Blit(theData, theData, comp, clip,
                    x, sy, x+dx, sy+dy, w, partH);
        }
        return;
    }
        ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}
 
Example 18
Source File: X11PMBlitBgLoops.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public X11PMBlitBgLoops(SurfaceType srcType, SurfaceType dstType)
{
    super(srcType, CompositeType.SrcNoEa, dstType);
}
 
Example 19
Source File: X11PMBlitLoops.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param realDstType SurfaceType for which the loop should be
 * registered
 * @param delegateDstType SurfaceType which will be used
 * for finding delegate loop
 */
public DelegateBlitLoop(SurfaceType realDstType, SurfaceType delegateDstType) {
    super(SurfaceType.Any, CompositeType.SrcNoEa, realDstType);
    this.dstType = delegateDstType;
}
 
Example 20
Source File: X11PMBlitLoops.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param realDstType SurfaceType for which the loop should be
 * registered
 * @param delegateDstType SurfaceType which will be used
 * for finding delegate loop
 */
public DelegateBlitLoop(SurfaceType realDstType, SurfaceType delegateDstType) {
    super(SurfaceType.Any, CompositeType.SrcNoEa, realDstType);
    this.dstType = delegateDstType;
}