Java Code Examples for sun.java2d.loops.CompositeType#Clear
The following examples show how to use
sun.java2d.loops.CompositeType#Clear .
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 | 6 votes |
final 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 2
Source File: SunGraphics2D.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
final 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: SunGraphics2D.java From hottub with GNU General Public License v2.0 | 6 votes |
final 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 4
Source File: SunGraphics2D.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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 5
Source File: SunGraphics2D.java From Bytecoder with Apache License 2.0 | 6 votes |
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 6
Source File: SunGraphics2D.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
final 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 7
Source File: SunGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
final 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 8
Source File: SunGraphics2D.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
final 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 9
Source File: SunGraphics2D.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
final 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 10
Source File: SunGraphics2D.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * 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 jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * 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 dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * 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 jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * 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 openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * 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 15
Source File: SunGraphics2D.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * 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 16
Source File: SunGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * 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 17
Source File: SunGraphics2D.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * 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 18
Source File: SunGraphics2D.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * 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 19
Source File: SunGraphics2D.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * 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 20
Source File: SunGraphics2D.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * 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(); } }