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

The following examples show how to use sun.java2d.loops.CompositeType#Src . 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 dragonwell8_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 2
Source File: SunGraphics2D.java    From TencentKona-8 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 3
Source File: SunGraphics2D.java    From jdk8u60 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 4
Source File: SunGraphics2D.java    From openjdk-jdk8u 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 5
Source File: SunGraphics2D.java    From openjdk-jdk8u-backup 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 6
Source File: SunGraphics2D.java    From Bytecoder with Apache License 2.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 7
Source File: SunGraphics2D.java    From openjdk-jdk9 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 8
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 9
Source File: SunGraphics2D.java    From hottub 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 10
Source File: SunGraphics2D.java    From openjdk-8-source 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 11
Source File: SunGraphics2D.java    From openjdk-8 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: 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 13
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 14
Source File: SunGraphics2D.java    From jdk8u-dev-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();
    }
}